Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
5a03b0c3
Commit
5a03b0c3
authored
Feb 09, 2001
by
Hiroshi Inoue
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change SELECT to not trigger "BEGIN" in not autocommit mode.
parent
dfbd5d65
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
12 deletions
+26
-12
src/interfaces/odbc/statement.c
src/interfaces/odbc/statement.c
+26
-12
No files found.
src/interfaces/odbc/statement.c
View file @
5a03b0c3
...
...
@@ -746,16 +746,18 @@ QueryInfo qi;
conn
=
SC_get_conn
(
self
);
/* Begin a transaction if one is not already in progress */
/* The reason is because we can't use declare/fetch cursors without
starting a transaction first.
A transaction should be begun if and only if
we use declare/fetch and the statement is SELECT
or we are not in autocommit state
We assume that the Postgres backend has an autocommit
feature as default. (Zoltan Kovacs, 04/26/2000)
/*
Basically we don't have to begin a transaction in
autocommit mode because Postgres backend runs in
autocomit mode.
We issue "BEGIN" in the following cases.
1) we use declare/fetch and the statement is SELECT
(because declare/fetch must be called in a transaction).
2) we are not in autocommit state and the statement
is of type UPDATE.
*/
if
(
!
self
->
internal
&&
!
CC_is_in_trans
(
conn
)
&&
((
globals
.
use_declarefetch
&&
self
->
statement_type
==
STMT_TYPE_SELECT
)
||
!
CC_is_in_autocommit
(
conn
)))
{
if
(
!
self
->
internal
&&
!
CC_is_in_trans
(
conn
)
&&
((
globals
.
use_declarefetch
&&
self
->
statement_type
==
STMT_TYPE_SELECT
)
||
(
!
CC_is_in_autocommit
(
conn
)
&&
STMT_UPDATE
(
self
))))
{
mylog
(
" about to begin a transaction on statement = %u
\n
"
,
self
);
res
=
CC_send_query
(
conn
,
"BEGIN"
,
NULL
);
...
...
@@ -802,7 +804,8 @@ QueryInfo qi;
/* send the declare/select */
self
->
result
=
CC_send_query
(
conn
,
self
->
stmt_with_params
,
NULL
);
if
(
globals
.
use_declarefetch
&&
self
->
result
!=
NULL
)
{
if
(
globals
.
use_declarefetch
&&
self
->
result
!=
NULL
&&
QR_command_successful
(
self
->
result
))
{
QR_Destructor
(
self
->
result
);
...
...
@@ -834,6 +837,15 @@ QueryInfo qi;
/* We shouldn't send COMMIT. Postgres backend does the
autocommit if neccessary. (Zoltan, 04/26/2000)
*/
/* Even in case of autocommit, started transactions
must be committed. (Hiroshi, 09/02/2001)
*/
if
(
!
self
->
internal
&&
CC_is_in_autocommit
(
conn
)
&&
CC_is_in_trans
(
conn
)
&&
STMT_UPDATE
(
self
))
{
res
=
CC_send_query
(
conn
,
"COMMIT"
,
NULL
);
QR_Destructor
(
res
);
CC_set_no_trans
(
conn
);
}
}
conn
->
status
=
oldstatus
;
...
...
@@ -867,7 +879,9 @@ QueryInfo qi;
return
SQL_ERROR
;
}
}
/* in autocommit mode declare/fetch error must be aborted */
if
(
!
was_ok
&&
!
self
->
internal
&&
CC_is_in_autocommit
(
conn
)
&&
CC_is_in_trans
(
conn
))
CC_abort
(
conn
);
}
else
{
/* Bad Error -- The error message will be in the Connection */
if
(
self
->
statement_type
==
STMT_TYPE_CREATE
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment