Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | save bignums as strings in sqlite3 |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
1d7eb01ce5ad95f2dddcdf70750d2a85 |
User & Date: | aldo 2017-09-11 21:17:41 |
Context
2017-09-11
| ||
21:18 | added base64 library check-in: ac71b34f1f user: aldo tags: trunk | |
21:17 | save bignums as strings in sqlite3 check-in: 1d7eb01ce5 user: aldo tags: trunk | |
21:16 | fixed escaped double quote bug in json parser check-in: 15097c3329 user: aldo tags: trunk | |
Changes
Changes to sqlite3.sls.
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
...
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
|
=> (abort-sqlite3-error 'bind! (statement-database stmt) stmt i v)])] [(or (and (fixnum? v) v) (and (boolean? v) (if v 1 0))) => (lambda (v) (cond [((foreign-procedure "sqlite3_bind_int64" (sqlite3:statement* int integer-64) int) (statement-addr stmt) (fx+ i 1) v) => (abort-sqlite3-error 'bind! (statement-database stmt) stmt i v)]))] [(real? v) (cond [((foreign-procedure "sqlite3_bind_double" (sqlite3:statement* int double) int) (statement-addr stmt) (fx+ i 1) (exact->inexact v)) => (abort-sqlite3-error 'bind! (statement-database stmt) stmt i v)])] [(string? v) (let ([f (foreign-procedure "sqlite3_bind_text" (sqlite3:statement* int u8* int void*) int)] [s (string->utf8 v)]) (cond [(f (statement-addr stmt) (fx+ i 1) s (bytevector-length s) SQLITE_TRANSIENT) => (abort-sqlite3-error 'bind! (statement-database stmt) stmt i v)]))] [(sql-null? v) (cond [((foreign-procedure "sqlite3_bind_null" (sqlite3:statement* int) int) (statement-addr stmt) (fx+ i 1)) => (abort-sqlite3-error 'bind! (statement-database stmt) stmt i)])] [else ................................................................................ [len (sqlite3-column-bytes stmt i)]) (void*->bytevector ptr len))) ;; Retrieve data from a stepped statement (define (column-data stmt i) (case (column-type stmt i) [(integer) (if (and-let* ([type (column-declared-type stmt i)]) (string-contains-ci type "bool")) (sqlite3_column_boolean (statement-addr stmt) i) (sqlite3_column_int64 (statement-addr stmt) i))] [(float) (sqlite3_column_double (statement-addr stmt) i)] [(text) (sqlite3-column-text stmt i)] [(blob) (sqlite3-column-blob stmt i)] [else |
|
|
>
|
>
|
|
|
>
|
|
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
...
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
|
=> (abort-sqlite3-error 'bind! (statement-database stmt) stmt i v)])] [(or (and (fixnum? v) v) (and (boolean? v) (if v 1 0))) => (lambda (v) (cond [((foreign-procedure "sqlite3_bind_int64" (sqlite3:statement* int integer-64) int) (statement-addr stmt) (fx+ i 1) v) => (abort-sqlite3-error 'bind! (statement-database stmt) stmt i v)]))] [(flonum? v) (cond [((foreign-procedure "sqlite3_bind_double" (sqlite3:statement* int double) int) (statement-addr stmt) (fx+ i 1) (exact->inexact v)) => (abort-sqlite3-error 'bind! (statement-database stmt) stmt i v)])] [(or (string? v) (number? v)) (let ([f (foreign-procedure "sqlite3_bind_text" (sqlite3:statement* int u8* int void*) int)] [s (if (string? v) (string->utf8 v) (number->string v))]) (cond [(f (statement-addr stmt) (fx+ i 1) s (bytevector-length s) SQLITE_TRANSIENT) => (abort-sqlite3-error 'bind! (statement-database stmt) stmt i v)]))] [(sql-null? v) (cond [((foreign-procedure "sqlite3_bind_null" (sqlite3:statement* int) int) (statement-addr stmt) (fx+ i 1)) => (abort-sqlite3-error 'bind! (statement-database stmt) stmt i)])] [else ................................................................................ [len (sqlite3-column-bytes stmt i)]) (void*->bytevector ptr len))) ;; Retrieve data from a stepped statement (define (column-data stmt i) (case (column-type stmt i) [(integer) (cond [(and-let* ([type (column-declared-type stmt i)]) (string-contains-ci type "bool")) (sqlite3_column_boolean (statement-addr stmt) i)] [else (sqlite3_column_int64 (statement-addr stmt) i)])] [(float) (sqlite3_column_double (statement-addr stmt) i)] [(text) (sqlite3-column-text stmt i)] [(blob) (sqlite3-column-blob stmt i)] [else |