mirror of
https://github.com/psycopg/psycopg2.git
synced 2024-11-10 19:16:34 +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;
|
||||
}
|
||||
|
||||
snprintf(buf, bufsize, "BEGIN%s%s%s%s%s",
|
||||
conn->server_version < 80000 ? ";SET TRANSACTION" : "",
|
||||
(conn->isolevel >= 1 && conn->isolevel <= 4)
|
||||
? " ISOLATION LEVEL " : "",
|
||||
(conn->isolevel >= 1 && conn->isolevel <= 4)
|
||||
? srv_isolevels[conn->isolevel] : "",
|
||||
srv_readonly[conn->readonly],
|
||||
srv_deferrable[conn->deferrable]);
|
||||
if (conn->isolevel == ISOLATION_LEVEL_DEFAULT
|
||||
&& 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)
|
||||
? " ISOLATION LEVEL " : "",
|
||||
(conn->isolevel >= 1 && conn->isolevel <= 4)
|
||||
? srv_isolevels[conn->isolevel] : "",
|
||||
srv_readonly[conn->readonly],
|
||||
srv_deferrable[conn->deferrable]);
|
||||
}
|
||||
|
||||
result = pq_execute_command_locked(conn, buf, pgres, error, tstate);
|
||||
if (result == 0)
|
||||
|
|
Loading…
Reference in New Issue
Block a user