| 1 | =head1 NAME | ||
| 2 | |||
| 3 | DBIx::SQLEngine::Driver::Sybase::MSSQL - Support Microsoft SQL via DBD::Sybase | ||
| 4 | |||
| 5 | =head1 SYNOPSIS | ||
| 6 | |||
| 7 | B<DBI Wrapper>: Adds methods to a DBI database handle. | ||
| 8 | |||
| 9 | my $sqldb = DBIx::SQLEngine->new( 'dbi:Sybase:server=MyServer' ); | ||
| 10 | |||
| 11 | B<Portability Subclasses:> Uses driver's idioms or emulation. | ||
| 12 | |||
| 13 | $sqldb->select_dbms_flavor('MSSQL'); | ||
| 14 | |||
| 15 | $hash_ary = $sqldb->fetch_select( | ||
| 16 | table => 'students' | ||
| 17 | limit => 5, offset => 10 | ||
| 18 | ); | ||
| 19 | |||
| 20 | =head1 DESCRIPTION | ||
| 21 | |||
| 22 | This package provides a subclass of DBIx::SQLEngine::Driver::Sybase which compensates for configurations in which DBD::Sybase is being used to communicate with a Microsoft SQL Server database. | ||
| 23 | |||
| 24 | If you are connecting to a Microsoft SQL Server through ODBC, you should use the regular MSSQL driver; see L<DBIx::SQLEngine::Driver::MSSQL> | ||
| 25 | |||
| 26 | For more information, see L<DBD::Sybase/"Using DBD::Sybase with MS-SQL">. | ||
| 27 | |||
| 28 | =head2 Under Development | ||
| 29 | |||
| 30 | Note that this driver class has been added recently and not yet tested in real-world conditions. | ||
| 31 | |||
| 32 | =head2 About DBMS Flavors | ||
| 33 | |||
| 34 | This subclass of the Sybase driver must be specifically triggered, because the package is unable to automatically detect the difference between using DBD::Sybase with a Sybase server and using it with a Microsoft server. | ||
| 35 | |||
| 36 | To do this, call select_dbms_flavor after connecting: | ||
| 37 | |||
| 38 | my $sqldb = DBIx::SQLEngine->new( 'dbi:Sybase:server=MyServer' ); | ||
| 39 | |||
| 40 | $sqldb->select_dbms_flavor('MSSQL'); | ||
| 41 | |||
| 42 | For more information, see the documentation for the superclass, L<DBIx::SQLEngine::Driver::Sybase>. | ||
| 43 | |||
| 44 | =cut | ||
| 45 | |||
| 46 | ######################################################################## | ||
| 47 | |||
| 48 | package DBIx::SQLEngine::Driver::Sybase::MSSQL; | ||
| 49 | |||
| 50 | @ISA = qw( DBIx::SQLEngine::Driver::Sybase ); | ||
| 51 | |||
| 52 | use strict; | ||
| 53 | use Carp; | ||
| 54 | |||
| 55 | ######################################################################## | ||
| 56 | |||
| 57 | ######################################################################## | ||
| 58 | |||
| 59 | =head1 INTERNAL STATEMENT METHODS (DBI STH) | ||
| 60 | |||
| 61 | =head2 No Placeholders | ||
| 62 | |||
| 63 | When using DBD::Sybase to talk to a Microsoft SQL Server, "?"-style placeholders are not supported. | ||
| 64 | |||
| 65 | Uses the NoPlaceholders trait. For more information, see L<DBIx::SQLEngine::Driver::Trait::NoPlaceholders>. | ||
| 66 | |||
| 67 | =cut | ||
| 68 | |||
| 69 | use DBIx::SQLEngine::Driver::Trait::NoPlaceholders qw( :all !prepare_execute ); | ||
| 70 | |||
| 71 | ######################################################################## | ||
| 72 | |||
| 73 | ######################################################################## | ||
| 74 | |||
| 75 | =head1 INTERNAL STATEMENT METHODS (DBI STH) | ||
| 76 | |||
| 77 | =head2 Statement Handle Lifecycle | ||
| 78 | |||
| 79 | =over 4 | ||
| 80 | |||
| 81 | =item prepare_execute() | ||
| 82 | |||
| 83 | After the normal prepare_execute cycle, this also sets the sth's LongReadLen to dbms_longreadlen_bufsize(). | ||
| 84 | |||
| 85 | =item dbms_longreadlen_bufsize() | ||
| 86 | |||
| 87 | Set to 1_000_000. | ||
| 88 | |||
| 89 | =back | ||
| 90 | |||
| 91 | =cut | ||
| 92 | |||
| 93 | sub dbms_longreadlen_bufsize { 1_000_000 } | ||
| 94 | |||
| 95 | sub prepare_execute { | ||
| 96 | my $self = shift; | ||
| 97 | my $sth = $self-> | ||
| 98 | DBIx::SQLEngine::Driver::Trait::NoPlaceholders::prepare_execute( @_ ); | ||
| 99 | $sth->{LongReadLen} = $self->dbms_longreadlen_bufsize; | ||
| 100 | $sth->{LongTruncOk} = 0; | ||
| 101 | $sth; | ||
| 102 | } | ||
| 103 | |||
| 104 | ######################################################################## | ||
| 105 | |||
| 106 | =head1 SEE ALSO | ||
| 107 | |||
| 108 | See L<DBIx::SQLEngine> for the overall interface and developer documentation. | ||
| 109 | |||
| 110 | See L<DBIx::SQLEngine::Docs::ReadMe> for general information about | ||
| 111 | this distribution, including installation and license information. | ||
| 112 | |||
| 113 | =cut | ||
| 114 | |||
| 115 | ######################################################################## | ||
| 116 | |||
| 117 | 1; |