From d6b698a6ad00a5f707ae48af039388687ac9b4ba Mon Sep 17 00:00:00 2001 From: Adam Chlipala Date: Thu, 27 May 2010 16:36:17 -0400 Subject: -moduleOf command-line option; compatibility fixes and better error messages for SQLite --- src/sqlite.sml | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'src/sqlite.sml') diff --git a/src/sqlite.sml b/src/sqlite.sml index 26cfc9d5..d628da16 100644 --- a/src/sqlite.sml +++ b/src/sqlite.sml @@ -58,7 +58,7 @@ fun checkRel (table, checkNullable) (s, xts) = newline, box [string "sqlite3_close(conn->conn);", newline, - string "uw_error(ctx, FATAL, \"Query preparation failed:\\n", + string "uw_error(ctx, FATAL, \"Query preparation failed:
", string q, string "\");", newline], @@ -77,7 +77,7 @@ fun checkRel (table, checkNullable) (s, xts) = newline, string "sqlite3_close(conn->conn);", newline, - string "uw_error(ctx, FATAL, \"No row returned:\\n", + string "uw_error(ctx, FATAL, \"No row returned:
", string q, string "\");", newline], @@ -90,7 +90,7 @@ fun checkRel (table, checkNullable) (s, xts) = newline, string "sqlite3_close(conn->conn);", newline, - string "uw_error(ctx, FATAL, \"Error getting row:\\n", + string "uw_error(ctx, FATAL, \"Error getting row:
", string q, string "\");", newline], @@ -104,7 +104,7 @@ fun checkRel (table, checkNullable) (s, xts) = newline, string "sqlite3_close(conn->conn);", newline, - string "uw_error(ctx, FATAL, \"Bad column count:\\n", + string "uw_error(ctx, FATAL, \"Bad column count:
", string q, string "\");", newline], @@ -242,7 +242,7 @@ fun init {dbstring, prepared = ss, tables, views, sequences} = string "msg[1023] = 0;", newline, uhoh false ("Error preparing statement: " - ^ String.toString s ^ "\\n%s") ["msg"]], + ^ String.toString s ^ "
%s") ["msg"]], string "}", newline] end) @@ -353,7 +353,7 @@ fun init {dbstring, prepared = ss, tables, views, sequences} = newline], string "else {", newline, - box [string "fprintf(stderr, \"Begin error: %s\\n\", sqlite3_errmsg(conn->conn));", + box [string "fprintf(stderr, \"Begin error: %s
\", sqlite3_errmsg(conn->conn));", newline, string "return 1;", newline], @@ -371,7 +371,7 @@ fun init {dbstring, prepared = ss, tables, views, sequences} = newline], string "else {", newline, - box [string "fprintf(stderr, \"Commit error: %s\\n\", sqlite3_errmsg(conn->conn));", + box [string "fprintf(stderr, \"Commit error: %s
\", sqlite3_errmsg(conn->conn));", newline, string "return 1;", newline], @@ -391,7 +391,7 @@ fun init {dbstring, prepared = ss, tables, views, sequences} = newline], string "else {", newline, - box [string "fprintf(stderr, \"Rollback error: %s\\n\", sqlite3_errmsg(conn->conn));", + box [string "fprintf(stderr, \"Rollback error: %s
\", sqlite3_errmsg(conn->conn));", newline, string "return 1;", newline], @@ -522,7 +522,7 @@ fun queryCommon {loc, query, cols, doCols} = string "if (r != SQLITE_DONE) uw_error(ctx, FATAL, \"", string (ErrorMsg.spanToString loc), - string ": query step failed: %s\\n%s\", ", + string ": query step failed: %s
%s\", ", query, string ", sqlite3_errmsg(conn->conn));", newline, @@ -534,7 +534,7 @@ fun query {loc, cols, doCols} = string "sqlite3_stmt *stmt;", newline, newline, - string "if (sqlite3_prepare_v2(conn->conn, query, -1, &stmt, NULL) != SQLITE_OK) uw_error(ctx, FATAL, \"Error preparing statement: %s\\n%s\", sqlite3_errmsg(conn->conn));", + string "if (sqlite3_prepare_v2(conn->conn, query, -1, &stmt, NULL) != SQLITE_OK) uw_error(ctx, FATAL, \"Error preparing statement: %s
%s\", sqlite3_errmsg(conn->conn), query);", newline, newline, string "uw_push_cleanup(ctx, (void (*)(void *))sqlite3_finalize, stmt);", @@ -654,7 +654,7 @@ fun queryPrepared {loc, id, query, inputs, cols, doCols, nested} = string (String.toString query), string "\", -1, &stmt, NULL) != SQLITE_OK) uw_error(ctx, FATAL, \"Error preparing statement: ", string (String.toString query), - string "\\n%s\", sqlite3_errmsg(conn->conn));", + string "
%s\", sqlite3_errmsg(conn->conn));", newline, if nested then box [string "uw_push_cleanup(ctx, (void (*)(void *))sqlite3_finalize, stmt);", @@ -703,7 +703,7 @@ fun dmlCommon {loc, dml} = string "if (r != SQLITE_DONE) uw_error(ctx, FATAL, \"", string (ErrorMsg.spanToString loc), - string ": DML step failed: %s\\n%s\", ", + string ": DML step failed: %s
%s\", ", dml, string ", sqlite3_errmsg(conn->conn));", newline] @@ -714,7 +714,7 @@ fun dml loc = string "sqlite3_stmt *stmt;", newline, newline, - string "if (sqlite3_prepare_v2(conn->conn, dml, -1, &stmt, NULL) != SQLITE_OK) uw_error(ctx, FATAL, \"Error preparing statement: %s\\n%s\", dml, sqlite3_errmsg(conn->conn));", + string "if (sqlite3_prepare_v2(conn->conn, dml, -1, &stmt, NULL) != SQLITE_OK) uw_error(ctx, FATAL, \"Error preparing statement: %s
%s\", dml, sqlite3_errmsg(conn->conn));", newline, newline, string "uw_push_cleanup(ctx, (void (*)(void *))sqlite3_finalize, stmt);", @@ -742,7 +742,7 @@ fun dmlPrepared {loc, id, dml, inputs} = string (String.toString dml), string "\", -1, &stmt, NULL) != SQLITE_OK) uw_error(ctx, FATAL, \"Error preparing statement: ", string (String.toString dml), - string "\\n%s\", sqlite3_errmsg(conn->conn));", + string "
%s\", sqlite3_errmsg(conn->conn));", newline, string "conn->p", string (Int.toString id), -- cgit v1.2.3