foreach my $bound (@$bind) {
my $col = shift @$bound;
- my $name_sep = $self->_sql_maker_opts->{name_sep} || '.';
+ my $name_sep = $self->_sql_maker_opts->{name_sep} || '.';
+ my $quote_char = $self->_sql_maker_opts->{quote_char} || '';
+ $quote_char = join '', @$quote_char if ref $quote_char eq 'ARRAY';
+ $col =~ s/[\Q${quote_char}\E]//g if $quote_char;
$col =~ s/^([^\Q${name_sep}\E]*)\Q${name_sep}\E//;
my $alias = $1 || 'me';
my $datatype = $rsrc && $rsrc->column_info($col)->{data_type};
foreach my $data (@$bound) {
- if(ref $data) {
- $data = ''.$data;
- }
- $data = $self->_dbh->quote($data) if $self->should_quote_data_type($datatype, $data);
+ $data = ''.$data if ref $data;
+
+ $data = $self->_dbh->quote($data) if $self->should_quote($datatype, $data);
+
$new_sql .= shift(@sql_part) . $data;
}
}
return ($new_sql, []);
}
-=head2 should_quote_data_type
+=head2 should_quote
This method is called by L</_prep_for_execute> for every column in
order to determine if its value should be quoted or not. The arguments
=cut
-sub should_quote_data_type { 1 }
+sub should_quote { 1 }
=head1 AUTHORS
Does C<< $dbh->{syb_binary_images} = 1; >> to return C<IMAGE> data as raw binary
instead of as a hex string.
+Recommended.
+
=cut
sub connect_call_blob_setup {
}
}
+sub datetime_parser_type { "DateTime::Format::Sybase" }
+
sub _dbh_last_insert_id {
my ($self, $dbh, $source, $col) = @_;
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) = @_;
return $count - $offset;
}
-sub datetime_parser_type { "DateTime::Format::Sybase" }
-
1;
=head1 NAME
But your queries will be cached.
+A recommended L<DBIx::Class::Storage::DBI/connect_info> setting:
+
+ on_connect_call => [qw/datetime_setup blob_setup/]
+
=head1 DATES
See L</connect_call_datetime_setup> to setup date formats
for L<DBIx::Class::InflateColumn::DateTime>.
-=head1 IMAGE COLUMNS
+=head1 IMAGE AND TEXT COLUMNS
See L</connect_call_blob_setup> for a L<DBIx::Class::Storage::DBI/connect_info>
setting you need to work with C<IMAGE> columns.
+Due to limitations in L<DBD::Sybase> and this driver, it is only possible to
+select one C<TEXT> or C<IMAGE> column at a time, and it must be at the end of
+your C<select> list (one way to insure that is to define the column last in your
+C<Result> class.)
+
=head1 AUTHORS
See L<DBIx::Class/CONTRIBUTORS>.
numeric => $decimal,
);
-sub should_quote_data_type {
+sub should_quote {
my $self = shift;
my ($type, $value) = @_;
is( $row->updated_date, $dt, 'DateTime inflation works' );
}
-# stole the blob stuff Nniuq wrote for 73oracle.t
+# mostly stole the blob stuff Nniuq wrote for t/73oracle.t
my $dbh = $schema->storage->dbh;
{
local $SIG{__WARN__} = sub {};
my $id = 0;
TODO: {
- local $TODO = 'text/image columns don\'t work yet';
+ local $TODO = 'TEXT/IMAGE columns don\'t work yet';
- foreach my $type (qw(clob blob)) {
+ foreach my $type (qw(blob clob)) {
foreach my $size (qw(small large)) {
no warnings 'uninitialized';
$id++;
- lives_ok { $rs->create( { 'id' => $id, $type => $binstr{$size} } ) }
- "inserted $size $type without dying";
- ok(eval { $rs->find($id)->$type } eq $binstr{$size},
- "verified inserted $size $type" );
+ eval { $rs->create( { 'id' => $id, $type => $binstr{$size} } ) };
+ ok(!$@, "inserted $size $type without dying");
+ ok(eval {
+ $rs->search({ id=> $id }, { select => [$type] })->single->$type
+ } eq $binstr{$size}, "verified inserted $size $type" );
}
}
}