Skip to content

Commit

Permalink
Add test and bind handler for IntStr argument
Browse files Browse the repository at this point in the history
Per Issue: #2
  • Loading branch information
CurtTilmes committed Feb 12, 2019
1 parent 7f186a5 commit 753bdf0
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/DB/SQLite/Native.pm6
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,11 @@ class DB::SQLite::Native::Statement is repr('CPointer')
$.bind-int64($n,$v) == SQLITE_OK or $.check
}

multi method bind(Int $n, IntStr:D $v --> Nil)
{
$.bind-int64($n,$v) == SQLITE_OK or $.check
}

multi method bind(Int $n, Any:U --> Nil)
{
$.bind-null($n) == SQLITE_OK or $.check
Expand Down
19 changes: 19 additions & 0 deletions t/08-intstr.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
use Test;
use Test::When <extended>;

use DB::SQLite;

plan 4;

isa-ok my $db = DB::SQLite.new, DB::SQLite, 'Create object';

my IntStr $foo = <42>;

is $db.query('select 1 where ? = ?', $foo, $foo).value, 1,
'Pass in IntStr value';

lives-ok { $db.finish }, 'Finish object';

is DB::SQLite::Native.memory-used, 0, 'All handles deleted';

done-testing;

0 comments on commit 753bdf0

Please sign in to comment.