Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #2 from jkramer/master

Method that returns a statement handle.
  • Loading branch information...
commit 4240de23e583aca8838cd7aec1acac38fa11dd43 2 parents 91cd318 + 647edd2
@matiu authored
Showing with 15 additions and 1 deletion.
  1. +13 −0 lib/SQL/Bibliosoph.pm
  2. +2 −1  t/biblio.t
View
13 lib/SQL/Bibliosoph.pm
@@ -308,6 +308,14 @@ package SQL::Bibliosoph; {
return $ret || [];
};
+ # Get statement handle instead of results.
+ $name_row = $name . '_sth';
+ *$name_row = sub {
+ my ($that) = shift;
+ $self->d('sth ', $name, @_);
+ return $self->queries()->{$name}->select_do([@_]);
+ };
+
last SW;
};
@@ -562,6 +570,11 @@ SQL::Bibliosoph - A SQL Statements Library
my $products_array_of_hash_ref
= $bs->h_get_products($country,$price,$start,$limit);
+
+ # To get a prepared and executed statement handle, append '_sth':
+ my $sth = $bs->get_products_sth($country, $price, $start, $limit);
+
+
# Selecting only one row (add row_ at the begining)
# Query:
View
3  t/biblio.t
@@ -45,6 +45,7 @@ is(ref($q),'ARRAY','Simple query 3');
$q = $bb->rowh_USERS3();
is(ref($q),'HASH','Simple query 3');
-
+$q = $bb->USERS3_sth();
+is(ref($q), 'DBI::st', 'Simple query 3 STH');
done_testing();
Please sign in to comment.
Something went wrong with that request. Please try again.