[libdbd-firebird-perl] 01/01: New upstream version 1.23
Damyan Ivanov
dmn at moszumanska.debian.org
Tue Oct 11 09:04:27 UTC 2016
This is an automated email from the git hooks/post-receive script.
dmn pushed a commit to annotated tag upstream/1.23
in repository libdbd-firebird-perl.
commit 7c12dc357fffb80d067697ff130168ec3dda0c0d
Author: Damyan Ivanov <dmn at debian.org>
Date: Mon Oct 10 12:32:21 2016 +0000
New upstream version 1.23
---
Firebird.pm | 3 +-
Firebird.xs | 2 +-
MANIFEST | 4 ++
META.json | 6 +--
META.yml | 4 +-
Makefile.PL | 4 +-
README.md | 81 ++++++++++++++++++++++++++++
dbdimp.c | 135 +++++++++++++++++++++++-----------------------
inc/FirebirdMaker.pm | 13 ++++-
t/03-dbh-attr.t | 47 ++++++++++++++++
t/63-doubles.t | 102 +++++++++++++++++++++++++++++++++++
t/81-event-fork.t | 7 +++
t/TestFirebirdEmbedded.pm | 9 +++-
t/rt110979.t | 73 +++++++++++++++++++++++++
14 files changed, 411 insertions(+), 79 deletions(-)
diff --git a/Firebird.pm b/Firebird.pm
index 1457df9..e3f1f7e 100644
--- a/Firebird.pm
+++ b/Firebird.pm
@@ -19,7 +19,7 @@ require Exporter;
require DynaLoader;
@ISA = qw(Exporter DynaLoader);
-$VERSION = '1.22';
+$VERSION = '1.23';
bootstrap DBD::Firebird $VERSION;
@@ -29,6 +29,7 @@ $err = 0;
$errstr = "";
$drh = undef;
+use constant fb_api_ver => 0;
sub CLONE
{
diff --git a/Firebird.xs b/Firebird.xs
index c1c2361..a1693e5 100644
--- a/Firebird.xs
+++ b/Firebird.xs
@@ -573,7 +573,7 @@ ib_set_tx_param(dbh, ...)
if (i >= items - 1)
{
Safefree(tmp_tpb);
- croak("You must specify parameter => value pairs, but theres no value for %s", tx_key);
+ croak("You must specify parameter => value pairs, but there's no value for %s", tx_key);
}
/**********************************************************************/
diff --git a/MANIFEST b/MANIFEST
index 89151ad..c4e4a26 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -15,9 +15,11 @@ lib/DBD/Firebird/TypeInfo.pm
Makefile.PL
MANIFEST This list of files
README
+README.md
t/00-base.t
t/01-connect.t
t/02-ib_embedded.t
+t/03-dbh-attr.t
t/20-createdrop.t
t/30-insertfetch.t
t/31-prepare_cached.t
@@ -36,6 +38,7 @@ t/51-commit.t
t/60-leaks.t
t/61-settx.t
t/62-timeout.t
+t/63-doubles.t
t/70-nested-sth.t
t/75-utf8.t
t/80-event-ithreads.t
@@ -50,6 +53,7 @@ t/dbi-primary_key_info.t
t/dbi-rowcount.t
t/dbi-table_info.t
t/dbi-tables.t
+t/rt110979.t
t/rt49896.t
t/rt54561.t
t/rt55244.t
diff --git a/META.json b/META.json
index dcc4544..d6cf0b4 100644
--- a/META.json
+++ b/META.json
@@ -4,7 +4,7 @@
"Edwin Pratomo (edpratomo at users.sourceforge.net)"
],
"dynamic_config" : 1,
- "generated_by" : "ExtUtils::MakeMaker version 7.0401, CPAN::Meta::Converter version 2.150005",
+ "generated_by" : "ExtUtils::MakeMaker version 7.1002, CPAN::Meta::Converter version 2.150005",
"license" : [
"perl_5"
],
@@ -48,6 +48,6 @@
"url" : "https://github.com/mariuz/perl-dbd-firebird"
}
},
- "version" : "1.22",
- "x_serialization_backend" : "JSON::PP version 2.27300"
+ "version" : "1.23",
+ "x_serialization_backend" : "JSON::PP version 2.27400"
}
diff --git a/META.yml b/META.yml
index 9d482cc..7a245f9 100644
--- a/META.yml
+++ b/META.yml
@@ -12,7 +12,7 @@ configure_requires:
DBI: '1.41'
File::Which: '0'
dynamic_config: 1
-generated_by: 'ExtUtils::MakeMaker version 7.0401, CPAN::Meta::Converter version 2.150005'
+generated_by: 'ExtUtils::MakeMaker version 7.1002, CPAN::Meta::Converter version 2.150005'
license: perl
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.4.html
@@ -27,5 +27,5 @@ requires:
perl: '5.008001'
resources:
repository: https://github.com/mariuz/perl-dbd-firebird
-version: '1.22'
+version: '1.23'
x_serialization_backend: 'CPAN::Meta::YAML version 0.018'
diff --git a/Makefile.PL b/Makefile.PL
index 073cbae..b1a8860 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -158,7 +158,7 @@ unless ($EMBEDDED) {
}
}
-my $client_lib = $EMBEDDED ? 'fbembed' : 'fbclient';
+my $client_lib = ( $EMBEDDED and $FB::API_VER < 30 ) ? 'fbembed' : 'fbclient';
if ($interactive) {
@@ -294,7 +294,7 @@ SWITCH: {
}
unless ($EMBEDDED) {
- if ($FB::libfbembed_available) {
+ if ($FB::libfbembed_available or $FB::API_VER >= 30) {
print "Found libfbembed, will build DBD::FirebirdEmbed too.\n";
create_embedded_files();
}
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..7f34aa9
--- /dev/null
+++ b/README.md
@@ -0,0 +1,81 @@
+DBD::Firebird version 1.21
+==========================
+
+DBI driver for the Firebird RDBMS server.
+
+- Copyright © 2015 Stefan Roas
+- Copyright © 2014 H.Merijn Brand - Tux
+- Copyright © 2010-2015 Popa Adrian Marius
+- Copyright © 2011-2013 Stefan Suciu
+- Copyright © 2011-2015 Damyan Ivanov
+- Copyright © 2011 Alexandr Ciornii
+- Copyright © 2010-2014 Mike Pomraning
+- Copyright © 1999-2005 Edwin Pratomo
+- Portions Copyright © 2001-2005 Daniel Ritz
+
+License
+-------
+
+You may distribute under the terms of either the GNU General Public
+License or the Artistic License, as specified in the Perl README file.
+(http://dev.perl.org/licenses/artistic.html)
+
+
+Installation
+------------
+
+Requirements:
+
+- Perl (Threaded and version 5.8.1 or higher)
+- Perl DBI (1.41 or higher)
+- Firebird (2.5.1 or higher)
+- A C compiler
+ * UN*X
+ GCC 4.x (tested, older may or may not work) or other capable
+ clang
+
+ * Windows
+ - Strawberry perl (http://strawberryperl.com/) comes with it's own compiler (mingw)
+ - Visual Studio C++ (http://visualstudio.com)
+ - Cygwin
+ * Freebsd
+ - Threaded Perl is required (You have to re-install Perl from
+ ports and you have to select the config option that says 'build a
+ Perl with threads')
+
+
+*BEFORE* BUILDING, TESTING AND INSTALLING this you will need to:
+
+- Build, test and install Perl 5 (at least 5.8.1).
+
+- Build, test and install the DBI module (at least DBI 1.41).
+
+ On Debian/Ubuntu you can do a simple:
+ sudo apt-get install firebird2.5-dev libdbi-perl
+
+- Remember to *read* the DBI README file if you installed it from source
+
+- Make sure that Firebird server is running (for testing telnet localhost 3050)
+
+
+BUILDING:
+ Win32/Win64 with Strawberry
+ type 'dmake' from the console
+
+ Win32/Win64 with MS compiler:
+ type 'nmake', not just 'make'
+
+ To Configure and build the DBD:
+ perl Makefile.PL
+ make
+
+TESTING
+ To run tests module Test::Exception is required on Debian/Ubuntu systems:
+ sudo apt-get install libtest-exception-perl
+
+ Please, set at least DBI_PASS (or ISC_PASSWORD), before 'make test'.
+ The default for DBI_USER is 'SYSDBA'.(masterkey password is given here as example only)
+ ISC_PASSWORD=masterkey make test
+
+INSTALLING:
+ make install
diff --git a/dbdimp.c b/dbdimp.c
index 490d804..1c48d7c 100644
--- a/dbdimp.c
+++ b/dbdimp.c
@@ -1043,6 +1043,73 @@ int dbd_st_prepare(SV *sth, imp_sth_t *imp_sth, char *statement, SV *attribs)
return TRUE;
}
+int dbd_st_finish_internal(SV *sth, imp_sth_t *imp_sth, int honour_auto_commit)
+{
+ D_imp_dbh_from_sth;
+ ISC_STATUS status[ISC_STATUS_LENGTH];
+
+ DBI_TRACE_imp_xxh(imp_sth, 2, (DBIc_LOGPIO(imp_sth), "dbd_st_finish\n"));
+
+ if (!DBIc_ACTIVE(imp_sth)) /* already finished */
+ {
+ DBI_TRACE_imp_xxh(imp_sth, 3, (DBIc_LOGPIO(imp_sth), "dbd_st_finish: nothing to do (not active)\n"));
+ return TRUE;
+ }
+
+ /* Close the cursor, not drop the statement! */
+ if (imp_sth->type != isc_info_sql_stmt_exec_procedure)
+ isc_dsql_free_statement(status, (isc_stmt_handle *)&(imp_sth->stmt), DSQL_close);
+
+ /* Ignore errors when closing already closed cursor (sqlcode -501).
+ May happen when closing "select * from sample" statement, which was
+ closed by the server because of a "drop table sample" statement.
+ There is no point to error-out here, since nothing bad has happened --
+ the statement is closed, just without we knowing. There is no resource
+ leak and the user can't and needs not do anything.
+ */
+ if ((status[0] == 1) && (status[1] > 0)) {
+ long sqlcode = isc_sqlcode(status);
+
+ if (sqlcode != -501) {
+ if (ib_error_check(sth, status))
+ return FALSE;
+ }
+ else
+ {
+ DBI_TRACE_imp_xxh(imp_sth, 3, (DBIc_LOGPIO(imp_sth), "dbd_st_finish: ignoring error -501 from isc_dsql_free_statement.\n"));
+ }
+ }
+
+ DBI_TRACE_imp_xxh(imp_sth, 3, (DBIc_LOGPIO(imp_sth), "dbd_st_finish: isc_dsql_free_statement passed.\n"));
+
+ /* set statement to inactive - must be before ib_commit_transaction 'cos
+ commit can call dbd_st_finish function again */
+ DBIc_ACTIVE_off(imp_sth);
+
+ if ( imp_sth->param_values != NULL )
+ hv_clear(imp_sth->param_values);
+
+ /* if AutoCommit on */
+ if (DBIc_has(imp_dbh, DBIcf_AutoCommit) && honour_auto_commit)
+ {
+ DBI_TRACE_imp_xxh(imp_sth, 4, (DBIc_LOGPIO(imp_sth), "dbd_st_finish: Trying to call ib_commit_transaction.\n"));
+
+ if (!ib_commit_transaction(sth, imp_dbh))
+ {
+ DBI_TRACE_imp_xxh(imp_sth, 4, (DBIc_LOGPIO(imp_sth), "dbd_st_finish: Call ib_commit_transaction finished returned FALSE.\n"));
+ return FALSE;
+ }
+ DBI_TRACE_imp_xxh(imp_sth, 4, (DBIc_LOGPIO(imp_sth), "dbd_st_finish: Call ib_commit_transaction succeeded.\n"));
+ }
+
+ return TRUE;
+}
+
+int dbd_st_finish(SV *sth, imp_sth_t *imp_sth)
+{
+ return dbd_st_finish_internal(sth, imp_sth, TRUE);
+}
+
int dbd_st_execute(SV *sth, imp_sth_t *imp_sth)
{
@@ -1775,73 +1842,6 @@ AV *dbd_st_fetch(SV *sth, imp_sth_t *imp_sth)
}
-int dbd_st_finish(SV *sth, imp_sth_t *imp_sth)
-{
- return dbd_st_finish_internal(sth, imp_sth, TRUE);
-}
-
-int dbd_st_finish_internal(SV *sth, imp_sth_t *imp_sth, int honour_auto_commit)
-{
- D_imp_dbh_from_sth;
- ISC_STATUS status[ISC_STATUS_LENGTH];
-
- DBI_TRACE_imp_xxh(imp_sth, 2, (DBIc_LOGPIO(imp_sth), "dbd_st_finish\n"));
-
- if (!DBIc_ACTIVE(imp_sth)) /* already finished */
- {
- DBI_TRACE_imp_xxh(imp_sth, 3, (DBIc_LOGPIO(imp_sth), "dbd_st_finish: nothing to do (not active)\n"));
- return TRUE;
- }
-
- /* Close the cursor, not drop the statement! */
- if (imp_sth->type != isc_info_sql_stmt_exec_procedure)
- isc_dsql_free_statement(status, (isc_stmt_handle *)&(imp_sth->stmt), DSQL_close);
-
- /* Ignore errors when closing already closed cursor (sqlcode -501).
- May happen when closing "select * from sample" statement, which was
- closed by the server because of a "drop table sample" statement.
- There is no point to error-out here, since nothing bad has happened --
- the statement is closed, just without we knowing. There is no resource
- leak and the user can't and needs not do anything.
- */
- if ((status[0] == 1) && (status[1] > 0)) {
- long sqlcode = isc_sqlcode(status);
-
- if (sqlcode != -501) {
- if (ib_error_check(sth, status))
- return FALSE;
- }
- else
- {
- DBI_TRACE_imp_xxh(imp_sth, 3, (DBIc_LOGPIO(imp_sth), "dbd_st_finish: ignoring error -501 from isc_dsql_free_statement.\n"));
- }
- }
-
- DBI_TRACE_imp_xxh(imp_sth, 3, (DBIc_LOGPIO(imp_sth), "dbd_st_finish: isc_dsql_free_statement passed.\n"));
-
- /* set statement to inactive - must be before ib_commit_transaction 'cos
- commit can call dbd_st_finish function again */
- DBIc_ACTIVE_off(imp_sth);
-
- if ( imp_sth->param_values != NULL )
- hv_clear(imp_sth->param_values);
-
- /* if AutoCommit on */
- if (DBIc_has(imp_dbh, DBIcf_AutoCommit) && honour_auto_commit)
- {
- DBI_TRACE_imp_xxh(imp_sth, 4, (DBIc_LOGPIO(imp_sth), "dbd_st_finish: Trying to call ib_commit_transaction.\n"));
-
- if (!ib_commit_transaction(sth, imp_dbh))
- {
- DBI_TRACE_imp_xxh(imp_sth, 4, (DBIc_LOGPIO(imp_sth), "dbd_st_finish: Call ib_commit_transaction finished returned FALSE.\n"));
- return FALSE;
- }
- DBI_TRACE_imp_xxh(imp_sth, 4, (DBIc_LOGPIO(imp_sth), "dbd_st_finish: Call ib_commit_transaction succeded.\n"));
- }
-
- return TRUE;
-}
-
void dbd_st_destroy(SV *sth, imp_sth_t *imp_sth)
{
@@ -2180,7 +2180,6 @@ int ib_blob_write(SV *sth, imp_sth_t *imp_sth, XSQLVAR *var, SV *value)
static int ib_fill_isqlda(SV *sth, imp_sth_t *imp_sth, SV *param, SV *value,
IV sql_type)
{
- D_imp_dbh_from_sth;
STRLEN len;
XSQLVAR *ivar;
int retval;
diff --git a/inc/FirebirdMaker.pm b/inc/FirebirdMaker.pm
index 16c0185..04a257b 100644
--- a/inc/FirebirdMaker.pm
+++ b/inc/FirebirdMaker.pm
@@ -28,6 +28,8 @@ our ( $use_libfbembed );
our $test_conf = 't/tests-setup.tmp.conf';
our $test_mark = 't/tests-setup.tmp.OK';
+$FB::API_VER = 0;
+
# Written by Alexandr Ciornii, version 0.23. Added by eumm-upgrade.
sub WriteMakefile1 {
my %params = @_;
@@ -164,6 +166,13 @@ sub locate_firebird {
for (@items) {
if (s/^-I\s*//) {
$FB::INC = $_;
+
+ open( my $fh, '<', File::Spec->catfile( $_, 'ibase.h' ) )
+ or die "open($_/ibase.h): $!";
+ while (<$fh>) {
+ $FB::API_VER = $1, last if /^#define FB_API_VER (\w+)/;
+ }
+ close($fh);
last;
}
}
@@ -242,7 +251,8 @@ sub check_and_set_devlibs {
die "libfbembed.so not found\n"
if $ENV{DBD_FIREBIRD_REQUIRE_EMBEDDED}
- and not $FB::libfbembed_available;
+ and not $FB::libfbembed_available
+ and $FB::API_VER < 30;
return;
}
@@ -795,6 +805,7 @@ EOT
$_[0] =~ s/dbi:Firebird:.+/dbi:FirebirdEmbedded:db=\$dbname", undef, undef);/g;
$_[0] =~ s/(?<!L\<)DBD::Firebird\b(?!::(?:Get|Type|Table)Info)/DBD::FirebirdEmbedded/g;
$_[0] =~ s/'Firebird'/'FirebirdEmbedded'/g;
+ $_[0] =~ s/use constant fb_api_ver => .+;/use constant fb_api_ver => $FB::API_VER;/;
},
},
);
diff --git a/t/03-dbh-attr.t b/t/03-dbh-attr.t
new file mode 100644
index 0000000..6691339
--- /dev/null
+++ b/t/03-dbh-attr.t
@@ -0,0 +1,47 @@
+use strict;
+use warnings;
+
+# Smattering of dbh attribute tests.
+# FIXME: add generic handle attribute tests, FB-specific attribute tests
+
+use Test::More;
+
+use lib 't','.';
+
+use TestFirebird;
+
+my $T = TestFirebird->new;
+
+plan tests => 9;
+
+my( $dbh, $error ) = $T->connect_to_database;
+ok(!$error, "Connected to database") or diag($error);
+
+ok($dbh->{Active},
+ "Active attribute is true after connect");
+
+ok(defined($dbh->{AutoCommit}),
+ "AutoCommit attribute supported");
+
+isa_ok($dbh->{Driver}, 'DBI::dr',
+ "Driver attribute returns a DBI::dr");
+
+ok($dbh->{Name} =~ /db=[^;]+/,
+ "Name attribute is of the form db=...")
+ or diag("\$dbh->{Name} is $dbh->{Name}");
+
+$dbh->prepare('SELECT 1 FROM RDB$DATABASE');
+
+cmp_ok($dbh->{Statement}, 'eq', 'SELECT 1 FROM RDB$DATABASE',
+ "Statement attribute is as expected");
+
+# Borrowed from DBD::Pg
+is($dbh->{RowCacheSize}, undef,
+ "RowCacheSize attribute is undefined");
+$dbh->{RowCacheSize} = 42;
+is($dbh->{RowCacheSize}, undef,
+ "RowCacheSize attribute is undefined after assignment");
+
+$dbh->disconnect();
+ok(!$dbh->{Active},
+ "Active attribute is false after disconnect");
diff --git a/t/63-doubles.t b/t/63-doubles.t
new file mode 100644
index 0000000..a09767f
--- /dev/null
+++ b/t/63-doubles.t
@@ -0,0 +1,102 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+use Test::More;
+use Test::Deep;
+use DBI;
+
+use lib 't','.';
+
+use TestFirebird;
+my $T = TestFirebird->new;
+
+my ( $dbh, $error_str ) = $T->connect_to_database( { ChopBlanks => 1 } );
+
+if ($error_str) {
+ BAIL_OUT("Unknown: $error_str!");
+}
+
+unless ( $dbh->isa('DBI::db') ) {
+ plan skip_all => 'Connection to database failed, cannot continue testing';
+}
+
+ok($dbh, 'Connected to the database');
+
+# DBI->trace(4, "trace.txt");
+
+# ------- TESTS ------------------------------------------------------------- #
+
+#
+# Find a possible new table name
+#
+my $table = find_new_table($dbh);
+ok($table, "TABLE is '$table'");
+
+my @doubles = ( 0.4, 0.6, 0.8, 0.95, 1.0, 1.1, 1.2, 1.15, 3.14159 );
+
+my $def =<<"DEF";
+CREATE TABLE $table (
+ id integer,
+ flt float,
+ dbl double precision
+)
+DEF
+ok( $dbh->do($def), qq{CREATE TABLE '$table'} );
+
+#
+# Insert some values
+#
+
+my $stmt =<<"END_OF_QUERY";
+INSERT INTO $table (
+ id, flt, dbl
+) VALUES (?, ?, ?)
+END_OF_QUERY
+
+ok(my $insert = $dbh->prepare($stmt), 'PREPARE INSERT');
+
+# Insert positive numbers
+my $id = 1;
+ok($insert->execute( $id++, $_, $_ ), "Inserting $_" ) for @doubles;
+
+# Insert positive numbers
+ok($insert->execute( $id++, -$_, -$_ ), "Inserting -$_" ) for @doubles;
+
+
+#
+# Select the values
+#
+ok( my $cursor = $dbh->prepare( qq{SELECT id, flt, dbl FROM $table WHERE id=?} ),
+ 'PREPARE SELECT' );
+
+$id = 0;
+for my $n (@doubles) {
+ $id++;
+ ok($cursor->execute($id), "EXECUTE SELECT $id ($n)");
+ ok((my $res = $cursor->fetchrow_arrayref), "FETCHALL arrayref $id ($n)");
+ cmp_deeply($res, [ $id, num($n, 1e-6), num($n, 1e-6) ], "row $id ($n)");
+}
+
+for my $n (@doubles) {
+ $id++;
+ ok($cursor->execute($id), "EXECUTE SELECT $id (-$n)");
+ ok((my $res = $cursor->fetchrow_arrayref), "FETCHALL arrayref $id (-$n)");
+ cmp_deeply($res, [ $id, num(-$n, 1e-6), num(-$n, 1e-6) ], "row $id (-$n)");
+}
+
+
+#
+# Drop the test table
+#
+$dbh->{AutoCommit} = 1;
+
+ok( $dbh->do("DROP TABLE $table"), "DROP TABLE '$table'" );
+
+#
+# Finally disconnect.
+#
+ok($dbh->disconnect, 'DISCONNECT');
+
+done_testing;
diff --git a/t/81-event-fork.t b/t/81-event-fork.t
index 237ddf4..aadf1cc 100644
--- a/t/81-event-fork.t
+++ b/t/81-event-fork.t
@@ -17,6 +17,13 @@ plan skip_all => 'DBD_FIREBIRD_TEST_SKIP_EVENTS_FORK found in the environment'
use TestFirebird;
my $T = TestFirebird->new;
+if ( eval{$T->is_embedded} ) {
+ use DBD::FirebirdEmbedded;
+ plan skip_all =>
+ 'Only one process can access the database in embedded mode'
+ if DBD::FirebirdEmbedded->fb_api_ver >= 30;
+}
+
my ($dbh, $error_str) = $T->connect_to_database();
if ($error_str) {
diff --git a/t/TestFirebirdEmbedded.pm b/t/TestFirebirdEmbedded.pm
index f19d604..4eac75e 100644
--- a/t/TestFirebirdEmbedded.pm
+++ b/t/TestFirebirdEmbedded.pm
@@ -27,6 +27,8 @@ sub import {
use constant is_embedded => 1;
use constant dbd => 'DBD::FirebirdEmbedded';
+use DBD::FirebirdEmbedded;
+
sub check_credentials {
# this is embedded, nothing to check, we don't need credentials
}
@@ -36,7 +38,8 @@ sub read_cached_configs {
$self->SUPER::read_cached_configs;
# this is embedded, no server involved
- $ENV{FIREBIRD} = $ENV{FIREBIRD_LOCK} = '.';
+ $ENV{FIREBIRD} = $ENV{FIREBIRD_LOCK} = '.'
+ unless DBD::FirebirdEmbedded->fb_api_ver => 30;
# no authentication either
delete $ENV{ISC_USER};
delete $ENV{ISC_PASSWORD};
@@ -47,6 +50,10 @@ sub read_cached_configs {
delete $self->{pass};
delete $self->{host};
+ if (DBD::FirebirdEmbedded->fb_api_ver >= 30) {
+ $self->{user} = 'SYSDBA';
+ $self->{pass} = 'any';
+ }
$self->{tdsn} = $self->get_dsn;
$self->{path} = $self->get_path;
}
diff --git a/t/rt110979.t b/t/rt110979.t
new file mode 100644
index 0000000..42b0d8e
--- /dev/null
+++ b/t/rt110979.t
@@ -0,0 +1,73 @@
+#!/usr/bin/perl
+#
+# Test that RT#110979 is fixed
+#
+
+use strict;
+use warnings;
+
+use Test::More;
+use lib 't','.';
+
+use TestFirebird;
+my $T = TestFirebird->new;
+
+my ($dbh, $error_str) = $T->connect_to_database();
+
+if ($error_str) {
+ BAIL_OUT("Unknown: $error_str!");
+}
+
+unless ( $dbh->isa('DBI::db') ) {
+ plan skip_all => 'Connection to database failed, cannot continue testing';
+}
+
+ok($dbh, 'Connected to the database');
+
+
+# ------- TESTS ------------------------------------------------------------- #
+
+my $table = find_new_table($dbh);
+ok($table, qq{Table is '$table'});
+
+#
+# Create a new table
+#
+my $def =<<"DEF";
+CREATE TABLE $table (
+ id INTEGER PRIMARY KEY,
+ name VARCHAR(200)
+)
+DEF
+ok( $dbh->do($def), qq{CREATE TABLE '$table'} );
+
+ok( $dbh->do("create generator gen_$table"), "create generator gen_$table" );
+
+$def = <<"DEF";
+CREATE TRIGGER $table\_bi FOR $table
+ACTIVE BEFORE INSERT POSITION 0
+AS
+BEGIN
+ IF (NEW.id IS NULL) THEN
+ NEW.id = GEN_ID(gen_$table,1);
+END
+DEF
+
+ok( $dbh->do($def), "create trigger $table\_bi" );
+
+my $sth
+ = $dbh->prepare_cached("INSERT INTO $table(name) VALUES(?) RETURNING id");
+ok( $sth->execute('foo'), 'Insert worked' );
+is( ($sth->fetchrow_array)[0], 1, 'Autoinc PK retrieved' );
+ok( $sth->finish, "finish" );
+
+ok( $dbh->do( "drop trigger $table\_bi", "drop trigger" ) );
+ok( $dbh->do( "drop generator gen_$table", "drop generator" ) );
+ok($dbh->do("DROP TABLE $table"), "DROP TABLE '$table'");
+
+#
+# Finally disconnect.
+#
+ok($dbh->disconnect());
+
+done_testing();
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libdbd-firebird-perl.git
More information about the Pkg-perl-cvs-commits
mailing list