## scalar refs, or at least, all the same type as the first set, the statement is
## only prepped once.
sub insert_bulk {
- my ($self, $source, $cols, $data, $sth_attr) = @_;
+ my ($self, $source, $cols, $data) = @_;
# redispatch to insert_bulk method of storage we reblessed into, if necessary
if (not $self->_driver_determined) {
}
$self->_query_start( $sql, @bind );
- my $sth = $self->sth($sql, 'insert', $sth_attr);
+ my $sth = $self->sth($sql);
my $rv = do {
if ($empty_bind) {
return @pcols ? \@pcols : [ 1 ];
}
-=head2 order_select_columns
-
-=over 4
-
-=item Arguments: $source, \@columns
-
-=back
-
-Returns an ordered list of column names to be used in a SELECT statement. By
-default simply returns the list that was 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.
-
-=cut
-
-sub order_select_columns {
- #my ($self, $source, $columns) = @_;
- return @{$_[2]};
-}
-
sub source_bind_attributes {
my ($self, $source) = @_;
=cut
sub _dbh_sth {
- my ($self, $dbh, $sql, $op, $sth_attr) = @_;
-# $op is ignored right now
-
- $sth_attr ||= {};
+ my ($self, $dbh, $sql) = @_;
# 3 is the if_active parameter which avoids active sth re-use
my $sth = $self->disable_sth_caching
- ? $dbh->prepare($sql, $sth_attr)
- : $dbh->prepare_cached($sql, $sth_attr, 3);
+ ? $dbh->prepare($sql)
+ : $dbh->prepare_cached($sql, {}, 3);
# XXX You would think RaiseError would make this impossible,
# but apparently that's not true :(
}
sub sth {
- my ($self, $sql, $op, $sth_attr) = @_;
- $self->dbh_do('_dbh_sth', $sql, $op, $sth_attr); # retry over disconnects
+ my ($self, $sql) = @_;
+ $self->dbh_do('_dbh_sth', $sql); # retry over disconnects
}
sub _dbh_columns_info_for {
use lib qw(t/lib);
use DBICTest;
-plan tests => 23;
+plan tests => 24;
my $schema = DBICTest->init_schema();
is($link7->url, undef, 'Link 7 url');
is($link7->title, 'gtitle', 'Link 7 title');
+# test _execute_array_empty (insert_bulk with all literal sql)
+my $rs = $schema->resultset('Artist');
+$rs->delete;
+$rs->populate([
+ (+{
+ name => \"'DT'",
+ rank => \500,
+ charfield => \"'mtfnpy'",
+ }) x 5
+]);
+
+is((grep {
+ $_->name eq 'DT' &&
+ $_->rank == 500 &&
+ $_->charfield eq 'mtfnpy'
+} $rs->all), 5, 'populate with all literal SQL');