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