Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

rename to DBIish

  • Loading branch information...
commit 842327f4c0fb44704593046763cbeba15e14ee3c 1 parent 2b3ec5d
@moritz moritz authored
View
4 META.info
@@ -1,7 +1,7 @@
{
- "name" : "MiniDBI",
+ "name" : "DBIish",
"version" : "*",
"description" : "a subset of Perl 5 DBI ported to Perl 6 to use while experts build the Real Deal",
"depends" : ["NativeCall"],
- "source-url" : "git://github.com/mberends/MiniDBI.git"
+ "source-url" : "git://github.com/mberends/DBIish.git"
}
View
154 Makefile
@@ -1,4 +1,4 @@
-# Makefile for MiniDBI
+# Makefile for DBIish
PERL_EXE = perl
PERL6_EXE = perl6
@@ -10,28 +10,28 @@ TEST_F = $(PERL_EXE) -MExtUtils::Command -e test_f
LIBSYSTEM = $(shell $(PERL6_EXE) -e 'print @*INC[2]')
LIBUSER = $(shell $(PERL6_EXE) -e 'print @*INC[1]')
-# first (therefore default) target is MiniDBI.pir
-all: lib/MiniDBI.pir
+# first (therefore default) target is DBIish.pir
+all: lib/DBIish.pir
-lib/MiniDBD.pir: lib/MiniDBD.pm6
- $(PERL6_EXE) --target=pir --output=lib/MiniDBD.pir lib/MiniDBD.pm6
+lib/DBDish.pir: lib/DBDish.pm6
+ $(PERL6_EXE) --target=pir --output=lib/DBDish.pir lib/DBDish.pm6
-lib/MiniDBD/CSV.pir: lib/MiniDBD/CSV.pm6 lib/MiniDBD.pir
- export PERL6LIB=lib; $(PERL6_EXE) --target=pir --output=lib/MiniDBD/CSV.pir lib/MiniDBD/CSV.pm6
+lib/DBDish/CSV.pir: lib/DBDish/CSV.pm6 lib/DBDish.pir
+ export PERL6LIB=lib; $(PERL6_EXE) --target=pir --output=lib/DBDish/CSV.pir lib/DBDish/CSV.pm6
-lib/MiniDBD/mysql.pir: lib/MiniDBD/mysql.pm6 lib/MiniDBD.pir
- export PERL6LIB=lib; $(PERL6_EXE) --target=pir --output=lib/MiniDBD/mysql.pir lib/MiniDBD/mysql.pm6
+lib/DBDish/mysql.pir: lib/DBDish/mysql.pm6 lib/DBDish.pir
+ export PERL6LIB=lib; $(PERL6_EXE) --target=pir --output=lib/DBDish/mysql.pir lib/DBDish/mysql.pm6
-lib/MiniDBD/Pg.pir: lib/MiniDBD/Pg.pm6 lib/MiniDBD.pir
- export PERL6LIB=lib; $(PERL6_EXE) --target=pir --output=lib/MiniDBD/Pg.pir lib/MiniDBD/Pg.pm6
+lib/DBDish/Pg.pir: lib/DBDish/Pg.pm6 lib/DBDish.pir
+ export PERL6LIB=lib; $(PERL6_EXE) --target=pir --output=lib/DBDish/Pg.pir lib/DBDish/Pg.pm6
-lib/MiniDBD/SQLite.pir: lib/MiniDBD/SQLite.pm6 lib/MiniDBD.pir
- export PERL6LIB=lib; $(PERL6_EXE) --target=pir --output=lib/MiniDBD/SQLite.pir lib/MiniDBD/SQLite.pm6
+lib/DBDish/SQLite.pir: lib/DBDish/SQLite.pm6 lib/DBDish.pir
+ export PERL6LIB=lib; $(PERL6_EXE) --target=pir --output=lib/DBDish/SQLite.pir lib/DBDish/SQLite.pm6
-lib/MiniDBI.pir: lib/MiniDBI.pm6 lib/MiniDBD/CSV.pir lib/MiniDBD/mysql.pir lib/MiniDBD/Pg.pir lib/MiniDBD/SQLite.pir
- export PERL6LIB=lib; $(PERL6_EXE) --target=pir --output=lib/MiniDBI.pir lib/MiniDBI.pm6
+lib/DBIish.pir: lib/DBIish.pm6 lib/DBDish/CSV.pir lib/DBDish/mysql.pir lib/DBDish/Pg.pir lib/DBDish/SQLite.pir
+ export PERL6LIB=lib; $(PERL6_EXE) --target=pir --output=lib/DBIish.pir lib/DBIish.pm6
-test: lib/MiniDBI.pir lib/MiniDBD/CSV.pir lib/MiniDBD/mysql.pir lib/MiniDBD/Pg.pir lib/MiniDBD/SQLite.pir
+test: lib/DBIish.pir lib/DBDish/CSV.pir lib/DBDish/mysql.pir lib/DBDish/Pg.pir lib/DBDish/SQLite.pir
@#export PERL6LIB=lib; prove --exec $(PERL6_EXE) t/10-mysql.t
@#export PERL6LIB=lib; prove --exec $(PERL6_EXE) t/20-CSV-common.t
@#export PERL6LIB=lib; prove --exec $(PERL6_EXE) t/25-mysql-common.t
@@ -39,86 +39,86 @@ test: lib/MiniDBI.pir lib/MiniDBD/CSV.pir lib/MiniDBD/mysql.pir lib/MiniDBD/Pg.p
export PERL6LIB=lib; prove --exec $(PERL6_EXE) t/
# standard install is to the shared system wide directory
-install: lib/MiniDBI.pir lib/MiniDBD.pir lib/MiniDBD/mysql.pir lib/MiniDBD/Pg.pir lib/MiniDBD/SQLite.pir
+install: lib/DBIish.pir lib/DBDish.pir lib/DBDish/mysql.pir lib/DBDish/Pg.pir lib/DBDish/SQLite.pir
@echo "--> $(LIBSYSTEM)"
- @$(CP) lib/MiniDBI.pm6 lib/MiniDBI.pir $(LIBSYSTEM)
- @$(CP) lib/MiniDBD.pm6 lib/MiniDBD.pir $(LIBSYSTEM)
- @$(MKPATH) $(LIBSYSTEM)/MiniDBD
- @$(CP) lib/MiniDBD/CSV.pm6 lib/MiniDBD/CSV.pir $(LIBSYSTEM)/MiniDBD
- @$(CP) lib/MiniDBD/mysql.pm6 lib/MiniDBD/mysql.pir $(LIBSYSTEM)/MiniDBD
- @$(CP) lib/MiniDBD/Pg.pm6 lib/MiniDBD/Pg.pir $(LIBSYSTEM)/MiniDBD
- @$(CP) lib/MiniDBD/SQLite.pm6 lib/MiniDBD/SQLite.pir $(LIBSYSTEM)/MiniDBD
+ @$(CP) lib/DBIish.pm6 lib/DBIish.pir $(LIBSYSTEM)
+ @$(CP) lib/DBDish.pm6 lib/DBDish.pir $(LIBSYSTEM)
+ @$(MKPATH) $(LIBSYSTEM)/DBDish
+ @$(CP) lib/DBDish/CSV.pm6 lib/DBDish/CSV.pir $(LIBSYSTEM)/DBDish
+ @$(CP) lib/DBDish/mysql.pm6 lib/DBDish/mysql.pir $(LIBSYSTEM)/DBDish
+ @$(CP) lib/DBDish/Pg.pm6 lib/DBDish/Pg.pir $(LIBSYSTEM)/DBDish
+ @$(CP) lib/DBDish/SQLite.pm6 lib/DBDish/SQLite.pir $(LIBSYSTEM)/DBDish
# if user has no permission to install globally, try a personal directory
-install-user: lib/MiniDBI.pir lib/MiniDBD.pir lib/MiniDBD/mysql.pir lib/MiniDBD/Pg.pir lib/MiniDBD/SQLite.pir
+install-user: lib/DBIish.pir lib/DBDish.pir lib/DBDish/mysql.pir lib/DBDish/Pg.pir lib/DBDish/SQLite.pir
@echo "--> $(LIBUSER)"
- @$(CP) lib/MiniDBI.pm6 lib/MiniDBI.pir $(LIBUSER)
- @$(CP) lib/MiniDBD.pm6 lib/MiniDBD.pir $(LIBUSER)
- @$(MKPATH) $(LIBUSER)/MiniDBD
- @$(CP) lib/MiniDBD/CSV.pm6 lib/MiniDBD/CSV.pir $(LIBUSER)/MiniDBD
- @$(CP) lib/MiniDBD/mysql.pm6 lib/MiniDBD/mysql.pir $(LIBUSER)/MiniDBD
- @$(CP) lib/MiniDBD/Pg.pm6 lib/MiniDBD/Pg.pir $(LIBUSER)/MiniDBD
- @$(CP) lib/MiniDBD/SQLite.pm6 lib/MiniDBD/SQLite.pir $(LIBUSER)/MiniDBD
+ @$(CP) lib/DBIish.pm6 lib/DBIish.pir $(LIBUSER)
+ @$(CP) lib/DBDish.pm6 lib/DBDish.pir $(LIBUSER)
+ @$(MKPATH) $(LIBUSER)/DBDish
+ @$(CP) lib/DBDish/CSV.pm6 lib/DBDish/CSV.pir $(LIBUSER)/DBDish
+ @$(CP) lib/DBDish/mysql.pm6 lib/DBDish/mysql.pir $(LIBUSER)/DBDish
+ @$(CP) lib/DBDish/Pg.pm6 lib/DBDish/Pg.pir $(LIBUSER)/DBDish
+ @$(CP) lib/DBDish/SQLite.pm6 lib/DBDish/SQLite.pir $(LIBUSER)/DBDish
# Uninstall from the shared system wide directory.
-# This might leave an empty MiniDBD subdirectory behind.
+# This might leave an empty DBDish subdirectory behind.
uninstall:
@echo "x-> $(LIBSYSTEM)"
- @$(TEST_F) $(LIBSYSTEM)/MiniDBI.pm6
- @$(RM_F) $(LIBSYSTEM)/MiniDBD.pm6
- @$(TEST_F) $(LIBSYSTEM)/MiniDBI.pir
- @$(RM_F) $(LIBSYSTEM)/MiniDBD.pir
- @$(TEST_F) $(LIBSYSTEM)/MiniDBD/CSV.pm6
- @$(RM_F) $(LIBSYSTEM)/MiniDBD/CSV.pm6
- @$(TEST_F) $(LIBSYSTEM)/MiniDBD/CSV.pir
- @$(RM_F) $(LIBSYSTEM)/MiniDBD/CSV.pir
- @$(TEST_F) $(LIBSYSTEM)/MiniDBD/mysql.pm6
- @$(RM_F) $(LIBSYSTEM)/MiniDBD/mysql.pm6
- @$(TEST_F) $(LIBSYSTEM)/MiniDBD/mysql.pir
- @$(RM_F) $(LIBSYSTEM)/MiniDBD/mysql.pir
- @$(TEST_F) $(LIBSYSTEM)/MiniDBD/Pg.pm6
- @$(RM_F) $(LIBSYSTEM)/MiniDBD/Pg.pm6
- @$(TEST_F) $(LIBSYSTEM)/MiniDBD/Pg.pir
- @$(RM_F) $(LIBSYSTEM)/MiniDBD/Pg.pir
- @$(TEST_F) $(LIBSYSTEM)/MiniDBD/SQLite.pm6
- @$(RM_F) $(LIBSYSTEM)/MiniDBD/SQLite.pm6
- @$(TEST_F) $(LIBSYSTEM)/MiniDBD/SQLite.pir
- @$(RM_F) $(LIBSYSTEM)/MiniDBD/SQLite.pir
+ @$(TEST_F) $(LIBSYSTEM)/DBIish.pm6
+ @$(RM_F) $(LIBSYSTEM)/DBDish.pm6
+ @$(TEST_F) $(LIBSYSTEM)/DBIish.pir
+ @$(RM_F) $(LIBSYSTEM)/DBDish.pir
+ @$(TEST_F) $(LIBSYSTEM)/DBDish/CSV.pm6
+ @$(RM_F) $(LIBSYSTEM)/DBDish/CSV.pm6
+ @$(TEST_F) $(LIBSYSTEM)/DBDish/CSV.pir
+ @$(RM_F) $(LIBSYSTEM)/DBDish/CSV.pir
+ @$(TEST_F) $(LIBSYSTEM)/DBDish/mysql.pm6
+ @$(RM_F) $(LIBSYSTEM)/DBDish/mysql.pm6
+ @$(TEST_F) $(LIBSYSTEM)/DBDish/mysql.pir
+ @$(RM_F) $(LIBSYSTEM)/DBDish/mysql.pir
+ @$(TEST_F) $(LIBSYSTEM)/DBDish/Pg.pm6
+ @$(RM_F) $(LIBSYSTEM)/DBDish/Pg.pm6
+ @$(TEST_F) $(LIBSYSTEM)/DBDish/Pg.pir
+ @$(RM_F) $(LIBSYSTEM)/DBDish/Pg.pir
+ @$(TEST_F) $(LIBSYSTEM)/DBDish/SQLite.pm6
+ @$(RM_F) $(LIBSYSTEM)/DBDish/SQLite.pm6
+ @$(TEST_F) $(LIBSYSTEM)/DBDish/SQLite.pir
+ @$(RM_F) $(LIBSYSTEM)/DBDish/SQLite.pir
# Uninstall from the user's own Perl 6 directory.
-# This might leave an empty MiniDBD subdirectory behind.
+# This might leave an empty DBDish subdirectory behind.
uninstall-user:
@echo "x-> $(LIBUSER)"
- @$(TEST_F) $(LIBUSER)/MiniDBI.pm6
- @$(RM_F) $(LIBUSER)/MiniDBI.pm6
- @$(TEST_F) $(LIBUSER)/MiniDBI.pir
- @$(RM_F) $(LIBUSER)/MiniDBI.pir
- @$(TEST_F) $(LIBUSER)/MiniDBD/CSV.pm6
- @$(RM_F) $(LIBUSER)/MiniDBD/CSV.pm6
- @$(TEST_F) $(LIBUSER)/MiniDBD/CSV.pir
- @$(RM_F) $(LIBUSER)/MiniDBD/CSV.pir
- @$(TEST_F) $(LIBUSER)/MiniDBD/mysql.pm6
- @$(RM_F) $(LIBUSER)/MiniDBD/mysql.pm6
- @$(TEST_F) $(LIBUSER)/MiniDBD/mysql.pir
- @$(RM_F) $(LIBUSER)/MiniDBD/mysql.pir
- @$(TEST_F) $(LIBUSER)/MiniDBD/Pg.pm6
- @$(RM_F) $(LIBUSER)/MiniDBD/Pg.pm6
- @$(TEST_F) $(LIBUSER)/MiniDBD/Pg.pir
- @$(RM_F) $(LIBUSER)/MiniDBD/Pg.pir
- @$(TEST_F) $(LIBUSER)/MiniDBD/SQLite.pm6
- @$(RM_F) $(LIBUSER)/MiniDBD/SQLite.pm6
- @$(TEST_F) $(LIBUSER)/MiniDBD/SQLite.pir
- @$(RM_F) $(LIBUSER)/MiniDBD/SQLite.pir
+ @$(TEST_F) $(LIBUSER)/DBIish.pm6
+ @$(RM_F) $(LIBUSER)/DBIish.pm6
+ @$(TEST_F) $(LIBUSER)/DBIish.pir
+ @$(RM_F) $(LIBUSER)/DBIish.pir
+ @$(TEST_F) $(LIBUSER)/DBDish/CSV.pm6
+ @$(RM_F) $(LIBUSER)/DBDish/CSV.pm6
+ @$(TEST_F) $(LIBUSER)/DBDish/CSV.pir
+ @$(RM_F) $(LIBUSER)/DBDish/CSV.pir
+ @$(TEST_F) $(LIBUSER)/DBDish/mysql.pm6
+ @$(RM_F) $(LIBUSER)/DBDish/mysql.pm6
+ @$(TEST_F) $(LIBUSER)/DBDish/mysql.pir
+ @$(RM_F) $(LIBUSER)/DBDish/mysql.pir
+ @$(TEST_F) $(LIBUSER)/DBDish/Pg.pm6
+ @$(RM_F) $(LIBUSER)/DBDish/Pg.pm6
+ @$(TEST_F) $(LIBUSER)/DBDish/Pg.pir
+ @$(RM_F) $(LIBUSER)/DBDish/Pg.pir
+ @$(TEST_F) $(LIBUSER)/DBDish/SQLite.pm6
+ @$(RM_F) $(LIBUSER)/DBDish/SQLite.pm6
+ @$(TEST_F) $(LIBUSER)/DBDish/SQLite.pir
+ @$(RM_F) $(LIBUSER)/DBDish/SQLite.pir
clean:
@# delete compiled files
- $(RM_F) lib/*.pir lib/MiniDBD/*.pir
+ $(RM_F) lib/*.pir lib/DBDish/*.pir
@# delete all editor backup files
- $(RM_F) *~ lib/*~ t/*~ lib/MiniDBD/*~
+ $(RM_F) *~ lib/*~ t/*~ lib/DBDish/*~
help:
@echo
- @echo "You can make the following in 'MiniDBI':"
+ @echo "You can make the following in 'DBIish':"
@echo "clean removes compiled, temporary and backup files"
@echo "test runs a local test suite"
@echo "install copies .pm and .pir files to system perl6 lib/"
View
17 README
@@ -1,19 +1,22 @@
=begin pod
=head1 NAME
-MiniDBI - a simple database interface for Rakudo Perl 6
+DBIish - a simple database interface for Rakudo Perl 6
=head1 DESCRIPTION
-The MiniDBI project provides a simple database interface for Perl 6.
+The DBIish project provides a simple database interface for Perl 6.
It's not a port of the Perl 5 DBI and does not intend to become one.
It is, however, a simple and useful database interface for Perl 6 that works
now. It looks like a DBI, and it talks like a DBI (although it only offers
a subset of the functionality).
-=head1 DBD CLASSES
-Until there is a benefit in doing it otherwise, the MiniDBD drivers stay
-and install together with the main MiniDBI.pm6 in a single project. The
+It is based on Martin Berends' MiniDBI project, but unlike MiniDBI, DBDish
+aims to provide an interface that takes advantage of Perl 6 idioms
+
+=head1 DBDish CLASSES
+Until there is a benefit in doing it otherwise, the DBDish drivers stay
+and install together with the main DBIish.pm6 in a single project. The
first DBD is for MySQL, there will probably soon be SQLite, Postgres and
FreeTDS. An AnyData driver for memory or file formats such as YAML or
XML is also planned.
@@ -47,10 +50,10 @@ Numbers with decimal points are passed to the database server as quoted
strings, because of far-too-simple checking in execute().
=head1 SEE ALSO
-The Perl 6 Pod in the L<doc:MiniDBI> module.
+The Perl 6 Pod in the L<doc:DBIish> module.
The Perl 5 L<doc:DBI> and L<doc:DBI::DBD>.
-This README and the documention of the MiniDBI and the MiniDBD modules
+This README and the documention of the DBIish and the DBDish modules
are in the proposed Pod6 format. The reasons are that Perl 6 does not
allow any other kind of Pod, and that Pod6 needs more examples. View it
with an appropriate formatter if your system has one.
View
20 lib/MiniDBD.pm6 → lib/DBDish.pm6
@@ -1,9 +1,9 @@
-# MiniDBD.pm6
+# DBDish.pm6
# Provide default methods for all database drivers
=begin pod
=head1 DESCRIPTION
-The MiniDBD module contains generic code that should be re-used by every
+The DBDish module contains generic code that should be re-used by every
database driver, and documentation guidelines for DBD implementation.
It is also an experiment in distributing Pod fragments in and around the
@@ -11,15 +11,15 @@ code. Without syntax highlighting, it is very awkward to work with. It
shows that this style of file layout is unsuitable for general use.
=head1 ROLES
-=head2 role MiniDBD::StatementHandle
+=head2 role DBDish::StatementHandle
The Connection C<prepare> method returns a StatementHandle object that
mainly provides the C<execute> and C<finish> methods.
=end pod
-role MiniDBD::StatementHandle {
+role DBDish::StatementHandle {
=begin pod
-=head3 MiniDBD::StatementHandle members
+=head3 DBDish::StatementHandle members
=head4 instance variables
=head5 $!errstr
The C<$!errstr> variable keeps an internal copy of the last error
@@ -53,13 +53,13 @@ database driver.
}
=begin pod
-=head2 role MiniDBD::Connection
+=head2 role DBDish::Connection
=end pod
-role MiniDBD::Connection {
+role DBDish::Connection {
=begin pod
-=head3 MiniDBD::Connection members
+=head3 DBDish::Connection members
=head4 instance variables
=head5 $!errstr
The C<$!errstr> variable keeps an internal copy of the last error
@@ -75,7 +75,7 @@ message retrieved from the database driver. It is cleared (when?).
=end pod
method do( Str $statement, *@params ) {
- # warn "in MiniDBD::Connection.do('$statement')";
+ # warn "in DBDish::Connection.do('$statement')";
my $sth = self.prepare($statement) or return fail();
$sth.execute(@params);
# $sth.execute(@params) or return fail();
@@ -87,7 +87,7 @@ The C<disconnect> method
=end pod
method disconnect() {
- # warn "in MiniDBI::DatabaseHandle.disconnect()";
+ # warn "in DBIish::DatabaseHandle.disconnect()";
return Bool::True;
}
View
28 lib/MiniDBD/CSV.pm6 → lib/DBDish/CSV.pm6
@@ -1,8 +1,8 @@
-# MiniDBD/CSV.pm6
+# DBDish/CSV.pm6
-use MiniDBD;
+use DBDish;
-grammar MiniDBD::CSV::SQL {
+grammar DBDish::CSV::SQL {
# note: token means regex :ratchet, rule means token :sigspace
regex TOP { ^ [ <create_table> | <drop_table> | <insert> | <update>
| <delete> | <select> ] }
@@ -19,7 +19,7 @@ grammar MiniDBD::CSV::SQL {
token column_type {:i int|char|numeric}
}
-class MiniDBD::CSV::SQL::actions {
+class DBDish::CSV::SQL::actions {
method create_table(Match $m) {
print "doing CREATE TABLE ";
my $table_name = ~$m<table_name>;
@@ -36,13 +36,13 @@ class MiniDBD::CSV::SQL::actions {
method select(Match $m) { say "doing SELECT" }
}
-class MiniDBD::CSV::StatementHandle does MiniDBD::StatementHandle {
+class DBDish::CSV::StatementHandle does DBDish::StatementHandle {
has $!RaiseError;
has $!sql_command;
method execute(*@params is copy) {
#say "executing: $!sql_command";
- my Match $sql_match = MiniDBD::CSV::SQL.parse( $!sql_command,
- :actions( MiniDBD::CSV::SQL::actions ) );
+ my Match $sql_match = DBDish::CSV::SQL.parse( $!sql_command,
+ :actions( DBDish::CSV::SQL::actions ) );
say "execute " ~ $sql_match.perl;
return Bool::True;
}
@@ -54,12 +54,12 @@ class MiniDBD::CSV::StatementHandle does MiniDBD::StatementHandle {
}
}
-class MiniDBD::CSV::Connection does MiniDBD::Connection {
+class DBDish::CSV::Connection does DBDish::Connection {
has $!RaiseError;
method prepare( Str $sql_command ) {
my $statement_handle;
- $statement_handle = MiniDBD::CSV::StatementHandle.bless(
- MiniDBD::CSV::StatementHandle.CREATE(),
+ $statement_handle = DBDish::CSV::StatementHandle.bless(
+ DBDish::CSV::StatementHandle.CREATE(),
RaiseError => $!RaiseError,
sql_command => $sql_command
);
@@ -67,14 +67,14 @@ class MiniDBD::CSV::Connection does MiniDBD::Connection {
}
}
-class MiniDBD::CSV:auth<mberends>:ver<0.0.1> {
+class DBDish::CSV:auth<mberends>:ver<0.0.1> {
has $.Version = 0.01;
method connect(:$RaiseError ) {
- #warn "in MiniDBD::CSV.connect('$user',*,'$params')";
- my $connection = MiniDBD::CSV::Connection.bless(
- MiniDBD::CSV::Connection.CREATE(),
+ #warn "in DBDish::CSV.connect('$user',*,'$params')";
+ my $connection = DBDish::CSV::Connection.bless(
+ DBDish::CSV::Connection.CREATE(),
:$RaiseError
);
return $connection;
View
32 lib/MiniDBD/Pg.pm6 → lib/DBDish/Pg.pm6
@@ -1,9 +1,9 @@
-# MiniDBD::Pg.pm6
+# DBDish::Pg.pm6
use NativeCall; # from project 'zavolaj'
-use MiniDBD; # roles for drivers
+use DBDish; # roles for drivers
-#module MiniDBD:auth<mberends>:ver<0.0.1>;
+#module DBDish:auth<mberends>:ver<0.0.1>;
#------------ Pg library functions in alphabetical order ------------
@@ -96,7 +96,7 @@ constant PGRES_COPY_IN = 4;
#-----------------------------------------------------------------------
-class MiniDBD::Pg::StatementHandle does MiniDBD::StatementHandle {
+class DBDish::Pg::StatementHandle does DBDish::StatementHandle {
has $!pg_conn;
has $.RaiseError;
has Str $!statement_name;
@@ -329,7 +329,7 @@ class MiniDBD::Pg::StatementHandle does MiniDBD::StatementHandle {
}
}
-class MiniDBD::Pg::Connection does MiniDBD::Connection {
+class DBDish::Pg::Connection does DBDish::Connection {
has $!pg_conn;
has $.RaiseError;
has $.AutoCommit is rw = 1;
@@ -337,8 +337,8 @@ class MiniDBD::Pg::Connection does MiniDBD::Connection {
method BUILD(:$!pg_conn) { }
method prepare(Str $statement, $attr?) {
- my $statement_handle = MiniDBD::Pg::StatementHandle.bless(
- MiniDBD::Pg::StatementHandle.CREATE(),
+ my $statement_handle = DBDish::Pg::StatementHandle.bless(
+ DBDish::Pg::StatementHandle.CREATE(),
:$!pg_conn,
:$statement,
:$!RaiseError,
@@ -414,13 +414,13 @@ class MiniDBD::Pg::Connection does MiniDBD::Connection {
}
}
-class MiniDBD::Pg:auth<mberends>:ver<0.0.1> {
+class DBDish::Pg:auth<mberends>:ver<0.0.1> {
has $.Version = 0.01;
has $!errstr;
method !errstr() is rw { $!errstr }
-#------------------ methods to be called from MiniDBI ------------------
+#------------------ methods to be called from DBIish ------------------
method connect(*%params) {
my $host = %params<host> // 'localhost';
my $port = %params<port> // 5432;
@@ -432,7 +432,7 @@ class MiniDBD::Pg:auth<mberends>:ver<0.0.1> {
my $status = PQstatus($pg_conn);
my $connection;
if $status eq CONNECTION_OK {
- $connection = MiniDBD::Pg::Connection.bless(*,
+ $connection = DBDish::Pg::Connection.bless(*,
:$pg_conn,
:RaiseError(%params<RaiseError>),
);
@@ -448,18 +448,18 @@ class MiniDBD::Pg:auth<mberends>:ver<0.0.1> {
=begin pod
=head1 DESCRIPTION
-# 'zavolaj' is a Native Call Interface for Rakudo/Parrot. 'MiniDBI' and
-# 'MiniDBD::Pg' are Perl 6 modules that use 'zavolaj' to use the
+# 'zavolaj' is a Native Call Interface for Rakudo/Parrot. 'DBIish' and
+# 'DBDish::Pg' are Perl 6 modules that use 'zavolaj' to use the
# standard libpq library. There is a long term Parrot based
# project to develop a new, comprehensive DBI architecture for Parrot
-# and Perl 6. MiniDBI is not that, it is a naive rewrite of the
+# and Perl 6. DBIish is not that, it is a naive rewrite of the
# similarly named Perl 5 modules. Hence the 'Mini' part of the name.
=head1 CLASSES
-The MiniDBD::Pg module contains the same classes and methods as every
+The DBDish::Pg module contains the same classes and methods as every
database driver. Therefore read the main documentation of usage in
-L<doc:MiniDBI> and internal architecture in L<doc:MiniDBD>. Below are
-only notes about code unique to the MiniDBD::Pg implementation.
+L<doc:DBIish> and internal architecture in L<doc:DBDish>. Below are
+only notes about code unique to the DBDish::Pg implementation.
=head1 SEE ALSO
The Postgres 8.4 Documentation, C Library.
View
12 lib/MiniDBD/SQLite.pm6 → lib/DBDish/SQLite.pm6
@@ -1,5 +1,5 @@
use NativeCall;
-use MiniDBD;
+use DBDish;
enum SQLITE (
SQLITE_OK => 0 , # Successful result
@@ -77,7 +77,7 @@ sub sqlite3_finalize(OpaquePointer) returns Int is native('libsqlite3') { ... }
sub sqlite3_column_count(OpaquePointer) returns Int is native('libsqlite3') { ... }
-class MiniDBD::SQLite::StatementHandle does MiniDBD::StatementHandle {
+class DBDish::SQLite::StatementHandle does DBDish::StatementHandle {
has $!conn;
has $.statement;
has $!statement_handle;
@@ -153,12 +153,12 @@ class MiniDBD::SQLite::StatementHandle does MiniDBD::StatementHandle {
}
}
-class MiniDBD::SQLite::Connection does MiniDBD::Connection {
+class DBDish::SQLite::Connection does DBDish::Connection {
has $.RaiseError;
has $!conn;
method BUILD(:$!conn) { }
method prepare(Str $statement, $attr?) {
- MiniDBD::SQLite::StatementHandle.bless(*,
+ DBDish::SQLite::StatementHandle.bless(*,
:$!conn,
:$statement,
:$!RaiseError,
@@ -216,7 +216,7 @@ class MiniDBD::SQLite::Connection does MiniDBD::Connection {
}
}
-class MiniDBD::SQLite:auth<mberends>:ver<0.0.1> {
+class DBDish::SQLite:auth<mberends>:ver<0.0.1> {
has $.Version = 0.01;
has $.errstr;
method !errstr() is rw { $!errstr }
@@ -228,7 +228,7 @@ class MiniDBD::SQLite:auth<mberends>:ver<0.0.1> {
@conn[0] = OpaquePointer;
my $status = sqlite3_open($dbname, @conn);
if $status == SQLITE_OK {
- return MiniDBD::SQLite::Connection.bless(*,
+ return DBDish::SQLite::Connection.bless(*,
:conn(@conn[0]),
:$RaiseError,
);
View
40 lib/MiniDBD/mysql.pm6 → lib/DBDish/mysql.pm6
@@ -1,9 +1,9 @@
-# MiniDBD::mysql.pm6
+# DBDish::mysql.pm6
use NativeCall; # from project 'zavolaj'
-use MiniDBD; # roles for drivers
+use DBDish; # roles for drivers
-#module MiniDBD:auth<mberends>:ver<0.0.1>;
+#module DBDish:auth<mberends>:ver<0.0.1>;
#------------ mysql library functions in alphabetical order ------------
@@ -114,7 +114,7 @@ sub mysql_warning_count( OpaquePointer $mysql_client )
#-----------------------------------------------------------------------
-class MiniDBD::mysql::StatementHandle does MiniDBD::StatementHandle {
+class DBDish::mysql::StatementHandle does DBDish::StatementHandle {
has $!mysql_client;
has $!RaiseError;
has $!statement;
@@ -127,7 +127,7 @@ class MiniDBD::mysql::StatementHandle does MiniDBD::StatementHandle {
submethod BUILD(:$!mysql_client, :$!statement, :$!RaiseError) { }
method execute(*@params is copy) {
- # warn "in MiniDBD::mysql::StatementHandle.execute()";
+ # warn "in DBDish::mysql::StatementHandle.execute()";
my $statement = $!statement;
while @params.elems>0 and $statement.index('?')>=0 {
my $param = @params.shift;
@@ -138,7 +138,7 @@ class MiniDBD::mysql::StatementHandle does MiniDBD::StatementHandle {
$statement .= subst("?",$param); # do not quote numbers
}
}
- # warn "in MiniDBD::mysql::StatementHandle.execute statement=$statement";
+ # warn "in DBDish::mysql::StatementHandle.execute statement=$statement";
$!result_set = Mu;
my $status = mysql_query( $!mysql_client, $statement ); # 0 means OK
$.mysql_warning_count = mysql_warning_count( $!mysql_client );
@@ -302,13 +302,13 @@ class MiniDBD::mysql::StatementHandle does MiniDBD::StatementHandle {
}
}
-class MiniDBD::mysql::Connection does MiniDBD::Connection {
+class DBDish::mysql::Connection does DBDish::Connection {
has $!mysql_client;
has $!RaiseError;
submethod BUILD(:$!mysql_client, :$!RaiseError) { }
method prepare( Str $statement ) {
- # warn "in MiniDBD::mysql::Connection.prepare()";
- my $statement_handle = MiniDBD::mysql::StatementHandle.new(
+ # warn "in DBDish::mysql::Connection.prepare()";
+ my $statement_handle = DBDish::mysql::StatementHandle.new(
mysql_client => $!mysql_client,
statement => $statement,
RaiseError => $!RaiseError
@@ -321,13 +321,13 @@ class MiniDBD::mysql::Connection does MiniDBD::Connection {
}
}
-class MiniDBD::mysql:auth<mberends>:ver<0.0.1> {
+class DBDish::mysql:auth<mberends>:ver<0.0.1> {
has $.Version = 0.01;
-#------------------ methods to be called from MiniDBI ------------------
+#------------------ methods to be called from DBIish ------------------
method connect(Str :$user, Str :$password, :$RaiseError, *%params ) {
- # warn "in MiniDBD::mysql.connect('$user',*,'$params')";
+ # warn "in DBDish::mysql.connect('$user',*,'$params')";
my ( $mysql_client, $mysql_error );
unless defined $mysql_client {
$mysql_client = mysql_init( OpaquePointer );
@@ -342,7 +342,7 @@ class MiniDBD::mysql:auth<mberends>:ver<0.0.1> {
my $error = mysql_error( $mysql_client );
my $connection;
if $error eq '' {
- $connection = MiniDBD::mysql::Connection.new(
+ $connection = DBDish::mysql::Connection.new(
mysql_client => $mysql_client,
RaiseError => $RaiseError
);
@@ -354,23 +354,23 @@ class MiniDBD::mysql:auth<mberends>:ver<0.0.1> {
}
}
-# warn "module MiniDBD::mysql.pm has loaded";
+# warn "module DBDish::mysql.pm has loaded";
=begin pod
=head1 DESCRIPTION
-# 'zavolaj' is a Native Call Interface for Rakudo/Parrot. 'MiniDBI' and
-# 'MiniDBD::mysql' are Perl 6 modules that use 'zavolaj' to use the
+# 'zavolaj' is a Native Call Interface for Rakudo/Parrot. 'DBIish' and
+# 'DBDish::mysql' are Perl 6 modules that use 'zavolaj' to use the
# standard mysqlclient library. There is a long term Parrot based
# project to develop a new, comprehensive DBI architecture for Parrot
-# and Perl 6. MiniDBI is not that, it is a naive rewrite of the
+# and Perl 6. DBIish is not that, it is a naive rewrite of the
# similarly named Perl 5 modules. Hence the 'Mini' part of the name.
=head1 CLASSES
-The MiniDBD::mysql module contains the same classes and methods as every
+The DBDish::mysql module contains the same classes and methods as every
database driver. Therefore read the main documentation of usage in
-L<doc:MiniDBI> and internal architecture in L<doc:MiniDBD>. Below are
-only notes about code unique to the MiniDBD::mysql implementation.
+L<doc:DBIish> and internal architecture in L<doc:DBDish>. Below are
+only notes about code unique to the DBDish::mysql implementation.
=head1 SEE ALSO
The MySQL 5.1 Reference Manual, C API.
View
32 lib/MiniDBI.pm6 → lib/DBIish.pm6
@@ -1,21 +1,21 @@
-# MiniDBI.pm6
+# DBIish.pm6
-class MiniDBI:auth<mberends>:ver<0.1.0> {
+class DBIish:auth<mberends>:ver<0.1.0> {
has $!err;
has $!errstr;
method connect($driver, :$RaiseError=0, :$PrintError=0, :$AutoCommit=1, *%opts ) {
my $d = self.install_driver( $driver );
- # warn "calling MiniDBD::" ~ $drivername ~ ".connect($username,*,$params)";
+ # warn "calling DBDish::" ~ $drivername ~ ".connect($username,*,$params)";
my $connection = $d.connect(:$RaiseError, :$PrintError, :$AutoCommit, |%opts );
return $connection;
}
method install_driver( $drivername ) {
my $driver;
given $drivername {
- when 'CSV' { eval 'use MiniDBD::CSV; $driver = MiniDBD::CSV.new()' }
- when 'mysql' { eval 'use MiniDBD::mysql; $driver = MiniDBD::mysql.new()' }
- when 'Pg' { eval 'use MiniDBD::Pg; $driver = MiniDBD::Pg.new()' }
- when 'SQLite' { eval 'use MiniDBD::SQLite;$driver = MiniDBD::SQLite.new()' }
+ when 'CSV' { eval 'use DBDish::CSV; $driver = DBDish::CSV.new()' }
+ when 'mysql' { eval 'use DBDish::mysql; $driver = DBDish::mysql.new()' }
+ when 'Pg' { eval 'use DBDish::Pg; $driver = DBDish::Pg.new()' }
+ when 'SQLite' { eval 'use DBDish::SQLite;$driver = DBDish::SQLite.new()' }
default { die "driver name '$drivername' is not known"; }
}
return $driver;
@@ -96,12 +96,12 @@ our sub SQL_INTERVAL_MINUTE_TO_SECOND { 113 }
=begin pod
=head1 SYNOPSIS
# the list is from Perl 5 DBI, uncommented is working here
- use MiniDBI;
+ use DBIish;
# TODO: @driver_names = DBI.available_drivers;
# TODO: %drivers = DBI.installed_drivers;
# TODO: @data_sources = DBI.data_sources($driver_name, \%attr);
- $dbh = MiniDBI.connect($driver, :$username, :$password, |%options);
+ $dbh = DBIish.connect($driver, :$username, :$password, |%options);
$rv = $dbh.do($statement);
# TODO: $rv = $dbh.do($statement, \%attr);
@@ -157,19 +157,19 @@ our sub SQL_INTERVAL_MINUTE_TO_SECOND { 113 }
The (Perl 5) synopsis above only lists the major methods and parameters.
=head1 DESCRIPTION
-The name C<MiniDBI> has two meanings. In lowercase it indicates the
+The name C<DBIish> has two meanings. In lowercase it indicates the
github project being used for development. In mixed case it is the
module name and class name that database client applications should use.
-=head1 MiniDBI CLASSES and ROLES
+=head1 DBIish CLASSES and ROLES
-=head2 MiniDBI
-The C<MiniDBI> class exists mainly to provide the F<connect> method,
+=head2 DBIish
+The C<DBIish> class exists mainly to provide the F<connect> method,
which acts as a constructor for database connections.
-=head2 MiniDBD
-The C<MiniDBD> role should only be used with 'does' to provide standard
-members for MiniDBD classes.
+=head2 DBDish
+The C<DBDish> role should only be used with 'does' to provide standard
+members for DBDish classes.
=head1 SEE ALSO
L<http://dbi.perl.org>
View
24 t/10-mysql.t
@@ -1,4 +1,4 @@
-# MiniDBI/t/10-mysql.t
+# DBIish/t/10-mysql.t
# Before running the tests, prepare the database with something like:
@@ -32,7 +32,7 @@ use Test;
plan 87;
-use MiniDBI;
+use DBIish;
# The file 'lib.pl' customizes the testing environment per DBD, but all
# this test script currently needs is the variables listed here.
@@ -61,11 +61,11 @@ my $table = 't1';
#ok $drh->{Version}, "Version $drh->{Version}";
#print "Driver version is ", $drh->{Version}, "\n";my $mdriver = 'mysql';
my $drh;
-$drh = MiniDBI.install_driver($mdriver);
+$drh = DBIish.install_driver($mdriver);
ok $drh, 'Install driver'; # test 1
my $drh_version;
$drh_version = $drh.Version;
-ok $drh_version > 0, "MiniDBD::mysql version $drh_version"; # test 2
+ok $drh_version > 0, "DBDish::mysql version $drh_version"; # test 2
#-----------------------------------------------------------------------
# from perl5 DBD/mysql/t/10connect.t
@@ -75,11 +75,11 @@ ok $drh_version > 0, "MiniDBD::mysql version $drh_version"; # test 2
#ok defined $dbh, "Connected to database";
#ok $dbh->disconnect();
#
-my $dbh = MiniDBI.connect($mdriver, :user($test_user), :password($test_password),
+my $dbh = DBIish.connect($mdriver, :user($test_user), :password($test_password),
:$host, :$port, :$database,
RaiseError => 1, PrintError => 1, AutoCommit => 0
);
-# die "ERROR: {MiniDBI.errstr}. Can't continue test" if $!.defined;
+# die "ERROR: {DBIish.errstr}. Can't continue test" if $!.defined;
ok $dbh.defined, "Connected to database"; # test 3
my $result = $dbh.disconnect();
ok $result, 'disconnect returned true'; # test 4
@@ -94,9 +94,9 @@ ok $result, 'disconnect returned true'; # test 4
#$dbh->disconnect();
try {
- $dbh = MiniDBI.connect( $mdriver, :user($test_user), :password($test_password), :$host, :$port,
+ $dbh = DBIish.connect( $mdriver, :user($test_user), :password($test_password), :$host, :$port,
RaiseError => 1, PrintError => 1, AutoCommit => 0 );
- CATCH { die "ERROR: {MiniDBI.errstr}. Can't continue test\n"; }
+ CATCH { die "ERROR: {DBIish.errstr}. Can't continue test\n"; }
}
ok($dbh.defined, "Connected to database"); # test 5
ok($dbh.do("DROP TABLE IF EXISTS $table"), "making slate clean"); # test 6
@@ -164,9 +164,9 @@ ok $dbh.do("DROP TABLE $table"), "Drop table $table"; # test 19
# is($sth->{mysql_warning_count}, 1);
#};
#try {
-# $dbh = MiniDBI.connect( $test_dsn, $test_user, $test_password,
+# $dbh = DBIish.connect( $test_dsn, $test_user, $test_password,
# RaiseError => 1, PrintError => 1, AutoCommit => 0 );
-# CATCH { die "ERROR: {MiniDBI.errstr}. Can't continue test\n"; }
+# CATCH { die "ERROR: {DBIish.errstr}. Can't continue test\n"; }
#}
ok($sth= $dbh.prepare("DROP TABLE IF EXISTS no_such_table"), "prepare drop no_such_table"); # test 20
ok($sth.execute(), "execute drop no_such_table..."); # test 21
@@ -239,9 +239,9 @@ ok $dbh.do("DROP TABLE $table"),"drop table $table"; # test 38
# Because the drop table might fail, disconnect and reconnect
$dbh.disconnect();
try {
- $dbh = MiniDBI.connect( $mdriver, :user($test_user), :password($test_password), :$host, :$port,
+ $dbh = DBIish.connect( $mdriver, :user($test_user), :password($test_password), :$host, :$port,
RaiseError => 1, PrintError => 1, AutoCommit => 0 );
- CATCH { die "ERROR: {MiniDBI.errstr}. Can't continue test\n"; }
+ CATCH { die "ERROR: {DBIish.errstr}. Can't continue test\n"; }
}
#-----------------------------------------------------------------------
View
6 t/20-CSV-common.t.not.ready
@@ -1,7 +1,7 @@
-# MiniDBI/t/20-CSV-common.t
+# DBIish/t/20-CSV-common.t
use Test;
-use MiniDBI;
+use DBIish;
# Define the only database specific values used by the common tests.
my ( $mdriver, $test_dsn, $test_user, $test_password );
@@ -9,7 +9,7 @@ my ( $mdriver, $test_dsn, $test_user, $test_password );
# Define values that are relevant only to CSV
# Set up the common variables with the CSV specific values
$mdriver = 'CSV';
- $test_dsn = "MiniDBI:$mdriver:"; # TODO remove last :
+ $test_dsn = "DBIish:$mdriver:"; # TODO remove last :
$test_user = '';
$test_password = '';
}
View
4 t/25-mysql-common.t
@@ -1,7 +1,7 @@
-# MiniDBI/t/10-mysql-common.t
+# DBIish/t/10-mysql-common.t
use Test;
-use MiniDBI;
+use DBIish;
# Define the only database specific values used by the common tests.
my $*mdriver = 'mysql';
View
4 t/35-Pg-common.t
@@ -1,7 +1,7 @@
-# MiniDBI/t/35-Pg-common.t
+# DBIish/t/35-Pg-common.t
use v6;
use Test;
-use MiniDBI;
+use DBIish;
# Define the only database specific values used by the common tests.
my ( $*mdriver, %*opts ) = 'Pg';
View
4 t/40-sqlite-common.t
@@ -1,7 +1,7 @@
-# MiniDBI/t/40-SQLite-common.t
+# DBIish/t/40-SQLite-common.t
use v6;
use Test;
-use MiniDBI;
+use DBIish;
# Define the only database specific values used by the common tests.
my ( $*mdriver, %*opts) = 'SQLite';
View
8 t/99-common.pl6
@@ -1,21 +1,21 @@
-# MiniDBI/t/99-common.pl6
+# DBIish/t/99-common.pl6
# This script is intended to be included as the common SQL tests in
# scripts for specific DBDs such as CSV or mysql.
#use Test; # "use" dies in a runtime eval
-#use MiniDBI;
+#use DBIish;
diag "Testing MiniDBD::$*mdriver";
plan 33;
# Verify that the driver loads before attempting a connect
-my $drh = MiniDBI.install_driver($*mdriver);
+my $drh = DBIish.install_driver($*mdriver);
ok $drh, 'Install driver'; # test 1
my $drh_version;
$drh_version = $drh.Version;
ok $drh_version > 0, "MiniDBD::$*mdriver version $drh_version"; # test 2
# Connect to the data sourcequantity*price AS amount FROM nom
-my $dbh = MiniDBI.connect( $*mdriver, |%*opts, :RaiseError<1> );
+my $dbh = DBIish.connect( $*mdriver, |%*opts, :RaiseError<1> );
ok $dbh, "connect to %*opts<database>"; # test 3
try eval '$*post_connect_cb.($dbh)';
Please sign in to comment.
Something went wrong with that request. Please try again.