Skip to content
Snippets Groups Projects
Commit c610aae7 authored by Kieron Taylor's avatar Kieron Taylor :angry:
Browse files

Extended support for different SQL backends through specific return values....

Extended support for different SQL backends through specific return values. See Michael Gray's efforts.
parent 2a1034ef
No related branches found
No related tags found
No related merge requests found
...@@ -708,13 +708,14 @@ issued i.e. ...@@ -708,13 +708,14 @@ issued i.e.
$helper->execute_update( $helper->execute_update(
-SQL => 'insert into tab (name) values(?)', -SQL => 'insert into tab (name) values(?)',
-CALLBACK => sub { -CALLBACK => sub {
my ( $sth, $dbh ) = @_; my ( $sth, $dbh, $rv ) = @_;
$obj->{id} = $dbh->{mysql_insertid}; $obj->{id} = $dbh->{mysql_insertid};
}, },
-PARAMS => [ $obj->name() ] ); -PARAMS => [ $obj->name() ] );
This lets us access the statement handle & database handle to access other This lets us access the statement handle, the database handle and
properties such as the last identifier inserted. the return value from $sth->execute, to access other properties such as
the last identifier inserted.
=cut =cut
...@@ -729,7 +730,7 @@ sub execute_update { ...@@ -729,7 +730,7 @@ sub execute_update {
$sth = $self->db_connection()->prepare($sql, @prepare_params); $sth = $self->db_connection()->prepare($sql, @prepare_params);
$self->_bind_params($sth, $params); $self->_bind_params($sth, $params);
$rv = $sth->execute(); $rv = $sth->execute();
$callback->($sth, $self->db_connection()->db_handle()) if $callback; $callback->($sth, $self->db_connection()->db_handle(), $rv) if $callback;
}; };
my $error = $@; my $error = $@;
$self->_finish_sth($sth); $self->_finish_sth($sth);
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment