Commit 1c551683 authored by Bruce Momjian's avatar Bruce Momjian

Run pgindent on ODBC code only, to reformat new comments.

parent 296e7ba2
...@@ -220,10 +220,9 @@ SQLBindCol( ...@@ -220,10 +220,9 @@ SQLBindCol(
} }
/* /*
* Allocate enough bindings if not already done. * Allocate enough bindings if not already done. Most likely,
* Most likely, execution of a statement would have setup the * execution of a statement would have setup the necessary bindings.
* necessary bindings. But some apps call BindCol before any * But some apps call BindCol before any statement is executed.
* statement is executed.
*/ */
if (icol > stmt->bindings_allocated) if (icol > stmt->bindings_allocated)
extend_bindings(stmt, icol); extend_bindings(stmt, icol);
...@@ -467,10 +466,11 @@ extend_bindings(StatementClass *stmt, int num_columns) ...@@ -467,10 +466,11 @@ extend_bindings(StatementClass *stmt, int num_columns)
stmt->bindings = new_bindings; stmt->bindings = new_bindings;
stmt->bindings_allocated = num_columns; stmt->bindings_allocated = num_columns;
} }
/* /*
* There is no reason to zero out extra bindings if there are * There is no reason to zero out extra bindings if there are more
* more than needed. If an app has allocated extra bindings, * than needed. If an app has allocated extra bindings, let it worry
* let it worry about it by unbinding those columns. * about it by unbinding those columns.
*/ */
/* SQLBindCol(1..) ... SQLBindCol(10...) # got 10 bindings */ /* SQLBindCol(1..) ... SQLBindCol(10...) # got 10 bindings */
......
...@@ -61,6 +61,7 @@ CI_read_fields(ColumnInfoClass *self, ConnectionClass *conn) ...@@ -61,6 +61,7 @@ CI_read_fields(ColumnInfoClass *self, ConnectionClass *conn)
Oid new_adtid; Oid new_adtid;
Int2 new_adtsize; Int2 new_adtsize;
Int4 new_atttypmod = -1; Int4 new_atttypmod = -1;
/* MAX_COLUMN_LEN may be sufficient but for safety */ /* MAX_COLUMN_LEN may be sufficient but for safety */
char new_field_name[2 * MAX_COLUMN_LEN + 1]; char new_field_name[2 * MAX_COLUMN_LEN + 1];
SocketClass *sock; SocketClass *sock;
......
...@@ -915,8 +915,10 @@ CC_send_query(ConnectionClass *self, char *query, QueryInfo *qi) ...@@ -915,8 +915,10 @@ CC_send_query(ConnectionClass *self, char *query, QueryInfo *qi)
char swallow; char swallow;
int id; int id;
SocketClass *sock = self->sock; SocketClass *sock = self->sock;
/* ERROR_MSG_LENGTH is suffcient */ /* ERROR_MSG_LENGTH is suffcient */
static char msgbuffer[ERROR_MSG_LENGTH + 1]; static char msgbuffer[ERROR_MSG_LENGTH + 1];
/* QR_set_command() dups this string so doesn't need static */ /* QR_set_command() dups this string so doesn't need static */
char cmdbuffer[ERROR_MSG_LENGTH + 1]; char cmdbuffer[ERROR_MSG_LENGTH + 1];
...@@ -1210,6 +1212,7 @@ CC_send_function(ConnectionClass *self, int fnid, void *result_buf, int *actual_ ...@@ -1210,6 +1212,7 @@ CC_send_function(ConnectionClass *self, int fnid, void *result_buf, int *actual_
c, c,
done; done;
SocketClass *sock = self->sock; SocketClass *sock = self->sock;
/* ERROR_MSG_LENGTH is sufficient */ /* ERROR_MSG_LENGTH is sufficient */
static char msgbuffer[ERROR_MSG_LENGTH + 1]; static char msgbuffer[ERROR_MSG_LENGTH + 1];
int i; int i;
...@@ -1590,8 +1593,8 @@ CC_lookup_pg_version(ConnectionClass *self) ...@@ -1590,8 +1593,8 @@ CC_lookup_pg_version(ConnectionClass *self)
} }
/* /*
* Extract the Major and Minor numbers from the string. * Extract the Major and Minor numbers from the string. This assumes
* This assumes the string starts 'Postgresql X.X' * the string starts 'Postgresql X.X'
*/ */
strcpy(szVersion, "0.0"); strcpy(szVersion, "0.0");
if (sscanf(self->pg_version, "%*s %d.%d", &major, &minor) >= 2) if (sscanf(self->pg_version, "%*s %d.%d", &major, &minor) >= 2)
......
...@@ -199,9 +199,7 @@ copy_and_convert_field(StatementClass *stmt, Int4 field_type, void *value, Int2 ...@@ -199,9 +199,7 @@ copy_and_convert_field(StatementClass *stmt, Int4 field_type, void *value, Int2
*/ */
if (bind_size > 0) if (bind_size > 0)
{
pcbValueOffset = rgbValueOffset = (bind_size * bind_row); pcbValueOffset = rgbValueOffset = (bind_size * bind_row);
}
else else
{ {
pcbValueOffset = bind_row * sizeof(SDWORD); pcbValueOffset = bind_row * sizeof(SDWORD);
...@@ -221,9 +219,10 @@ copy_and_convert_field(StatementClass *stmt, Int4 field_type, void *value, Int2 ...@@ -221,9 +219,10 @@ copy_and_convert_field(StatementClass *stmt, Int4 field_type, void *value, Int2
if (!value) if (!value)
{ {
/* /*
* handle a null just by returning SQL_NULL_DATA in pcbValue, * handle a null just by returning SQL_NULL_DATA in pcbValue, and
* and doing nothing to the buffer. * doing nothing to the buffer.
*/ */
if (pcbValue) if (pcbValue)
*(SDWORD *) ((char *) pcbValue + pcbValueOffset) = SQL_NULL_DATA; *(SDWORD *) ((char *) pcbValue + pcbValueOffset) = SQL_NULL_DATA;
...@@ -242,14 +241,14 @@ copy_and_convert_field(StatementClass *stmt, Int4 field_type, void *value, Int2 ...@@ -242,14 +241,14 @@ copy_and_convert_field(StatementClass *stmt, Int4 field_type, void *value, Int2
} }
/* /*
* First convert any specific postgres types into more * First convert any specific postgres types into more useable data.
* useable data.
* *
* NOTE: Conversions from PG char/varchar of a date/time/timestamp * NOTE: Conversions from PG char/varchar of a date/time/timestamp value
* value to SQL_C_DATE,SQL_C_TIME, SQL_C_TIMESTAMP not supported * to SQL_C_DATE,SQL_C_TIME, SQL_C_TIMESTAMP not supported
*/ */
switch (field_type) switch (field_type)
{ {
/* /*
* $$$ need to add parsing for date/time/timestamp strings in * $$$ need to add parsing for date/time/timestamp strings in
* PG_TYPE_CHAR,VARCHAR $$$ * PG_TYPE_CHAR,VARCHAR $$$
...@@ -269,9 +268,10 @@ copy_and_convert_field(StatementClass *stmt, Int4 field_type, void *value, Int2 ...@@ -269,9 +268,10 @@ copy_and_convert_field(StatementClass *stmt, Int4 field_type, void *value, Int2
sscanf(value, "%4d-%2d-%2d %2d:%2d:%2d", &st.y, &st.m, &st.d, &st.hh, &st.mm, &st.ss); sscanf(value, "%4d-%2d-%2d %2d:%2d:%2d", &st.y, &st.m, &st.d, &st.hh, &st.mm, &st.ss);
else else
{ {
/* /*
* The timestamp is invalid so set * The timestamp is invalid so set something conspicuous,
* something conspicuous, like the epoch * like the epoch
*/ */
t = 0; t = 0;
tim = localtime(&t); tim = localtime(&t);
...@@ -379,6 +379,7 @@ copy_and_convert_field(StatementClass *stmt, Int4 field_type, void *value, Int2 ...@@ -379,6 +379,7 @@ copy_and_convert_field(StatementClass *stmt, Int4 field_type, void *value, Int2
if (fCType == SQL_C_CHAR) if (fCType == SQL_C_CHAR)
{ {
/* Special character formatting as required */ /* Special character formatting as required */
/* /*
* These really should return error if cbValueMax is not big * These really should return error if cbValueMax is not big
* enough. * enough.
...@@ -483,6 +484,7 @@ copy_and_convert_field(StatementClass *stmt, Int4 field_type, void *value, Int2 ...@@ -483,6 +484,7 @@ copy_and_convert_field(StatementClass *stmt, Int4 field_type, void *value, Int2
} }
else else
{ {
/* /*
* for SQL_C_CHAR, it's probably ok to leave currency symbols in. * for SQL_C_CHAR, it's probably ok to leave currency symbols in.
* But to convert to numeric types, it is necessary to get rid of * But to convert to numeric types, it is necessary to get rid of
...@@ -780,8 +782,10 @@ copy_statement_with_parameters(StatementClass *stmt) ...@@ -780,8 +782,10 @@ copy_statement_with_parameters(StatementClass *stmt)
#ifdef MULTIBYTE #ifdef MULTIBYTE
char *end = multibyte_strchr(begin, '}'); char *end = multibyte_strchr(begin, '}');
#else #else
char *end = strchr(begin, '}'); char *end = strchr(begin, '}');
#endif #endif
if (!end) if (!end)
...@@ -806,6 +810,7 @@ copy_statement_with_parameters(StatementClass *stmt) ...@@ -806,6 +810,7 @@ copy_statement_with_parameters(StatementClass *stmt)
*end = '}'; *end = '}';
continue; continue;
} }
/* /*
* Can you have parameter markers inside of quotes? I dont think * Can you have parameter markers inside of quotes? I dont think
* so. All the queries I've seen expect the driver to put quotes * so. All the queries I've seen expect the driver to put quotes
...@@ -1101,9 +1106,7 @@ copy_statement_with_parameters(StatementClass *stmt) ...@@ -1101,9 +1106,7 @@ copy_statement_with_parameters(StatementClass *stmt)
case SQL_LONGVARBINARY: case SQL_LONGVARBINARY:
if (stmt->parameters[param_number].data_at_exec) if (stmt->parameters[param_number].data_at_exec)
{
lobj_oid = stmt->parameters[param_number].lobj_oid; lobj_oid = stmt->parameters[param_number].lobj_oid;
}
else else
{ {
/* begin transaction if needed */ /* begin transaction if needed */
...@@ -1308,7 +1311,8 @@ convert_escape(char *value) ...@@ -1308,7 +1311,8 @@ convert_escape(char *value)
if ((strcmp(key, "d") == 0) || if ((strcmp(key, "d") == 0) ||
(strcmp(key, "t") == 0) || (strcmp(key, "t") == 0) ||
(strcmp(key, "oj") == 0) || /* {oj syntax support for 7.1 servers */ (strcmp(key, "oj") == 0) || /* {oj syntax support for 7.1
* servers */
(strcmp(key, "ts") == 0)) (strcmp(key, "ts") == 0))
{ {
/* Literal; return the escape part as-is */ /* Literal; return the escape part as-is */
...@@ -1316,6 +1320,7 @@ convert_escape(char *value) ...@@ -1316,6 +1320,7 @@ convert_escape(char *value)
} }
else if (strcmp(key, "fn") == 0) else if (strcmp(key, "fn") == 0)
{ {
/* /*
* Function invocation Separate off the func name, skipping * Function invocation Separate off the func name, skipping
* trailing whitespace. * trailing whitespace.
......
...@@ -56,6 +56,7 @@ extern GLOBAL_VALUES globals; ...@@ -56,6 +56,7 @@ extern GLOBAL_VALUES globals;
void void
SetDlgStuff(HWND hdlg, ConnInfo *ci) SetDlgStuff(HWND hdlg, ConnInfo *ci)
{ {
/* /*
* If driver attribute NOT present, then set the datasource name and * If driver attribute NOT present, then set the datasource name and
* description * description
...@@ -791,6 +792,7 @@ getGlobalDefaults(char *section, char *filename, char override) ...@@ -791,6 +792,7 @@ getGlobalDefaults(char *section, char *filename, char override)
/* Dont allow override of an override! */ /* Dont allow override of an override! */
if (!override) if (!override)
{ {
/* /*
* ConnSettings is stored in the driver section and per datasource * ConnSettings is stored in the driver section and per datasource
* for override * for override
......
...@@ -112,9 +112,9 @@ SQLDriverConnect( ...@@ -112,9 +112,9 @@ SQLDriverConnect(
dconn_get_connect_attributes(connStrIn, ci); dconn_get_connect_attributes(connStrIn, ci);
/* /*
* If the ConnInfo in the hdbc is missing anything, * If the ConnInfo in the hdbc is missing anything, this function will
* this function will fill them in from the registry (assuming * fill them in from the registry (assuming of course there is a DSN
* of course there is a DSN given -- if not, it does nothing!) * given -- if not, it does nothing!)
*/ */
getDSNinfo(ci, CONN_DONT_OVERWRITE); getDSNinfo(ci, CONN_DONT_OVERWRITE);
...@@ -217,6 +217,7 @@ dialog: ...@@ -217,6 +217,7 @@ dialog:
if (szConnStrOut) if (szConnStrOut)
{ {
/* /*
* Return the completed string to the caller. The correct method * Return the completed string to the caller. The correct method
* is to only construct the connect string if a dialog was put up, * is to only construct the connect string if a dialog was put up,
......
...@@ -308,6 +308,7 @@ SQLError( ...@@ -308,6 +308,7 @@ SQLError(
break; break;
case CONN_TRANSACT_IN_PROGRES: case CONN_TRANSACT_IN_PROGRES:
strcpy(szSqlState, "S1010"); strcpy(szSqlState, "S1010");
/* /*
* when the user tries to switch commit mode in a * when the user tries to switch commit mode in a
* transaction * transaction
...@@ -441,8 +442,8 @@ EN_Destructor(EnvironmentClass *self) ...@@ -441,8 +442,8 @@ EN_Destructor(EnvironmentClass *self)
mylog("in EN_Destructor, self=%u\n", self); mylog("in EN_Destructor, self=%u\n", self);
/* /*
* the error messages are static strings distributed throughout * the error messages are static strings distributed throughout the
* the source--they should not be freed * source--they should not be freed
*/ */
/* Free any connections belonging to this environment */ /* Free any connections belonging to this environment */
......
...@@ -153,8 +153,8 @@ SQLExecDirect( ...@@ -153,8 +153,8 @@ SQLExecDirect(
free(stmt->statement); free(stmt->statement);
/* /*
* keep a copy of the un-parametrized statement, in case * keep a copy of the un-parametrized statement, in case they try to
* they try to execute this statement again * execute this statement again
*/ */
stmt->statement = make_string(szSqlStr, cbSqlStr, NULL); stmt->statement = make_string(szSqlStr, cbSqlStr, NULL);
if (!stmt->statement) if (!stmt->statement)
...@@ -170,9 +170,9 @@ SQLExecDirect( ...@@ -170,9 +170,9 @@ SQLExecDirect(
stmt->prepare = FALSE; stmt->prepare = FALSE;
/* /*
* If an SQLPrepare was performed prior to this, but was left in * If an SQLPrepare was performed prior to this, but was left in the
* the premature state because an error occurred prior to SQLExecute * premature state because an error occurred prior to SQLExecute then
* then set the statement to finished so it can be recycled. * set the statement to finished so it can be recycled.
*/ */
if (stmt->status == STMT_PREMATURE) if (stmt->status == STMT_PREMATURE)
stmt->status = STMT_FINISHED; stmt->status = STMT_FINISHED;
...@@ -288,18 +288,23 @@ SQLExecute( ...@@ -288,18 +288,23 @@ SQLExecute(
return SQL_ERROR; return SQL_ERROR;
} }
/* Check if statement has any data-at-execute parameters when it is not in SC_pre_execute. */ /*
* Check if statement has any data-at-execute parameters when it is
* not in SC_pre_execute.
*/
if (!stmt->pre_executing) if (!stmt->pre_executing)
{ {
/* /*
* The bound parameters could have possibly changed since the last * The bound parameters could have possibly changed since the last
* execute of this statement? Therefore check for params and re-copy. * execute of this statement? Therefore check for params and
* re-copy.
*/ */
stmt->data_at_exec = -1; stmt->data_at_exec = -1;
for (i = 0; i < stmt->parameters_allocated; i++) for (i = 0; i < stmt->parameters_allocated; i++)
{ {
Int4 *pcVal = stmt->parameters[i].used; Int4 *pcVal = stmt->parameters[i].used;
if (pcVal && (*pcVal == SQL_DATA_AT_EXEC || *pcVal <= SQL_LEN_DATA_AT_EXEC_OFFSET)) if (pcVal && (*pcVal == SQL_DATA_AT_EXEC || *pcVal <= SQL_LEN_DATA_AT_EXEC_OFFSET))
stmt->parameters[i].data_at_exec = TRUE; stmt->parameters[i].data_at_exec = TRUE;
else else
...@@ -313,11 +318,15 @@ SQLExecute( ...@@ -313,11 +318,15 @@ SQLExecute(
stmt->data_at_exec++; stmt->data_at_exec++;
} }
} }
/* If there are some data at execution parameters, return need data */
/* /*
* SQLParamData and SQLPutData will be used to send params and execute * If there are some data at execution parameters, return need
* the statement. * data
*/
/*
* SQLParamData and SQLPutData will be used to send params and
* execute the statement.
*/ */
if (stmt->data_at_exec > 0) if (stmt->data_at_exec > 0)
return SQL_NEED_DATA; return SQL_NEED_DATA;
...@@ -449,6 +458,7 @@ SQLCancel( ...@@ -449,6 +458,7 @@ SQLCancel(
*/ */
if (stmt->data_at_exec < 0) if (stmt->data_at_exec < 0)
{ {
/* /*
* MAJOR HACK for Windows to reset the driver manager's cursor * MAJOR HACK for Windows to reset the driver manager's cursor
* state: Because of what seems like a bug in the Odbc driver * state: Because of what seems like a bug in the Odbc driver
...@@ -753,8 +763,8 @@ SQLPutData( ...@@ -753,8 +763,8 @@ SQLPutData(
} }
/* /*
* major hack -- to allow convert to see somethings there * major hack -- to allow convert to see somethings there have
* have to modify convert to handle this better * to modify convert to handle this better
*/ */
current_param->EXEC_buffer = (char *) &current_param->lobj_oid; current_param->EXEC_buffer = (char *) &current_param->lobj_oid;
...@@ -788,6 +798,7 @@ SQLPutData( ...@@ -788,6 +798,7 @@ SQLPutData(
else else
{ {
Int2 ctype = current_param->CType; Int2 ctype = current_param->CType;
if (ctype == SQL_C_DEFAULT) if (ctype == SQL_C_DEFAULT)
ctype = sqltype_to_default_ctype(current_param->SQLType); ctype = sqltype_to_default_ctype(current_param->SQLType);
if (ctype == SQL_C_CHAR || ctype == SQL_C_BINARY) if (ctype == SQL_C_CHAR || ctype == SQL_C_BINARY)
...@@ -806,6 +817,7 @@ SQLPutData( ...@@ -806,6 +817,7 @@ SQLPutData(
else else
{ {
Int4 used = ctype_length(ctype); Int4 used = ctype_length(ctype);
current_param->EXEC_buffer = malloc(used); current_param->EXEC_buffer = malloc(used);
if (!current_param->EXEC_buffer) if (!current_param->EXEC_buffer)
{ {
......
...@@ -342,9 +342,8 @@ WritePrivateProfileString(char *theSection, /* section name */ ...@@ -342,9 +342,8 @@ WritePrivateProfileString(char *theSection, /* section name */
/* /*
* This doesn't make it so we find an ini file but allows normal * This doesn't make it so we find an ini file but allows normal
* processing to continue further on down. The likelihood is that * processing to continue further on down. The likelihood is that the
* the file won't be found and thus the default value will be * file won't be found and thus the default value will be returned.
* returned.
*/ */
if (MAXPGPATH - 1 < strlen(ptr) + j) if (MAXPGPATH - 1 < strlen(ptr) + j)
{ {
...@@ -357,8 +356,8 @@ WritePrivateProfileString(char *theSection, /* section name */ ...@@ -357,8 +356,8 @@ WritePrivateProfileString(char *theSection, /* section name */
sprintf(buf, "%s/%s", ptr, theIniFileName); sprintf(buf, "%s/%s", ptr, theIniFileName);
/* /*
* This code makes it so that a file in the users home dir * This code makes it so that a file in the users home dir overrides a
* overrides a the "default" file as passed in * the "default" file as passed in
*/ */
aFile = (FILE *) (buf ? fopen(buf, "r+") : NULL); aFile = (FILE *) (buf ? fopen(buf, "r+") : NULL);
if (!aFile) if (!aFile)
...@@ -372,9 +371,9 @@ WritePrivateProfileString(char *theSection, /* section name */ ...@@ -372,9 +371,9 @@ WritePrivateProfileString(char *theSection, /* section name */
aLength = strlen(theBuffer); aLength = strlen(theBuffer);
/* /*
* We have to search for theKey, because if it already * We have to search for theKey, because if it already exists we have
* exists we have to overwrite it. If it doesn't exist * to overwrite it. If it doesn't exist we just write a new line to
* we just write a new line to the file. * the file.
*/ */
while (fgets(aLine, sizeof(aLine), aFile) != NULL) while (fgets(aLine, sizeof(aLine), aFile) != NULL)
{ {
......
...@@ -153,6 +153,7 @@ SQLGetInfo( ...@@ -153,6 +153,7 @@ SQLGetInfo(
break; break;
case SQL_CORRELATION_NAME: /* ODBC 1.0 */ case SQL_CORRELATION_NAME: /* ODBC 1.0 */
/* /*
* Saying no correlation name makes Query not work right. * Saying no correlation name makes Query not work right.
* value = SQL_CN_NONE; * value = SQL_CN_NONE;
...@@ -180,6 +181,7 @@ SQLGetInfo( ...@@ -180,6 +181,7 @@ SQLGetInfo(
break; break;
case SQL_DATABASE_NAME:/* Support for old ODBC 1.0 Apps */ case SQL_DATABASE_NAME:/* Support for old ODBC 1.0 Apps */
/* /*
* Returning the database name causes problems in MS Query. It * Returning the database name causes problems in MS Query. It
* generates query like: "SELECT DISTINCT a FROM byronnbad3 * generates query like: "SELECT DISTINCT a FROM byronnbad3
...@@ -195,6 +197,7 @@ SQLGetInfo( ...@@ -195,6 +197,7 @@ SQLGetInfo(
break; break;
case SQL_DBMS_VER: /* ODBC 1.0 */ case SQL_DBMS_VER: /* ODBC 1.0 */
/* /*
* The ODBC spec wants ##.##.#### ...whatever... so prepend * The ODBC spec wants ##.##.#### ...whatever... so prepend
* the driver * the driver
...@@ -252,6 +255,7 @@ SQLGetInfo( ...@@ -252,6 +255,7 @@ SQLGetInfo(
break; break;
case SQL_IDENTIFIER_CASE: /* ODBC 1.0 */ case SQL_IDENTIFIER_CASE: /* ODBC 1.0 */
/* /*
* are identifiers case-sensitive (yes, but only when quoted. * are identifiers case-sensitive (yes, but only when quoted.
* If not quoted, they default to lowercase) * If not quoted, they default to lowercase)
...@@ -270,6 +274,7 @@ SQLGetInfo( ...@@ -270,6 +274,7 @@ SQLGetInfo(
break; break;
case SQL_LIKE_ESCAPE_CLAUSE: /* ODBC 2.0 */ case SQL_LIKE_ESCAPE_CLAUSE: /* ODBC 2.0 */
/* /*
* is there a character that escapes '%' and '_' in a LIKE * is there a character that escapes '%' and '_' in a LIKE
* clause? not as far as I can tell * clause? not as far as I can tell
...@@ -362,6 +367,7 @@ SQLGetInfo( ...@@ -362,6 +367,7 @@ SQLGetInfo(
break; break;
case SQL_MAX_ROW_SIZE_INCLUDES_LONG: /* ODBC 2.0 */ case SQL_MAX_ROW_SIZE_INCLUDES_LONG: /* ODBC 2.0 */
/* /*
* does the preceding value include LONGVARCHAR and * does the preceding value include LONGVARCHAR and
* LONGVARBINARY fields? Well, it does include longvarchar, * LONGVARBINARY fields? Well, it does include longvarchar,
...@@ -410,6 +416,7 @@ SQLGetInfo( ...@@ -410,6 +416,7 @@ SQLGetInfo(
break; break;
case SQL_NEED_LONG_DATA_LEN: /* ODBC 2.0 */ case SQL_NEED_LONG_DATA_LEN: /* ODBC 2.0 */
/* /*
* Don't need the length, SQLPutData can handle any size and * Don't need the length, SQLPutData can handle any size and
* multiple calls * multiple calls
...@@ -537,6 +544,7 @@ SQLGetInfo( ...@@ -537,6 +544,7 @@ SQLGetInfo(
break; break;
case SQL_ROW_UPDATES: /* ODBC 1.0 */ case SQL_ROW_UPDATES: /* ODBC 1.0 */
/* /*
* Driver doesn't support keyset-driven or mixed cursors, so * Driver doesn't support keyset-driven or mixed cursors, so
* not much point in saying row updates are supported * not much point in saying row updates are supported
...@@ -624,6 +632,7 @@ SQLGetInfo( ...@@ -624,6 +632,7 @@ SQLGetInfo(
break; break;
case SQL_TXN_CAPABLE: /* ODBC 1.0 */ case SQL_TXN_CAPABLE: /* ODBC 1.0 */
/* /*
* Postgres can deal with create or drop table statements in a * Postgres can deal with create or drop table statements in a
* transaction * transaction
...@@ -1297,6 +1306,7 @@ SQLTables( ...@@ -1297,6 +1306,7 @@ SQLTables(
result = SQLFetch(htbl_stmt); result = SQLFetch(htbl_stmt);
while ((result == SQL_SUCCESS) || (result == SQL_SUCCESS_WITH_INFO)) while ((result == SQL_SUCCESS) || (result == SQL_SUCCESS_WITH_INFO))
{ {
/* /*
* Determine if this table name is a system table. If treating * Determine if this table name is a system table. If treating
* system tables as regular tables, then no need to do this test. * system tables as regular tables, then no need to do this test.
...@@ -1351,9 +1361,9 @@ SQLTables( ...@@ -1351,9 +1361,9 @@ SQLTables(
/* /*
* I have to hide the table owner from Access, otherwise it * I have to hide the table owner from Access, otherwise it
* insists on referring to the table as 'owner.table'. * insists on referring to the table as 'owner.table'. (this
* (this is valid according to the ODBC SQL grammar, but * is valid according to the ODBC SQL grammar, but Postgres
* Postgres won't support it.) * won't support it.)
* *
* set_tuplefield_string(&row->tuple[1], table_owner); * set_tuplefield_string(&row->tuple[1], table_owner);
*/ */
...@@ -1379,8 +1389,8 @@ SQLTables( ...@@ -1379,8 +1389,8 @@ SQLTables(
} }
/* /*
* also, things need to think that this statement is finished so * also, things need to think that this statement is finished so the
* the results can be retrieved. * results can be retrieved.
*/ */
stmt->status = STMT_FINISHED; stmt->status = STMT_FINISHED;
...@@ -1463,8 +1473,8 @@ SQLColumns( ...@@ -1463,8 +1473,8 @@ SQLColumns(
my_strcat(columns_query, " and a.attname like '%.*s'", szColumnName, cbColumnName); my_strcat(columns_query, " and a.attname like '%.*s'", szColumnName, cbColumnName);
/* /*
* give the output in the order the columns were defined * give the output in the order the columns were defined when the
* when the table was created * table was created
*/ */
strcat(columns_query, " order by attnum"); strcat(columns_query, " order by attnum");
...@@ -1787,8 +1797,8 @@ SQLColumns( ...@@ -1787,8 +1797,8 @@ SQLColumns(
} }
/* /*
* Put the row version column at the end so it might not be * Put the row version column at the end so it might not be mistaken
* mistaken for a key field. * for a key field.
*/ */
if (relhasrules[0] != '1' && !stmt->internal && atoi(ci->row_versioning)) if (relhasrules[0] != '1' && !stmt->internal && atoi(ci->row_versioning))
{ {
...@@ -1817,8 +1827,8 @@ SQLColumns( ...@@ -1817,8 +1827,8 @@ SQLColumns(
} }
/* /*
* also, things need to think that this statement is finished so * also, things need to think that this statement is finished so the
* the results can be retrieved. * results can be retrieved.
*/ */
stmt->status = STMT_FINISHED; stmt->status = STMT_FINISHED;
...@@ -2064,8 +2074,8 @@ SQLStatistics( ...@@ -2064,8 +2074,8 @@ SQLStatistics(
QR_set_field_info(stmt->result, 12, "FILTER_CONDITION", PG_TYPE_TEXT, MAX_INFO_STRING); QR_set_field_info(stmt->result, 12, "FILTER_CONDITION", PG_TYPE_TEXT, MAX_INFO_STRING);
/* /*
* only use the table name... the owner should be redundant, and * only use the table name... the owner should be redundant, and we
* we never use qualifiers. * never use qualifiers.
*/ */
table_name = make_string(szTableName, cbTableName, NULL); table_name = make_string(szTableName, cbTableName, NULL);
if (!table_name) if (!table_name)
...@@ -2077,8 +2087,8 @@ SQLStatistics( ...@@ -2077,8 +2087,8 @@ SQLStatistics(
} }
/* /*
* we need to get a list of the field names first, * we need to get a list of the field names first, so we can return
* so we can return them later. * them later.
*/ */
result = SQLAllocStmt(stmt->hdbc, &hcol_stmt); result = SQLAllocStmt(stmt->hdbc, &hcol_stmt);
if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO)) if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
...@@ -2168,6 +2178,7 @@ SQLStatistics( ...@@ -2168,6 +2178,7 @@ SQLStatistics(
result = SQLExecDirect(hindx_stmt, index_query, strlen(index_query)); result = SQLExecDirect(hindx_stmt, index_query, strlen(index_query));
if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO)) if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
{ {
/* /*
* "Couldn't execute index query (w/SQLExecDirect) in * "Couldn't execute index query (w/SQLExecDirect) in
* SQLStatistics."; * SQLStatistics.";
...@@ -2352,8 +2363,8 @@ SQLStatistics( ...@@ -2352,8 +2363,8 @@ SQLStatistics(
SQLFreeStmt(hindx_stmt, SQL_DROP); SQLFreeStmt(hindx_stmt, SQL_DROP);
/* /*
* also, things need to think that this statement is finished so * also, things need to think that this statement is finished so the
* the results can be retrieved. * results can be retrieved.
*/ */
stmt->status = STMT_FINISHED; stmt->status = STMT_FINISHED;
...@@ -2575,8 +2586,8 @@ SQLPrimaryKeys( ...@@ -2575,8 +2586,8 @@ SQLPrimaryKeys(
/* /*
* also, things need to think that this statement is finished so * also, things need to think that this statement is finished so the
* the results can be retrieved. * results can be retrieved.
*/ */
stmt->status = STMT_FINISHED; stmt->status = STMT_FINISHED;
...@@ -2636,6 +2647,7 @@ SQLForeignKeys( ...@@ -2636,6 +2647,7 @@ SQLForeignKeys(
#if (ODBCVER >= 0x0300) #if (ODBCVER >= 0x0300)
SWORD defer_type; SWORD defer_type;
#endif #endif
char pkey[MAX_INFO_STRING]; char pkey[MAX_INFO_STRING];
Int2 result_cols; Int2 result_cols;
...@@ -2690,8 +2702,8 @@ SQLForeignKeys( ...@@ -2690,8 +2702,8 @@ SQLForeignKeys(
#endif /* ODBCVER >= 0x0300 */ #endif /* ODBCVER >= 0x0300 */
/* /*
* also, things need to think that this statement is finished so * also, things need to think that this statement is finished so the
* the results can be retrieved. * results can be retrieved.
*/ */
stmt->status = STMT_FINISHED; stmt->status = STMT_FINISHED;
......
...@@ -85,6 +85,7 @@ mylog(char *fmt,...) ...@@ -85,6 +85,7 @@ mylog(char *fmt,...)
va_end(args); va_end(args);
} }
} }
#endif #endif
...@@ -114,6 +115,7 @@ qlog(char *fmt,...) ...@@ -114,6 +115,7 @@ qlog(char *fmt,...)
va_end(args); va_end(args);
} }
} }
#endif #endif
/* Undefine these because windows.h will redefine and cause a warning */ /* Undefine these because windows.h will redefine and cause a warning */
......
...@@ -67,6 +67,7 @@ set_statement_option(ConnectionClass *conn, ...@@ -67,6 +67,7 @@ set_statement_option(ConnectionClass *conn,
break; break;
case SQL_CONCURRENCY: case SQL_CONCURRENCY:
/* /*
* positioned update isn't supported so cursor concurrency is * positioned update isn't supported so cursor concurrency is
* read-only * read-only
...@@ -101,6 +102,7 @@ set_statement_option(ConnectionClass *conn, ...@@ -101,6 +102,7 @@ set_statement_option(ConnectionClass *conn,
*/ */
case SQL_CURSOR_TYPE: case SQL_CURSOR_TYPE:
/* /*
* if declare/fetch, then type can only be forward. otherwise, * if declare/fetch, then type can only be forward. otherwise,
* it can only be forward or static. * it can only be forward or static.
...@@ -191,12 +193,12 @@ set_statement_option(ConnectionClass *conn, ...@@ -191,12 +193,12 @@ set_statement_option(ConnectionClass *conn,
mylog("SetStmtOption: SQL_NOSCAN, vParam = %d\n", vParam); mylog("SetStmtOption: SQL_NOSCAN, vParam = %d\n", vParam);
break; break;
case SQL_QUERY_TIMEOUT: /* ignored */ case SQL_QUERY_TIMEOUT:/* ignored */
mylog("SetStmtOption: SQL_QUERY_TIMEOUT, vParam = %d\n", vParam); mylog("SetStmtOption: SQL_QUERY_TIMEOUT, vParam = %d\n", vParam);
/* "0" returned in SQLGetStmtOption */ /* "0" returned in SQLGetStmtOption */
break; break;
case SQL_RETRIEVE_DATA: /* ignored, but saved */ case SQL_RETRIEVE_DATA:/* ignored, but saved */
mylog("SetStmtOption(): SQL_RETRIEVE_DATA, vParam = %d\n", vParam); mylog("SetStmtOption(): SQL_RETRIEVE_DATA, vParam = %d\n", vParam);
if (conn) if (conn)
conn->stmtOptions.retrieve_data = vParam; conn->stmtOptions.retrieve_data = vParam;
...@@ -315,6 +317,7 @@ SQLSetConnectOption( ...@@ -315,6 +317,7 @@ SQLSetConnectOption(
switch (fOption) switch (fOption)
{ {
/* /*
* Statement Options (apply to all stmts on the connection and * Statement Options (apply to all stmts on the connection and
* become defaults for new stmts) * become defaults for new stmts)
...@@ -392,7 +395,7 @@ SQLSetConnectOption( ...@@ -392,7 +395,7 @@ SQLSetConnectOption(
case SQL_CURRENT_QUALIFIER: /* ignored */ case SQL_CURRENT_QUALIFIER: /* ignored */
break; break;
case SQL_LOGIN_TIMEOUT: /* ignored */ case SQL_LOGIN_TIMEOUT:/* ignored */
break; break;
case SQL_PACKET_SIZE: /* ignored */ case SQL_PACKET_SIZE: /* ignored */
...@@ -401,7 +404,7 @@ SQLSetConnectOption( ...@@ -401,7 +404,7 @@ SQLSetConnectOption(
case SQL_QUIET_MODE: /* ignored */ case SQL_QUIET_MODE: /* ignored */
break; break;
case SQL_TXN_ISOLATION: /* ignored */ case SQL_TXN_ISOLATION:/* ignored */
break; break;
/* These options should be handled by driver manager */ /* These options should be handled by driver manager */
...@@ -471,7 +474,7 @@ SQLGetConnectOption( ...@@ -471,7 +474,7 @@ SQLGetConnectOption(
break; break;
case SQL_LOGIN_TIMEOUT: /* NOT SUPPORTED */ case SQL_LOGIN_TIMEOUT:/* NOT SUPPORTED */
*((UDWORD *) pvParam) = 0; *((UDWORD *) pvParam) = 0;
break; break;
...@@ -483,7 +486,7 @@ SQLGetConnectOption( ...@@ -483,7 +486,7 @@ SQLGetConnectOption(
*((UDWORD *) pvParam) = (UDWORD) NULL; *((UDWORD *) pvParam) = (UDWORD) NULL;
break; break;
case SQL_TXN_ISOLATION: /* NOT SUPPORTED */ case SQL_TXN_ISOLATION:/* NOT SUPPORTED */
*((UDWORD *) pvParam) = SQL_TXN_SERIALIZABLE; *((UDWORD *) pvParam) = SQL_TXN_SERIALIZABLE;
break; break;
...@@ -525,9 +528,9 @@ SQLSetStmtOption( ...@@ -525,9 +528,9 @@ SQLSetStmtOption(
mylog("%s: entering...\n", func); mylog("%s: entering...\n", func);
/* /*
* Though we could fake Access out by just returning SQL_SUCCESS * Though we could fake Access out by just returning SQL_SUCCESS all
* all the time, but it tries to set a huge value for SQL_MAX_LENGTH * the time, but it tries to set a huge value for SQL_MAX_LENGTH and
* and expects the driver to reduce it to the real value. * expects the driver to reduce it to the real value.
*/ */
if (!stmt) if (!stmt)
{ {
...@@ -552,9 +555,9 @@ SQLGetStmtOption( ...@@ -552,9 +555,9 @@ SQLGetStmtOption(
mylog("%s: entering...\n", func); mylog("%s: entering...\n", func);
/* /*
* thought we could fake Access out by just returning SQL_SUCCESS * thought we could fake Access out by just returning SQL_SUCCESS all
* all the time, but it tries to set a huge value for SQL_MAX_LENGTH * the time, but it tries to set a huge value for SQL_MAX_LENGTH and
* and expects the driver to reduce it to the real value * expects the driver to reduce it to the real value
*/ */
if (!stmt) if (!stmt)
{ {
......
...@@ -233,7 +233,8 @@ getColInfo(COL_INFO *col_info, FIELD_INFO *fi, int k) ...@@ -233,7 +233,8 @@ getColInfo(COL_INFO *col_info, FIELD_INFO *fi, int k)
char char
searchColInfo(COL_INFO *col_info, FIELD_INFO *fi) searchColInfo(COL_INFO *col_info, FIELD_INFO *fi)
{ {
int k, cmp; int k,
cmp;
char *col; char *col;
for (k = 0; k < QR_get_num_tuples(col_info->result); k++) for (k = 0; k < QR_get_num_tuples(col_info->result); k++)
...@@ -576,6 +577,7 @@ parse_statement(StatementClass *stmt) ...@@ -576,6 +577,7 @@ parse_statement(StatementClass *stmt)
if (!dquote) if (!dquote)
{ {
char *ptr; char *ptr;
/* lower case table name */ /* lower case table name */
for (ptr = ti[stmt->ntab]->name; *ptr; ptr++) for (ptr = ti[stmt->ntab]->name; *ptr; ptr++)
*ptr = tolower((unsigned char) *ptr); *ptr = tolower((unsigned char) *ptr);
......
...@@ -262,6 +262,7 @@ pgtype_to_sqltype(StatementClass *stmt, Int4 type) ...@@ -262,6 +262,7 @@ pgtype_to_sqltype(StatementClass *stmt, Int4 type)
return globals.bools_as_char ? SQL_CHAR : SQL_BIT; return globals.bools_as_char ? SQL_CHAR : SQL_BIT;
default: default:
/* /*
* first, check to see if 'type' is in list. If not, look up * first, check to see if 'type' is in list. If not, look up
* with query. Add oid, name to list. If it's already in * with query. Add oid, name to list. If it's already in
...@@ -922,6 +923,7 @@ pgtype_create_params(StatementClass *stmt, Int4 type) ...@@ -922,6 +923,7 @@ pgtype_create_params(StatementClass *stmt, Int4 type)
Int2 Int2
sqltype_to_default_ctype(Int2 sqltype) sqltype_to_default_ctype(Int2 sqltype)
{ {
/* /*
* from the table on page 623 of ODBC 2.0 Programmer's Reference * from the table on page 623 of ODBC 2.0 Programmer's Reference
* (Appendix D) * (Appendix D)
......
...@@ -138,8 +138,8 @@ QR_Destructor(QResultClass *self) ...@@ -138,8 +138,8 @@ QR_Destructor(QResultClass *self)
TL_Destructor(self->manual_tuples); TL_Destructor(self->manual_tuples);
/* /*
* If conn is defined, then we may have used "backend_tuples", * If conn is defined, then we may have used "backend_tuples", so in
* so in case we need to, free it up. Also, close the cursor. * case we need to, free it up. Also, close the cursor.
*/ */
if (self->conn && self->conn->sock && CC_is_in_trans(self->conn)) if (self->conn && self->conn->sock && CC_is_in_trans(self->conn))
QR_close(self); /* close the cursor if there is one */ QR_close(self); /* close the cursor if there is one */
...@@ -232,11 +232,10 @@ QR_fetch_tuples(QResultClass *self, ConnectionClass *conn, char *cursor) ...@@ -232,11 +232,10 @@ QR_fetch_tuples(QResultClass *self, ConnectionClass *conn, char *cursor)
int tuple_size; int tuple_size;
/* /*
* If called from send_query the first time (conn != NULL), * If called from send_query the first time (conn != NULL), then set
* then set the inTuples state, * the inTuples state, and read the tuples. If conn is NULL, it
* and read the tuples. If conn is NULL, * implies that we are being called from next_tuple(), like to get
* it implies that we are being called from next_tuple(), * more rows so don't call next_tuple again!
* like to get more rows so don't call next_tuple again!
*/ */
if (conn != NULL) if (conn != NULL)
{ {
...@@ -303,9 +302,10 @@ QR_fetch_tuples(QResultClass *self, ConnectionClass *conn, char *cursor) ...@@ -303,9 +302,10 @@ QR_fetch_tuples(QResultClass *self, ConnectionClass *conn, char *cursor)
} }
else else
{ {
/* /*
* Always have to read the field attributes. * Always have to read the field attributes. But we dont have to
* But we dont have to reallocate memory for them! * reallocate memory for them!
*/ */
if (!CI_read_fields(NULL, self->conn)) if (!CI_read_fields(NULL, self->conn))
...@@ -390,8 +390,10 @@ QR_next_tuple(QResultClass *self) ...@@ -390,8 +390,10 @@ QR_next_tuple(QResultClass *self)
int end_tuple = self->rowset_size + self->base; int end_tuple = self->rowset_size + self->base;
char corrected = FALSE; char corrected = FALSE;
TupleField *the_tuples = self->backend_tuples; TupleField *the_tuples = self->backend_tuples;
/* ERROR_MSG_LENGTH is sufficient */ /* ERROR_MSG_LENGTH is sufficient */
static char msgbuffer[ERROR_MSG_LENGTH + 1]; static char msgbuffer[ERROR_MSG_LENGTH + 1];
/* QR_set_command() dups this string so doesn't need static */ /* QR_set_command() dups this string so doesn't need static */
char cmdbuffer[ERROR_MSG_LENGTH + 1]; char cmdbuffer[ERROR_MSG_LENGTH + 1];
char fetch[128]; char fetch[128];
...@@ -417,6 +419,7 @@ QR_next_tuple(QResultClass *self) ...@@ -417,6 +419,7 @@ QR_next_tuple(QResultClass *self)
} }
else else
{ {
/* /*
* See if we need to fetch another group of rows. We may be being * See if we need to fetch another group of rows. We may be being
* called from send_query(), and if so, don't send another fetch, * called from send_query(), and if so, don't send another fetch,
...@@ -646,6 +649,7 @@ QR_read_tuple(QResultClass *self, char binary) ...@@ -646,6 +649,7 @@ QR_read_tuple(QResultClass *self, char binary)
} }
else else
{ {
/* /*
* NO, the field is not null. so get at first the length of * NO, the field is not null. so get at first the length of
* the field (four bytes) * the field (four bytes)
......
...@@ -592,6 +592,7 @@ SQLColAttributes( ...@@ -592,6 +592,7 @@ SQLColAttributes(
break; break;
case SQL_COLUMN_UPDATABLE: case SQL_COLUMN_UPDATABLE:
/* /*
* Neither Access or Borland care about this. * Neither Access or Borland care about this.
* *
...@@ -992,6 +993,7 @@ SQLExtendedFetch( ...@@ -992,6 +993,7 @@ SQLExtendedFetch(
switch (fFetchType) switch (fFetchType)
{ {
case SQL_FETCH_NEXT: case SQL_FETCH_NEXT:
/* /*
* From the odbc spec... If positioned before the start of the * From the odbc spec... If positioned before the start of the
* RESULT SET, then this should be equivalent to * RESULT SET, then this should be equivalent to
...@@ -1009,6 +1011,7 @@ SQLExtendedFetch( ...@@ -1009,6 +1011,7 @@ SQLExtendedFetch(
case SQL_FETCH_PRIOR: case SQL_FETCH_PRIOR:
mylog("SQL_FETCH_PRIOR: num_tuples=%d, currtuple=%d\n", num_tuples, stmt->currTuple); mylog("SQL_FETCH_PRIOR: num_tuples=%d, currtuple=%d\n", num_tuples, stmt->currTuple);
/* /*
* From the odbc spec... If positioned after the end of the * From the odbc spec... If positioned after the end of the
* RESULT SET, then this should be equivalent to * RESULT SET, then this should be equivalent to
...@@ -1054,6 +1057,7 @@ SQLExtendedFetch( ...@@ -1054,6 +1057,7 @@ SQLExtendedFetch(
break; break;
case SQL_FETCH_RELATIVE: case SQL_FETCH_RELATIVE:
/* /*
* Refresh the current rowset -- not currently implemented, * Refresh the current rowset -- not currently implemented,
* but lie anyway * but lie anyway
......
...@@ -265,6 +265,7 @@ ConfigDlgProc(HWND hdlg, ...@@ -265,6 +265,7 @@ ConfigDlgProc(HWND hdlg,
case WM_COMMAND: case WM_COMMAND:
switch (GET_WM_COMMAND_ID(wParam, lParam)) switch (GET_WM_COMMAND_ID(wParam, lParam))
{ {
/* /*
* Ensure the OK button is enabled only when a data * Ensure the OK button is enabled only when a data
* source name * source name
...@@ -353,7 +354,11 @@ ParseAttributes(LPCSTR lpszAttributes, LPSETUPDLG lpsetupdlg) ...@@ -353,7 +354,11 @@ ParseAttributes(LPCSTR lpszAttributes, LPSETUPDLG lpsetupdlg)
for (lpsz = lpszAttributes; *lpsz; lpsz++) for (lpsz = lpszAttributes; *lpsz; lpsz++)
{ {
/* Extract key name (e.g., DSN), it must be terminated by an equals */
/*
* Extract key name (e.g., DSN), it must be terminated by an
* equals
*/
lpszStart = lpsz; lpszStart = lpsz;
for (;; lpsz++) for (;; lpsz++)
{ {
......
...@@ -302,9 +302,9 @@ SOCK_get_next_byte(SocketClass *self) ...@@ -302,9 +302,9 @@ SOCK_get_next_byte(SocketClass *self)
{ {
if (self->buffer_read_in >= self->buffer_filled_in) if (self->buffer_read_in >= self->buffer_filled_in)
{ {
/* /*
* there are no more bytes left in the buffer so * there are no more bytes left in the buffer so reload the buffer
* reload the buffer
*/ */
self->buffer_read_in = 0; self->buffer_read_in = 0;
self->buffer_filled_in = recv(self->socket, (char *) self->buffer_in, globals.socket_buffersize, 0); self->buffer_filled_in = recv(self->socket, (char *) self->buffer_in, globals.socket_buffersize, 0);
......
...@@ -181,11 +181,10 @@ SQLFreeStmt(HSTMT hstmt, ...@@ -181,11 +181,10 @@ SQLFreeStmt(HSTMT hstmt,
SC_Destructor(stmt); SC_Destructor(stmt);
} }
else if (fOption == SQL_UNBIND) else if (fOption == SQL_UNBIND)
{
SC_unbind_cols(stmt); SC_unbind_cols(stmt);
}
else if (fOption == SQL_CLOSE) else if (fOption == SQL_CLOSE)
{ {
/* /*
* this should discard all the results, but leave the statement * this should discard all the results, but leave the statement
* itself in place (it can be executed again) * itself in place (it can be executed again)
...@@ -198,9 +197,7 @@ SQLFreeStmt(HSTMT hstmt, ...@@ -198,9 +197,7 @@ SQLFreeStmt(HSTMT hstmt,
} }
} }
else if (fOption == SQL_RESET_PARAMS) else if (fOption == SQL_RESET_PARAMS)
{
SC_free_params(stmt, STMT_FREE_PARAMS_ALL); SC_free_params(stmt, STMT_FREE_PARAMS_ALL);
}
else else
{ {
stmt->errormsg = "Invalid option passed to SQLFreeStmt."; stmt->errormsg = "Invalid option passed to SQLFreeStmt.";
...@@ -321,8 +318,8 @@ SC_Destructor(StatementClass *self) ...@@ -321,8 +318,8 @@ SC_Destructor(StatementClass *self)
/* /*
* the memory pointed to by the bindings is not deallocated by the * the memory pointed to by the bindings is not deallocated by the
* driver but by the application that uses that driver, so we don't have to * driver but by the application that uses that driver, so we don't
* care * have to care
*/ */
/* about that here. */ /* about that here. */
if (self->bindings) if (self->bindings)
...@@ -534,8 +531,8 @@ SC_recycle_statement(StatementClass *self) ...@@ -534,8 +531,8 @@ SC_recycle_statement(StatementClass *self)
/* /*
* Free any data at exec params before the statement is executed * Free any data at exec params before the statement is executed
* again. If not, then there will be a memory leak when * again. If not, then there will be a memory leak when the next
* the next SQLParamData/SQLPutData is called. * SQLParamData/SQLPutData is called.
*/ */
SC_free_params(self, STMT_FREE_PARAMS_DATA_AT_EXEC_ONLY); SC_free_params(self, STMT_FREE_PARAMS_DATA_AT_EXEC_ONLY);
...@@ -556,6 +553,7 @@ SC_pre_execute(StatementClass *self) ...@@ -556,6 +553,7 @@ SC_pre_execute(StatementClass *self)
if (self->statement_type == STMT_TYPE_SELECT) if (self->statement_type == STMT_TYPE_SELECT)
{ {
char old_pre_executing = self->pre_executing; char old_pre_executing = self->pre_executing;
self->pre_executing = TRUE; self->pre_executing = TRUE;
self->inaccurate_result = FALSE; self->inaccurate_result = FALSE;
...@@ -715,6 +713,7 @@ SC_fetch(StatementClass *self) ...@@ -715,6 +713,7 @@ SC_fetch(StatementClass *self)
if (self->currTuple >= QR_get_num_tuples(res) - 1 || if (self->currTuple >= QR_get_num_tuples(res) - 1 ||
(self->options.maxRows > 0 && self->currTuple == self->options.maxRows - 1)) (self->options.maxRows > 0 && self->currTuple == self->options.maxRows - 1))
{ {
/* /*
* if at the end of the tuples, return "no data found" and set * if at the end of the tuples, return "no data found" and set
* the cursor past the end of the result set * the cursor past the end of the result set
......
...@@ -215,8 +215,8 @@ struct StatementClass_ ...@@ -215,8 +215,8 @@ struct StatementClass_
* substitution */ * substitution */
char pre_executing; /* This statement is prematurely executing */ char pre_executing; /* This statement is prematurely executing */
char inaccurate_result; /* Current status is PREMATURE char inaccurate_result; /* Current status is PREMATURE but
* but result is inaccurate */ * result is inaccurate */
}; };
#define SC_get_conn(a) (a->hdbc) #define SC_get_conn(a) (a->hdbc)
......
...@@ -137,6 +137,7 @@ TL_get_fieldval(TupleListClass *self, Int4 tupleno, Int2 fieldno) ...@@ -137,6 +137,7 @@ TL_get_fieldval(TupleListClass *self, Int4 tupleno, Int2 fieldno)
} }
else if (start_is_closer) else if (start_is_closer)
{ {
/* /*
* the shortest way is to start the search from the head of the * the shortest way is to start the search from the head of the
* list * list
...@@ -182,6 +183,7 @@ TL_get_fieldval(TupleListClass *self, Int4 tupleno, Int2 fieldno) ...@@ -182,6 +183,7 @@ TL_get_fieldval(TupleListClass *self, Int4 tupleno, Int2 fieldno)
char char
TL_add_tuple(TupleListClass *self, TupleNode *new_field) TL_add_tuple(TupleListClass *self, TupleNode *new_field)
{ {
/* /*
* we append the tuple at the end of the doubly linked list of the * we append the tuple at the end of the doubly linked list of the
* tuples we have already read in * tuples we have already read in
...@@ -200,6 +202,7 @@ TL_add_tuple(TupleListClass *self, TupleNode *new_field) ...@@ -200,6 +202,7 @@ TL_add_tuple(TupleListClass *self, TupleNode *new_field)
} }
else else
{ {
/* /*
* there is already an element in the list, so add the new one at * there is already an element in the list, so add the new one at
* the end of the list * the end of the list
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment