mirror of
https://github.com/psycopg/psycopg2.git
synced 2025-01-31 17:34:08 +03:00
Fixed BEGIN; SET TRANSACTION with PG 7.4
This commit is contained in:
parent
c54a614c6e
commit
7485fabe4f
|
@ -493,14 +493,22 @@ pq_begin_locked(connectionObject *conn, PGresult **pgres, char **error,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
snprintf(buf, bufsize, "BEGIN%s%s%s%s%s",
|
if (conn->isolevel == ISOLATION_LEVEL_DEFAULT
|
||||||
conn->server_version < 80000 ? ";SET TRANSACTION" : "",
|
&& conn->readonly == STATE_DEFAULT
|
||||||
|
&& conn->deferrable == STATE_DEFAULT) {
|
||||||
|
strcpy(buf, "BEGIN");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
snprintf(buf, bufsize,
|
||||||
|
conn->server_version >= 80000 ?
|
||||||
|
"BEGIN%s%s%s%s" : "BEGIN;SET TRANSACTION%s%s%s%s",
|
||||||
(conn->isolevel >= 1 && conn->isolevel <= 4)
|
(conn->isolevel >= 1 && conn->isolevel <= 4)
|
||||||
? " ISOLATION LEVEL " : "",
|
? " ISOLATION LEVEL " : "",
|
||||||
(conn->isolevel >= 1 && conn->isolevel <= 4)
|
(conn->isolevel >= 1 && conn->isolevel <= 4)
|
||||||
? srv_isolevels[conn->isolevel] : "",
|
? srv_isolevels[conn->isolevel] : "",
|
||||||
srv_readonly[conn->readonly],
|
srv_readonly[conn->readonly],
|
||||||
srv_deferrable[conn->deferrable]);
|
srv_deferrable[conn->deferrable]);
|
||||||
|
}
|
||||||
|
|
||||||
result = pq_execute_command_locked(conn, buf, pgres, error, tstate);
|
result = pq_execute_command_locked(conn, buf, pgres, error, tstate);
|
||||||
if (result == 0)
|
if (result == 0)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user