Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

rename FakeDBI to MiniDBI everywhere

  • Loading branch information...
commit 69d6f1ddf00a2afbf516bb9e496504ca57e40336 1 parent a6f314b
Martin Berends authored
View
106 Makefile
@@ -1,4 +1,4 @@
-# Makefile for FakeDBI
+# Makefile for MiniDBI
PERL_EXE = perl
PERL6_EXE = perl6
@@ -10,88 +10,88 @@ 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 FakeDBI.pir
-all: lib/FakeDBI.pir
+# first (therefore default) target is MiniDBI.pir
+all: lib/MiniDBI.pir
-lib/FakeDBD.pir: lib/FakeDBD.pm6
- $(PERL6_EXE) --target=pir --output=lib/FakeDBD.pir lib/FakeDBD.pm6
+lib/MiniDBD.pir: lib/MiniDBD.pm6
+ $(PERL6_EXE) --target=pir --output=lib/MiniDBD.pir lib/MiniDBD.pm6
-lib/FakeDBD/CSV.pir: lib/FakeDBD/CSV.pm6 lib/FakeDBD.pir
- export PERL6LIB=lib; $(PERL6_EXE) --target=pir --output=lib/FakeDBD/CSV.pir lib/FakeDBD/CSV.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/FakeDBD/mysql.pir: lib/FakeDBD/mysql.pm6 lib/FakeDBD.pir
- export PERL6LIB=lib; $(PERL6_EXE) --target=pir --output=lib/FakeDBD/mysql.pir lib/FakeDBD/mysql.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/FakeDBI.pir: lib/FakeDBI.pm6 lib/FakeDBD/CSV.pir lib/FakeDBD/mysql.pir
- export PERL6LIB=lib; $(PERL6_EXE) --target=pir --output=lib/FakeDBI.pir lib/FakeDBI.pm6
+lib/MiniDBI.pir: lib/MiniDBI.pm6 lib/MiniDBD/CSV.pir lib/MiniDBD/mysql.pir
+ export PERL6LIB=lib; $(PERL6_EXE) --target=pir --output=lib/MiniDBI.pir lib/MiniDBI.pm6
-test: lib/FakeDBI.pir lib/FakeDBD/CSV.pir lib/FakeDBD/mysql.pir
+test: lib/MiniDBI.pir lib/MiniDBD/CSV.pir lib/MiniDBD/mysql.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
export PERL6LIB=lib; prove --exec $(PERL6_EXE) t/
# standard install is to the shared system wide directory
-install: lib/FakeDBI.pir lib/FakeDBD.pir lib/FakeDBD/mysql.pir
+install: lib/MiniDBI.pir lib/MiniDBD.pir lib/MiniDBD/mysql.pir
@echo "--> $(LIBSYSTEM)"
- @$(CP) lib/FakeDBI.pm6 lib/FakeDBI.pir $(LIBSYSTEM)
- @$(CP) lib/FakeDBD.pm6 lib/FakeDBD.pir $(LIBSYSTEM)
- @$(MKPATH) $(LIBSYSTEM)/FakeDBD
- @$(CP) lib/FakeDBD/CSV.pm6 lib/FakeDBD/CSV.pir $(LIBSYSTEM)/FakeDBD
- @$(CP) lib/FakeDBD/mysql.pm6 lib/FakeDBD/mysql.pir $(LIBSYSTEM)/FakeDBD
+ @$(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
# if user has no permission to install globally, try a personal directory
-install-user: lib/FakeDBI.pir lib/FakeDBD.pir lib/FakeDBD/mysql.pir
+install-user: lib/MiniDBI.pir lib/MiniDBD.pir lib/MiniDBD/mysql.pir
@echo "--> $(LIBUSER)"
- @$(CP) lib/FakeDBI.pm6 lib/FakeDBI.pir $(LIBUSER)
- @$(CP) lib/FakeDBD.pm6 lib/FakeDBD.pir $(LIBUSER)
- @$(MKPATH) $(LIBUSER)/FakeDBD
- @$(CP) lib/FakeDBD/CSV.pm6 lib/FakeDBD/CSV.pir $(LIBUSER)/FakeDBD
- @$(CP) lib/FakeDBD/mysql.pm6 lib/FakeDBD/mysql.pir $(LIBUSER)/FakeDBD
+ @$(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
# Uninstall from the shared system wide directory.
-# This might leave an empty FakeDBD subdirectory behind.
+# This might leave an empty MiniDBD subdirectory behind.
uninstall:
@echo "x-> $(LIBSYSTEM)"
- @$(TEST_F) $(LIBSYSTEM)/FakeDBI.pm6
- @$(RM_F) $(LIBSYSTEM)/FakeDBD.pm6
- @$(TEST_F) $(LIBSYSTEM)/FakeDBI.pir
- @$(RM_F) $(LIBSYSTEM)/FakeDBD.pir
- @$(TEST_F) $(LIBSYSTEM)/FakeDBD/CSV.pm6
- @$(RM_F) $(LIBSYSTEM)/FakeDBD/CSV.pm6
- @$(TEST_F) $(LIBSYSTEM)/FakeDBD/CSV.pir
- @$(RM_F) $(LIBSYSTEM)/FakeDBD/CSV.pir
- @$(TEST_F) $(LIBSYSTEM)/FakeDBD/mysql.pm6
- @$(RM_F) $(LIBSYSTEM)/FakeDBD/mysql.pm6
- @$(TEST_F) $(LIBSYSTEM)/FakeDBD/mysql.pir
- @$(RM_F) $(LIBSYSTEM)/FakeDBD/mysql.pir
+ @$(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
# Uninstall from the user's own Perl 6 directory.
-# This might leave an empty FakeDBD subdirectory behind.
+# This might leave an empty MiniDBD subdirectory behind.
uninstall-user:
@echo "x-> $(LIBUSER)"
- @$(TEST_F) $(LIBUSER)/FakeDBI.pm6
- @$(RM_F) $(LIBUSER)/FakeDBI.pm6
- @$(TEST_F) $(LIBUSER)/FakeDBI.pir
- @$(RM_F) $(LIBUSER)/FakeDBI.pir
- @$(TEST_F) $(LIBUSER)/FakeDBD/CSV.pm6
- @$(RM_F) $(LIBUSER)/FakeDBD/CSV.pm6
- @$(TEST_F) $(LIBUSER)/FakeDBD/CSV.pir
- @$(RM_F) $(LIBUSER)/FakeDBD/CSV.pir
- @$(TEST_F) $(LIBUSER)/FakeDBD/mysql.pm6
- @$(RM_F) $(LIBUSER)/FakeDBD/mysql.pm6
- @$(TEST_F) $(LIBUSER)/FakeDBD/mysql.pir
- @$(RM_F) $(LIBUSER)/FakeDBD/mysql.pir
+ @$(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
clean:
@# delete compiled files
- $(RM_F) lib/*.pir lib/FakeDBD/*.pir
+ $(RM_F) lib/*.pir lib/MiniDBD/*.pir
@# delete all editor backup files
- $(RM_F) *~ lib/*~ t/*~ lib/FakeDBD/*~
+ $(RM_F) *~ lib/*~ t/*~ lib/MiniDBD/*~
help:
@echo
- @echo "You can make the following in 'FakeDBI':"
+ @echo "You can make the following in 'MiniDBI':"
@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
20 lib/FakeDBD.pm6 → lib/MiniDBD.pm6
@@ -1,9 +1,9 @@
-# FakeDBD.pm6
+# MiniDBD.pm6
# Provide default methods for all database drivers
=begin pod
=head1 DESCRIPTION
-The FakeDBD module contains generic code that should be re-used by every
+The MiniDBD 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 FakeDBD::StatementHandle
+=head2 role MiniDBD::StatementHandle
The Connection C<prepare> method returns a StatementHandle object that
mainly provides the C<execute> and C<finish> methods.
=end pod
-role FakeDBD::StatementHandle {
+role MiniDBD::StatementHandle {
=begin pod
-=head3 FakeDBD::StatementHandle members
+=head3 MiniDBD::StatementHandle members
=head4 instance variables
=head5 $!errstr
The C<$!errstr> variable keeps an internal copy of the last error
@@ -51,13 +51,13 @@ database driver.
}
=begin pod
-=head2 role FakeDBD::Connection
+=head2 role MiniDBD::Connection
=end pod
-role FakeDBD::Connection {
+role MiniDBD::Connection {
=begin pod
-=head3 FakeDBD::Connection members
+=head3 MiniDBD::Connection members
=head4 instance variables
=head5 $!errstr
The C<$!errstr> variable keeps an internal copy of the last error
@@ -72,7 +72,7 @@ message retrieved from the database driver. It is cleared (when?).
=end pod
method do( Str $statement, *@params ) {
- # warn "in FakeDBD::Connection.do('$statement')";
+ # warn "in MiniDBD::Connection.do('$statement')";
my $sth = self.prepare($statement) or return fail();
$sth.execute(@params);
# $sth.execute(@params) or return fail();
@@ -84,7 +84,7 @@ The C<disconnect> method
=end pod
method disconnect() {
- # warn "in FakeDBI::DatabaseHandle.disconnect()";
+ # warn "in MiniDBI::DatabaseHandle.disconnect()";
return Bool::True;
}
View
28 lib/FakeDBD/CSV.pm6 → lib/MiniDBD/CSV.pm6
@@ -1,8 +1,8 @@
-# FakeDBD/CSV.pm6
+# MiniDBD/CSV.pm6
-use FakeDBD;
+use MiniDBD;
-grammar FakeDBD::CSV::SQL {
+grammar MiniDBD::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 FakeDBD::CSV::SQL {
token column_type {:i int|char|numeric}
}
-class FakeDBD::CSV::SQL::actions {
+class MiniDBD::CSV::SQL::actions {
method create_table(Match $m) {
print "doing CREATE TABLE ";
my $table_name = ~$m<table_name>;
@@ -36,13 +36,13 @@ class FakeDBD::CSV::SQL::actions {
method select(Match $m) { say "doing SELECT" }
}
-class FakeDBD::CSV::StatementHandle does FakeDBD::StatementHandle {
+class MiniDBD::CSV::StatementHandle does MiniDBD::StatementHandle {
has $!RaiseError;
has $!sql_command;
method execute(*@params is copy) {
#say "executing: $!sql_command";
- my Match $sql_match = FakeDBD::CSV::SQL.parse( $!sql_command,
- :actions( FakeDBD::CSV::SQL::actions ) );
+ my Match $sql_match = MiniDBD::CSV::SQL.parse( $!sql_command,
+ :actions( MiniDBD::CSV::SQL::actions ) );
say "execute " ~ $sql_match.perl;
return Bool::True;
}
@@ -54,12 +54,12 @@ class FakeDBD::CSV::StatementHandle does FakeDBD::StatementHandle {
}
}
-class FakeDBD::CSV::Connection does FakeDBD::Connection {
+class MiniDBD::CSV::Connection does MiniDBD::Connection {
has $!RaiseError;
method prepare( Str $sql_command ) {
my $statement_handle;
- $statement_handle = FakeDBD::CSV::StatementHandle.bless(
- FakeDBD::CSV::StatementHandle.CREATE(),
+ $statement_handle = MiniDBD::CSV::StatementHandle.bless(
+ MiniDBD::CSV::StatementHandle.CREATE(),
RaiseError => $!RaiseError,
sql_command => $sql_command
);
@@ -67,15 +67,15 @@ class FakeDBD::CSV::Connection does FakeDBD::Connection {
}
}
-class FakeDBD::CSV:auth<mberends>:ver<0.0.1> {
+class MiniDBD::CSV:auth<mberends>:ver<0.0.1> {
has $.Version = 0.01;
method connect( Str $user, Str $password, Str $params, $RaiseError ) {
- #warn "in FakeDBD::CSV.connect('$user',*,'$params')";
+ #warn "in MiniDBD::CSV.connect('$user',*,'$params')";
my $connection;
- $connection = FakeDBD::CSV::Connection.bless(
- FakeDBD::CSV::Connection.CREATE(),
+ $connection = MiniDBD::CSV::Connection.bless(
+ MiniDBD::CSV::Connection.CREATE(),
RaiseError => $RaiseError
);
return $connection;
View
46 lib/FakeDBD/mysql.pm6 → lib/MiniDBD/mysql.pm6
@@ -1,9 +1,9 @@
-# FakeDBD::mysql.pm6
+# MiniDBD::mysql.pm6
use NativeCall; # from project 'zavolaj'
-use FakeDBD; # roles for drivers
+use MiniDBD; # roles for drivers
-#module FakeDBD:auth<mberends>:ver<0.0.1>;
+#module MiniDBD:auth<mberends>:ver<0.0.1>;
#------------ mysql library functions in alphabetical order ------------
@@ -114,7 +114,7 @@ sub mysql_warning_count( OpaquePointer $mysql_client )
#-----------------------------------------------------------------------
-class FakeDBD::mysql::StatementHandle does FakeDBD::StatementHandle {
+class MiniDBD::mysql::StatementHandle does MiniDBD::StatementHandle {
has $!mysql_client;
has $!RaiseError;
has $!statement;
@@ -124,7 +124,7 @@ class FakeDBD::mysql::StatementHandle does FakeDBD::StatementHandle {
has $!field_count;
has $.mysql_warning_count is rw = 0;
method execute(*@params is copy) {
- # warn "in FakeDBD::mysql::StatementHandle.execute()";
+ # warn "in MiniDBD::mysql::StatementHandle.execute()";
my $statement = $!statement;
while @params.elems>0 and $statement.index('?')>=0 {
my $param = @params.shift;
@@ -135,7 +135,7 @@ class FakeDBD::mysql::StatementHandle does FakeDBD::StatementHandle {
$statement .= subst("?",$param); # do not quote numbers
}
}
- # warn "in FakeDBD::mysql::StatementHandle.execute statement=$statement";
+ # warn "in MiniDBD::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 );
@@ -297,13 +297,13 @@ class FakeDBD::mysql::StatementHandle does FakeDBD::StatementHandle {
}
}
-class FakeDBD::mysql::Connection does FakeDBD::Connection {
+class MiniDBD::mysql::Connection does MiniDBD::Connection {
has $!mysql_client;
has $!RaiseError;
method prepare( Str $statement ) {
- # warn "in FakeDBD::mysql::Connection.prepare()";
- my $statement_handle = FakeDBD::mysql::StatementHandle.bless(
- FakeDBD::mysql::StatementHandle.CREATE(),
+ # warn "in MiniDBD::mysql::Connection.prepare()";
+ my $statement_handle = MiniDBD::mysql::StatementHandle.bless(
+ MiniDBD::mysql::StatementHandle.CREATE(),
mysql_client => $!mysql_client,
statement => $statement,
RaiseError => $!RaiseError
@@ -316,13 +316,13 @@ class FakeDBD::mysql::Connection does FakeDBD::Connection {
}
}
-class FakeDBD::mysql:auth<mberends>:ver<0.0.1> {
+class MiniDBD::mysql:auth<mberends>:ver<0.0.1> {
has $.Version = 0.01;
-#------------------ methods to be called from FakeDBI ------------------
+#------------------ methods to be called from MiniDBI ------------------
method connect( Str $user, Str $password, Str $params, $RaiseError ) {
- # warn "in FakeDBD::mysql.connect('$user',*,'$params')";
+ # warn "in MiniDBD::mysql.connect('$user',*,'$params')";
my ( $mysql_client, $mysql_error );
unless defined $mysql_client {
$mysql_client = mysql_init( pir::null__P() );
@@ -343,8 +343,8 @@ class FakeDBD::mysql:auth<mberends>:ver<0.0.1> {
my $error = mysql_error( $mysql_client );
my $connection;
if $error eq '' {
- $connection = FakeDBD::mysql::Connection.bless(
- FakeDBD::mysql::Connection.CREATE(),
+ $connection = MiniDBD::mysql::Connection.bless(
+ MiniDBD::mysql::Connection.CREATE(),
mysql_client => $mysql_client,
RaiseError => $RaiseError
);
@@ -353,23 +353,23 @@ class FakeDBD::mysql:auth<mberends>:ver<0.0.1> {
}
}
-# warn "module FakeDBD::mysql.pm has loaded";
+# warn "module MiniDBD::mysql.pm has loaded";
=begin pod
=head1 DESCRIPTION
-# 'zavolaj' is a Native Call Interface for Rakudo/Parrot. 'FakeDBI' and
-# 'FakeDBD::mysql' are Perl 6 modules that use 'zavolaj' to use the
+# 'zavolaj' is a Native Call Interface for Rakudo/Parrot. 'MiniDBI' and
+# 'MiniDBD::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. FakeDBI is not that, it is a naive rewrite of the
-# similarly named Perl 5 modules. Hence the 'Fake' part of the name.
+# and Perl 6. MiniDBI 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 FakeDBD::mysql module contains the same classes and methods as every
+The MiniDBD::mysql module contains the same classes and methods as every
database driver. Therefore read the main documentation of usage in
-L<doc:FakeDBI> and internal architecture in L<doc:FakeDBD>. Below are
-only notes about code unique to the FakeDBD::mysql implementation.
+L<doc:MiniDBI> and internal architecture in L<doc:MiniDBD>. Below are
+only notes about code unique to the MiniDBD::mysql implementation.
=head1 SEE ALSO
The MySQL 5.1 Reference Manual, C API.
View
38 lib/FakeDBI.pm6 → lib/MiniDBI.pm6
@@ -1,32 +1,32 @@
-# FakeDBI.pm6
+# MiniDBI.pm6
-class FakeDBI:auth<mberends>:ver<0.0.1> {
+class MiniDBI:auth<mberends>:ver<0.1.0> {
has $!err;
has $!errstr;
method connect( $dsn, $username, $password, :$RaiseError=0, :$PrintError=0, :$AutoCommit=1 ) {
- # warn "in FakeDBI.connect('$dsn')";
+ # warn "in MiniDBI.connect('$dsn')";
# Divide $dsn up into its separate fields.
my ( $prefix, $drivername, $params ) = $dsn.split(':');
my $driver = self.install_driver( $drivername );
- # warn "calling FakeDBD::" ~ $drivername ~ ".connect($username,*,$params)";
+ # warn "calling MiniDBD::" ~ $drivername ~ ".connect($username,*,$params)";
my $connection = $driver.connect( $username, $password, $params, $RaiseError );
return $connection;
}
method install_driver( $drivername ) {
- # warn "in FakeDBI.install_driver('$drivername')";
+ # warn "in MiniDBI.install_driver('$drivername')";
my $result;
# the need($n, {} ) argument would be a hash of named argements,
# but it dies with: get_pmc_keyed() not implemented in class ''
- # Perl6::Module::Loader.need( "FakeDBD::$drivername", {} );
- $result = Perl6::Module::Loader.need( "FakeDBD::$drivername" );
+ # Perl6::Module::Loader.need( "MiniDBD::$drivername", {} );
+ $result = Perl6::Module::Loader.need( "MiniDBD::$drivername" );
unless $result {
- warn "install_driver cannot load FakeDBD::$drivername in $*PROGRAM_NAME";
+ warn "install_driver cannot load MiniDBD::$drivername in $*PROGRAM_NAME";
exit( 1 ); # instead of dying with an unnecessary stack trace
}
my $driver;
given $drivername {
- when 'CSV' { eval 'use FakeDBD::CSV; $driver = FakeDBD::CSV.new()' }
- when 'mysql' { eval 'use FakeDBD::mysql; $driver = FakeDBD::mysql.new()' }
+ when 'CSV' { eval 'use MiniDBD::CSV; $driver = MiniDBD::CSV.new()' }
+ when 'mysql' { eval 'use MiniDBD::mysql; $driver = MiniDBD::mysql.new()' }
default { die "driver name '$drivername' is not known"; }
}
return $driver;
@@ -107,12 +107,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 FakeDBI;
+ use MiniDBI;
# TODO: @driver_names = DBI.available_drivers;
# TODO: %drivers = DBI.installed_drivers;
# TODO: @data_sources = DBI.data_sources($driver_name, \%attr);
- $dbh = FakeDBI.connect($data_source, $username, $auth, \%attr);
+ $dbh = MiniDBI.connect($data_source, $username, $auth, \%attr);
$rv = $dbh.do($statement);
# TODO: $rv = $dbh.do($statement, \%attr);
@@ -168,19 +168,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<FakeDBI> has two meanings. In lowercase it indicates the
+The name C<MiniDBI> 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 FakeDBI CLASSES and ROLES
+=head1 MiniDBI CLASSES and ROLES
-=head2 FakeDBI
-The C<FakeDBI> class exists mainly to provide the F<connect> method,
+=head2 MiniDBI
+The C<MiniDBI> class exists mainly to provide the F<connect> method,
which acts as a constructor for database connections.
-=head2 FakeDBD
-The C<FakeDBD> role should only be used with 'does' to provide standard
-members for FakeDBD classes.
+=head2 MiniDBD
+The C<MiniDBD> role should only be used with 'does' to provide standard
+members for MiniDBD classes.
=head1 SEE ALSO
L<http://dbi.perl.org>
View
26 t/10-mysql.t
@@ -1,4 +1,4 @@
-# fakedbi/t/10-mysql.t
+# MiniDBI/t/10-mysql.t
# Before running the tests, prepare the database with something like:
@@ -32,7 +32,7 @@ use Test;
plan 86;
-use FakeDBI;
+use MiniDBI;
# The file 'lib.pl' customizes the testing environment per DBD, but all
# this test script currently needs is the variables listed here.
@@ -42,7 +42,7 @@ my $port = 3306;
my $database = 'zavolaj';
my $test_user = 'testuser';
my $test_password = 'testpass';
-my $test_dsn = "FakeDBI:$mdriver" ~ ":database=$database;" ~
+my $test_dsn = "MiniDBI:$mdriver" ~ ":database=$database;" ~
"host=$hostname;port=$port";
my $table = 't1';
@@ -63,11 +63,11 @@ my $table = 't1';
#ok $drh->{Version}, "Version $drh->{Version}";
#print "Driver version is ", $drh->{Version}, "\n";my $mdriver = 'mysql';
my $drh;
-$drh = FakeDBI.install_driver($mdriver);
+$drh = MiniDBI.install_driver($mdriver);
ok $drh, 'Install driver'; # test 1
my $drh_version;
$drh_version = $drh.Version;
-ok $drh_version > 0, "FakeDBD::mysql version $drh_version"; # test 2
+ok $drh_version > 0, "MiniDBD::mysql version $drh_version"; # test 2
#-----------------------------------------------------------------------
# from perl5 DBD/mysql/t/10connect.t
@@ -79,12 +79,12 @@ ok $drh_version > 0, "FakeDBD::mysql version $drh_version"; # test 2
#
my $dbh;
try {
- $dbh = FakeDBI.connect( $test_dsn, $test_user, $test_password,
+ $dbh = MiniDBI.connect( $test_dsn, $test_user, $test_password,
RaiseError => 1, PrintError => 1, AutoCommit => 0
);
# CATCH {
# warn $!;
-# die "ERROR: {FakeDBI.errstr}. Can't continue test";
+# die "ERROR: {MiniDBI.errstr}. Can't continue test";
# }
}
ok defined $dbh, "Connected to database"; # test 3
@@ -101,9 +101,9 @@ ok $result, 'disconnect returned true'; # test 4
#$dbh->disconnect();
try {
- $dbh = FakeDBI.connect( $test_dsn, $test_user, $test_password,
+ $dbh = MiniDBI.connect( $test_dsn, $test_user, $test_password,
RaiseError => 1, PrintError => 1, AutoCommit => 0 );
- CATCH { die "ERROR: {FakeDBI.errstr}. Can't continue test\n"; }
+ CATCH { die "ERROR: {MiniDBI.errstr}. Can't continue test\n"; }
}
ok(defined $dbh, "Connected to database"); # test 5
ok($dbh.do("DROP TABLE IF EXISTS $table"), "making slate clean"); # test 6
@@ -171,9 +171,9 @@ ok $dbh.do("DROP TABLE $table"), "Drop table $table"; # test 19
# is($sth->{mysql_warning_count}, 1);
#};
#try {
-# $dbh = FakeDBI.connect( $test_dsn, $test_user, $test_password,
+# $dbh = MiniDBI.connect( $test_dsn, $test_user, $test_password,
# RaiseError => 1, PrintError => 1, AutoCommit => 0 );
-# CATCH { die "ERROR: {FakeDBI.errstr}. Can't continue test\n"; }
+# CATCH { die "ERROR: {MiniDBI.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
@@ -246,9 +246,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 = FakeDBI.connect( $test_dsn, $test_user, $test_password,
+ $dbh = MiniDBI.connect( $test_dsn, $test_user, $test_password,
RaiseError => 1, PrintError => 1, AutoCommit => 0 );
- CATCH { die "ERROR: {FakeDBI.errstr}. Can't continue test\n"; }
+ CATCH { die "ERROR: {MiniDBI.errstr}. Can't continue test\n"; }
}
#-----------------------------------------------------------------------
View
6 t/20-CSV-common.t
@@ -1,7 +1,7 @@
-# fakedbi/t/05-AnyData-common.t
+# MiniDBI/t/20-CSV-common.t
use Test;
-use FakeDBI;
+use MiniDBI;
# 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 = "FakeDBI:$mdriver:"; # TODO remove last :
+ $test_dsn = "MiniDBI:$mdriver:"; # TODO remove last :
$test_user = '';
$test_password = '';
}
View
6 t/25-mysql-common.t
@@ -1,7 +1,7 @@
-# fakedbi/t/10-mysql-common.t
+# MiniDBI/t/10-mysql-common.t
use Test;
-use FakeDBI;
+use MiniDBI;
# Define the only database specific values used by the common tests.
my ( $mdriver, $test_dsn, $test_user, $test_password );
@@ -12,7 +12,7 @@ my ( $mdriver, $test_dsn, $test_user, $test_password );
my $database = 'zavolaj';
# Set up the common variables with the MySQL specific values
$mdriver = 'mysql';
- $test_dsn = "FakeDBI:$mdriver" ~ ":database=$database;"
+ $test_dsn = "MiniDBI:$mdriver" ~ ":database=$database;"
~ "host=$hostname;port=$port";
$test_user = 'testuser';
$test_password = 'testpass';
View
12 t/99-common.pl6
@@ -1,21 +1,21 @@
-# fakedbi/t/99-common.pl6
+# MiniDBI/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 FakeDBI;
-diag "Testing FakeDBD::$mdriver";
+#use MiniDBI;
+diag "Testing MiniDBD::$mdriver";
plan 32;
# Verify that the driver loads before attempting a connect
-my $drh = FakeDBI.install_driver($mdriver);
+my $drh = MiniDBI.install_driver($mdriver);
ok $drh, 'Install driver'; # test 1
my $drh_version;
$drh_version = $drh.Version;
-ok $drh_version > 0, "FakeDBD::$mdriver version $drh_version"; # test 2
+ok $drh_version > 0, "MiniDBD::$mdriver version $drh_version"; # test 2
# Connect to the data sourcequantity*price AS amount FROM nom
-my $dbh = FakeDBI.connect( $test_dsn, $test_user, $test_password );
+my $dbh = MiniDBI.connect( $test_dsn, $test_user, $test_password );
ok $dbh, "connect to $test_dsn"; # test 3
# Test .prepare() and .execute() a few times while setting things up.
Please sign in to comment.
Something went wrong with that request. Please try again.