[Bast-commits] r6526 - in DBIx-Class/0.08/branches/sybase:
lib/DBIx/Class/Storage/DBI/Sybase t
caelum at dev.catalyst.perl.org
caelum at dev.catalyst.perl.org
Sat Jun 6 03:36:04 GMT 2009
Author: caelum
Date: 2009-06-06 03:36:03 +0000 (Sat, 06 Jun 2009)
New Revision: 6526
Modified:
DBIx-Class/0.08/branches/sybase/lib/DBIx/Class/Storage/DBI/Sybase/NoBindVars.pm
DBIx-Class/0.08/branches/sybase/t/746sybase.t
Log:
temporary sybase noquote hack
Modified: DBIx-Class/0.08/branches/sybase/lib/DBIx/Class/Storage/DBI/Sybase/NoBindVars.pm
===================================================================
--- DBIx-Class/0.08/branches/sybase/lib/DBIx/Class/Storage/DBI/Sybase/NoBindVars.pm 2009-06-06 02:45:09 UTC (rev 6525)
+++ DBIx-Class/0.08/branches/sybase/lib/DBIx/Class/Storage/DBI/Sybase/NoBindVars.pm 2009-06-06 03:36:03 UTC (rev 6526)
@@ -37,10 +37,15 @@
return $self->next::method(@_) if not defined $value;
- if (my $key = List::Util::first { $type =~ /$_/i } keys %noquote) {
- return 0 if $noquote{$key}->($value);
- }
+## this is the correct method, but we have no type yet
+# if (my $key = List::Util::first { $type =~ /$_/i } keys %noquote) {
+# return 0 if $noquote{$key}->($value);
+# }
+# temporary hack
+ return 0 if Scalar::Util::looks_like_number($value) ||
+ ($value =~ /^\$(\S*)\z/ && Scalar::Util::looks_like_number($1));
+
return $self->next::method(@_);
}
Modified: DBIx-Class/0.08/branches/sybase/t/746sybase.t
===================================================================
--- DBIx-Class/0.08/branches/sybase/t/746sybase.t 2009-06-06 02:45:09 UTC (rev 6525)
+++ DBIx-Class/0.08/branches/sybase/t/746sybase.t 2009-06-06 03:36:03 UTC (rev 6526)
@@ -105,21 +105,17 @@
is( $it->count, 7, 'COUNT of GROUP_BY ok' );
- SKIP: {
- skip 'quoting bug with NoBindVars', 4*2
- if $storage_type eq 'DBI::Sybase::NoBindVars';
-
# Test DateTime inflation with DATETIME
- my @dt_types = (
- ['DATETIME', '2004-08-21T14:36:48.080Z'],
- ['SMALLDATETIME', '2004-08-21T14:36:00.000Z'], # minute precision
- );
-
- for my $dt_type (@dt_types) {
- my ($type, $sample_dt) = @$dt_type;
+ my @dt_types = (
+ ['DATETIME', '2004-08-21T14:36:48.080Z'],
+ ['SMALLDATETIME', '2004-08-21T14:36:00.000Z'], # minute precision
+ );
+
+ for my $dt_type (@dt_types) {
+ my ($type, $sample_dt) = @$dt_type;
- eval { $schema->storage->dbh->do("DROP TABLE track") };
- $schema->storage->dbh->do(<<"SQL");
+ eval { $schema->storage->dbh->do("DROP TABLE track") };
+ $schema->storage->dbh->do(<<"SQL");
CREATE TABLE track (
trackid INT IDENTITY PRIMARY KEY,
cd INT,
@@ -127,20 +123,19 @@
last_updated_on $type,
)
SQL
- ok(my $dt = DBIx::Class::Storage::DBI::Sybase::DateTime
- ->parse_datetime($sample_dt));
+ ok(my $dt = DBIx::Class::Storage::DBI::Sybase::DateTime
+ ->parse_datetime($sample_dt));
- my $row;
- ok( $row = $schema->resultset('Track')->create({
- last_updated_on => $dt,
- cd => 1,
- }));
- ok( $row = $schema->resultset('Track')
- ->search({ trackid => $row->trackid }, { select => ['last_updated_on'] })
- ->first
- );
- is( $row->updated_date, $dt, 'DateTime inflation works' );
- }
+ my $row;
+ ok( $row = $schema->resultset('Track')->create({
+ last_updated_on => $dt,
+ cd => 1,
+ }));
+ ok( $row = $schema->resultset('Track')
+ ->search({ trackid => $row->trackid }, { select => ['last_updated_on'] })
+ ->first
+ );
+ is( $row->updated_date, $dt, 'DateTime inflation works' );
}
}
More information about the Bast-commits
mailing list