return @{$_[2]};
}
-
-
-
sub source_bind_attributes {
my ($self, $source) = @_;
sub sqlt_type { shift->_get_dbh->{Driver}->{Name} }
+
+# 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 bind_attribute_by_data_type
Given a datatype from column info, returns a database specific bind
To turn off this warning set the DBIC_SYBASE_FREETDS_NOWARN environment
variable.
EOF
- if (not $self->placeholders_with_type_conversion_supported) {
- if ($self->placeholders_supported) {
+ if (not $self->_typeless_placeholders_supported) {
+ if ($self->_placeholders_supported) {
$self->auto_cast(1);
} else {
$self->ensure_class_loaded($no_bind_vars);
return $@ ? 0 : 1;
}
-=head2 placeholders_supported
-
-Whether or not string placeholders work. Does not check for implicit conversion
-errors, see L</placeholders_with_type_conversion_supported>.
-
-=cut
-
-sub placeholders_supported {
- my $self = shift;
- my $dbh = $self->_get_dbh;
-
- return eval {
-# There's also $dbh->{syb_dynamic_supported} but it can be inaccurate for this
-# purpose.
- local $dbh->{PrintError} = 0;
- local $dbh->{RaiseError} = 1;
- $dbh->selectrow_array('select ?', {}, 1);
- };
-}
-
-=head2 placeholders_with_type_conversion_supported
-
-Checks if placeholders bound to non-string types throw implicit type conversion
-errors or not.
-
-See L<DBIx::Class::Storage::DBI::Sybase/connect_call_set_auto_cast>.
-
-=cut
-
-sub placeholders_with_type_conversion_supported {
- my $self = shift;
- my $dbh = $self->_dbh;
-
- return eval {
- local $dbh->{PrintError} = 0;
- local $dbh->{RaiseError} = 1;
-# this specifically tests a bind that is NOT a string
- $dbh->selectrow_array('select 1 where 1 = ?', {}, 1);
- };
-}
-
sub _set_max_connect {
my $self = shift;
my $val = shift || 256;