Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

[SQlite] use explicit memory management for strings. arnsholt++

  • Loading branch information...
commit 9b339432405228a895c76bf1193bdba3f935b99b 1 parent a5f4ae0
Moritz Lenz moritz authored
Showing with 9 additions and 0 deletions.
  1. +9 −0 lib/DBDish/SQLite.pm6
9 lib/DBDish/SQLite.pm6
View
@@ -88,6 +88,7 @@ class DBDish::SQLite::StatementHandle does DBDish::StatementHandle {
has $!statement_handle;
has $.dbh;
has Int $!row_status;
+ has @!mem_rows;
method !handle-error($status) {
return if $status == SQLITE_OK;
@@ -106,13 +107,21 @@ class DBDish::SQLite::StatementHandle does DBDish::StatementHandle {
CArray[OpaquePointer]
);
$!statement_handle = @stmt[0];
+ note "prepare: $!statement_handle.WHICH() text: $!statement";
self!handle-error($status);
}
method execute(*@params) {
sqlite3_reset($!statement_handle) if $!statement_handle.defined;
+ @!mem_rows = ();
+ my @strings;
for @params.kv -> $idx, $v {
+ if $v ~~ Str {
+ explicitly-manage($v);
+ @!mem_rows.push: $v;
+ }
self!handle-error(sqlite3_bind($!statement_handle, $idx + 1, $v));
+ push @strings, $v;
}
$!row_status = sqlite3_step($!statement_handle);
self.rows;
Please sign in to comment.
Something went wrong with that request. Please try again.