From: Rafael Kitover Date: Sat, 29 Aug 2009 06:50:56 +0000 (+0000) Subject: Merge 'trunk' into 'sybase' X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=9c1a4b61a3fe975792eb6bceb57a0c456c03cfaf;p=dbsrgits%2FDBIx-Class-Historic.git Merge 'trunk' into 'sybase' r7370@hlagh (orig r7369): caelum | 2009-08-24 06:32:57 -0400 bump CAG dep r7389@hlagh (orig r7388): ribasushi | 2009-08-25 07:43:38 -0400 typo r7390@hlagh (orig r7389): ribasushi | 2009-08-25 08:29:37 -0400 r7354@Thesaurus (orig r7351): abraxxa | 2009-08-20 17:46:06 +0200 new branch grouped_has_many_join r7382@Thesaurus (orig r7379): ribasushi | 2009-08-24 22:50:13 +0200 Seems like abraxxa's bug is fixed r7385@Thesaurus (orig r7382): ribasushi | 2009-08-25 11:33:40 +0200 One more test r7394@hlagh (orig r7393): ribasushi | 2009-08-26 12:07:51 -0400 Stop testing deprecated json::syck r7395@hlagh (orig r7394): ribasushi | 2009-08-26 12:08:24 -0400 Make sure sqlt_type gets called after determining driver r7396@hlagh (orig r7395): ribasushi | 2009-08-26 12:21:53 -0400 Make POD::Coverage happy... again r7397@hlagh (orig r7396): ribasushi | 2009-08-26 12:31:54 -0400 Clarify r7398@hlagh (orig r7397): frew | 2009-08-26 16:24:19 -0400 Remove dead, sketchtowne link r7402@hlagh (orig r7401): ribasushi | 2009-08-27 12:50:12 -0400 Changes r7404@hlagh (orig r7403): ribasushi | 2009-08-27 18:11:29 -0400 Add a test proving how dumb I am r7405@hlagh (orig r7404): ribasushi | 2009-08-28 10:34:46 -0400 Warning to spare mst explanations r18700@hlagh (orig r7419): caelum | 2009-08-29 02:34:07 -0400 r7381@hlagh (orig r7380): ribasushi | 2009-08-24 17:07:58 -0400 Branch to add autocast support as a standalone piece of code r7382@hlagh (orig r7381): ribasushi | 2009-08-25 05:06:43 -0400 Move storage tests to their own dir r7385@hlagh (orig r7384): ribasushi | 2009-08-25 06:35:19 -0400 Switch storage class loading to ensure_class_loaded r7386@hlagh (orig r7385): ribasushi | 2009-08-25 06:37:48 -0400 Change a datatype for test purposes r7387@hlagh (orig r7386): ribasushi | 2009-08-25 06:45:35 -0400 Fix two storage tests r7388@hlagh (orig r7387): ribasushi | 2009-08-25 06:45:52 -0400 Actual autocast code r18697@hlagh (orig r7416): caelum | 2009-08-29 01:42:29 -0400 rename method and add docs r18698@hlagh (orig r7417): ribasushi | 2009-08-29 02:07:18 -0400 Make sure arrays work r18699@hlagh (orig r7418): caelum | 2009-08-29 02:11:14 -0400 rename _map_data_type to _native_data_type --- 9c1a4b61a3fe975792eb6bceb57a0c456c03cfaf diff --cc Changes index e47fc10,ce62fa2..18b153f --- a/Changes +++ b/Changes @@@ -1,12 -1,11 +1,20 @@@ Revision history for DBIx::Class + - Complete Sybase RDBMS support including: + - Support for TEXT/IMAGE columns + - Support for the 'money' datatype + - Transaction savepoints support - - Support for bind variables when connecting via Sybase OpenClient ++ - Support for bind variables when connecting to a newer Sybase with ++ OpenClient libraries ++ - Support for bind variables over FreeTDS with CASTs when needed + - Support for interpolated variables with proper quoting when - connecting via FreeTDS ++ connecting to an older Sybase or via FreeTDS + - Fixed a complex prefetch + regular join regression introduced + in 0.08108 + - SQLT related fixes: + - sqlt_type is now called on the correct storage object + - hooks can now see the correct producer_type + - POD improvements 0.08109 2009-08-18 08:35:00 (UTC) - Replication updates: diff --cc lib/DBIx/Class/Storage/DBI.pm index 0d8a855,b92546c..1c1ddfe --- a/lib/DBIx/Class/Storage/DBI.pm +++ b/lib/DBIx/Class/Storage/DBI.pm @@@ -2065,45 -2078,53 +2110,83 @@@ sub last_insert_id $self->dbh_do('_dbh_last_insert_id', @_); } - =head2 sqlt_type + =head2 _native_data_type - Returns the database driver name. + =over 4 - =cut + =item Arguments: $type_name + + =back + + This API is B, will almost definitely change in the future, and + currently only used by L<::AutoCast|DBIx::Class::Storage::DBI::AutoCast> and + L<::Sybase|DBIx::Class::Storage::DBI::Sybase>. + + The default implementation returns C, implement in your Storage driver if + you need this functionality. - sub sqlt_type { shift->_get_dbh->{Driver}->{Name} } + Should map types from other databases to the native RDBMS type, for example + C to C. + Types with modifiers should map to the underlying data type. For example, + C should become C. + + Composite types should map to the container type, for example + C becomes C. + + =cut + + sub _native_data_type { + #my ($self, $data_type) = @_; + return undef + } +# Check if placeholders are supported at all +sub _placeholders_supported { + my $self = shift; + my $dbh = $self->_get_dbh; + + # some drivers provide a $dbh attribute (e.g. Sybase and $dbh->{syb_dynamic_supported}) + # but it is inaccurate more often than not + eval { + local $dbh->{PrintError} = 0; + local $dbh->{RaiseError} = 1; + $dbh->do('select ?', {}, 1); + }; + return $@ ? 0 : 1; +} + +# Check if placeholders bound to non-string types throw exceptions +# +sub _typeless_placeholders_supported { + my $self = shift; + my $dbh = $self->_get_dbh; + + eval { + local $dbh->{PrintError} = 0; + local $dbh->{RaiseError} = 1; + # this specifically tests a bind that is NOT a string + $dbh->do('select 1 where 1 = ?', {}, 1); + }; + return $@ ? 0 : 1; +} + + =head2 sqlt_type + + Returns the database driver name. + + =cut + + sub sqlt_type { + my ($self) = @_; + + if (not $self->_driver_determined) { + $self->_determine_driver; + goto $self->can ('sqlt_type'); + } + + $self->_get_dbh->{Driver}->{Name}; + } =head2 bind_attribute_by_data_type diff --cc t/lib/sqlite.sql index ac09dbb,a160193..888ccd0 --- a/t/lib/sqlite.sql +++ b/t/lib/sqlite.sql @@@ -1,4 -1,6 +1,4 @@@ - -- Created on Thu Aug 20 07:47:13 2009 --- --- Created by SQL::Translator::Producer::SQLite + -- Created on Tue Aug 25 12:34:34 2009 --