[Bast-commits] r8597 - in
DBIx-Class/0.08/branches/storage-interbase:
lib/DBIx/Class/Storage/DBI lib/DBIx/Class/Storage/DBI/ODBC t
caelum at dev.catalyst.perl.org
caelum at dev.catalyst.perl.org
Wed Feb 10 12:05:21 GMT 2010
Author: caelum
Date: 2010-02-10 12:05:21 +0000 (Wed, 10 Feb 2010)
New Revision: 8597
Modified:
DBIx-Class/0.08/branches/storage-interbase/lib/DBIx/Class/Storage/DBI/InterBase.pm
DBIx-Class/0.08/branches/storage-interbase/lib/DBIx/Class/Storage/DBI/ODBC/Firebird.pm
DBIx-Class/0.08/branches/storage-interbase/t/750firebird.t
Log:
default to sql dialect 3 unless overridden
Modified: DBIx-Class/0.08/branches/storage-interbase/lib/DBIx/Class/Storage/DBI/InterBase.pm
===================================================================
--- DBIx-Class/0.08/branches/storage-interbase/lib/DBIx/Class/Storage/DBI/InterBase.pm 2010-02-10 11:40:37 UTC (rev 8596)
+++ DBIx-Class/0.08/branches/storage-interbase/lib/DBIx/Class/Storage/DBI/InterBase.pm 2010-02-10 12:05:21 UTC (rev 8597)
@@ -140,6 +140,29 @@
return $@ ? 0 : 1;
}
+# We want dialect 3 for new features and quoting to work, DBD::InterBase uses
+# dialect 1 (interbase compat) by default.
+sub _init {
+ my $self = shift;
+ $self->_set_sql_dialect(3);
+}
+
+sub _set_sql_dialect {
+ my $self = shift;
+ my $val = shift || 3;
+
+ my $dsn = $self->_dbi_connect_info->[0];
+
+ return if ref($dsn) eq 'CODE';
+
+ if ($dsn !~ /ib_dialect=/) {
+ $self->_dbi_connect_info->[0] = "$dsn;ib_dialect=$val";
+ my $connected = defined $self->_dbh;
+ $self->disconnect;
+ $self->ensure_connected if $connected;
+ }
+}
+
=head2 connect_call_datetime_setup
Used as:
Modified: DBIx-Class/0.08/branches/storage-interbase/lib/DBIx/Class/Storage/DBI/ODBC/Firebird.pm
===================================================================
--- DBIx-Class/0.08/branches/storage-interbase/lib/DBIx/Class/Storage/DBI/ODBC/Firebird.pm 2010-02-10 11:40:37 UTC (rev 8596)
+++ DBIx-Class/0.08/branches/storage-interbase/lib/DBIx/Class/Storage/DBI/ODBC/Firebird.pm 2010-02-10 12:05:21 UTC (rev 8597)
@@ -37,6 +37,12 @@
);
}
+# we don't need DBD::InterBase-specific initialization
+sub _init { 1 }
+
+# ODBC uses dialect 3 by default, good
+sub _set_sql_dialect { 1 }
+
1;
=head1 CAVEATS
Modified: DBIx-Class/0.08/branches/storage-interbase/t/750firebird.t
===================================================================
--- DBIx-Class/0.08/branches/storage-interbase/t/750firebird.t 2010-02-10 11:40:37 UTC (rev 8596)
+++ DBIx-Class/0.08/branches/storage-interbase/t/750firebird.t 2010-02-10 12:05:21 UTC (rev 8597)
@@ -25,7 +25,7 @@
my $schema;
foreach my $conn_idx (0..1) {
- my ($dsn, $user, $pass) = @{ $info[$conn_idx] };
+ my ($dsn, $user, $pass) = @{ $info[$conn_idx] || [] };
next unless $dsn;
@@ -211,8 +211,8 @@
eval { $dbh->do('DROP GENERATOR "gen_artist_artistid"') };
diag $@ if $@;
- foreach my $table (qw/"artist" "bindtype_test"/) {
- eval { $dbh->do(q[DROP TABLE "$table"]) };
+ foreach my $table (qw/artist bindtype_test/) {
+ eval { $dbh->do(qq[DROP TABLE "$table"]) };
#diag $@ if $@;
}
}
More information about the Bast-commits
mailing list