Permalink
Browse files

[t] test that quoted question marks are OK

also fix Pgs method do
  • Loading branch information...
1 parent 2a0dfe4 commit 77f88572b70ce5d187bc6c4fb4148cb3978a20db @moritz moritz committed May 5, 2012
Showing with 14 additions and 2 deletions.
  1. +1 −1 lib/DBDish/Pg.pm6
  2. +13 −1 t/99-common.pl6
View
@@ -372,7 +372,7 @@ class DBDish::Pg::Connection does DBDish::Connection {
return $statement_handle;
}
- method do(Str $statement, $attr?, *@bind is copy) {
+ method do(Str $statement, *@bind is copy) {
my $sth = self.prepare($statement);
$sth.execute(@bind);
my $rows = $sth.rows;
View
@@ -5,7 +5,7 @@
#use Test; # "use" dies in a runtime eval
#use DBIish;
diag "Testing MiniDBD::$*mdriver";
-plan 38;
+plan 40;
sub magic_cmp(@a, @b) {
my $res = @a[0] eq @b[0]
@@ -189,6 +189,18 @@ $sth.finish;
else {
skip('dependent tests', 2);
}
+
+ $lived = 0;
+ lives_ok { $dbh.do(q[INSERT INTO nom (name, description) VALUES(?, '?"')], 'mark'); $lived = 1}, 'can use question mark in quoted strings';
+ if $lived {
+ my $sth = $dbh.prepare(q[SELECT description FROM nom WHERE name = 'mark']);
+ $sth.execute;
+ is $sth.fetchrow.join, '?"', 'correctly retrieved question mark';
+ $sth.finish;
+ }
+ else {
+ skip('dependent test', 1);
+ }
}

0 comments on commit 77f8857

Please sign in to comment.