DBIO-Sybase

 view release on metacpan or  search on metacpan

lib/DBIO/Sybase/Storage/ASE.pm  view on Meta::CPAN

  my $self = shift;
  my $dbh = $self->_get_dbh;

  if ($dbh->can('syb_date_fmt')) {
    # amazingly, this works with FreeTDS
    $dbh->syb_date_fmt('ISO_strict');
  }
  else {
    carp_once
      'Your DBD::Sybase is too old to support '
     .'DBIO::InflateColumn::DateTime, please upgrade!';

    $dbh->do('SET DATEFORMAT mdy');
  }
}


package DBIO::Sybase::Storage::ASE::DateTime::Format;

use base 'DBIO::Storage::DateTimeFormat';

# No preferred_format_class: DateTime::Format::Sybase expects mdy in both
# directions, but connect_call_datetime_setup configures ISO_strict output.
__PACKAGE__->datetime_parse_pattern('%Y-%m-%dT%H:%M:%S.%3NZ');
__PACKAGE__->datetime_format_pattern('%m/%d/%Y %H:%M:%S.%3N');

1;

__END__

=pod

=encoding UTF-8

=head1 NAME

DBIO::Sybase::Storage::ASE - Sybase ASE SQL Server support for DBIO

=head1 VERSION

version 0.900000

=head1 SYNOPSIS

    # Recommended connect_info settings for Sybase ASE:
    on_connect_call => [['datetime_setup'], ['blob_setup', log_on_update => 0]]

=head1 DESCRIPTION

Storage driver for Sybase ASE (Adaptive Server Enterprise) databases via
L<DBD::Sybase>.

If your Sybase version does not support placeholders, the storage is reblessed
to C<DBIO::Sybase::Storage::ASE::NoBindVars> automatically. FreeTDS connections
are supported but TEXT/IMAGE columns will not work; use the native Sybase
OpenClient libraries for full functionality.

Autoincrement retrieval is done via C<SELECT MAX(col)> inside a locked
transaction, as Sybase ASE provides no single-statement equivalent of
C<SCOPE_IDENTITY()>. TEXT/IMAGE (blob) columns require a separate write
operation on a dedicated connection and are handled transparently.

Bulk inserts use the L<DBD::Sybase> bulk API when available.

=head1 METHODS

=head2 connect_call_blob_setup

Used as:

  on_connect_call => [ [ 'blob_setup', log_on_update => 0 ] ]

Does C<< $dbh->{syb_binary_images} = 1; >> to return C<IMAGE> data as raw binary
instead of as a hex string.

Recommended.

Also sets the C<log_on_update> value for blob write operations. The default is
C<1>, but C<0> is better if your database is configured for it.

See
L<DBD::Sybase/Handling IMAGE/TEXT data with syb_ct_get_data()/syb_ct_send_data()>.

=head2 connect_call_datetime_setup

Used as:

  on_connect_call => 'datetime_setup'

In L<connect_info|DBIO::Storage::DBI/connect_info> to set:

  $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

This works for both C<DATETIME> and C<SMALLDATETIME> columns, note that
C<SMALLDATETIME> columns only have minute precision.

=head1 SEE ALSO

=over

=item * L<DBIO::Sybase> - Sybase schema component

=item * L<DBIO::Sybase::Storage> - Sybase storage dispatcher

=item * L<DBIO::Sybase::Storage::FreeTDS> - FreeTDS connection layer

=item * L<DBIO::Storage::DBI> - Base DBI storage class

=back

=head1 AUTHOR

DBIO & DBIx::Class Authors

=head1 COPYRIGHT AND LICENSE

Copyright (C) 2026 DBIO Authors
Portions Copyright (C) 2005-2025 DBIx::Class Authors
Based on DBIx::Class, heavily modified.



( run in 2.337 seconds using v1.01-cache-2.11-cpan-7fcb06a456a )