Mercurial > urweb
comparison src/mysql.sml @ 1955:469e02eea43a
MySQL: Combine transaction setup commands into one mysql_query()
author | Adam Chlipala <adam@chlipala.net> |
---|---|
date | Tue, 07 Jan 2014 08:36:18 -0500 |
parents | 1802eb00a0ae |
children | ef9fdbb05c73 |
comparison
equal
deleted
inserted
replaced
1954:1802eb00a0ae | 1955:469e02eea43a |
---|---|
534 case !port of | 534 case !port of |
535 NONE => string "0" | 535 NONE => string "0" |
536 | SOME n => string (Int.toString n), | 536 | SOME n => string (Int.toString n), |
537 string ", ", | 537 string ", ", |
538 stringOf unix_socket, | 538 stringOf unix_socket, |
539 string ", 0) == NULL) {", | 539 string ", CLIENT_MULTI_STATEMENTS) == NULL) {", |
540 newline, | 540 newline, |
541 box [string "char msg[1024];", | 541 box [string "char msg[1024];", |
542 newline, | 542 newline, |
543 string "strncpy(msg, mysql_error(mysql), 1024);", | 543 string "strncpy(msg, mysql_error(mysql), 1024);", |
544 newline, | 544 newline, |
587 string "static int uw_db_begin(uw_context ctx, int could_write) {", | 587 string "static int uw_db_begin(uw_context ctx, int could_write) {", |
588 newline, | 588 newline, |
589 string "uw_conn *conn = uw_get_db(ctx);", | 589 string "uw_conn *conn = uw_get_db(ctx);", |
590 newline, | 590 newline, |
591 newline, | 591 newline, |
592 string "return mysql_query(conn->conn, \"SET TRANSACTION ISOLATION LEVEL SERIALIZABLE\")", | 592 string "return mysql_query(conn->conn, \"SET TRANSACTION ISOLATION LEVEL SERIALIZABLE; BEGIN\") ? 1 : (mysql_next_result(conn->conn), 0);", |
593 newline, | |
594 string " || mysql_query(conn->conn, \"BEGIN\");", | |
595 newline, | 593 newline, |
596 string "}", | 594 string "}", |
597 newline, | 595 newline, |
598 newline, | 596 newline, |
599 | 597 |