|
|
|
|
@ -24,17 +24,43 @@ int main(int argc, char** argv) {
|
|
|
|
|
return exit_status();
|
|
|
|
|
|
|
|
|
|
plan(48);
|
|
|
|
|
diag("Testing autocommit and transaction in SQLite3 Server");
|
|
|
|
|
|
|
|
|
|
// Verbose test header
|
|
|
|
|
diag("================================================================================");
|
|
|
|
|
diag("Test: sqlite_autocommit-t");
|
|
|
|
|
diag("================================================================================");
|
|
|
|
|
diag("This test verifies that ProxySQL correctly handles autocommit and transaction");
|
|
|
|
|
diag("status flags when communicating with a SQLite3 backend server.");
|
|
|
|
|
diag("");
|
|
|
|
|
diag("Test scenarios:");
|
|
|
|
|
diag(" - SET autocommit=0: Verify SERVER_STATUS_AUTOCOMMIT is cleared");
|
|
|
|
|
diag(" - SET autocommit=1: Verify SERVER_STATUS_AUTOCOMMIT is set");
|
|
|
|
|
diag(" - SELECT queries: Verify SERVER_STATUS_IN_TRANS is correctly set/cleared");
|
|
|
|
|
diag(" - FOR UPDATE and LOCK IN SHARE MODE: Verify transaction state");
|
|
|
|
|
diag(" - UPDATE queries: Verify transaction state during DML operations");
|
|
|
|
|
diag(" - COMMIT: Verify transaction state is cleared after commit");
|
|
|
|
|
diag("");
|
|
|
|
|
diag("Connection parameters:");
|
|
|
|
|
diag(" - Host: %s", cl.host);
|
|
|
|
|
diag(" - Port: 6030 (SQLite3 Server)");
|
|
|
|
|
diag(" - Username: %s", cl.username);
|
|
|
|
|
diag("================================================================================");
|
|
|
|
|
diag("");
|
|
|
|
|
|
|
|
|
|
MYSQL* mysql = mysql_init(NULL);
|
|
|
|
|
if (!mysql)
|
|
|
|
|
if (!mysql) {
|
|
|
|
|
diag("Failed to initialize MySQL handle");
|
|
|
|
|
return exit_status();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
diag("Attempting to connect to SQLite3 Server at %s:6030", cl.host);
|
|
|
|
|
if (!mysql_real_connect(mysql, cl.host, cl.username, cl.password, NULL, 6030, NULL, 0)) {
|
|
|
|
|
fprintf(stderr, "Failed to connect to database: Error: %s\n",
|
|
|
|
|
mysql_error(mysql));
|
|
|
|
|
diag("Failed to connect to SQLite3 Server: Error: %s", mysql_error(mysql));
|
|
|
|
|
diag("Connection details: host=%s, port=6030, username=%s", cl.host, cl.username);
|
|
|
|
|
return exit_status();
|
|
|
|
|
}
|
|
|
|
|
diag("Successfully connected to SQLite3 Server");
|
|
|
|
|
diag("");
|
|
|
|
|
MYSQL_RES *res;
|
|
|
|
|
if (create_table_test_sqlite_sbtest1(100,mysql)) {
|
|
|
|
|
fprintf(stderr, "File %s, line %d, Error: create_table_test_sbtest1() failed\n", __FILE__, __LINE__);
|
|
|
|
|
|