EnvironmentClass *
EN_Constructor(void)
{
- CSTR func = "EN_Constructor";
EnvironmentClass *rv = NULL;
#ifdef WIN32
WORD wVersionRequested;
if (WSAStartup(wVersionRequested, &wsaData))
{
- mylog("%s: WSAStartup error\n", func);
+ mylog("%s: WSAStartup error\n", __FUNCTION__);
return rv;
}
/* Verify that this is the minimum version of WinSock */
if (LOBYTE(wsaData.wVersion) != major ||
HIBYTE(wsaData.wVersion) != minor)
{
- mylog("%s: WSAStartup version=(%d,%d)\n", func,
+ mylog("%s: WSAStartup version=(%d,%d)\n", __FUNCTION__,
LOBYTE(wsaData.wVersion), HIBYTE(wsaData.wVersion));
+ goto cleanup;
}
#endif /* WIN32 */
rv = (EnvironmentClass *) malloc(sizeof(EnvironmentClass));
-cleanup:
- if (rv)
+ if (NULL == rv)
{
- rv->errormsg = 0;
- rv->errornumber = 0;
- rv->flag = 0;
- INIT_ENV_CS(rv);
+ mylog("%s: malloc error\n", __FUNCTION__);
+ goto cleanup;
}
+ rv->errormsg = 0;
+ rv->errornumber = 0;
+ rv->flag = 0;
+ INIT_ENV_CS(rv);
+cleanup:
#ifdef WIN32
- else
+ if (NULL == rv)
{
- mylog("%s: malloc error\n", func);
WSACleanup();
}
#endif /* WIN32 */
char tmp[MAX_INFO_STRING];
SQLULEN len = 0,
value = 0;
- RETCODE result;
+ RETCODE result = SQL_ERROR;
char odbcver[16];
int i_odbcver;
default:
/* unrecognized key */
CC_set_error(conn, CONN_NOT_IMPLEMENTED_ERROR, "Unrecognized key passed to PGAPI_GetInfo.", NULL);
- return SQL_ERROR;
+ goto cleanup;
}
result = SQL_SUCCESS;
CSTR func = "PGAPI_GetTypeInfo";
StatementClass *stmt = (StatementClass *) hstmt;
ConnectionClass *conn;
- QResultClass *res;
+ QResultClass *res = NULL;
TupleField *tuple;
int i, result_cols;
}
for (cnt = 0; cnt < pgtcount; cnt ++)
{
- tuple = QR_AddNew(res);
+ if (tuple = QR_AddNew(res), NULL == tuple)
+ {
+ result = SQL_ERROR;
+ SC_set_error(stmt, STMT_NO_MEMORY_ERROR, "Couldn't QR_AddNew.", func);
+ goto cleanup;
+ }
/* These values can't be NULL */
if (aunq_match == cnt)
*/
stmt->status = STMT_FINISHED;
stmt->currTuple = -1;
- SC_set_rowset_start(stmt, -1, FALSE);
+ if (SQL_SUCCEEDED(result))
+ SC_set_rowset_start(stmt, -1, FALSE);
+ else
+ SC_set_Result(stmt, NULL);
SC_set_current_col(stmt, -1);
if (stmt->internal)
size_t cq_len,cq_size;
char *col_query;
BOOL search_pattern;
- QResultClass *res;
+ QResultClass *res = NULL;
mylog("%s: entering...\n", func);
if (res = CC_send_query(conn, column_query, NULL, IGNORE_ABORT_ON_CONN, stmt), !QR_command_maybe_successful(res))
{
SC_set_error(stmt, STMT_EXEC_ERROR, "PGAPI_ColumnPrivileges query error", func);
- QR_Destructor(res);
- return SQL_ERROR;
+ goto cleanup;
}
SC_set_Result(stmt, res);
/* set up the current tuple pointer for SQLFetch */
result = SQL_SUCCESS;
cleanup:
+ if (!SQL_SUCCEEDED(result))
+ QR_Destructor(res);
/* set up the current tuple pointer for SQLFetch */
stmt->status = STMT_FINISHED;
stmt->currTuple = -1;
ENTER_CONN_CS(conn);
CC_clear_error(conn);
#if (ODBCVER >= 0x0300)
- mylog("[SQLGetInfo(30)]");
+ mylog("[%s(30)]", func);
if ((ret = PGAPI_GetInfo(ConnectionHandle, InfoType, InfoValue,
BufferLength, StringLength)) == SQL_ERROR)
{
#define POSTGRESDRIVERVERSION "08.03.0201"
#define POSTGRES_RESOURCE_VERSION "08.03.0201\0"
#define PG_DRVFILE_VERSION 8,3,02,01
-#define PG_BUILD_VERSION "200810070001"
+#define PG_BUILD_VERSION "200810080001"
#endif