Mercurial > urweb
comparison src/sqlite.sml @ 1094:db52c32dbe42
All three current protocols work with move to using uw_app
author | Adam Chlipala <adamc@hcoop.net> |
---|---|
date | Sun, 27 Dec 2009 10:37:24 -0500 |
parents | b2311dfb3158 |
children | 150465f2895c |
comparison
equal
deleted
inserted
replaced
1093:8d3aa6c7cee0 | 1094:db52c32dbe42 |
---|---|
154 ss], | 154 ss], |
155 string "} uw_conn;", | 155 string "} uw_conn;", |
156 newline, | 156 newline, |
157 newline, | 157 newline, |
158 | 158 |
159 string "void uw_client_init(void) {", | 159 string "static void uw_client_init(void) {", |
160 newline, | 160 newline, |
161 box [string "uw_sqlfmtInt = \"%lld%n\";", | 161 box [string "uw_sqlfmtInt = \"%lld%n\";", |
162 newline, | 162 newline, |
163 string "uw_sqlfmtFloat = \"%g%n\";", | 163 string "uw_sqlfmtFloat = \"%g%n\";", |
164 newline, | 164 newline, |
254 newline, | 254 newline, |
255 string "static void uw_db_validate(uw_context ctx) { }"], | 255 string "static void uw_db_validate(uw_context ctx) { }"], |
256 newline, | 256 newline, |
257 newline, | 257 newline, |
258 | 258 |
259 string "void uw_db_init(uw_context ctx) {", | 259 string "static void uw_db_init(uw_context ctx) {", |
260 newline, | 260 newline, |
261 string "sqlite3 *sqlite;", | 261 string "sqlite3 *sqlite;", |
262 newline, | 262 newline, |
263 string "uw_conn *conn;", | 263 string "uw_conn *conn;", |
264 newline, | 264 newline, |
281 newline, | 281 newline, |
282 string "}", | 282 string "}", |
283 newline, | 283 newline, |
284 newline, | 284 newline, |
285 | 285 |
286 string "void uw_db_close(uw_context ctx) {", | 286 string "static void uw_db_close(uw_context ctx) {", |
287 newline, | 287 newline, |
288 string "uw_conn *conn = uw_get_db(ctx);", | 288 string "uw_conn *conn = uw_get_db(ctx);", |
289 newline, | 289 newline, |
290 p_list_sepi (box []) | 290 p_list_sepi (box []) |
291 (fn i => fn _ => | 291 (fn i => fn _ => |
300 newline, | 300 newline, |
301 string "}", | 301 string "}", |
302 newline, | 302 newline, |
303 newline, | 303 newline, |
304 | 304 |
305 string "int uw_db_begin(uw_context ctx) {", | 305 string "static int uw_db_begin(uw_context ctx) {", |
306 newline, | 306 newline, |
307 string "uw_conn *conn = uw_get_db(ctx);", | 307 string "uw_conn *conn = uw_get_db(ctx);", |
308 newline, | 308 newline, |
309 newline, | 309 newline, |
310 string "if (sqlite3_exec(conn->conn, \"BEGIN\", NULL, NULL, NULL) == SQLITE_OK)", | 310 string "if (sqlite3_exec(conn->conn, \"BEGIN\", NULL, NULL, NULL) == SQLITE_OK)", |
319 newline], | 319 newline], |
320 string "}", | 320 string "}", |
321 newline, | 321 newline, |
322 string "}", | 322 string "}", |
323 newline, | 323 newline, |
324 string "int uw_db_commit(uw_context ctx) {", | 324 string "static int uw_db_commit(uw_context ctx) {", |
325 newline, | 325 newline, |
326 string "uw_conn *conn = uw_get_db(ctx);", | 326 string "uw_conn *conn = uw_get_db(ctx);", |
327 newline, | 327 newline, |
328 string "if (sqlite3_exec(conn->conn, \"COMMIT\", NULL, NULL, NULL) == SQLITE_OK)", | 328 string "if (sqlite3_exec(conn->conn, \"COMMIT\", NULL, NULL, NULL) == SQLITE_OK)", |
329 newline, | 329 newline, |
339 newline, | 339 newline, |
340 string "}", | 340 string "}", |
341 newline, | 341 newline, |
342 newline, | 342 newline, |
343 | 343 |
344 string "int uw_db_rollback(uw_context ctx) {", | 344 string "static int uw_db_rollback(uw_context ctx) {", |
345 newline, | 345 newline, |
346 string "uw_conn *conn = uw_get_db(ctx);", | 346 string "uw_conn *conn = uw_get_db(ctx);", |
347 newline, | 347 newline, |
348 string "if (sqlite3_exec(conn->conn, \"ROLLBACK\", NULL, NULL, NULL) == SQLITE_OK)", | 348 string "if (sqlite3_exec(conn->conn, \"ROLLBACK\", NULL, NULL, NULL) == SQLITE_OK)", |
349 newline, | 349 newline, |