Mercurial > urweb
comparison src/sqlite.sml @ 887:9eb479691d1c
Timestamps working with SQLite
author | Adam Chlipala <adamc@hcoop.net> |
---|---|
date | Fri, 17 Jul 2009 17:09:55 -0400 |
parents | 5805fa825fe8 |
children | 034eeb099564 |
comparison
equal
deleted
inserted
replaced
886:5805fa825fe8 | 887:9eb479691d1c |
---|---|
35 case t of | 35 case t of |
36 Int => "integer" | 36 Int => "integer" |
37 | Float => "real" | 37 | Float => "real" |
38 | String => "text" | 38 | String => "text" |
39 | Bool => "integer" | 39 | Bool => "integer" |
40 | Time => "integer" | 40 | Time => "text" |
41 | Blob => "blob" | 41 | Blob => "blob" |
42 | Channel => "integer" | 42 | Channel => "integer" |
43 | Client => "integer" | 43 | Client => "integer" |
44 | Nullable t => p_sql_type t | 44 | Nullable t => p_sql_type t |
45 | 45 |
369 if wontLeakStrings then | 369 if wontLeakStrings then |
370 box [string "sqlite3_column_text(stmt, ", string (Int.toString i), string ")"] | 370 box [string "sqlite3_column_text(stmt, ", string (Int.toString i), string ")"] |
371 else | 371 else |
372 box [string "uw_strdup(ctx, sqlite3_column_text(stmt, ", string (Int.toString i), string "))"] | 372 box [string "uw_strdup(ctx, sqlite3_column_text(stmt, ", string (Int.toString i), string "))"] |
373 | Bool => box [string "(uw_Basis_bool)sqlite3_column_int(stmt, ", string (Int.toString i), string ")"] | 373 | Bool => box [string "(uw_Basis_bool)sqlite3_column_int(stmt, ", string (Int.toString i), string ")"] |
374 | Time => box [string "(uw_Basis_time)sqlite3_column_int64(stmt, ", string (Int.toString i), string ")"] | 374 | Time => box [string "uw_Basis_stringToTime_error(ctx, sqlite3_column_text(stmt, ", string (Int.toString i), string "))"] |
375 | Blob => box [string "({", | 375 | Blob => box [string "({", |
376 newline, | 376 newline, |
377 string "char *data = sqlite3_column_blob(stmt, ", | 377 string "char *data = sqlite3_column_blob(stmt, ", |
378 string (Int.toString i), | 378 string (Int.toString i), |
379 string ");", | 379 string ");", |
524 | Bool => box [string "sqlite3_bind_int(stmt, ", | 524 | Bool => box [string "sqlite3_bind_int(stmt, ", |
525 string (Int.toString (i + 1)), | 525 string (Int.toString (i + 1)), |
526 string ", ", | 526 string ", ", |
527 arg, | 527 arg, |
528 string ")"] | 528 string ")"] |
529 | Time => box [string "sqlite3_bind_int64(stmt, ", | 529 | Time => box [string "sqlite3_bind_text(stmt, ", |
530 string (Int.toString (i + 1)), | 530 string (Int.toString (i + 1)), |
531 string ", ", | 531 string ", uw_Basis_attrifyTime(ctx, ", |
532 arg, | 532 arg, |
533 string ")"] | 533 string "), -1, SQLITE_TRANSIENT)"] |
534 | Blob => box [string "sqlite3_bind_blob(stmt, ", | 534 | Blob => box [string "sqlite3_bind_blob(stmt, ", |
535 string (Int.toString (i + 1)), | 535 string (Int.toString (i + 1)), |
536 string ", ", | 536 string ", ", |
537 arg, | 537 arg, |
538 string ".data, ", | 538 string ".data, ", |