use Scalar::Util();
use List::Util();
+# what version of sqlt do we require if deploy() without a ddl_dir is invoked
+# when changing also adjust the corresponding author_require in Makefile.PL
+my $minimum_sqlt_version = '0.11002';
+
+
__PACKAGE__->mk_group_accessors('simple' =>
qw/_connect_info _dbi_connect_info _dbh _sql_maker _sql_maker_opts _conn_pid
_conn_tid transaction_depth _dbh_autocommit _driver_determined savepoints/
$weak_self->throw_exception("DBI Exception: $_[0]");
}
else {
+ # the handler may be invoked by something totally out of
+ # the scope of DBIC
croak ("DBI Exception: $_[0]");
}
};
my %colvalues;
my $table = $source->from;
@colvalues{@$cols} = (0..$#$cols);
-
- my ($sql, $bind) = $self->_prep_for_execute (
- 'insert', undef, $source, [\%colvalues]
- );
- my @bind = @$bind
- or croak 'Cannot insert_bulk without support for placeholders';
+ my ($sql, @bind) = $self->sql_maker->insert($table, \%colvalues);
$self->_query_start( $sql, @bind );
my $sth = $self->sth($sql);
$placeholder_index++;
}
my $rv = eval { $sth->execute_array({ArrayTupleStatus => $tuple_status}) };
- $sth->finish;
if (my $err = $@) {
my $i = 0;
++$i while $i <= $#$tuple_status && !ref $tuple_status->[$i];
return @pcols ? \@pcols : [ 1 ];
}
-#
-# Returns an ordered list of column names before they are used
-# in a SELECT statement. By default simply returns the list
-# passed in.
-#
-# This may be overridden in a specific storage when there are
-# requirements such as moving BLOB columns to the end of the
-# SELECT list.
-sub _order_select_columns {
- #my ($self, $source, $columns) = @_;
- return @{$_[2]};
-}
sub source_bind_attributes {
my ($self, $source) = @_;
return;
}
+# SQLT version handling
+{
+ my $_sqlt_version_ok; # private
+ my $_sqlt_version_error; # private
+
+ sub _sqlt_version_ok {
+ if (!defined $_sqlt_version_ok) {
+ eval "use SQL::Translator $minimum_sqlt_version";
+ if ($@) {
+ $_sqlt_version_ok = 0;
+ $_sqlt_version_error = $@;
+ }
+ else {
+ $_sqlt_version_ok = 1;
+ }
+ }
+ return $_sqlt_version_ok;
+ }
+
+ sub _sqlt_version_error {
+ shift->_sqlt_version_ok unless defined $_sqlt_version_ok;
+ return $_sqlt_version_error;
+ }
+
+ sub _sqlt_minimum_version { $minimum_sqlt_version };
+}
+
sub DESTROY {
my $self = shift;