1
- use std:: ffi:: CString ;
1
+ use std:: ffi:: { CStr , CString } ;
2
2
use std:: fmt:: { self , Debug } ;
3
3
use std:: os:: raw:: { c_int, c_void} ;
4
4
use std:: ptr;
@@ -45,9 +45,8 @@ fn bind_int(
45
45
fn bind_id (
46
46
stmt : * mut ffi:: sqlite3_stmt ,
47
47
col_idx : c_int ,
48
- id : & Eid ,
48
+ id_str : & CStr ,
49
49
) -> Result < ( ) > {
50
- let id_str = CString :: new ( id. to_string ( ) ) . unwrap ( ) ;
51
50
let result = unsafe {
52
51
ffi:: sqlite3_bind_text (
53
52
stmt,
@@ -360,7 +359,8 @@ impl Storable for SqliteStorage {
360
359
reset_stmt ( stmt) ?;
361
360
362
361
// bind parameters and run sql
363
- bind_id ( stmt, 1 , id) ?;
362
+ let id_str = CString :: new ( id. to_string ( ) ) . unwrap ( ) ;
363
+ bind_id ( stmt, 1 , & id_str) ?;
364
364
run_select_blob ( stmt)
365
365
}
366
366
@@ -369,7 +369,8 @@ impl Storable for SqliteStorage {
369
369
reset_stmt ( stmt) ?;
370
370
371
371
// bind parameters and run sql
372
- bind_id ( stmt, 1 , id) ?;
372
+ let id_str = CString :: new ( id. to_string ( ) ) . unwrap ( ) ;
373
+ bind_id ( stmt, 1 , & id_str) ?;
373
374
bind_blob ( stmt, 2 , wal) ?;
374
375
run_dml ( stmt)
375
376
}
@@ -379,7 +380,8 @@ impl Storable for SqliteStorage {
379
380
reset_stmt ( stmt) ?;
380
381
381
382
// bind parameters and run sql
382
- bind_id ( stmt, 1 , id) ?;
383
+ let id_str = CString :: new ( id. to_string ( ) ) . unwrap ( ) ;
384
+ bind_id ( stmt, 1 , & id_str) ?;
383
385
run_dml ( stmt)
384
386
}
385
387
@@ -388,7 +390,8 @@ impl Storable for SqliteStorage {
388
390
reset_stmt ( stmt) ?;
389
391
390
392
// bind parameters and run sql
391
- bind_id ( stmt, 1 , id) ?;
393
+ let id_str = CString :: new ( id. to_string ( ) ) . unwrap ( ) ;
394
+ bind_id ( stmt, 1 , & id_str) ?;
392
395
run_select_blob ( stmt)
393
396
}
394
397
@@ -397,7 +400,8 @@ impl Storable for SqliteStorage {
397
400
reset_stmt ( stmt) ?;
398
401
399
402
// bind parameters and run sql
400
- bind_id ( stmt, 1 , id) ?;
403
+ let id_str = CString :: new ( id. to_string ( ) ) . unwrap ( ) ;
404
+ bind_id ( stmt, 1 , & id_str) ?;
401
405
bind_blob ( stmt, 2 , addr) ?;
402
406
run_dml ( stmt)
403
407
}
@@ -407,7 +411,8 @@ impl Storable for SqliteStorage {
407
411
reset_stmt ( stmt) ?;
408
412
409
413
// bind parameters and run sql
410
- bind_id ( stmt, 1 , id) ?;
414
+ let id_str = CString :: new ( id. to_string ( ) ) . unwrap ( ) ;
415
+ bind_id ( stmt, 1 , & id_str) ?;
411
416
run_dml ( stmt)
412
417
}
413
418
0 commit comments