1
0
mirror of https://github.com/postgres/postgres.git synced 2025-05-02 11:44:50 +03:00

I suspect that you are not the person to send this to, but I wasn't sure

where else to mail it. I am the maintainer of unixODBC, and we have a
set of code in our project that started life as the Postgres windows
ODBC driver, which has been ported back to unix. Anyway I have just
fixed a memory leak in the driver, and I cant see any mention of the fix
being done in the main Postgres code, so I thougth I would let you know.

Its in the statement.c module, after the COMMIT statement has been
executed in SC_Execute, the code was

Nick Gorham
This commit is contained in:
Bruce Momjian 2000-02-14 12:33:19 +00:00
parent d891ca1853
commit f4ca323d21

View File

@ -62,7 +62,7 @@ static struct {
RETCODE SQL_API SQLAllocStmt(HDBC hdbc,
HSTMT FAR *phstmt)
HSTMT FAR *phstmt)
{
static char *func="SQLAllocStmt";
ConnectionClass *conn = (ConnectionClass *) hdbc;
@ -88,12 +88,12 @@ StatementClass *stmt;
}
if ( ! CC_add_statement(conn, stmt)) {
conn->errormsg = "Maximum number of connections exceeded.";
conn->errornumber = CONN_STMT_ALLOC_ERROR;
conn->errormsg = "Maximum number of connections exceeded.";
conn->errornumber = CONN_STMT_ALLOC_ERROR;
CC_log_error(func, "", conn);
SC_Destructor(stmt);
SC_Destructor(stmt);
*phstmt = SQL_NULL_HSTMT;
return SQL_ERROR;
return SQL_ERROR;
}
*phstmt = (HSTMT) stmt;
@ -111,7 +111,7 @@ StatementClass *stmt;
RETCODE SQL_API SQLFreeStmt(HSTMT hstmt,
UWORD fOption)
UWORD fOption)
{
static char *func="SQLFreeStmt";
StatementClass *stmt = (StatementClass *) hstmt;
@ -151,20 +151,20 @@ StatementClass *stmt = (StatementClass *) hstmt;
} else if (fOption == SQL_CLOSE) {
/* this should discard all the results, but leave the statement */
/* itself in place (it can be executed again) */
if (!SC_recycle_statement(stmt)) {
if (!SC_recycle_statement(stmt)) {
// errormsg passed in above
SC_log_error(func, "", stmt);
return SQL_ERROR;
return SQL_ERROR;
}
} else if(fOption == SQL_RESET_PARAMS) {
SC_free_params(stmt, STMT_FREE_PARAMS_ALL);
} else {
stmt->errormsg = "Invalid option passed to SQLFreeStmt.";
stmt->errornumber = STMT_OPTION_OUT_OF_RANGE_ERROR;
stmt->errormsg = "Invalid option passed to SQLFreeStmt.";
stmt->errornumber = STMT_OPTION_OUT_OF_RANGE_ERROR;
SC_log_error(func, "", stmt);
return SQL_ERROR;
return SQL_ERROR;
}
return SQL_SUCCESS;
@ -663,9 +663,9 @@ ColumnInfoClass *ci;
self->bindings[lf].data_left = -1;
if (self->bindings[lf].buffer != NULL) {
// this column has a binding
// this column has a binding
// type = QR_get_field_type(res, lf);
// type = QR_get_field_type(res, lf);
type = CI_get_oid(ci, lf); /* speed things up */
mylog("type = %d\n", type);
@ -827,8 +827,9 @@ QueryInfo qi;
// If we are in autocommit, we must send the commit.
if ( ! self->internal && CC_is_in_autocommit(conn) && STMT_UPDATE(self)) {
CC_send_query(conn, "COMMIT", NULL);
CC_set_no_trans(conn);
res = CC_send_query(conn, "COMMIT", NULL);
QR_Destructor(res);
CC_set_no_trans(conn);
}
}