Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit462c132

Browse files
author
Hiroshi Inoue
committed
1) Change transaction boundary in autocommit off mode
per recent discussion in pgsql-odbc. Now SELECT is a boundary but VACUUM isn't.2) Put back the error handling behavior. When elog(ERROR) was detected the driver automatically issue "ABORT" if a transaction is in progress.3) Driver version is 7.01.0003(Dave already set it but it was put back).
1 parent21deb42 commit462c132

File tree

6 files changed

+33
-25
lines changed

6 files changed

+33
-25
lines changed

‎src/interfaces/odbc/connection.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -964,9 +964,10 @@ char cmdbuffer[MAX_MESSAGE_LEN+1];/* QR_set_command() dups this string so dont
964964
self->errornumber=CONNECTION_SERVER_REPORTED_ERROR;
965965
CC_set_no_trans(self);
966966
}
967-
else
967+
else
968968
self->errornumber=CONNECTION_SERVER_REPORTED_WARNING;
969969
QR_set_status(res,PGRES_NONFATAL_ERROR);
970+
QR_set_aborted(res, TRUE);
970971
break;
971972
}
972973
}
@@ -1033,6 +1034,7 @@ char cmdbuffer[MAX_MESSAGE_LEN+1];/* QR_set_command() dups this string so dont
10331034
self->errornumber=CONNECTION_SERVER_REPORTED_WARNING;
10341035
QR_set_status(res,PGRES_NONFATAL_ERROR);
10351036
}
1037+
QR_set_aborted(res, TRUE);
10361038

10371039
returnres;/* instead of NULL. Zoltan */
10381040

‎src/interfaces/odbc/psqlodbc.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*
77
* Comments: See "notice.txt" for copyright and license information.
88
*
9-
* $Id: psqlodbc.h,v 1.37 2001/02/14 05:45:46 momjian Exp $
9+
* $Id: psqlodbc.h,v 1.38 2001/02/15 05:32:00 inoue Exp $
1010
*/
1111

1212
#ifndef__PSQLODBC_H__
@@ -41,7 +41,7 @@ typedef UInt4 Oid;
4141
#defineDRIVERNAME "PostgreSQL ODBC"
4242
#defineDBMS_NAME "PostgreSQL"
4343

44-
#definePOSTGRESDRIVERVERSION "07.01.0002"
44+
#definePOSTGRESDRIVERVERSION "07.01.0003"
4545

4646
#ifdefWIN32
4747
#defineDRIVER_FILE_NAME"PSQLODBC.DLL"

‎src/interfaces/odbc/psqlodbc.rc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -204,8 +204,8 @@ END
204204
//
205205

206206
VS_VERSION_INFO VERSIONINFO
207-
FILEVERSION 7,1,0,2
208-
PRODUCTVERSION 7,1,0,2
207+
FILEVERSION 7,1,0,3
208+
PRODUCTVERSION 7,1,0,3
209209
FILEFLAGSMASK 0x3L
210210
#ifdef _DEBUG
211211
FILEFLAGS 0x1L
@@ -223,14 +223,14 @@ BEGIN
223223
VALUE "Comments", "PostgreSQL ODBC driver\0"
224224
VALUE "CompanyName", "Insight Distribution Systems\0"
225225
VALUE "FileDescription", "PostgreSQL Driver\0"
226-
VALUE "FileVersion", " 07.01.0002\0"
226+
VALUE "FileVersion", " 07.01.0003\0"
227227
VALUE "InternalName", "psqlodbc\0"
228228
VALUE "LegalCopyright", "\0"
229229
VALUE "LegalTrademarks", "ODBC(TM) is a trademark of Microsoft Corporation. Microsoft� is a registered trademark of Microsoft Corporation. Windows(TM) is a trademark of Microsoft Corporation.\0"
230230
VALUE "OriginalFilename", "psqlodbc.dll\0"
231231
VALUE "PrivateBuild", "\0"
232232
VALUE "ProductName", "Microsoft Open Database Connectivity\0"
233-
VALUE "ProductVersion", " 07.01.0002\0"
233+
VALUE "ProductVersion", " 07.01.0003\0"
234234
VALUE "SpecialBuild", "\0"
235235
END
236236
END

‎src/interfaces/odbc/qresult.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ QResultClass *rv;
106106
rv->num_fields=0;
107107
rv->tupleField=NULL;
108108
rv->cursor=NULL;
109+
rv->aborted= FALSE;
109110

110111
rv->cache_size=globals.fetch_max;
111112
rv->rowset_size=1;

‎src/interfaces/odbc/qresult.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ struct QResultClass_ {
6262
TupleField*tupleField;/* current backend tuple being retrieved */
6363

6464
charinTuples;/* is a fetch of rows from the backend in progress? */
65+
charaborted;/* was aborted?*/
6566
};
6667

6768
#defineQR_get_fields(self)(self->fields)
@@ -91,11 +92,15 @@ struct QResultClass_ {
9192
#defineQR_end_tuples(self)( self->status == PGRES_END_TUPLES)
9293
#defineQR_set_status(self,condition)( self->status = condition )
9394
#defineQR_set_message(self,message_)( self->message = message_)
95+
#defineQR_set_aborted(self,aborted_)( self->aborted = aborted_)
9496

9597
#defineQR_get_message(self)(self->message)
9698
#defineQR_get_command(self)(self->command)
9799
#defineQR_get_notice(self)(self->notice)
98100
#defineQR_get_status(self)(self->status)
101+
#defineQR_get_aborted(self)(self->aborted)
102+
103+
#defineQR_aborted(self)(!self || self->aborted)
99104

100105
/*Core Functions */
101106
QResultClass*QR_Constructor(void);

‎src/interfaces/odbc/statement.c

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -753,21 +753,19 @@ QueryInfo qi;
753753

754754
/*Begin a transaction if one is not already in progress */
755755
/*
756-
Basically we don't have to begin a transaction in
757-
autocommit mode because Postgres backend runs in
758-
autocomit mode.
759-
We issue "BEGIN" in the following cases.
760-
1) we use declare/fetch and the statement is SELECT
761-
(because declare/fetch must be called in a transaction).
762-
2) we are not in autocommit state and the statement
763-
is of type UPDATE.
764-
*/
765-
if ( !self->internal&& !CC_is_in_trans(conn)&&
766-
((globals.use_declarefetch&&self->statement_type==STMT_TYPE_SELECT)|| (!CC_is_in_autocommit(conn)&&STMT_UPDATE(self)))) {
767-
756+
* Basically we don't have to begin a transaction in autocommit mode
757+
* because Postgres backend runs in autocomit mode. We issue "BEGIN"
758+
* in the following cases. 1) we use declare/fetch and the statement
759+
* is SELECT (because declare/fetch must be called in a transaction).
760+
* 2) we are in autocommit off state and the statement isn't of type
761+
* OTHER.
762+
*/
763+
if (!self->internal&& !CC_is_in_trans(conn)&&
764+
((globals.use_declarefetch&&self->statement_type==STMT_TYPE_SELECT)|| (!CC_is_in_autocommit(conn)&&self->statement_type!=STMT_TYPE_OTHER)))
765+
{
768766
mylog(" about to begin a transaction on statement = %u\n",self);
769767
res=CC_send_query(conn,"BEGIN",NULL);
770-
if ( !res) {
768+
if (QR_aborted(res)) {
771769
self->errormsg="Could not begin a transaction";
772770
self->errornumber=STMT_EXEC_ERROR;
773771
SC_log_error(func,"",self);
@@ -843,10 +841,12 @@ QueryInfo qi;
843841
/*We shouldn't send COMMIT. Postgres backend does the
844842
autocommit if neccessary. (Zoltan, 04/26/2000)
845843
*/
846-
/*Even in case of autocommit, started transactions
847-
must be committed. (Hiroshi, 09/02/2001)
844+
/*Above seems wrong.
845+
Even in case of autocommit, started transactions
846+
must be committed. (Hiroshi, 02/11/2001)
848847
*/
849-
if ( !self->internal&&CC_is_in_autocommit(conn)&&CC_is_in_trans(conn)&&STMT_UPDATE(self)) {
848+
if ( !self->internal&&CC_is_in_autocommit(conn)&&CC_is_in_trans(conn))
849+
{
850850
res=CC_send_query(conn,"COMMIT",NULL);
851851
QR_Destructor(res);
852852
CC_set_no_trans(conn);
@@ -885,8 +885,8 @@ QueryInfo qi;
885885
returnSQL_ERROR;
886886
}
887887
}
888-
/*in autocommit mode declare/fetch error must be aborted */
889-
if ( !was_ok&& !self->internal&&CC_is_in_autocommit(conn)&&CC_is_in_trans(conn))
888+
/*issue "ABORT" when query aborted */
889+
if (QR_get_aborted(self->result)&& !self->internal )
890890
CC_abort(conn);
891891
}else {/* Bad Error -- The error message will be in the Connection */
892892

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp