[Bast-commits] r6517 - in DBIx-Class/0.08/branches/sybase/lib/DBIx/Class: ResultSource Storage/DBI Storage/DBI/Sybase

caelum at dev.catalyst.perl.org caelum at dev.catalyst.perl.org
Fri Jun 5 04:34:25 GMT 2009


Author: caelum
Date: 2009-06-05 04:34:25 +0000 (Fri, 05 Jun 2009)
New Revision: 6517

Modified:
   DBIx-Class/0.08/branches/sybase/lib/DBIx/Class/ResultSource/Table.pm
   DBIx-Class/0.08/branches/sybase/lib/DBIx/Class/Storage/DBI/NoBindVars.pm
   DBIx-Class/0.08/branches/sybase/lib/DBIx/Class/Storage/DBI/Sybase/NoBindVars.pm
Log:
shit doesn't work yet

Modified: DBIx-Class/0.08/branches/sybase/lib/DBIx/Class/ResultSource/Table.pm
===================================================================
--- DBIx-Class/0.08/branches/sybase/lib/DBIx/Class/ResultSource/Table.pm	2009-06-05 00:29:25 UTC (rev 6516)
+++ DBIx-Class/0.08/branches/sybase/lib/DBIx/Class/ResultSource/Table.pm	2009-06-05 04:34:25 UTC (rev 6517)
@@ -26,6 +26,9 @@
 
 =cut
 
+use overload
+  '""' => \&from;    
+
 sub from { shift->name; }
 
 1;

Modified: DBIx-Class/0.08/branches/sybase/lib/DBIx/Class/Storage/DBI/NoBindVars.pm
===================================================================
--- DBIx-Class/0.08/branches/sybase/lib/DBIx/Class/Storage/DBI/NoBindVars.pm	2009-06-05 00:29:25 UTC (rev 6516)
+++ DBIx-Class/0.08/branches/sybase/lib/DBIx/Class/Storage/DBI/NoBindVars.pm	2009-06-05 04:34:25 UTC (rev 6517)
@@ -4,6 +4,8 @@
 use warnings;
 
 use base 'DBIx::Class::Storage::DBI';
+use Scalar::Util ();
+use Carp::Clan qw/^DBIx::Class/;
 
 =head1 NAME 
 
@@ -39,7 +41,7 @@
 sub _prep_for_execute {
   my $self = shift;
 
-  my ($op, $extra_bind, $ident) = @_;
+  my ($op, $extra_bind, $ident, $rsrc) = @_;
 
   my ($sql, $bind) = $self->next::method(@_);
 
@@ -50,7 +52,12 @@
 
   foreach my $bound (@$bind) {
     my $col = shift @$bound;
+
     my $datatype = 'FIXME!!!';
+
+# this is what needs to happen:
+#    my $datatype = $rsrc->column_info($col)->{data_type};
+
     foreach my $data (@$bound) {
         if(ref $data) {
             $data = ''.$data;

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-05 00:29:25 UTC (rev 6516)
+++ DBIx-Class/0.08/branches/sybase/lib/DBIx/Class/Storage/DBI/Sybase/NoBindVars.pm	2009-06-05 04:34:25 UTC (rev 6517)
@@ -5,6 +5,7 @@
   DBIx::Class::Storage::DBI::NoBindVars
   DBIx::Class::Storage::DBI::Sybase
 /;
+use List::Util ();
 
 sub _dbh_last_insert_id {
   my ($self, $dbh, $source, $col) = @_;
@@ -14,11 +15,10 @@
   return ($dbh->selectrow_array('select @@identity'))[0];
 }
 
-my $noquote = {
-    int => qr/^ \-? \d+ $/x,
-    integer => qr/^ \-? \d+ $/x,
+my %noquote = (
+    int => sub { /^ -? \d+ \z/x },
     # TODO maybe need to add float/real/etc
-};
+);
 
 sub should_quote_data_type {
   my $self = shift;
@@ -26,14 +26,14 @@
 
   return $self->next::method(@_) if not defined $value;
 
-  if (my $re = $noquote->{$type}) {
-    return 0 if $value =~ $re;
+  if (my $key = List::Util::first { $type =~ /^$_/i } keys %noquote) {
+    local $_ = $value;
+    return 0 if $noquote{$key}->();
   }
 
   return $self->next::method(@_);
 }
 
-
 1;
 
 =head1 NAME




More information about the Bast-commits mailing list