X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FStorage%2FDBI%2FSybase.pm;h=d92a60e2e8ad11b3cb1d98f84350d595c9d14a91;hb=9041a97a57cd2831d20e3b25772b29f9af3d8ef9;hp=a46163bdd1a5cb52eed464eaf855b5c3154a565c;hpb=9539eeb15c1a77b6385a659579666114786e1a72;p=dbsrgits%2FDBIx-Class.git diff --git a/lib/DBIx/Class/Storage/DBI/Sybase.pm b/lib/DBIx/Class/Storage/DBI/Sybase.pm index a46163b..d92a60e 100644 --- a/lib/DBIx/Class/Storage/DBI/Sybase.pm +++ b/lib/DBIx/Class/Storage/DBI/Sybase.pm @@ -30,6 +30,7 @@ sub _rebless { $self->_rebless; } $self->connect_call_datetime_setup; + $self->connect_call_blob_setup; } } } @@ -38,11 +39,28 @@ sub _populate_dbh { my $self = shift; $self->next::method(@_); $self->connect_call_datetime_setup; + $self->connect_call_blob_setup; 1; } -{ - my $old_dbd_warned = 0; +=head2 connect_call_blob_setup + +Used as: + + on_connect_call => 'blob_setup' + +Does C<< $dbh->{syb_binary_images} = 1; >> to return C data as raw binary +instead of as a hex string. + +Recommended. + +=cut + +sub connect_call_blob_setup { + my $self = shift; + my $dbh = $self->_dbh; + $dbh->{syb_binary_images} = 1; +} =head2 connect_call_datetime_setup @@ -52,14 +70,20 @@ Used as: In L to set: - $dbh->syb_date_fmt('ISO_strict'); - $dbh->do('set dateformat mdy'); + $dbh->syb_date_fmt('ISO_strict'); # output fmt: 2004-08-21T14:36:48.080Z + $dbh->do('set dateformat mdy'); # input fmt: 08/13/1979 18:08:55.080 On connection for use with L, using -L. +L, which you will need to install. + +This works for both C and C columns, although +C columns only have minute precision. =cut +{ + my $old_dbd_warned = 0; + sub connect_call_datetime_setup { my $self = shift; my $dbh = $self->_dbh; @@ -78,6 +102,8 @@ L. } } +sub datetime_parser_type { "DateTime::Format::Sybase" } + sub _dbh_last_insert_id { my ($self, $dbh, $source, $col) = @_; @@ -86,6 +112,15 @@ sub _dbh_last_insert_id { return ($dbh->selectrow_array($sth))[0]; } +=head2 count + +Counts for limited queries are emulated by executing select queries and +returning the number of successful executions minus the offset. + +This is necessary due to the limitations of Sybase. + +=cut + sub count { my $self = shift; my ($source, $attrs) = @_; @@ -115,8 +150,6 @@ sub count { return $count - $offset; } -sub datetime_parser_type { "DateTime::Format::Sybase" } - 1; =head1 NAME @@ -140,17 +173,22 @@ without doing a C