self->errornumber = CONNECTION_SERVER_REPORTED_ERROR;
CC_set_no_trans(self);
}
- else
+ else
self->errornumber = CONNECTION_SERVER_REPORTED_WARNING;
QR_set_status(res, PGRES_NONFATAL_ERROR);
+ QR_set_aborted(res, TRUE);
break;
}
}
self->errornumber = CONNECTION_SERVER_REPORTED_WARNING;
QR_set_status(res, PGRES_NONFATAL_ERROR);
}
+ QR_set_aborted(res, TRUE);
return res; /* instead of NULL. Zoltan */
*
* Comments: See "notice.txt" for copyright and license information.
*
- * $Id: psqlodbc.h,v 1.37 2001/02/14 05:45:46 momjian Exp $
+ * $Id: psqlodbc.h,v 1.38 2001/02/15 05:32:00 inoue Exp $
*/
#ifndef __PSQLODBC_H__
#define DRIVERNAME "PostgreSQL ODBC"
#define DBMS_NAME "PostgreSQL"
-#define POSTGRESDRIVERVERSION "07.01.0002"
+#define POSTGRESDRIVERVERSION "07.01.0003"
#ifdef WIN32
#define DRIVER_FILE_NAME "PSQLODBC.DLL"
//
VS_VERSION_INFO VERSIONINFO
- FILEVERSION 7,1,0,2
- PRODUCTVERSION 7,1,0,2
+ FILEVERSION 7,1,0,3
+ PRODUCTVERSION 7,1,0,3
FILEFLAGSMASK 0x3L
#ifdef _DEBUG
FILEFLAGS 0x1L
VALUE "Comments", "PostgreSQL ODBC driver\0"
VALUE "CompanyName", "Insight Distribution Systems\0"
VALUE "FileDescription", "PostgreSQL Driver\0"
- VALUE "FileVersion", " 07.01.0002\0"
+ VALUE "FileVersion", " 07.01.0003\0"
VALUE "InternalName", "psqlodbc\0"
VALUE "LegalCopyright", "\0"
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"
VALUE "OriginalFilename", "psqlodbc.dll\0"
VALUE "PrivateBuild", "\0"
VALUE "ProductName", "Microsoft Open Database Connectivity\0"
- VALUE "ProductVersion", " 07.01.0002\0"
+ VALUE "ProductVersion", " 07.01.0003\0"
VALUE "SpecialBuild", "\0"
END
END
rv->num_fields = 0;
rv->tupleField = NULL;
rv->cursor = NULL;
+ rv->aborted = FALSE;
rv->cache_size = globals.fetch_max;
rv->rowset_size = 1;
TupleField *tupleField; /* current backend tuple being retrieved */
char inTuples; /* is a fetch of rows from the backend in progress? */
+ char aborted; /* was aborted?*/
};
#define QR_get_fields(self) (self->fields)
#define QR_end_tuples(self) ( self->status == PGRES_END_TUPLES)
#define QR_set_status(self, condition) ( self->status = condition )
#define QR_set_message(self, message_) ( self->message = message_)
+#define QR_set_aborted(self, aborted_) ( self->aborted = aborted_)
#define QR_get_message(self) (self->message)
#define QR_get_command(self) (self->command)
#define QR_get_notice(self) (self->notice)
#define QR_get_status(self) (self->status)
+#define QR_get_aborted(self) (self->aborted)
+
+#define QR_aborted(self) (!self || self->aborted)
/* Core Functions */
QResultClass *QR_Constructor(void);
/* Begin a transaction if one is not already in progress */
/*
- 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) && STMT_UPDATE(self)))) {
-
+ * 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 in autocommit off state and the statement isn't of type
+ * OTHER.
+ */
+ if (!self->internal && !CC_is_in_trans(conn) &&
+ ((globals.use_declarefetch && self->statement_type == STMT_TYPE_SELECT) || (!CC_is_in_autocommit(conn) && self->statement_type != STMT_TYPE_OTHER)))
+ {
mylog(" about to begin a transaction on statement = %u\n", self);
res = CC_send_query(conn, "BEGIN", NULL);
- if ( ! res) {
+ if (QR_aborted(res)) {
self->errormsg = "Could not begin a transaction";
self->errornumber = STMT_EXEC_ERROR;
SC_log_error(func, "", self);
/* 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)
+ /* Above seems wrong.
+ Even in case of autocommit, started transactions
+ must be committed. (Hiroshi, 02/11/2001)
*/
- if ( ! self->internal && CC_is_in_autocommit(conn) && CC_is_in_trans(conn) && STMT_UPDATE(self)) {
+ if ( ! self->internal && CC_is_in_autocommit(conn) && CC_is_in_trans(conn))
+ {
res = CC_send_query(conn, "COMMIT", NULL);
QR_Destructor(res);
CC_set_no_trans(conn);
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))
+ /* issue "ABORT" when query aborted */
+ if (QR_get_aborted(self->result) && ! self->internal )
CC_abort(conn);
} else { /* Bad Error -- The error message will be in the Connection */