comparison src/mysql.sml @ 933:6a284a3519ba

Fix some MySQL bugs
author Adam Chlipala <adamc@hcoop.net>
date Sun, 13 Sep 2009 15:33:11 -0400
parents 034eeb099564
children 6b1d960e2616
comparison
equal deleted inserted replaced
932:0a156bbd205f 933:6a284a3519ba
1052 newline, 1052 newline,
1053 string "struct tm tms;", 1053 string "struct tm tms;",
1054 newline, 1054 newline,
1055 string "if (localtime_r(&arg", 1055 string "if (localtime_r(&arg",
1056 string (Int.toString (i + 1)), 1056 string (Int.toString (i + 1)),
1057 string ", &tm) == NULL) uw_error(\"", 1057 string ", &tms) == NULL) uw_error(ctx, FATAL, \"",
1058 string (ErrorMsg.spanToString loc), 1058 string (ErrorMsg.spanToString loc),
1059 string ": error converting to MySQL time\");", 1059 string ": error converting to MySQL time\");",
1060 newline, 1060 newline,
1061 oneField "year" "year", 1061 oneField "year" "year",
1062 box [string "in_buffer", 1062 box [string "in_buffer",
1071 string "in[", 1071 string "in[",
1072 string (Int.toString i), 1072 string (Int.toString i),
1073 string "].buffer = &in_buffer", 1073 string "].buffer = &in_buffer",
1074 string (Int.toString i), 1074 string (Int.toString i),
1075 string ";", 1075 string ";",
1076 newline,
1077 string "});",
1076 newline] 1078 newline]
1077 end 1079 end
1078 | Channel => box [string "in_buffer", 1080 | Channel => box [string "in_buffer",
1079 string (Int.toString i), 1081 string (Int.toString i),
1080 string " = ((unsigned long long)arg", 1082 string " = ((unsigned long long)arg",
1176 fun dml loc = 1178 fun dml loc =
1177 box [string "uw_conn *conn = uw_get_db(ctx);", 1179 box [string "uw_conn *conn = uw_get_db(ctx);",
1178 newline, 1180 newline,
1179 string "MYSQL_stmt *stmt = mysql_stmt_init(conn->conn);", 1181 string "MYSQL_stmt *stmt = mysql_stmt_init(conn->conn);",
1180 newline, 1182 newline,
1181 string "if (stmt == NULL) uw_error(ctx, \"", 1183 string "if (stmt == NULL) uw_error(ctx, FATAL, \"",
1182 string (ErrorMsg.spanToString loc), 1184 string (ErrorMsg.spanToString loc),
1183 string ": can't allocate temporary prepared statement\");", 1185 string ": can't allocate temporary prepared statement\");",
1184 newline, 1186 newline,
1185 string "uw_push_cleanup(ctx, (void (*)(void *))mysql_stmt_close, stmt);", 1187 string "uw_push_cleanup(ctx, (void (*)(void *))mysql_stmt_close, stmt);",
1186 newline, 1188 newline,
1331 newline, 1333 newline,
1332 string "struct tm tms;", 1334 string "struct tm tms;",
1333 newline, 1335 newline,
1334 string "if (localtime_r(&arg", 1336 string "if (localtime_r(&arg",
1335 string (Int.toString (i + 1)), 1337 string (Int.toString (i + 1)),
1336 string ", &tm) == NULL) uw_error(\"", 1338 string ", &tms) == NULL) uw_error(ctx, FATAL, \"",
1337 string (ErrorMsg.spanToString loc), 1339 string (ErrorMsg.spanToString loc),
1338 string ": error converting to MySQL time\");", 1340 string ": error converting to MySQL time\");",
1339 newline, 1341 newline,
1340 oneField "year" "year", 1342 oneField "year" "year",
1341 oneField "month" "mon", 1343 oneField "month" "mon",
1347 string "in[", 1349 string "in[",
1348 string (Int.toString i), 1350 string (Int.toString i),
1349 string "].buffer = &in_buffer", 1351 string "].buffer = &in_buffer",
1350 string (Int.toString i), 1352 string (Int.toString i),
1351 string ";", 1353 string ";",
1354 newline,
1355 string "});",
1352 newline] 1356 newline]
1353 end 1357 end
1354 | Channel => box [string "in_buffer", 1358 | Channel => box [string "in_buffer",
1355 string (Int.toString i), 1359 string (Int.toString i),
1356 string " = ((unsigned long long)arg", 1360 string " = ((unsigned long long)arg",