Skip to content

Commit

Permalink
Support for .execute method at Connection level
Browse files Browse the repository at this point in the history
Prepared statements can be expensive or unavailable for some
drivers, so Connection.do can skip 'prepare' when no @params given
and the driver support direct execution implementing the .execute
method in its Connection class.
MySQL in particular can't prepare some kinds of statements.
  • Loading branch information
salortiz committed Mar 24, 2016
1 parent dddfba3 commit eb3dc55
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/DBDish/Connection.pm6
Expand Up @@ -45,7 +45,9 @@ method new(*%args) {
method prepare(Str $statement, *%args) { ... }

method do(Str $statement, *@params, *%args) {
with self.prepare($statement) {
if !@params && self.can('execute') {
self.execute($statement, |%args);
} orwith self.prepare($statement, |%args) {
LEAVE { .finish }
.execute(@params, |%args);
}
Expand Down

0 comments on commit eb3dc55

Please sign in to comment.