Commit ddae527c authored by Bruce Momjian's avatar Bruce Momjian

Remove // comments from ODBC.

parent c328e75a
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
#include <sqlext.h> #include <sqlext.h>
#endif #endif
// Bind parameters on a statement handle /* Bind parameters on a statement handle */
RETCODE SQL_API SQLBindParameter( RETCODE SQL_API SQLBindParameter(
HSTMT hstmt, HSTMT hstmt,
...@@ -75,18 +75,18 @@ static char *func="SQLBindParameter"; ...@@ -75,18 +75,18 @@ static char *func="SQLBindParameter";
stmt->parameters_allocated = ipar; stmt->parameters_allocated = ipar;
// copy the old parameters over /* copy the old parameters over */
for(i = 0; i < old_parameters_allocated; i++) { for(i = 0; i < old_parameters_allocated; i++) {
// a structure copy should work /* a structure copy should work */
stmt->parameters[i] = old_parameters[i]; stmt->parameters[i] = old_parameters[i];
} }
// get rid of the old parameters, if there were any /* get rid of the old parameters, if there were any */
if(old_parameters) if(old_parameters)
free(old_parameters); free(old_parameters);
// zero out the newly allocated parameters (in case they skipped some, /* zero out the newly allocated parameters (in case they skipped some, */
// so we don't accidentally try to use them later) /* so we don't accidentally try to use them later) */
for(; i < stmt->parameters_allocated; i++) { for(; i < stmt->parameters_allocated; i++) {
stmt->parameters[i].buflen = 0; stmt->parameters[i].buflen = 0;
stmt->parameters[i].buffer = 0; stmt->parameters[i].buffer = 0;
...@@ -105,7 +105,7 @@ static char *func="SQLBindParameter"; ...@@ -105,7 +105,7 @@ static char *func="SQLBindParameter";
ipar--; /* use zero based column numbers for the below part */ ipar--; /* use zero based column numbers for the below part */
// store the given info /* store the given info */
stmt->parameters[ipar].buflen = cbValueMax; stmt->parameters[ipar].buflen = cbValueMax;
stmt->parameters[ipar].buffer = rgbValue; stmt->parameters[ipar].buffer = rgbValue;
stmt->parameters[ipar].used = pcbValue; stmt->parameters[ipar].used = pcbValue;
...@@ -140,9 +140,9 @@ static char *func="SQLBindParameter"; ...@@ -140,9 +140,9 @@ static char *func="SQLBindParameter";
return SQL_SUCCESS; return SQL_SUCCESS;
} }
// - - - - - - - - - /* - - - - - - - - - */
// Associate a user-supplied buffer with a database column. /* Associate a user-supplied buffer with a database column. */
RETCODE SQL_API SQLBindCol( RETCODE SQL_API SQLBindCol(
HSTMT hstmt, HSTMT hstmt,
UWORD icol, UWORD icol,
...@@ -195,14 +195,14 @@ mylog("**** SQLBindCol: stmt = %u, icol = %d\n", stmt, icol); ...@@ -195,14 +195,14 @@ mylog("**** SQLBindCol: stmt = %u, icol = %d\n", stmt, icol);
return SQL_SUCCESS; return SQL_SUCCESS;
} }
// allocate enough bindings if not already done /* allocate enough bindings if not already done */
// Most likely, execution of a statement would have setup the /* Most likely, execution of a statement would have setup the */
// necessary bindings. But some apps call BindCol before any /* necessary bindings. 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);
// check to see if the bindings were allocated /* check to see if the bindings were allocated */
if ( ! stmt->bindings) { if ( ! stmt->bindings) {
stmt->errormsg = "Could not allocate memory for bindings."; stmt->errormsg = "Could not allocate memory for bindings.";
stmt->errornumber = STMT_NO_MEMORY_ERROR; stmt->errornumber = STMT_NO_MEMORY_ERROR;
...@@ -234,14 +234,14 @@ mylog("**** SQLBindCol: stmt = %u, icol = %d\n", stmt, icol); ...@@ -234,14 +234,14 @@ mylog("**** SQLBindCol: stmt = %u, icol = %d\n", stmt, icol);
return SQL_SUCCESS; return SQL_SUCCESS;
} }
// - - - - - - - - - /* - - - - - - - - - */
// Returns the description of a parameter marker. /* Returns the description of a parameter marker. */
// This function is listed as not being supported by SQLGetFunctions() because it is /* This function is listed as not being supported by SQLGetFunctions() because it is */
// used to describe "parameter markers" (not bound parameters), in which case, /* used to describe "parameter markers" (not bound parameters), in which case, */
// the dbms should return info on the markers. Since Postgres doesn't support that, /* the dbms should return info on the markers. Since Postgres doesn't support that, */
// it is best to say this function is not supported and let the application assume a /* it is best to say this function is not supported and let the application assume a */
// data type (most likely varchar). /* data type (most likely varchar). */
RETCODE SQL_API SQLDescribeParam( RETCODE SQL_API SQLDescribeParam(
HSTMT hstmt, HSTMT hstmt,
...@@ -270,8 +270,8 @@ static char *func = "SQLDescribeParam"; ...@@ -270,8 +270,8 @@ static char *func = "SQLDescribeParam";
ipar--; ipar--;
// This implementation is not very good, since it is supposed to describe /* This implementation is not very good, since it is supposed to describe */
// parameter markers, not bound parameters. /* parameter markers, not bound parameters. */
if(pfSqlType) if(pfSqlType)
*pfSqlType = stmt->parameters[ipar].SQLType; *pfSqlType = stmt->parameters[ipar].SQLType;
...@@ -287,9 +287,9 @@ static char *func = "SQLDescribeParam"; ...@@ -287,9 +287,9 @@ static char *func = "SQLDescribeParam";
return SQL_SUCCESS; return SQL_SUCCESS;
} }
// - - - - - - - - - /* - - - - - - - - - */
// Sets multiple values (arrays) for the set of parameter markers. /* Sets multiple values (arrays) for the set of parameter markers. */
RETCODE SQL_API SQLParamOptions( RETCODE SQL_API SQLParamOptions(
HSTMT hstmt, HSTMT hstmt,
...@@ -304,15 +304,15 @@ static char *func = "SQLParamOptions"; ...@@ -304,15 +304,15 @@ static char *func = "SQLParamOptions";
return SQL_ERROR; return SQL_ERROR;
} }
// - - - - - - - - - /* - - - - - - - - - */
// This function should really talk to the dbms to determine the number of /* This function should really talk to the dbms to determine the number of */
// "parameter markers" (not bound parameters) in the statement. But, since /* "parameter markers" (not bound parameters) in the statement. But, since */
// Postgres doesn't support that, the driver should just count the number of markers /* Postgres doesn't support that, the driver should just count the number of markers */
// and return that. The reason the driver just can't say this function is unsupported /* and return that. The reason the driver just can't say this function is unsupported */
// like it does for SQLDescribeParam is that some applications don't care and try /* like it does for SQLDescribeParam is that some applications don't care and try */
// to call it anyway. /* to call it anyway. */
// If the statement does not have parameters, it should just return 0. /* If the statement does not have parameters, it should just return 0. */
RETCODE SQL_API SQLNumParams( RETCODE SQL_API SQLNumParams(
HSTMT hstmt, HSTMT hstmt,
SWORD FAR *pcpar) SWORD FAR *pcpar)
...@@ -338,7 +338,7 @@ static char *func = "SQLNumParams"; ...@@ -338,7 +338,7 @@ static char *func = "SQLNumParams";
if(!stmt->statement) { if(!stmt->statement) {
// no statement has been allocated /* no statement has been allocated */
stmt->errormsg = "SQLNumParams called with no statement ready."; stmt->errormsg = "SQLNumParams called with no statement ready.";
stmt->errornumber = STMT_SEQUENCE_ERROR; stmt->errornumber = STMT_SEQUENCE_ERROR;
SC_log_error(func, "", stmt); SC_log_error(func, "", stmt);
...@@ -419,13 +419,13 @@ mylog("%s: entering ... stmt=%u, bindings_allocated=%d, num_columns=%d\n", func, ...@@ -419,13 +419,13 @@ mylog("%s: entering ... stmt=%u, bindings_allocated=%d, num_columns=%d\n", func,
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 than needed. If an app has allocated extra bindings, /* more than needed. If an app has allocated extra bindings, */
// let it worry about it by unbinding those columns. /* let it worry about it by unbinding those columns. */
// SQLBindCol(1..) ... SQLBindCol(10...) # got 10 bindings /* SQLBindCol(1..) ... SQLBindCol(10...) # got 10 bindings */
// SQLExecDirect(...) # returns 5 cols /* SQLExecDirect(...) # returns 5 cols */
// SQLExecDirect(...) # returns 10 cols (now OK) /* SQLExecDirect(...) # returns 10 cols (now OK) */
mylog("exit extend_bindings\n"); mylog("exit extend_bindings\n");
} }
...@@ -144,12 +144,12 @@ CI_set_field_info(ColumnInfoClass *self, int field_num, char *new_name, ...@@ -144,12 +144,12 @@ CI_set_field_info(ColumnInfoClass *self, int field_num, char *new_name,
Oid new_adtid, Int2 new_adtsize, Int4 new_atttypmod) Oid new_adtid, Int2 new_adtsize, Int4 new_atttypmod)
{ {
// check bounds /* check bounds */
if((field_num < 0) || (field_num >= self->num_fields)) { if((field_num < 0) || (field_num >= self->num_fields)) {
return; return;
} }
// store the info /* store the info */
self->name[field_num] = strdup(new_name); self->name[field_num] = strdup(new_name);
self->adtid[field_num] = new_adtid; self->adtid[field_num] = new_adtid;
self->adtsize[field_num] = new_adtsize; self->adtsize[field_num] = new_adtsize;
......
...@@ -70,7 +70,7 @@ static char *func="SQLAllocConnect"; ...@@ -70,7 +70,7 @@ static char *func="SQLAllocConnect";
} }
// - - - - - - - - - /* - - - - - - - - - */
RETCODE SQL_API SQLConnect( RETCODE SQL_API SQLConnect(
HDBC hdbc, HDBC hdbc,
...@@ -111,7 +111,7 @@ static char *func = "SQLConnect"; ...@@ -111,7 +111,7 @@ static char *func = "SQLConnect";
qlog("conn = %u, %s(DSN='%s', UID='%s', PWD='%s')\n", conn, func, ci->dsn, ci->username, ci->password); qlog("conn = %u, %s(DSN='%s', UID='%s', PWD='%s')\n", conn, func, ci->dsn, ci->username, ci->password);
if ( CC_connect(conn, FALSE) <= 0) { if ( CC_connect(conn, FALSE) <= 0) {
// Error messages are filled in /* Error messages are filled in */
CC_log_error(func, "Error on CC_connect", conn); CC_log_error(func, "Error on CC_connect", conn);
return SQL_ERROR; return SQL_ERROR;
} }
...@@ -121,7 +121,7 @@ static char *func = "SQLConnect"; ...@@ -121,7 +121,7 @@ static char *func = "SQLConnect";
return SQL_SUCCESS; return SQL_SUCCESS;
} }
// - - - - - - - - - /* - - - - - - - - - */
RETCODE SQL_API SQLBrowseConnect( RETCODE SQL_API SQLBrowseConnect(
HDBC hdbc, HDBC hdbc,
...@@ -138,7 +138,7 @@ static char *func="SQLBrowseConnect"; ...@@ -138,7 +138,7 @@ static char *func="SQLBrowseConnect";
return SQL_SUCCESS; return SQL_SUCCESS;
} }
// - - - - - - - - - /* - - - - - - - - - */
/* Drop any hstmts open on hdbc and disconnect from database */ /* Drop any hstmts open on hdbc and disconnect from database */
RETCODE SQL_API SQLDisconnect( RETCODE SQL_API SQLDisconnect(
...@@ -176,7 +176,7 @@ static char *func = "SQLDisconnect"; ...@@ -176,7 +176,7 @@ static char *func = "SQLDisconnect";
} }
// - - - - - - - - - /* - - - - - - - - - */
RETCODE SQL_API SQLFreeConnect( RETCODE SQL_API SQLFreeConnect(
HDBC hdbc) HDBC hdbc)
...@@ -229,7 +229,7 @@ ConnectionClass *rv; ...@@ -229,7 +229,7 @@ ConnectionClass *rv;
rv->errormsg_created = FALSE; rv->errormsg_created = FALSE;
rv->status = CONN_NOT_CONNECTED; rv->status = CONN_NOT_CONNECTED;
rv->transact_status = CONN_IN_AUTOCOMMIT; // autocommit by default rv->transact_status = CONN_IN_AUTOCOMMIT; /* autocommit by default */
memset(&rv->connInfo, 0, sizeof(ConnInfo)); memset(&rv->connInfo, 0, sizeof(ConnInfo));
...@@ -334,8 +334,8 @@ CC_clear_error(ConnectionClass *self) ...@@ -334,8 +334,8 @@ CC_clear_error(ConnectionClass *self)
self->errormsg_created = FALSE; self->errormsg_created = FALSE;
} }
// Used to cancel a transaction /* Used to cancel a transaction */
// We are almost always in the middle of a transaction. /* We are almost always in the middle of a transaction. */
char char
CC_abort(ConnectionClass *self) CC_abort(ConnectionClass *self)
{ {
...@@ -371,9 +371,9 @@ StatementClass *stmt; ...@@ -371,9 +371,9 @@ StatementClass *stmt;
mylog("in CC_Cleanup, self=%u\n", self); mylog("in CC_Cleanup, self=%u\n", self);
// Cancel an ongoing transaction /* Cancel an ongoing transaction */
// We are always in the middle of a transaction, /* We are always in the middle of a transaction, */
// even if we are in auto commit. /* even if we are in auto commit. */
if (self->sock) if (self->sock)
CC_abort(self); CC_abort(self);
...@@ -549,7 +549,7 @@ static char *func="CC_connect"; ...@@ -549,7 +549,7 @@ static char *func="CC_connect";
mylog("sizeof startup packet = %d\n", sizeof(StartupPacket)); mylog("sizeof startup packet = %d\n", sizeof(StartupPacket));
// Send length of Authentication Block /* Send length of Authentication Block */
SOCK_put_int(sock, 4+sizeof(StartupPacket), 4); SOCK_put_int(sock, 4+sizeof(StartupPacket), 4);
if ( PROTOCOL_63(ci)) if ( PROTOCOL_63(ci))
...@@ -579,9 +579,9 @@ static char *func="CC_connect"; ...@@ -579,9 +579,9 @@ static char *func="CC_connect";
mylog("gonna do authentication\n"); mylog("gonna do authentication\n");
// *************************************************** /* *************************************************** */
// Now get the authentication request from backend /* Now get the authentication request from backend */
// *************************************************** /* *************************************************** */
if ( ! PROTOCOL_62(ci)) do { if ( ! PROTOCOL_62(ci)) do {
...@@ -790,7 +790,7 @@ int rv; ...@@ -790,7 +790,7 @@ int rv;
mylog("enter CC_get_error\n"); mylog("enter CC_get_error\n");
// Create a very informative errormsg if it hasn't been done yet. /* Create a very informative errormsg if it hasn't been done yet. */
if ( ! self->errormsg_created) { if ( ! self->errormsg_created) {
self->errormsg = CC_create_errormsg(self); self->errormsg = CC_create_errormsg(self);
self->errormsg_created = TRUE; self->errormsg_created = TRUE;
...@@ -802,7 +802,7 @@ int rv; ...@@ -802,7 +802,7 @@ int rv;
} }
rv = (self->errornumber != 0); rv = (self->errornumber != 0);
self->errornumber = 0; // clear the error self->errornumber = 0; /* clear the error */
mylog("exit CC_get_error\n"); mylog("exit CC_get_error\n");
...@@ -826,13 +826,13 @@ char swallow; ...@@ -826,13 +826,13 @@ char swallow;
int id; int id;
SocketClass *sock = self->sock; SocketClass *sock = self->sock;
static char msgbuffer[MAX_MESSAGE_LEN+1]; static char msgbuffer[MAX_MESSAGE_LEN+1];
char cmdbuffer[MAX_MESSAGE_LEN+1]; // QR_set_command() dups this string so dont need static char cmdbuffer[MAX_MESSAGE_LEN+1]; /* QR_set_command() dups this string so dont need static */
mylog("send_query(): conn=%u, query='%s'\n", self, query); mylog("send_query(): conn=%u, query='%s'\n", self, query);
qlog("conn=%u, query='%s'\n", self, query); qlog("conn=%u, query='%s'\n", self, query);
// Indicate that we are sending a query to the backend /* Indicate that we are sending a query to the backend */
if(strlen(query) > MAX_MESSAGE_LEN-2) { if(strlen(query) > MAX_MESSAGE_LEN-2) {
self->errornumber = CONNECTION_MSG_TOO_LONG; self->errornumber = CONNECTION_MSG_TOO_LONG;
self->errormsg = "Query string is too long"; self->errormsg = "Query string is too long";
...@@ -971,7 +971,7 @@ char cmdbuffer[MAX_MESSAGE_LEN+1]; // QR_set_command() dups this string so dont ...@@ -971,7 +971,7 @@ char cmdbuffer[MAX_MESSAGE_LEN+1]; // QR_set_command() dups this string so dont
mylog("~~~ NOTICE: '%s'\n", cmdbuffer); mylog("~~~ NOTICE: '%s'\n", cmdbuffer);
qlog("NOTICE from backend during send_query: '%s'\n", cmdbuffer); qlog("NOTICE from backend during send_query: '%s'\n", cmdbuffer);
continue; // dont return a result -- continue reading continue; /* dont return a result -- continue reading */
case 'I' : /* The server sends an empty query */ case 'I' : /* The server sends an empty query */
/* There is a closing '\0' following the 'I', so we eat it */ /* There is a closing '\0' following the 'I', so we eat it */
...@@ -1034,7 +1034,7 @@ char cmdbuffer[MAX_MESSAGE_LEN+1]; // QR_set_command() dups this string so dont ...@@ -1034,7 +1034,7 @@ char cmdbuffer[MAX_MESSAGE_LEN+1]; // QR_set_command() dups this string so dont
return NULL; return NULL;
} }
} }
else { // next fetch, so reuse an existing result else { /* next fetch, so reuse an existing result */
if ( ! QR_fetch_tuples(result_in, NULL, NULL)) { if ( ! QR_fetch_tuples(result_in, NULL, NULL)) {
self->errornumber = CONNECTION_COULD_NOT_RECEIVE; self->errornumber = CONNECTION_COULD_NOT_RECEIVE;
self->errormsg = QR_get_message(result_in); self->errormsg = QR_get_message(result_in);
...@@ -1186,7 +1186,7 @@ int i; ...@@ -1186,7 +1186,7 @@ int i;
mylog("send_function(G): 'N' - %s\n", msgbuffer); mylog("send_function(G): 'N' - %s\n", msgbuffer);
qlog("NOTICE from backend during send_function: '%s'\n", msgbuffer); qlog("NOTICE from backend during send_function: '%s'\n", msgbuffer);
continue; // dont return a result -- continue reading continue; /* dont return a result -- continue reading */
case '0': /* empty result */ case '0': /* empty result */
return TRUE; return TRUE;
...@@ -1206,9 +1206,9 @@ int i; ...@@ -1206,9 +1206,9 @@ int i;
char char
CC_send_settings(ConnectionClass *self) CC_send_settings(ConnectionClass *self)
{ {
// char ini_query[MAX_MESSAGE_LEN]; /* char ini_query[MAX_MESSAGE_LEN]; */
ConnInfo *ci = &(self->connInfo); ConnInfo *ci = &(self->connInfo);
// QResultClass *res; /* QResultClass *res; */
HSTMT hstmt; HSTMT hstmt;
StatementClass *stmt; StatementClass *stmt;
RETCODE result; RETCODE result;
......
...@@ -65,66 +65,66 @@ extern GLOBAL_VALUES globals; ...@@ -65,66 +65,66 @@ extern GLOBAL_VALUES globals;
* - thomas 2000-04-03 * - thomas 2000-04-03
*/ */
char *mapFuncs[][2] = { char *mapFuncs[][2] = {
// { "ASCII", "ascii" }, /* { "ASCII", "ascii" }, */
{ "CHAR", "ichar" }, { "CHAR", "ichar" },
{ "CONCAT", "textcat" }, { "CONCAT", "textcat" },
// { "DIFFERENCE", "difference" }, /* { "DIFFERENCE", "difference" }, */
// { "INSERT", "insert" }, /* { "INSERT", "insert" }, */
{ "LCASE", "lower" }, { "LCASE", "lower" },
{ "LEFT", "ltrunc" }, { "LEFT", "ltrunc" },
{ "LOCATE", "strpos" }, { "LOCATE", "strpos" },
{ "LENGTH", "char_length"}, { "LENGTH", "char_length"},
// { "LTRIM", "ltrim" }, /* { "LTRIM", "ltrim" }, */
{ "RIGHT", "rtrunc" }, { "RIGHT", "rtrunc" },
// { "REPEAT", "repeat" }, /* { "REPEAT", "repeat" }, */
// { "REPLACE", "replace" }, /* { "REPLACE", "replace" }, */
// { "RTRIM", "rtrim" }, /* { "RTRIM", "rtrim" }, */
// { "SOUNDEX", "soundex" }, /* { "SOUNDEX", "soundex" }, */
{ "SUBSTRING", "substr" }, { "SUBSTRING", "substr" },
{ "UCASE", "upper" }, { "UCASE", "upper" },
// { "ABS", "abs" }, /* { "ABS", "abs" }, */
// { "ACOS", "acos" }, /* { "ACOS", "acos" }, */
// { "ASIN", "asin" }, /* { "ASIN", "asin" }, */
// { "ATAN", "atan" }, /* { "ATAN", "atan" }, */
// { "ATAN2", "atan2" }, /* { "ATAN2", "atan2" }, */
{ "CEILING", "ceil" }, { "CEILING", "ceil" },
// { "COS", "cos" }, /* { "COS", "cos" }, */
// { "COT", "cot" }, /* { "COT", "cot" }, */
// { "DEGREES", "degrees" }, /* { "DEGREES", "degrees" }, */
// { "EXP", "exp" }, /* { "EXP", "exp" }, */
// { "FLOOR", "floor" }, /* { "FLOOR", "floor" }, */
{ "LOG", "ln" }, { "LOG", "ln" },
{ "LOG10", "log" }, { "LOG10", "log" },
// { "MOD", "mod" }, /* { "MOD", "mod" }, */
// { "PI", "pi" }, /* { "PI", "pi" }, */
{ "POWER", "pow" }, { "POWER", "pow" },
// { "RADIANS", "radians" }, /* { "RADIANS", "radians" }, */
{ "RAND", "random" }, { "RAND", "random" },
// { "ROUND", "round" }, /* { "ROUND", "round" }, */
// { "SIGN", "sign" }, /* { "SIGN", "sign" }, */
// { "SIN", "sin" }, /* { "SIN", "sin" }, */
// { "SQRT", "sqrt" }, /* { "SQRT", "sqrt" }, */
// { "TAN", "tan" }, /* { "TAN", "tan" }, */
{ "TRUNCATE", "trunc" }, { "TRUNCATE", "trunc" },
// { "CURDATE", "curdate" }, /* { "CURDATE", "curdate" }, */
// { "CURTIME", "curtime" }, /* { "CURTIME", "curtime" }, */
// { "DAYNAME", "dayname" }, /* { "DAYNAME", "dayname" }, */
// { "DAYOFMONTH", "dayofmonth" }, /* { "DAYOFMONTH", "dayofmonth" }, */
// { "DAYOFWEEK", "dayofweek" }, /* { "DAYOFWEEK", "dayofweek" }, */
// { "DAYOFYEAR", "dayofyear" }, /* { "DAYOFYEAR", "dayofyear" }, */
// { "HOUR", "hour" }, /* { "HOUR", "hour" }, */
// { "MINUTE", "minute" }, /* { "MINUTE", "minute" }, */
// { "MONTH", "month" }, /* { "MONTH", "month" }, */
// { "MONTHNAME", "monthname" }, /* { "MONTHNAME", "monthname" }, */
// { "NOW", "now" }, /* { "NOW", "now" }, */
// { "QUARTER", "quarter" }, /* { "QUARTER", "quarter" }, */
// { "SECOND", "second" }, /* { "SECOND", "second" }, */
// { "WEEK", "week" }, /* { "WEEK", "week" }, */
// { "YEAR", "year" }, /* { "YEAR", "year" }, */
// { "DATABASE", "database" }, /* { "DATABASE", "database" }, */
{ "IFNULL", "coalesce" }, { "IFNULL", "coalesce" },
{ "USER", "odbc_user" }, { "USER", "odbc_user" },
{ 0, 0 } { 0, 0 }
...@@ -270,7 +270,7 @@ copy_and_convert_field(StatementClass *stmt, Int4 field_type, void *value, Int2 ...@@ -270,7 +270,7 @@ copy_and_convert_field(StatementClass *stmt, Int4 field_type, void *value, Int2
case PG_TYPE_INT2VECTOR: { case PG_TYPE_INT2VECTOR: {
int nval, i; int nval, i;
char *vp; char *vp;
// this is an array of eight integers /* this is an array of eight integers */
short *short_array = (short *) ( (char *) rgbValue + rgbValueOffset); short *short_array = (short *) ( (char *) rgbValue + rgbValueOffset);
len = 16; len = 16;
...@@ -381,7 +381,7 @@ copy_and_convert_field(StatementClass *stmt, Int4 field_type, void *value, Int2 ...@@ -381,7 +381,7 @@ copy_and_convert_field(StatementClass *stmt, Int4 field_type, void *value, Int2
and all that stuff since there is essentially no limit on the large and all that stuff since there is essentially no limit on the large
object used to store those. object used to store those.
*/ */
case PG_TYPE_BYTEA: // convert binary data to hex strings (i.e, 255 = "FF") case PG_TYPE_BYTEA: /* convert binary data to hex strings (i.e, 255 = "FF") */
len = convert_pgbinary_to_char(value, rgbValueBindRow, cbValueMax); len = convert_pgbinary_to_char(value, rgbValueBindRow, cbValueMax);
/***** THIS IS NOT PROPERLY IMPLEMENTED *****/ /***** THIS IS NOT PROPERLY IMPLEMENTED *****/
...@@ -495,7 +495,7 @@ copy_and_convert_field(StatementClass *stmt, Int4 field_type, void *value, Int2 ...@@ -495,7 +495,7 @@ copy_and_convert_field(StatementClass *stmt, Int4 field_type, void *value, Int2
} else { } else {
*((UCHAR *)rgbValue + bind_row) = atoi(value); *((UCHAR *)rgbValue + bind_row) = atoi(value);
} }
// mylog("SQL_C_BIT: val = %d, cb = %d, rgb=%d\n", atoi(value), cbValueMax, *((UCHAR *)rgbValue)); /* mylog("SQL_C_BIT: val = %d, cb = %d, rgb=%d\n", atoi(value), cbValueMax, *((UCHAR *)rgbValue)); */
break; break;
case SQL_C_STINYINT: case SQL_C_STINYINT:
...@@ -575,8 +575,8 @@ copy_and_convert_field(StatementClass *stmt, Int4 field_type, void *value, Int2 ...@@ -575,8 +575,8 @@ copy_and_convert_field(StatementClass *stmt, Int4 field_type, void *value, Int2
case SQL_C_BINARY: case SQL_C_BINARY:
// truncate if necessary /* truncate if necessary */
// convert octal escapes to bytes /* convert octal escapes to bytes */
len = convert_from_pgbinary(value, tempBuf, sizeof(tempBuf)); len = convert_from_pgbinary(value, tempBuf, sizeof(tempBuf));
ptr = tempBuf; ptr = tempBuf;
...@@ -623,7 +623,7 @@ copy_and_convert_field(StatementClass *stmt, Int4 field_type, void *value, Int2 ...@@ -623,7 +623,7 @@ copy_and_convert_field(StatementClass *stmt, Int4 field_type, void *value, Int2
} }
} }
// store the length of what was copied, if there's a place for it /* store the length of what was copied, if there's a place for it */
if(pcbValue) { if(pcbValue) {
*(SDWORD *) ((char *)pcbValue + pcbValueOffset) = len; *(SDWORD *) ((char *)pcbValue + pcbValueOffset) = len;
} }
...@@ -674,7 +674,7 @@ int lobj_fd, retval; ...@@ -674,7 +674,7 @@ int lobj_fd, retval;
if ( stmt->cursor_name[0] == '\0') if ( stmt->cursor_name[0] == '\0')
sprintf(stmt->cursor_name, "SQL_CUR%p", stmt); sprintf(stmt->cursor_name, "SQL_CUR%p", stmt);
// For selects, prepend a declare cursor to the statement /* For selects, prepend a declare cursor to the statement */
if (stmt->statement_type == STMT_TYPE_SELECT && globals.use_declarefetch) { if (stmt->statement_type == STMT_TYPE_SELECT && globals.use_declarefetch) {
sprintf(new_statement, "declare %s cursor for ", stmt->cursor_name); sprintf(new_statement, "declare %s cursor for ", stmt->cursor_name);
npos = strlen(new_statement); npos = strlen(new_statement);
...@@ -690,13 +690,13 @@ int lobj_fd, retval; ...@@ -690,13 +690,13 @@ int lobj_fd, retval;
for (opos = 0; opos < oldstmtlen; opos++) { for (opos = 0; opos < oldstmtlen; opos++) {
// Squeeze carriage-return/linefeed pairs to linefeed only /* Squeeze carriage-return/linefeed pairs to linefeed only */
if (old_statement[opos] == '\r' && opos+1 < oldstmtlen && if (old_statement[opos] == '\r' && opos+1 < oldstmtlen &&
old_statement[opos+1] == '\n') { old_statement[opos+1] == '\n') {
continue; continue;
} }
// Handle literals (date, time, timestamp) and ODBC scalar functions /* Handle literals (date, time, timestamp) and ODBC scalar functions */
else if (old_statement[opos] == '{') { else if (old_statement[opos] == '{') {
char *esc; char *esc;
char *begin = &old_statement[opos + 1]; char *begin = &old_statement[opos + 1];
...@@ -779,7 +779,7 @@ int lobj_fd, retval; ...@@ -779,7 +779,7 @@ int lobj_fd, retval;
mylog("copy_statement_with_params: from(fcType)=%d, to(fSqlType)=%d\n", param_ctype, param_sqltype); mylog("copy_statement_with_params: from(fcType)=%d, to(fSqlType)=%d\n", param_ctype, param_sqltype);
// replace DEFAULT with something we can use /* replace DEFAULT with something we can use */
if(param_ctype == SQL_C_DEFAULT) if(param_ctype == SQL_C_DEFAULT)
param_ctype = sqltype_to_default_ctype(param_sqltype); param_ctype = sqltype_to_default_ctype(param_sqltype);
...@@ -878,10 +878,10 @@ int lobj_fd, retval; ...@@ -878,10 +878,10 @@ int lobj_fd, retval;
} }
default: default:
// error /* error */
stmt->errormsg = "Unrecognized C_parameter type in copy_statement_with_parameters"; stmt->errormsg = "Unrecognized C_parameter type in copy_statement_with_parameters";
stmt->errornumber = STMT_NOT_IMPLEMENTED_ERROR; stmt->errornumber = STMT_NOT_IMPLEMENTED_ERROR;
new_statement[npos] = '\0'; // just in case new_statement[npos] = '\0'; /* just in case */
SC_log_error(func, "", stmt); SC_log_error(func, "", stmt);
return SQL_ERROR; return SQL_ERROR;
} }
...@@ -1062,8 +1062,8 @@ int lobj_fd, retval; ...@@ -1062,8 +1062,8 @@ int lobj_fd, retval;
break; break;
// because of no conversion operator for bool and int4, SQL_BIT /* because of no conversion operator for bool and int4, SQL_BIT */
// must be quoted (0 or 1 is ok to use inside the quotes) /* must be quoted (0 or 1 is ok to use inside the quotes) */
default: /* a numeric type or SQL_BIT */ default: /* a numeric type or SQL_BIT */
if (param_sqltype == SQL_BIT) if (param_sqltype == SQL_BIT)
...@@ -1087,7 +1087,7 @@ int lobj_fd, retval; ...@@ -1087,7 +1087,7 @@ int lobj_fd, retval;
} /* end, for */ } /* end, for */
// make sure new_statement is always null-terminated /* make sure new_statement is always null-terminated */
new_statement[npos] = '\0'; new_statement[npos] = '\0';
...@@ -1194,7 +1194,7 @@ size_t i = 0, out = 0; ...@@ -1194,7 +1194,7 @@ size_t i = 0, out = 0;
for (i = 0; i < strlen(s); i++) { for (i = 0; i < strlen(s); i++) {
if (s[i] == '$' || s[i] == ',' || s[i] == ')') if (s[i] == '$' || s[i] == ',' || s[i] == ')')
; // skip these characters ; /* skip these characters */
else if (s[i] == '(') else if (s[i] == '(')
s[out++] = '-'; s[out++] = '-';
else else
...@@ -1358,7 +1358,7 @@ int i, y=0, val; ...@@ -1358,7 +1358,7 @@ int i, y=0, val;
return y; return y;
} }
// convert octal escapes to bytes /* convert octal escapes to bytes */
int int
convert_from_pgbinary(unsigned char *value, unsigned char *rgbValue, int cbValueMax) convert_from_pgbinary(unsigned char *value, unsigned char *rgbValue, int cbValueMax)
{ {
...@@ -1378,7 +1378,7 @@ int o=0; ...@@ -1378,7 +1378,7 @@ int o=0;
o++; o++;
} }
rgbValue[o] = '\0'; // extra protection rgbValue[o] = '\0'; /* extra protection */
return o; return o;
} }
...@@ -1402,7 +1402,7 @@ static char x[6]; ...@@ -1402,7 +1402,7 @@ static char x[6];
return x; return x;
} }
// convert non-ascii bytes to octal escape sequences /* convert non-ascii bytes to octal escape sequences */
int int
convert_to_pgbinary(unsigned char *in, char *out, int len) convert_to_pgbinary(unsigned char *in, char *out, int len)
{ {
......
...@@ -156,7 +156,7 @@ int CALLBACK driver_optionsProc(HWND hdlg, ...@@ -156,7 +156,7 @@ int CALLBACK driver_optionsProc(HWND hdlg,
globals.fetch_max = GetDlgItemInt(hdlg, DRV_CACHE_SIZE, NULL, FALSE); globals.fetch_max = GetDlgItemInt(hdlg, DRV_CACHE_SIZE, NULL, FALSE);
globals.max_varchar_size = GetDlgItemInt(hdlg, DRV_VARCHAR_SIZE, NULL, FALSE); globals.max_varchar_size = GetDlgItemInt(hdlg, DRV_VARCHAR_SIZE, NULL, FALSE);
globals.max_longvarchar_size= GetDlgItemInt(hdlg, DRV_LONGVARCHAR_SIZE, NULL, TRUE); // allows for SQL_NO_TOTAL globals.max_longvarchar_size= GetDlgItemInt(hdlg, DRV_LONGVARCHAR_SIZE, NULL, TRUE); /* allows for SQL_NO_TOTAL */
GetDlgItemText(hdlg, DRV_EXTRASYSTABLEPREFIXES, globals.extra_systable_prefixes, sizeof(globals.extra_systable_prefixes)); GetDlgItemText(hdlg, DRV_EXTRASYSTABLEPREFIXES, globals.extra_systable_prefixes, sizeof(globals.extra_systable_prefixes));
...@@ -165,7 +165,7 @@ int CALLBACK driver_optionsProc(HWND hdlg, ...@@ -165,7 +165,7 @@ int CALLBACK driver_optionsProc(HWND hdlg,
updateGlobals(); updateGlobals();
// fall through /* fall through */
case IDCANCEL: case IDCANCEL:
EndDialog(hdlg, GET_WM_COMMAND_ID(wParam, lParam) == IDOK); EndDialog(hdlg, GET_WM_COMMAND_ID(wParam, lParam) == IDOK);
...@@ -230,7 +230,7 @@ char buf[128]; ...@@ -230,7 +230,7 @@ char buf[128];
switch (wMsg) { switch (wMsg) {
case WM_INITDIALOG: case WM_INITDIALOG:
ci = (ConnInfo *) lParam; ci = (ConnInfo *) lParam;
SetWindowLong(hdlg, DWL_USER, lParam); // save for OK SetWindowLong(hdlg, DWL_USER, lParam); /* save for OK */
/* Change window caption */ /* Change window caption */
if (ci->driver[0]) if (ci->driver[0])
...@@ -301,7 +301,7 @@ char buf[128]; ...@@ -301,7 +301,7 @@ char buf[128];
GetDlgItemText(hdlg, DS_CONNSETTINGS, ci->conn_settings, sizeof(ci->conn_settings)); GetDlgItemText(hdlg, DS_CONNSETTINGS, ci->conn_settings, sizeof(ci->conn_settings));
// fall through /* fall through */
case IDCANCEL: case IDCANCEL:
EndDialog(hdlg, GET_WM_COMMAND_ID(wParam, lParam) == IDOK); EndDialog(hdlg, GET_WM_COMMAND_ID(wParam, lParam) == IDOK);
...@@ -389,7 +389,7 @@ copyAttributes(ConnInfo *ci, char *attribute, char *value) ...@@ -389,7 +389,7 @@ copyAttributes(ConnInfo *ci, char *attribute, char *value)
else if (stricmp(attribute, INI_CONNSETTINGS) == 0) { else if (stricmp(attribute, INI_CONNSETTINGS) == 0) {
decode(value, ci->conn_settings); decode(value, ci->conn_settings);
// strcpy(ci->conn_settings, value); /* strcpy(ci->conn_settings, value); */
} }
mylog("copyAttributes: DSN='%s',server='%s',dbase='%s',user='%s',passwd='%s',port='%s',onlyread='%s',protocol='%s', conn_settings='%s')\n", ci->dsn, ci->server,ci->database,ci->username,ci->password,ci->port,ci->onlyread,ci->protocol,ci->conn_settings); mylog("copyAttributes: DSN='%s',server='%s',dbase='%s',user='%s',passwd='%s',port='%s',onlyread='%s',protocol='%s', conn_settings='%s')\n", ci->dsn, ci->server,ci->database,ci->username,ci->password,ci->port,ci->onlyread,ci->protocol,ci->conn_settings);
...@@ -428,8 +428,8 @@ getDSNinfo(ConnInfo *ci, char overwrite) ...@@ -428,8 +428,8 @@ getDSNinfo(ConnInfo *ci, char overwrite)
char *DSN = ci->dsn; char *DSN = ci->dsn;
char encoded_conn_settings[LARGE_REGISTRY_LEN]; char encoded_conn_settings[LARGE_REGISTRY_LEN];
// If a driver keyword was present, then dont use a DSN and return. /* If a driver keyword was present, then dont use a DSN and return. */
// If DSN is null and no driver, then use the default datasource. /* If DSN is null and no driver, then use the default datasource. */
if ( DSN[0] == '\0') { if ( DSN[0] == '\0') {
if ( ci->driver[0] != '\0') if ( ci->driver[0] != '\0')
return; return;
...@@ -437,10 +437,10 @@ char encoded_conn_settings[LARGE_REGISTRY_LEN]; ...@@ -437,10 +437,10 @@ char encoded_conn_settings[LARGE_REGISTRY_LEN];
strcpy(DSN, INI_DSN); strcpy(DSN, INI_DSN);
} }
// brute-force chop off trailing blanks... /* brute-force chop off trailing blanks... */
while (*(DSN+strlen(DSN)-1) == ' ') *(DSN+strlen(DSN)-1) = '\0'; while (*(DSN+strlen(DSN)-1) == ' ') *(DSN+strlen(DSN)-1) = '\0';
// Proceed with getting info for the given DSN. /* Proceed with getting info for the given DSN. */
if ( ci->desc[0] == '\0' || overwrite) if ( ci->desc[0] == '\0' || overwrite)
SQLGetPrivateProfileString(DSN, INI_KDESC, "", ci->desc, sizeof(ci->desc), ODBC_INI); SQLGetPrivateProfileString(DSN, INI_KDESC, "", ci->desc, sizeof(ci->desc), ODBC_INI);
...@@ -600,7 +600,7 @@ void getGlobalDefaults(char *section, char *filename, char override) ...@@ -600,7 +600,7 @@ void getGlobalDefaults(char *section, char *filename, char override)
char temp[256]; char temp[256];
// Fetch Count is stored in driver section /* Fetch Count is stored in driver section */
SQLGetPrivateProfileString(section, INI_FETCH, "", SQLGetPrivateProfileString(section, INI_FETCH, "",
temp, sizeof(temp), filename); temp, sizeof(temp), filename);
if ( temp[0] ) { if ( temp[0] ) {
...@@ -613,7 +613,7 @@ char temp[256]; ...@@ -613,7 +613,7 @@ char temp[256];
globals.fetch_max = FETCH_MAX; globals.fetch_max = FETCH_MAX;
// Socket Buffersize is stored in driver section /* Socket Buffersize is stored in driver section */
SQLGetPrivateProfileString(section, INI_SOCKET, "", SQLGetPrivateProfileString(section, INI_SOCKET, "",
temp, sizeof(temp), filename); temp, sizeof(temp), filename);
if ( temp[0] ) if ( temp[0] )
...@@ -622,7 +622,7 @@ char temp[256]; ...@@ -622,7 +622,7 @@ char temp[256];
globals.socket_buffersize = SOCK_BUFFER_SIZE; globals.socket_buffersize = SOCK_BUFFER_SIZE;
// Debug is stored in the driver section /* Debug is stored in the driver section */
SQLGetPrivateProfileString(section, INI_DEBUG, "", SQLGetPrivateProfileString(section, INI_DEBUG, "",
temp, sizeof(temp), filename); temp, sizeof(temp), filename);
if ( temp[0] ) if ( temp[0] )
...@@ -631,7 +631,7 @@ char temp[256]; ...@@ -631,7 +631,7 @@ char temp[256];
globals.debug = DEFAULT_DEBUG; globals.debug = DEFAULT_DEBUG;
// CommLog is stored in the driver section /* CommLog is stored in the driver section */
SQLGetPrivateProfileString(section, INI_COMMLOG, "", SQLGetPrivateProfileString(section, INI_COMMLOG, "",
temp, sizeof(temp), filename); temp, sizeof(temp), filename);
if ( temp[0] ) if ( temp[0] )
...@@ -640,7 +640,7 @@ char temp[256]; ...@@ -640,7 +640,7 @@ char temp[256];
globals.commlog = DEFAULT_COMMLOG; globals.commlog = DEFAULT_COMMLOG;
// Optimizer is stored in the driver section only /* Optimizer is stored in the driver section only */
SQLGetPrivateProfileString(section, INI_OPTIMIZER, "", SQLGetPrivateProfileString(section, INI_OPTIMIZER, "",
temp, sizeof(temp), filename); temp, sizeof(temp), filename);
if ( temp[0] ) if ( temp[0] )
...@@ -648,7 +648,7 @@ char temp[256]; ...@@ -648,7 +648,7 @@ char temp[256];
else if ( ! override) else if ( ! override)
globals.disable_optimizer = DEFAULT_OPTIMIZER; globals.disable_optimizer = DEFAULT_OPTIMIZER;
// KSQO is stored in the driver section only /* KSQO is stored in the driver section only */
SQLGetPrivateProfileString(section, INI_KSQO, "", SQLGetPrivateProfileString(section, INI_KSQO, "",
temp, sizeof(temp), filename); temp, sizeof(temp), filename);
if ( temp[0] ) if ( temp[0] )
...@@ -656,7 +656,7 @@ char temp[256]; ...@@ -656,7 +656,7 @@ char temp[256];
else if ( ! override) else if ( ! override)
globals.ksqo = DEFAULT_KSQO; globals.ksqo = DEFAULT_KSQO;
// Recognize Unique Index is stored in the driver section only /* Recognize Unique Index is stored in the driver section only */
SQLGetPrivateProfileString(section, INI_UNIQUEINDEX, "", SQLGetPrivateProfileString(section, INI_UNIQUEINDEX, "",
temp, sizeof(temp), filename); temp, sizeof(temp), filename);
if ( temp[0] ) if ( temp[0] )
...@@ -665,7 +665,7 @@ char temp[256]; ...@@ -665,7 +665,7 @@ char temp[256];
globals.unique_index = DEFAULT_UNIQUEINDEX; globals.unique_index = DEFAULT_UNIQUEINDEX;
// Unknown Sizes is stored in the driver section only /* Unknown Sizes is stored in the driver section only */
SQLGetPrivateProfileString(section, INI_UNKNOWNSIZES, "", SQLGetPrivateProfileString(section, INI_UNKNOWNSIZES, "",
temp, sizeof(temp), filename); temp, sizeof(temp), filename);
if ( temp[0] ) if ( temp[0] )
...@@ -674,7 +674,7 @@ char temp[256]; ...@@ -674,7 +674,7 @@ char temp[256];
globals.unknown_sizes = DEFAULT_UNKNOWNSIZES; globals.unknown_sizes = DEFAULT_UNKNOWNSIZES;
// Lie about supported functions? /* Lie about supported functions? */
SQLGetPrivateProfileString(section, INI_LIE, "", SQLGetPrivateProfileString(section, INI_LIE, "",
temp, sizeof(temp), filename); temp, sizeof(temp), filename);
if ( temp[0] ) if ( temp[0] )
...@@ -682,7 +682,7 @@ char temp[256]; ...@@ -682,7 +682,7 @@ char temp[256];
else if ( ! override) else if ( ! override)
globals.lie = DEFAULT_LIE; globals.lie = DEFAULT_LIE;
// Parse statements /* Parse statements */
SQLGetPrivateProfileString(section, INI_PARSE, "", SQLGetPrivateProfileString(section, INI_PARSE, "",
temp, sizeof(temp), filename); temp, sizeof(temp), filename);
if ( temp[0] ) if ( temp[0] )
...@@ -690,7 +690,7 @@ char temp[256]; ...@@ -690,7 +690,7 @@ char temp[256];
else if ( ! override) else if ( ! override)
globals.parse = DEFAULT_PARSE; globals.parse = DEFAULT_PARSE;
// SQLCancel calls SQLFreeStmt in Driver Manager /* SQLCancel calls SQLFreeStmt in Driver Manager */
SQLGetPrivateProfileString(section, INI_CANCELASFREESTMT, "", SQLGetPrivateProfileString(section, INI_CANCELASFREESTMT, "",
temp, sizeof(temp), filename); temp, sizeof(temp), filename);
if ( temp[0] ) if ( temp[0] )
...@@ -700,7 +700,7 @@ char temp[256]; ...@@ -700,7 +700,7 @@ char temp[256];
// UseDeclareFetch is stored in the driver section only /* UseDeclareFetch is stored in the driver section only */
SQLGetPrivateProfileString(section, INI_USEDECLAREFETCH, "", SQLGetPrivateProfileString(section, INI_USEDECLAREFETCH, "",
temp, sizeof(temp), filename); temp, sizeof(temp), filename);
if ( temp[0] ) if ( temp[0] )
...@@ -709,7 +709,7 @@ char temp[256]; ...@@ -709,7 +709,7 @@ char temp[256];
globals.use_declarefetch = DEFAULT_USEDECLAREFETCH; globals.use_declarefetch = DEFAULT_USEDECLAREFETCH;
// Max Varchar Size /* Max Varchar Size */
SQLGetPrivateProfileString(section, INI_MAXVARCHARSIZE, "", SQLGetPrivateProfileString(section, INI_MAXVARCHARSIZE, "",
temp, sizeof(temp), filename); temp, sizeof(temp), filename);
if ( temp[0] ) if ( temp[0] )
...@@ -717,7 +717,7 @@ char temp[256]; ...@@ -717,7 +717,7 @@ char temp[256];
else if ( ! override) else if ( ! override)
globals.max_varchar_size = MAX_VARCHAR_SIZE; globals.max_varchar_size = MAX_VARCHAR_SIZE;
// Max TextField Size /* Max TextField Size */
SQLGetPrivateProfileString(section, INI_MAXLONGVARCHARSIZE, "", SQLGetPrivateProfileString(section, INI_MAXLONGVARCHARSIZE, "",
temp, sizeof(temp), filename); temp, sizeof(temp), filename);
if ( temp[0] ) if ( temp[0] )
...@@ -725,7 +725,7 @@ char temp[256]; ...@@ -725,7 +725,7 @@ char temp[256];
else if ( ! override) else if ( ! override)
globals.max_longvarchar_size = TEXT_FIELD_SIZE; globals.max_longvarchar_size = TEXT_FIELD_SIZE;
// Text As LongVarchar /* Text As LongVarchar */
SQLGetPrivateProfileString(section, INI_TEXTASLONGVARCHAR, "", SQLGetPrivateProfileString(section, INI_TEXTASLONGVARCHAR, "",
temp, sizeof(temp), filename); temp, sizeof(temp), filename);
if ( temp[0] ) if ( temp[0] )
...@@ -733,7 +733,7 @@ char temp[256]; ...@@ -733,7 +733,7 @@ char temp[256];
else if ( ! override) else if ( ! override)
globals.text_as_longvarchar = DEFAULT_TEXTASLONGVARCHAR; globals.text_as_longvarchar = DEFAULT_TEXTASLONGVARCHAR;
// Unknowns As LongVarchar /* Unknowns As LongVarchar */
SQLGetPrivateProfileString(section, INI_UNKNOWNSASLONGVARCHAR, "", SQLGetPrivateProfileString(section, INI_UNKNOWNSASLONGVARCHAR, "",
temp, sizeof(temp), filename); temp, sizeof(temp), filename);
if ( temp[0] ) if ( temp[0] )
...@@ -741,7 +741,7 @@ char temp[256]; ...@@ -741,7 +741,7 @@ char temp[256];
else if ( ! override) else if ( ! override)
globals.unknowns_as_longvarchar = DEFAULT_UNKNOWNSASLONGVARCHAR; globals.unknowns_as_longvarchar = DEFAULT_UNKNOWNSASLONGVARCHAR;
// Bools As Char /* Bools As Char */
SQLGetPrivateProfileString(section, INI_BOOLSASCHAR, "", SQLGetPrivateProfileString(section, INI_BOOLSASCHAR, "",
temp, sizeof(temp), filename); temp, sizeof(temp), filename);
if ( temp[0] ) if ( temp[0] )
...@@ -749,8 +749,8 @@ char temp[256]; ...@@ -749,8 +749,8 @@ char temp[256];
else if ( ! override) else if ( ! override)
globals.bools_as_char = DEFAULT_BOOLSASCHAR; globals.bools_as_char = DEFAULT_BOOLSASCHAR;
// Extra Systable prefixes /* Extra Systable prefixes */
// Use @@@ to distinguish between blank extra prefixes and no key entry /* Use @@@ to distinguish between blank extra prefixes and no key entry */
SQLGetPrivateProfileString(section, INI_EXTRASYSTABLEPREFIXES, "@@@", SQLGetPrivateProfileString(section, INI_EXTRASYSTABLEPREFIXES, "@@@",
temp, sizeof(temp), filename); temp, sizeof(temp), filename);
if ( strcmp(temp, "@@@" )) if ( strcmp(temp, "@@@" ))
...@@ -761,14 +761,14 @@ char temp[256]; ...@@ -761,14 +761,14 @@ char temp[256];
mylog("globals.extra_systable_prefixes = '%s'\n", globals.extra_systable_prefixes); mylog("globals.extra_systable_prefixes = '%s'\n", globals.extra_systable_prefixes);
// 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 for override /* ConnSettings is stored in the driver section and per datasource for override */
SQLGetPrivateProfileString(section, INI_CONNSETTINGS, "", SQLGetPrivateProfileString(section, INI_CONNSETTINGS, "",
globals.conn_settings, sizeof(globals.conn_settings), filename); globals.conn_settings, sizeof(globals.conn_settings), filename);
// Default state for future DSN's Readonly attribute /* Default state for future DSN's Readonly attribute */
SQLGetPrivateProfileString(section, INI_READONLY, "", SQLGetPrivateProfileString(section, INI_READONLY, "",
temp, sizeof(temp), filename); temp, sizeof(temp), filename);
if ( temp[0] ) if ( temp[0] )
......
...@@ -91,15 +91,15 @@ ...@@ -91,15 +91,15 @@
/* Connection Defaults */ /* Connection Defaults */
#define DEFAULT_PORT "5432" #define DEFAULT_PORT "5432"
#define DEFAULT_READONLY 1 #define DEFAULT_READONLY 1
#define DEFAULT_PROTOCOL "6.4" // the latest protocol is the default #define DEFAULT_PROTOCOL "6.4" /* the latest protocol is the default */
#define DEFAULT_USEDECLAREFETCH 0 #define DEFAULT_USEDECLAREFETCH 0
#define DEFAULT_TEXTASLONGVARCHAR 1 #define DEFAULT_TEXTASLONGVARCHAR 1
#define DEFAULT_UNKNOWNSASLONGVARCHAR 0 #define DEFAULT_UNKNOWNSASLONGVARCHAR 0
#define DEFAULT_BOOLSASCHAR 1 #define DEFAULT_BOOLSASCHAR 1
#define DEFAULT_OPTIMIZER 1 // disable #define DEFAULT_OPTIMIZER 1 /* disable */
#define DEFAULT_KSQO 1 // on #define DEFAULT_KSQO 1 /* on */
#define DEFAULT_UNIQUEINDEX 0 // dont recognize #define DEFAULT_UNIQUEINDEX 0 /* dont recognize */
#define DEFAULT_COMMLOG 0 // dont log #define DEFAULT_COMMLOG 0 /* dont log */
#define DEFAULT_DEBUG 0 #define DEFAULT_DEBUG 0
#define DEFAULT_UNKNOWNSIZES UNKNOWNS_AS_MAX #define DEFAULT_UNKNOWNSIZES UNKNOWNS_AS_MAX
...@@ -107,7 +107,7 @@ ...@@ -107,7 +107,7 @@
#define DEFAULT_FAKEOIDINDEX 0 #define DEFAULT_FAKEOIDINDEX 0
#define DEFAULT_SHOWOIDCOLUMN 0 #define DEFAULT_SHOWOIDCOLUMN 0
#define DEFAULT_ROWVERSIONING 0 #define DEFAULT_ROWVERSIONING 0
#define DEFAULT_SHOWSYSTEMTABLES 0 // dont show system tables #define DEFAULT_SHOWSYSTEMTABLES 0 /* dont show system tables */
#define DEFAULT_LIE 0 #define DEFAULT_LIE 0
#define DEFAULT_PARSE 0 #define DEFAULT_PARSE 0
......
...@@ -103,15 +103,15 @@ int len = 0; ...@@ -103,15 +103,15 @@ int len = 0;
ci = &(conn->connInfo); ci = &(conn->connInfo);
// Parse the connect string and fill in conninfo for this hdbc. /* Parse the connect string and fill in conninfo for this hdbc. */
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 fill them in from the registry (assuming /* this function will fill them in from the registry (assuming */
// of course there is a DSN given -- if not, it does nothing!) /* of course there is a DSN given -- if not, it does nothing!) */
getDSNinfo(ci, CONN_DONT_OVERWRITE); getDSNinfo(ci, CONN_DONT_OVERWRITE);
// Fill in any default parameters if they are not there. /* Fill in any default parameters if they are not there. */
getDSNdefaults(ci); getDSNdefaults(ci);
#ifdef WIN32 #ifdef WIN32
...@@ -164,13 +164,13 @@ dialog: ...@@ -164,13 +164,13 @@ dialog:
ci->server[0] == '\0' || ci->server[0] == '\0' ||
ci->database[0] == '\0' || ci->database[0] == '\0' ||
ci->port[0] == '\0') { ci->port[0] == '\0') {
// (password_required && ci->password[0] == '\0')) /* (password_required && ci->password[0] == '\0')) */
return SQL_NO_DATA_FOUND; return SQL_NO_DATA_FOUND;
} }
// do the actual connect /* do the actual connect */
retval = CC_connect(conn, password_required); retval = CC_connect(conn, password_required);
if (retval < 0) { /* need a password */ if (retval < 0) { /* need a password */
if (fDriverCompletion == SQL_DRIVER_NOPROMPT) { if (fDriverCompletion == SQL_DRIVER_NOPROMPT) {
...@@ -187,7 +187,7 @@ dialog: ...@@ -187,7 +187,7 @@ dialog:
} }
} }
else if (retval == 0) { else if (retval == 0) {
// error msg filled in above /* error msg filled in above */
CC_log_error(func, "Error from CC_Connect", conn); CC_log_error(func, "Error from CC_Connect", conn);
return SQL_ERROR; return SQL_ERROR;
} }
...@@ -273,7 +273,7 @@ ConnInfo *ci; ...@@ -273,7 +273,7 @@ ConnInfo *ci;
ShowWindow(GetDlgItem(hdlg, IDC_DESCTEXT), SW_HIDE); ShowWindow(GetDlgItem(hdlg, IDC_DESCTEXT), SW_HIDE);
ShowWindow(GetDlgItem(hdlg, IDC_DESC), SW_HIDE); ShowWindow(GetDlgItem(hdlg, IDC_DESC), SW_HIDE);
SetWindowLong(hdlg, DWL_USER, lParam);// Save the ConnInfo for the "OK" SetWindowLong(hdlg, DWL_USER, lParam);/* Save the ConnInfo for the "OK" */
SetDlgStuff(hdlg, ci); SetDlgStuff(hdlg, ci);
...@@ -354,15 +354,15 @@ char *strtok_arg; ...@@ -354,15 +354,15 @@ char *strtok_arg;
continue; continue;
*equals = '\0'; *equals = '\0';
attribute = pair; // ex. DSN attribute = pair; /* ex. DSN */
value = equals + 1; // ex. 'CEO co1' value = equals + 1; /* ex. 'CEO co1' */
mylog("attribute = '%s', value = '%s'\n", attribute, value); mylog("attribute = '%s', value = '%s'\n", attribute, value);
if( !attribute || !value) if( !attribute || !value)
continue; continue;
// Copy the appropriate value to the conninfo /* Copy the appropriate value to the conninfo */
copyAttributes(ci, attribute, value); copyAttributes(ci, attribute, value);
} }
......
...@@ -57,7 +57,7 @@ mylog("**** in SQLFreeEnv: env = %u ** \n", env); ...@@ -57,7 +57,7 @@ mylog("**** in SQLFreeEnv: env = %u ** \n", env);
return SQL_ERROR; return SQL_ERROR;
} }
// Returns the next SQL error information. /* Returns the next SQL error information. */
RETCODE SQL_API SQLError( RETCODE SQL_API SQLError(
HENV henv, HENV henv,
...@@ -75,7 +75,7 @@ int status; ...@@ -75,7 +75,7 @@ int status;
mylog("**** SQLError: henv=%u, hdbc=%u, hstmt=%u\n", henv, hdbc, hstmt); mylog("**** SQLError: henv=%u, hdbc=%u, hstmt=%u\n", henv, hdbc, hstmt);
if (SQL_NULL_HSTMT != hstmt) { if (SQL_NULL_HSTMT != hstmt) {
// CC: return an error of a hstmt /* CC: return an error of a hstmt */
StatementClass *stmt = (StatementClass *) hstmt; StatementClass *stmt = (StatementClass *) hstmt;
if (SC_get_error(stmt, &status, &msg)) { if (SC_get_error(stmt, &status, &msg)) {
...@@ -102,47 +102,47 @@ int status; ...@@ -102,47 +102,47 @@ int status;
if (NULL != szSqlState) if (NULL != szSqlState)
switch (status) { switch (status) {
// now determine the SQLSTATE to be returned /* now determine the SQLSTATE to be returned */
case STMT_TRUNCATED: case STMT_TRUNCATED:
strcpy(szSqlState, "01004"); strcpy(szSqlState, "01004");
// data truncated /* data truncated */
break; break;
case STMT_INFO_ONLY: case STMT_INFO_ONLY:
strcpy(szSqlState, "00000"); strcpy(szSqlState, "00000");
// just information that is returned, no error /* just information that is returned, no error */
break; break;
case STMT_BAD_ERROR: case STMT_BAD_ERROR:
strcpy(szSqlState, "08S01"); strcpy(szSqlState, "08S01");
// communication link failure /* communication link failure */
break; break;
case STMT_CREATE_TABLE_ERROR: case STMT_CREATE_TABLE_ERROR:
strcpy(szSqlState, "S0001"); strcpy(szSqlState, "S0001");
// table already exists /* table already exists */
break; break;
case STMT_STATUS_ERROR: case STMT_STATUS_ERROR:
case STMT_SEQUENCE_ERROR: case STMT_SEQUENCE_ERROR:
strcpy(szSqlState, "S1010"); strcpy(szSqlState, "S1010");
// Function sequence error /* Function sequence error */
break; break;
case STMT_NO_MEMORY_ERROR: case STMT_NO_MEMORY_ERROR:
strcpy(szSqlState, "S1001"); strcpy(szSqlState, "S1001");
// memory allocation failure /* memory allocation failure */
break; break;
case STMT_COLNUM_ERROR: case STMT_COLNUM_ERROR:
strcpy(szSqlState, "S1002"); strcpy(szSqlState, "S1002");
// invalid column number /* invalid column number */
break; break;
case STMT_NO_STMTSTRING: case STMT_NO_STMTSTRING:
strcpy(szSqlState, "S1001"); strcpy(szSqlState, "S1001");
// having no stmtstring is also a malloc problem /* having no stmtstring is also a malloc problem */
break; break;
case STMT_ERROR_TAKEN_FROM_BACKEND: case STMT_ERROR_TAKEN_FROM_BACKEND:
strcpy(szSqlState, "S1000"); strcpy(szSqlState, "S1000");
// general error /* general error */
break; break;
case STMT_INTERNAL_ERROR: case STMT_INTERNAL_ERROR:
strcpy(szSqlState, "S1000"); strcpy(szSqlState, "S1000");
// general error /* general error */
break; break;
case STMT_ROW_OUT_OF_RANGE: case STMT_ROW_OUT_OF_RANGE:
strcpy(szSqlState, "S1107"); strcpy(szSqlState, "S1107");
...@@ -153,7 +153,7 @@ int status; ...@@ -153,7 +153,7 @@ int status;
break; break;
case STMT_NOT_IMPLEMENTED_ERROR: case STMT_NOT_IMPLEMENTED_ERROR:
strcpy(szSqlState, "S1C00"); // == 'driver not capable' strcpy(szSqlState, "S1C00"); /* == 'driver not capable' */
break; break;
case STMT_OPTION_OUT_OF_RANGE_ERROR: case STMT_OPTION_OUT_OF_RANGE_ERROR:
strcpy(szSqlState, "S1092"); strcpy(szSqlState, "S1092");
...@@ -181,7 +181,7 @@ int status; ...@@ -181,7 +181,7 @@ int status;
break; break;
case STMT_INVALID_ARGUMENT_NO: case STMT_INVALID_ARGUMENT_NO:
strcpy(szSqlState, "S1009"); strcpy(szSqlState, "S1009");
// invalid argument value /* invalid argument value */
break; break;
case STMT_INVALID_CURSOR_POSITION: case STMT_INVALID_CURSOR_POSITION:
strcpy(szSqlState, "S1109"); strcpy(szSqlState, "S1109");
...@@ -198,7 +198,7 @@ int status; ...@@ -198,7 +198,7 @@ int status;
case STMT_EXEC_ERROR: case STMT_EXEC_ERROR:
default: default:
strcpy(szSqlState, "S1000"); strcpy(szSqlState, "S1000");
// also a general error /* also a general error */
break; break;
} }
...@@ -250,15 +250,15 @@ int status; ...@@ -250,15 +250,15 @@ int status;
case STMT_TRUNCATED: case STMT_TRUNCATED:
case CONN_TRUNCATED: case CONN_TRUNCATED:
strcpy(szSqlState, "01004"); strcpy(szSqlState, "01004");
// data truncated /* data truncated */
break; break;
case CONN_INIREAD_ERROR: case CONN_INIREAD_ERROR:
strcpy(szSqlState, "IM002"); strcpy(szSqlState, "IM002");
// data source not found /* data source not found */
break; break;
case CONN_OPENDB_ERROR: case CONN_OPENDB_ERROR:
strcpy(szSqlState, "08001"); strcpy(szSqlState, "08001");
// unable to connect to data source /* unable to connect to data source */
break; break;
case CONN_INVALID_AUTHENTICATION: case CONN_INVALID_AUTHENTICATION:
case CONN_AUTH_TYPE_UNSUPPORTED: case CONN_AUTH_TYPE_UNSUPPORTED:
...@@ -266,23 +266,23 @@ int status; ...@@ -266,23 +266,23 @@ int status;
break; break;
case CONN_STMT_ALLOC_ERROR: case CONN_STMT_ALLOC_ERROR:
strcpy(szSqlState, "S1001"); strcpy(szSqlState, "S1001");
// memory allocation failure /* memory allocation failure */
break; break;
case CONN_IN_USE: case CONN_IN_USE:
strcpy(szSqlState, "S1000"); strcpy(szSqlState, "S1000");
// general error /* general error */
break; break;
case CONN_UNSUPPORTED_OPTION: case CONN_UNSUPPORTED_OPTION:
strcpy(szSqlState, "IM001"); strcpy(szSqlState, "IM001");
// driver does not support this function /* driver does not support this function */
case CONN_INVALID_ARGUMENT_NO: case CONN_INVALID_ARGUMENT_NO:
strcpy(szSqlState, "S1009"); strcpy(szSqlState, "S1009");
// invalid argument value /* invalid argument value */
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 transaction /* when the user tries to switch commit mode in a transaction */
// -> function sequence error /* -> function sequence error */
break; break;
case CONN_NO_MEMORY_ERROR: case CONN_NO_MEMORY_ERROR:
strcpy(szSqlState, "S1001"); strcpy(szSqlState, "S1001");
...@@ -299,7 +299,7 @@ int status; ...@@ -299,7 +299,7 @@ int status;
default: default:
strcpy(szSqlState, "S1000"); strcpy(szSqlState, "S1000");
// general error /* general error */
break; break;
} }
...@@ -341,12 +341,12 @@ int status; ...@@ -341,12 +341,12 @@ int status;
if(szSqlState) { if(szSqlState) {
switch(status) { switch(status) {
case ENV_ALLOC_ERROR: case ENV_ALLOC_ERROR:
// memory allocation failure /* memory allocation failure */
strcpy(szSqlState, "S1001"); strcpy(szSqlState, "S1001");
break; break;
default: default:
strcpy(szSqlState, "S1000"); strcpy(szSqlState, "S1000");
// general error /* general error */
break; break;
} }
} }
...@@ -405,8 +405,8 @@ char rv = 1; ...@@ -405,8 +405,8 @@ char rv = 1;
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 source--they should not be freed /* the source--they should not be freed */
/* Free any connections belonging to this environment */ /* Free any connections belonging to this environment */
for (lf = 0; lf < MAX_CONNECTIONS; lf++) { for (lf = 0; lf < MAX_CONNECTIONS; lf++) {
......
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
extern GLOBAL_VALUES globals; extern GLOBAL_VALUES globals;
// Perform a Prepare on the SQL statement /* Perform a Prepare on the SQL statement */
RETCODE SQL_API SQLPrepare(HSTMT hstmt, RETCODE SQL_API SQLPrepare(HSTMT hstmt,
UCHAR FAR *szSqlStr, UCHAR FAR *szSqlStr,
SDWORD cbSqlStr) SDWORD cbSqlStr)
...@@ -108,7 +108,7 @@ StatementClass *self = (StatementClass *) hstmt; ...@@ -108,7 +108,7 @@ StatementClass *self = (StatementClass *) hstmt;
self->prepare = TRUE; self->prepare = TRUE;
self->statement_type = statement_type(self->statement); self->statement_type = statement_type(self->statement);
// Check if connection is onlyread (only selects are allowed) /* Check if connection is onlyread (only selects are allowed) */
if ( CC_is_onlyread(self->hdbc) && STMT_UPDATE(self)) { if ( CC_is_onlyread(self->hdbc) && STMT_UPDATE(self)) {
self->errornumber = STMT_EXEC_ERROR; self->errornumber = STMT_EXEC_ERROR;
self->errormsg = "Connection is readonly, only select statements are allowed."; self->errormsg = "Connection is readonly, only select statements are allowed.";
...@@ -121,9 +121,9 @@ StatementClass *self = (StatementClass *) hstmt; ...@@ -121,9 +121,9 @@ StatementClass *self = (StatementClass *) hstmt;
} }
// - - - - - - - - - /* - - - - - - - - - */
// Performs the equivalent of SQLPrepare, followed by SQLExecute. /* Performs the equivalent of SQLPrepare, followed by SQLExecute. */
RETCODE SQL_API SQLExecDirect( RETCODE SQL_API SQLExecDirect(
HSTMT hstmt, HSTMT hstmt,
...@@ -144,8 +144,8 @@ static char *func = "SQLExecDirect"; ...@@ -144,8 +144,8 @@ static char *func = "SQLExecDirect";
if (stmt->statement) if (stmt->statement)
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 execute this statement again /* they try to execute this statement again */
stmt->statement = make_string(szSqlStr, cbSqlStr, NULL); stmt->statement = make_string(szSqlStr, cbSqlStr, NULL);
if ( ! stmt->statement) { if ( ! stmt->statement) {
stmt->errornumber = STMT_NO_MEMORY_ERROR; stmt->errornumber = STMT_NO_MEMORY_ERROR;
...@@ -158,15 +158,15 @@ static char *func = "SQLExecDirect"; ...@@ -158,15 +158,15 @@ static char *func = "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 premature state because an error occurred prior to SQLExecute /* the premature state because an error occurred prior to SQLExecute */
// then set the statement to finished so it can be recycled. /* then 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;
stmt->statement_type = statement_type(stmt->statement); stmt->statement_type = statement_type(stmt->statement);
// Check if connection is onlyread (only selects are allowed) /* Check if connection is onlyread (only selects are allowed) */
if ( CC_is_onlyread(stmt->hdbc) && STMT_UPDATE(stmt)) { if ( CC_is_onlyread(stmt->hdbc) && STMT_UPDATE(stmt)) {
stmt->errornumber = STMT_EXEC_ERROR; stmt->errornumber = STMT_EXEC_ERROR;
stmt->errormsg = "Connection is readonly, only select statements are allowed."; stmt->errormsg = "Connection is readonly, only select statements are allowed.";
...@@ -182,7 +182,7 @@ static char *func = "SQLExecDirect"; ...@@ -182,7 +182,7 @@ static char *func = "SQLExecDirect";
return result; return result;
} }
// Execute a prepared SQL statement /* Execute a prepared SQL statement */
RETCODE SQL_API SQLExecute( RETCODE SQL_API SQLExecute(
HSTMT hstmt) HSTMT hstmt)
{ {
...@@ -272,15 +272,15 @@ int i, retval; ...@@ -272,15 +272,15 @@ int i, retval;
stmt->data_at_exec++; stmt->data_at_exec++;
} }
} }
// If there are some data at execution parameters, return need data /* If there are some data at execution parameters, return need data */
// SQLParamData and SQLPutData will be used to send params and execute the statement. /* 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;
mylog("%s: copying statement params: trans_status=%d, len=%d, stmt='%s'\n", func, conn->transact_status, strlen(stmt->statement), stmt->statement); mylog("%s: copying statement params: trans_status=%d, len=%d, stmt='%s'\n", func, conn->transact_status, strlen(stmt->statement), stmt->statement);
// Create the statement with parameters substituted. /* Create the statement with parameters substituted. */
retval = copy_statement_with_parameters(stmt); retval = copy_statement_with_parameters(stmt);
if( retval != SQL_SUCCESS) if( retval != SQL_SUCCESS)
/* error msg passed from above */ /* error msg passed from above */
...@@ -296,7 +296,7 @@ int i, retval; ...@@ -296,7 +296,7 @@ int i, retval;
// - - - - - - - - - /* - - - - - - - - - */
RETCODE SQL_API SQLTransact( RETCODE SQL_API SQLTransact(
HENV henv, HENV henv,
HDBC hdbc, HDBC hdbc,
...@@ -355,7 +355,7 @@ int lf; ...@@ -355,7 +355,7 @@ int lf;
CC_set_no_trans(conn); CC_set_no_trans(conn);
if ( ! res) { if ( ! res) {
// error msg will be in the connection /* error msg will be in the connection */
CC_log_error(func, "", conn); CC_log_error(func, "", conn);
return SQL_ERROR; return SQL_ERROR;
} }
...@@ -371,10 +371,10 @@ int lf; ...@@ -371,10 +371,10 @@ int lf;
return SQL_SUCCESS; return SQL_SUCCESS;
} }
// - - - - - - - - - /* - - - - - - - - - */
RETCODE SQL_API SQLCancel( RETCODE SQL_API SQLCancel(
HSTMT hstmt) // Statement to cancel. HSTMT hstmt) /* Statement to cancel. */
{ {
static char *func="SQLCancel"; static char *func="SQLCancel";
StatementClass *stmt = (StatementClass *) hstmt; StatementClass *stmt = (StatementClass *) hstmt;
...@@ -386,13 +386,13 @@ FARPROC addr; ...@@ -386,13 +386,13 @@ FARPROC addr;
mylog( "%s: entering...\n", func); mylog( "%s: entering...\n", func);
// Check if this can handle canceling in the middle of a SQLPutData? /* Check if this can handle canceling in the middle of a SQLPutData? */
if ( ! stmt) { if ( ! stmt) {
SC_log_error(func, "", NULL); SC_log_error(func, "", NULL);
return SQL_INVALID_HANDLE; return SQL_INVALID_HANDLE;
} }
// Not in the middle of SQLParamData/SQLPutData so cancel like a close. /* Not in the middle of SQLParamData/SQLPutData so cancel like a close. */
if (stmt->data_at_exec < 0) { if (stmt->data_at_exec < 0) {
...@@ -423,9 +423,9 @@ FARPROC addr; ...@@ -423,9 +423,9 @@ FARPROC addr;
return SQL_SUCCESS; return SQL_SUCCESS;
} }
// In the middle of SQLParamData/SQLPutData, so cancel that. /* In the middle of SQLParamData/SQLPutData, so cancel that. */
// Note, any previous data-at-exec buffers will be freed in the recycle /* Note, any previous data-at-exec buffers will be freed in the recycle */
// if they call SQLExecDirect or SQLExecute again. /* if they call SQLExecDirect or SQLExecute again. */
stmt->data_at_exec = -1; stmt->data_at_exec = -1;
stmt->current_exec_param = -1; stmt->current_exec_param = -1;
...@@ -435,11 +435,11 @@ FARPROC addr; ...@@ -435,11 +435,11 @@ FARPROC addr;
} }
// - - - - - - - - - /* - - - - - - - - - */
// Returns the SQL string as modified by the driver. /* Returns the SQL string as modified by the driver. */
// Currently, just copy the input string without modification /* Currently, just copy the input string without modification */
// observing buffer limits and truncation. /* observing buffer limits and truncation. */
RETCODE SQL_API SQLNativeSql( RETCODE SQL_API SQLNativeSql(
HDBC hdbc, HDBC hdbc,
UCHAR FAR *szSqlStrIn, UCHAR FAR *szSqlStrIn,
...@@ -485,10 +485,10 @@ RETCODE result; ...@@ -485,10 +485,10 @@ RETCODE result;
return result; return result;
} }
// - - - - - - - - - /* - - - - - - - - - */
// Supplies parameter data at execution time. Used in conjuction with /* Supplies parameter data at execution time. Used in conjuction with */
// SQLPutData. /* SQLPutData. */
RETCODE SQL_API SQLParamData( RETCODE SQL_API SQLParamData(
HSTMT hstmt, HSTMT hstmt,
...@@ -583,10 +583,10 @@ int i, retval; ...@@ -583,10 +583,10 @@ int i, retval;
return SQL_NEED_DATA; return SQL_NEED_DATA;
} }
// - - - - - - - - - /* - - - - - - - - - */
// Supplies parameter data at execution time. Used in conjunction with /* Supplies parameter data at execution time. Used in conjunction with */
// SQLParamData. /* SQLParamData. */
RETCODE SQL_API SQLPutData( RETCODE SQL_API SQLPutData(
HSTMT hstmt, HSTMT hstmt,
......
This diff is collapsed.
// GetPrivateProfileString /* GetPrivateProfileString */
// for UNIX use /* for UNIX use */
#ifndef GPPS_H #ifndef GPPS_H
#define GPPS_H #define GPPS_H
...@@ -17,18 +17,18 @@ extern "C" { ...@@ -17,18 +17,18 @@ extern "C" {
#endif #endif
DWORD DWORD
GetPrivateProfileString(char *theSection, // section name GetPrivateProfileString(char *theSection, /* section name */
char *theKey, // search key name char *theKey, /* search key name */
char *theDefault, // default value if not found char *theDefault, /* default value if not found */
char *theReturnBuffer, // return valuse stored here char *theReturnBuffer, /* return valuse stored here */
size_t theBufferLength, // byte length of return buffer size_t theBufferLength, /* byte length of return buffer */
char *theIniFileName); // pathname of ini file to search char *theIniFileName); /* pathname of ini file to search */
DWORD DWORD
WritePrivateProfileString(char *theSection, // section name WritePrivateProfileString(char *theSection, /* section name */
char *theKey, // write key name char *theKey, /* write key name */
char *theBuffer, // input buffer char *theBuffer, /* input buffer */
char *theIniFileName); // pathname of ini file to write char *theIniFileName); /* pathname of ini file to write */
#ifdef __cplusplus #ifdef __cplusplus
} }
......
This diff is collapsed.
...@@ -27,7 +27,7 @@ int retval, result_len; ...@@ -27,7 +27,7 @@ int retval, result_len;
argv[0].u.integer = mode; argv[0].u.integer = mode;
if ( ! CC_send_function(conn, LO_CREAT, &retval, &result_len, 1, argv, 1)) if ( ! CC_send_function(conn, LO_CREAT, &retval, &result_len, 1, argv, 1))
return 0; // invalid oid return 0; /* invalid oid */
else else
return retval; return retval;
......
...@@ -169,10 +169,10 @@ my_strcpy(char *dst, int dst_len, char *src, int src_len) ...@@ -169,10 +169,10 @@ my_strcpy(char *dst, int dst_len, char *src, int src_len)
return strlen(dst); return strlen(dst);
} }
// strncpy copies up to len characters, and doesn't terminate /* strncpy copies up to len characters, and doesn't terminate */
// the destination string if src has len characters or more. /* the destination string if src has len characters or more. */
// instead, I want it to copy up to len-1 characters and always /* instead, I want it to copy up to len-1 characters and always */
// terminate the destination string. /* terminate the destination string. */
char *strncpy_null(char *dst, const char *src, int len) char *strncpy_null(char *dst, const char *src, int len)
{ {
int i; int i;
...@@ -199,9 +199,9 @@ int i; ...@@ -199,9 +199,9 @@ int i;
return dst; return dst;
} }
// Create a null terminated string (handling the SQL_NTS thing): /* Create a null terminated string (handling the SQL_NTS thing): */
// 1. If buf is supplied, place the string in there (assumes enough space) and return buf. /* 1. If buf is supplied, place the string in there (assumes enough space) and return buf. */
// 2. If buf is not supplied, malloc space and return this string /* 2. If buf is not supplied, malloc space and return this string */
char * char *
make_string(char *s, int len, char *buf) make_string(char *s, int len, char *buf)
{ {
...@@ -227,10 +227,10 @@ char *str; ...@@ -227,10 +227,10 @@ char *str;
return NULL; return NULL;
} }
// Concatenate a single formatted argument to a given buffer handling the SQL_NTS thing. /* Concatenate a single formatted argument to a given buffer handling the SQL_NTS thing. */
// "fmt" must contain somewhere in it the single form '%.*s' /* "fmt" must contain somewhere in it the single form '%.*s' */
// This is heavily used in creating queries for info routines (SQLTables, SQLColumns). /* This is heavily used in creating queries for info routines (SQLTables, SQLColumns). */
// This routine could be modified to use vsprintf() to handle multiple arguments. /* This routine could be modified to use vsprintf() to handle multiple arguments. */
char * char *
my_strcat(char *buf, char *fmt, char *s, int len) my_strcat(char *buf, char *fmt, char *s, int len)
{ {
......
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
#ifndef WIN32 #ifndef WIN32
#define mylog(args...) /* GNU convention for variable arguments */ #define mylog(args...) /* GNU convention for variable arguments */
#else #else
#define mylog // mylog #define mylog /* mylog */
#endif #endif
#endif #endif
...@@ -66,7 +66,7 @@ ...@@ -66,7 +66,7 @@
#ifndef WIN32 #ifndef WIN32
#define qlog(args...) /* GNU convention for variable arguments */ #define qlog(args...) /* GNU convention for variable arguments */
#else #else
#define qlog // qlog #define qlog /* qlog */
#endif #endif
#endif #endif
......
...@@ -110,8 +110,8 @@ char changed = FALSE; ...@@ -110,8 +110,8 @@ char changed = FALSE;
else { else {
if (vParam == SQL_CURSOR_FORWARD_ONLY || vParam == SQL_CURSOR_STATIC) { if (vParam == SQL_CURSOR_FORWARD_ONLY || vParam == SQL_CURSOR_STATIC) {
if (conn) conn->stmtOptions.cursor_type = vParam; // valid type if (conn) conn->stmtOptions.cursor_type = vParam; /* valid type */
if (stmt) stmt->options.cursor_type = vParam; // valid type if (stmt) stmt->options.cursor_type = vParam; /* valid type */
} }
else { else {
...@@ -161,7 +161,7 @@ char changed = FALSE; ...@@ -161,7 +161,7 @@ char changed = FALSE;
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 */
...@@ -390,7 +390,7 @@ int i; ...@@ -390,7 +390,7 @@ int i;
return SQL_SUCCESS; return SQL_SUCCESS;
} }
// - - - - - - - - - /* - - - - - - - - - */
/* This function just can tell you whether you are in Autcommit mode or not */ /* This function just can tell you whether you are in Autcommit mode or not */
RETCODE SQL_API SQLGetConnectOption( RETCODE SQL_API SQLGetConnectOption(
...@@ -465,7 +465,7 @@ ConnectionClass *conn = (ConnectionClass *) hdbc; ...@@ -465,7 +465,7 @@ ConnectionClass *conn = (ConnectionClass *) hdbc;
return SQL_SUCCESS; return SQL_SUCCESS;
} }
// - - - - - - - - - /* - - - - - - - - - */
RETCODE SQL_API SQLSetStmtOption( RETCODE SQL_API SQLSetStmtOption(
HSTMT hstmt, HSTMT hstmt,
...@@ -477,9 +477,9 @@ StatementClass *stmt = (StatementClass *) hstmt; ...@@ -477,9 +477,9 @@ StatementClass *stmt = (StatementClass *) hstmt;
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 the time, but it tries to set a huge value for SQL_MAX_LENGTH /* 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 /* and expects the driver to reduce it to the real value */
if( ! stmt) { if( ! stmt) {
SC_log_error(func, "", NULL); SC_log_error(func, "", NULL);
...@@ -490,7 +490,7 @@ StatementClass *stmt = (StatementClass *) hstmt; ...@@ -490,7 +490,7 @@ StatementClass *stmt = (StatementClass *) hstmt;
} }
// - - - - - - - - - /* - - - - - - - - - */
RETCODE SQL_API SQLGetStmtOption( RETCODE SQL_API SQLGetStmtOption(
HSTMT hstmt, HSTMT hstmt,
...@@ -503,9 +503,9 @@ QResultClass *res; ...@@ -503,9 +503,9 @@ QResultClass *res;
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 the time, but it tries to set a huge value for SQL_MAX_LENGTH /* 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 /* and expects the driver to reduce it to the real value */
if( ! stmt) { if( ! stmt) {
SC_log_error(func, "", NULL); SC_log_error(func, "", NULL);
...@@ -519,7 +519,7 @@ QResultClass *res; ...@@ -519,7 +519,7 @@ QResultClass *res;
res = stmt->result; res = stmt->result;
if ( stmt->manual_result || ! globals.use_declarefetch) { if ( stmt->manual_result || ! globals.use_declarefetch) {
// make sure we're positioned on a valid row /* make sure we're positioned on a valid row */
if((stmt->currTuple < 0) || if((stmt->currTuple < 0) ||
(stmt->currTuple >= QR_get_num_tuples(res))) { (stmt->currTuple >= QR_get_num_tuples(res))) {
stmt->errormsg = "Not positioned on a valid row."; stmt->errormsg = "Not positioned on a valid row.";
...@@ -618,4 +618,4 @@ QResultClass *res; ...@@ -618,4 +618,4 @@ QResultClass *res;
return SQL_SUCCESS; return SQL_SUCCESS;
} }
// - - - - - - - - - /* - - - - - - - - - */
...@@ -56,7 +56,7 @@ char qc, in_escape = FALSE; ...@@ -56,7 +56,7 @@ char qc, in_escape = FALSE;
/* skip leading delimiters */ /* skip leading delimiters */
while (isspace(s[i]) || s[i] == ',') { while (isspace(s[i]) || s[i] == ',') {
// mylog("skipping '%c'\n", s[i]); /* mylog("skipping '%c'\n", s[i]); */
i++; i++;
} }
...@@ -128,7 +128,7 @@ char qc, in_escape = FALSE; ...@@ -128,7 +128,7 @@ char qc, in_escape = FALSE;
i++; i++;
} }
// mylog("done -- s[%d] = '%c'\n", i, s[i]); /* mylog("done -- s[%d] = '%c'\n", i, s[i]); */
token[out] = '\0'; token[out] = '\0';
...@@ -156,7 +156,7 @@ char qc, in_escape = FALSE; ...@@ -156,7 +156,7 @@ char qc, in_escape = FALSE;
} }
/* #if 0
QR_set_num_fields(stmt->result, 14); QR_set_num_fields(stmt->result, 14);
QR_set_field_info(stmt->result, 0, "TABLE_QUALIFIER", PG_TYPE_TEXT, MAX_INFO_STRING); QR_set_field_info(stmt->result, 0, "TABLE_QUALIFIER", PG_TYPE_TEXT, MAX_INFO_STRING);
QR_set_field_info(stmt->result, 1, "TABLE_OWNER", PG_TYPE_TEXT, MAX_INFO_STRING); QR_set_field_info(stmt->result, 1, "TABLE_OWNER", PG_TYPE_TEXT, MAX_INFO_STRING);
...@@ -170,10 +170,10 @@ QR_set_field_info(stmt->result, 8, "SCALE", PG_TYPE_INT2, 2); ...@@ -170,10 +170,10 @@ QR_set_field_info(stmt->result, 8, "SCALE", PG_TYPE_INT2, 2);
QR_set_field_info(stmt->result, 9, "RADIX", PG_TYPE_INT2, 2); QR_set_field_info(stmt->result, 9, "RADIX", PG_TYPE_INT2, 2);
QR_set_field_info(stmt->result, 10, "NULLABLE", PG_TYPE_INT2, 2); QR_set_field_info(stmt->result, 10, "NULLABLE", PG_TYPE_INT2, 2);
QR_set_field_info(stmt->result, 11, "REMARKS", PG_TYPE_TEXT, 254); QR_set_field_info(stmt->result, 11, "REMARKS", PG_TYPE_TEXT, 254);
// User defined fields /* User defined fields */
QR_set_field_info(stmt->result, 12, "DISPLAY_SIZE", PG_TYPE_INT4, 4); QR_set_field_info(stmt->result, 12, "DISPLAY_SIZE", PG_TYPE_INT4, 4);
QR_set_field_info(stmt->result, 13, "FIELD_TYPE", PG_TYPE_INT4, 4); QR_set_field_info(stmt->result, 13, "FIELD_TYPE", PG_TYPE_INT4, 4);
*/ #endif
void void
getColInfo(COL_INFO *col_info, FIELD_INFO *fi, int k) getColInfo(COL_INFO *col_info, FIELD_INFO *fi, int k)
...@@ -676,7 +676,7 @@ RETCODE result; ...@@ -676,7 +676,7 @@ RETCODE result;
total_cols--; /* makes up for the star */ total_cols--; /* makes up for the star */
/* Allocate some more field pointers if necessary */ /* Allocate some more field pointers if necessary */
//------------------------------------------------------------- /*------------------------------------------------------------- */
old_size = (stmt->nfld / FLD_INCR * FLD_INCR + FLD_INCR); old_size = (stmt->nfld / FLD_INCR * FLD_INCR + FLD_INCR);
need = total_cols - (old_size - stmt->nfld); need = total_cols - (old_size - stmt->nfld);
...@@ -692,22 +692,22 @@ RETCODE result; ...@@ -692,22 +692,22 @@ RETCODE result;
} }
} }
//------------------------------------------------------------- /*------------------------------------------------------------- */
// copy any other fields (if there are any) up past the expansion /* copy any other fields (if there are any) up past the expansion */
for (j = stmt->nfld - 1; j > i; j--) { for (j = stmt->nfld - 1; j > i; j--) {
mylog("copying field %d to %d\n", j, total_cols + j); mylog("copying field %d to %d\n", j, total_cols + j);
fi[total_cols + j] = fi[j]; fi[total_cols + j] = fi[j];
} }
mylog("done copying fields\n"); mylog("done copying fields\n");
//------------------------------------------------------------- /*------------------------------------------------------------- */
// Set the new number of fields /* Set the new number of fields */
stmt->nfld += total_cols; stmt->nfld += total_cols;
mylog("stmt->nfld now at %d\n", stmt->nfld); mylog("stmt->nfld now at %d\n", stmt->nfld);
//------------------------------------------------------------- /*------------------------------------------------------------- */
// copy the new field info /* copy the new field info */
do_all_tables = (fi[i]->ti ? FALSE : TRUE); do_all_tables = (fi[i]->ti ? FALSE : TRUE);
...@@ -720,7 +720,7 @@ RETCODE result; ...@@ -720,7 +720,7 @@ RETCODE result;
for (n = 0; n < cols; n++) { for (n = 0; n < cols; n++) {
mylog("creating field info: n=%d\n", n); mylog("creating field info: n=%d\n", n);
// skip malloc (already did it for the Star) /* skip malloc (already did it for the Star) */
if (k > 0 || n > 0) { if (k > 0 || n > 0) {
mylog("allocating field info at %d\n", n + i); mylog("allocating field info at %d\n", n + i);
fi[n + i] = (FIELD_INFO *) malloc( sizeof(FIELD_INFO)); fi[n + i] = (FIELD_INFO *) malloc( sizeof(FIELD_INFO));
...@@ -744,7 +744,7 @@ RETCODE result; ...@@ -744,7 +744,7 @@ RETCODE result;
mylog("i now at %d\n", i); mylog("i now at %d\n", i);
} }
//------------------------------------------------------------- /*------------------------------------------------------------- */
} }
/* We either know which table the field was in because it was qualified /* We either know which table the field was in because it was qualified
......
...@@ -737,8 +737,8 @@ char *pgtype_create_params(StatementClass *stmt, Int4 type) ...@@ -737,8 +737,8 @@ char *pgtype_create_params(StatementClass *stmt, Int4 type)
Int2 sqltype_to_default_ctype(Int2 sqltype) Int2 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) */
switch(sqltype) { switch(sqltype) {
case SQL_CHAR: case SQL_CHAR:
case SQL_VARCHAR: case SQL_VARCHAR:
......
...@@ -16,7 +16,9 @@ ...@@ -16,7 +16,9 @@
/* in table pg_type */ /* in table pg_type */
// #define PG_TYPE_LO ???? /* waiting for permanent type */ #if 0
#define PG_TYPE_LO ???? /* waiting for permanent type */
#endif
#define PG_TYPE_BOOL 16 #define PG_TYPE_BOOL 16
#define PG_TYPE_BYTEA 17 #define PG_TYPE_BYTEA 17
......
...@@ -83,7 +83,7 @@ typedef UInt4 Oid; ...@@ -83,7 +83,7 @@ typedef UInt4 Oid;
/* Info limits */ /* Info limits */
#define MAX_INFO_STRING 128 #define MAX_INFO_STRING 128
#define MAX_KEYPARTS 20 #define MAX_KEYPARTS 20
#define MAX_KEYLEN 512 // max key of the form "date+outlet+invoice" #define MAX_KEYLEN 512 /* max key of the form "date+outlet+invoice" */
#define MAX_STATEMENT_LEN MAX_MESSAGE_LEN #define MAX_STATEMENT_LEN MAX_MESSAGE_LEN
......
...@@ -125,14 +125,14 @@ QR_Destructor(QResultClass *self) ...@@ -125,14 +125,14 @@ QR_Destructor(QResultClass *self)
if (self->manual_tuples) if (self->manual_tuples)
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 case we need to, free it up. Also, close the cursor. /* 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)) 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 */
QR_free_memory(self); // safe to call anyway QR_free_memory(self); /* safe to call anyway */
// Should have been freed in the close() but just in case... /* Should have been freed in the close() but just in case... */
if (self->cursor) if (self->cursor)
free(self->cursor); free(self->cursor);
...@@ -192,7 +192,7 @@ int num_fields = self->num_fields; ...@@ -192,7 +192,7 @@ int num_fields = self->num_fields;
free(tuple[lf].value); free(tuple[lf].value);
} }
} }
tuple += num_fields; // next row tuple += num_fields; /* next row */
} }
free(self->backend_tuples); free(self->backend_tuples);
...@@ -204,17 +204,17 @@ int num_fields = self->num_fields; ...@@ -204,17 +204,17 @@ int num_fields = self->num_fields;
mylog("QResult: free memory out\n"); mylog("QResult: free memory out\n");
} }
// This function is called by send_query() /* This function is called by send_query() */
char char
QR_fetch_tuples(QResultClass *self, ConnectionClass *conn, char *cursor) 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 the inTuples state, /* then set the inTuples state, */
// and read the tuples. If conn is NULL, /* and read the tuples. If conn is NULL, */
// it implies that we are being called from next_tuple(), /* it implies that we are being called from next_tuple(), */
// like to get 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) {
self->conn = conn; self->conn = conn;
...@@ -232,8 +232,8 @@ int tuple_size; ...@@ -232,8 +232,8 @@ int tuple_size;
self->cursor = strdup(cursor); self->cursor = strdup(cursor);
} }
// Read the field attributes. /* Read the field attributes. */
// $$$$ Should do some error control HERE! $$$$ /* $$$$ Should do some error control HERE! $$$$ */
if ( CI_read_fields(self->fields, self->conn)) { if ( CI_read_fields(self->fields, self->conn)) {
self->status = PGRES_FIELDS_OK; self->status = PGRES_FIELDS_OK;
self->num_fields = CI_get_num_fields(self->fields); self->num_fields = CI_get_num_fields(self->fields);
...@@ -272,8 +272,8 @@ int tuple_size; ...@@ -272,8 +272,8 @@ int tuple_size;
} }
else { else {
// Always have to read the field attributes. /* Always have to read the field attributes. */
// But we dont have to reallocate memory for them! /* But we dont have to reallocate memory for them! */
if ( ! CI_read_fields(NULL, self->conn)) { if ( ! CI_read_fields(NULL, self->conn)) {
self->status = PGRES_BAD_RESPONSE; self->status = PGRES_BAD_RESPONSE;
...@@ -284,8 +284,8 @@ int tuple_size; ...@@ -284,8 +284,8 @@ int tuple_size;
} }
} }
// Close the cursor and end the transaction (if no cursors left) /* Close the cursor and end the transaction (if no cursors left) */
// We only close cursor/end the transaction if a cursor was used. /* We only close cursor/end the transaction if a cursor was used. */
int int
QR_close(QResultClass *self) QR_close(QResultClass *self)
{ {
...@@ -331,7 +331,7 @@ QResultClass *res; ...@@ -331,7 +331,7 @@ QResultClass *res;
return TRUE; return TRUE;
} }
// This function is called by fetch_tuples() AND SQLFetch() /* This function is called by fetch_tuples() AND SQLFetch() */
int int
QR_next_tuple(QResultClass *self) QR_next_tuple(QResultClass *self)
{ {
...@@ -346,7 +346,7 @@ int end_tuple = self->rowset_size + self->base; ...@@ -346,7 +346,7 @@ 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;
static char msgbuffer[MAX_MESSAGE_LEN+1]; static char msgbuffer[MAX_MESSAGE_LEN+1];
char cmdbuffer[MAX_MESSAGE_LEN+1]; // QR_set_command() dups this string so dont need static char cmdbuffer[MAX_MESSAGE_LEN+1]; /* QR_set_command() dups this string so dont need static */
char fetch[128]; char fetch[128];
QueryInfo qi; QueryInfo qi;
...@@ -357,7 +357,7 @@ QueryInfo qi; ...@@ -357,7 +357,7 @@ QueryInfo qi;
return TRUE; return TRUE;
} }
else if (self->fcount < self->cache_size) { /* last row from cache */ else if (self->fcount < self->cache_size) { /* last row from cache */
// We are done because we didn't even get CACHE_SIZE tuples /* We are done because we didn't even get CACHE_SIZE tuples */
mylog("next_tuple: fcount < CACHE_SIZE: fcount = %d, fetch_count = %d\n", fcount, fetch_count); mylog("next_tuple: fcount < CACHE_SIZE: fcount = %d, fetch_count = %d\n", fcount, fetch_count);
self->tupleField = NULL; self->tupleField = NULL;
self->status = PGRES_END_TUPLES; self->status = PGRES_END_TUPLES;
...@@ -417,7 +417,7 @@ QueryInfo qi; ...@@ -417,7 +417,7 @@ QueryInfo qi;
mylog("next_tuple: sending actual fetch (%d) query '%s'\n", fetch_size, fetch); mylog("next_tuple: sending actual fetch (%d) query '%s'\n", fetch_size, fetch);
// don't read ahead for the next tuple (self) ! /* don't read ahead for the next tuple (self) ! */
qi.row_size = self->cache_size; qi.row_size = self->cache_size;
qi.result_in = self; qi.result_in = self;
qi.cursor = NULL; qi.cursor = NULL;
...@@ -479,7 +479,7 @@ QueryInfo qi; ...@@ -479,7 +479,7 @@ QueryInfo qi;
} }
self->fcount++; self->fcount++;
break; // continue reading break; /* continue reading */
case 'C': /* End of tuple list */ case 'C': /* End of tuple list */
...@@ -498,7 +498,7 @@ QueryInfo qi; ...@@ -498,7 +498,7 @@ QueryInfo qi;
self->tupleField = self->backend_tuples + (offset * self->num_fields); self->tupleField = self->backend_tuples + (offset * self->num_fields);
return TRUE; return TRUE;
} }
else { // We are surely done here (we read 0 tuples) else { /* We are surely done here (we read 0 tuples) */
qlog(" [ fetched 0 rows ]\n"); qlog(" [ fetched 0 rows ]\n");
mylog("_next_tuple: 'C': DONE (fcount == 0)\n"); mylog("_next_tuple: 'C': DONE (fcount == 0)\n");
return -1; /* end of tuples */ return -1; /* end of tuples */
...@@ -546,7 +546,7 @@ Int2 bitmap_pos; ...@@ -546,7 +546,7 @@ Int2 bitmap_pos;
Int2 bitcnt; Int2 bitcnt;
Int4 len; Int4 len;
char *buffer; char *buffer;
int num_fields = self->num_fields; // speed up access int num_fields = self->num_fields; /* speed up access */
SocketClass *sock = CC_get_socket(self->conn); SocketClass *sock = CC_get_socket(self->conn);
ColumnInfoClass *flds; ColumnInfoClass *flds;
......
...@@ -37,31 +37,31 @@ typedef enum QueryResultCode_ QueryResultCode; ...@@ -37,31 +37,31 @@ typedef enum QueryResultCode_ QueryResultCode;
struct QResultClass_ { struct QResultClass_ {
ColumnInfoClass *fields; // the Column information ColumnInfoClass *fields; /* the Column information */
TupleListClass *manual_tuples; // manual result tuple list TupleListClass *manual_tuples; /* manual result tuple list */
ConnectionClass *conn; // the connection this result is using (backend) ConnectionClass *conn; /* the connection this result is using (backend) */
// Stuff for declare/fetch tuples /* Stuff for declare/fetch tuples */
int fetch_count; // logical rows read so far int fetch_count; /* logical rows read so far */
int fcount; // actual rows read in the fetch int fcount; /* actual rows read in the fetch */
int currTuple; int currTuple;
int base; int base;
int num_fields; // number of fields in the result int num_fields; /* number of fields in the result */
int cache_size; int cache_size;
int rowset_size; int rowset_size;
QueryResultCode status; QueryResultCode status;
char *message; char *message;
char *cursor; // The name of the cursor for select statements char *cursor; /* The name of the cursor for select statements */
char *command; char *command;
char *notice; char *notice;
TupleField *backend_tuples; // data from the backend (the tuple cache) TupleField *backend_tuples; /* data from the backend (the tuple cache) */
TupleField *tupleField; // current backend tuple being retrieved TupleField *tupleField; /* current backend tuple being retrieved */
char inTuples; // is a fetch of rows from the backend in progress? char inTuples; /* is a fetch of rows from the backend in progress? */
}; };
#define QR_get_fields(self) (self->fields) #define QR_get_fields(self) (self->fields)
...@@ -97,7 +97,7 @@ struct QResultClass_ { ...@@ -97,7 +97,7 @@ struct QResultClass_ {
#define QR_get_notice(self) (self->notice) #define QR_get_notice(self) (self->notice)
#define QR_get_status(self) (self->status) #define QR_get_status(self) (self->status)
// Core Functions /* Core Functions */
QResultClass *QR_Constructor(void); QResultClass *QR_Constructor(void);
void QR_Destructor(QResultClass *self); void QR_Destructor(QResultClass *self);
char QR_read_tuple(QResultClass *self, char binary); char QR_read_tuple(QResultClass *self, char binary);
......
//{{NO_DEPENDENCIES}} /*{{NO_DEPENDENCIES}} */
// Microsoft Developer Studio generated include file. /* Microsoft Developer Studio generated include file. */
// Used by psqlodbc.rc /* Used by psqlodbc.rc */
// /* */
#define IDS_BADDSN 1 #define IDS_BADDSN 1
#define IDS_MSGTITLE 2 #define IDS_MSGTITLE 2
#define DLG_OPTIONS_DRV 102 #define DLG_OPTIONS_DRV 102
...@@ -50,8 +50,8 @@ ...@@ -50,8 +50,8 @@
#define DS_PG64 1057 #define DS_PG64 1057
#define DS_PG63 1058 #define DS_PG63 1058
// Next default values for new objects /* Next default values for new objects */
// /* */
#ifdef APSTUDIO_INVOKED #ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS #ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 104 #define _APS_NEXT_RESOURCE_VALUE 104
......
...@@ -78,7 +78,7 @@ char *msg, *ptr; ...@@ -78,7 +78,7 @@ char *msg, *ptr;
if (res && pcrow) { if (res && pcrow) {
msg = QR_get_command(res); msg = QR_get_command(res);
mylog("*** msg = '%s'\n", msg); mylog("*** msg = '%s'\n", msg);
trim(msg); // get rid of trailing spaces trim(msg); /* get rid of trailing spaces */
ptr = strrchr(msg, ' '); ptr = strrchr(msg, ' ');
if (ptr) { if (ptr) {
*pcrow = atoi(ptr+1); *pcrow = atoi(ptr+1);
...@@ -99,8 +99,8 @@ char *msg, *ptr; ...@@ -99,8 +99,8 @@ char *msg, *ptr;
} }
// This returns the number of columns associated with the database /* This returns the number of columns associated with the database */
// attached to "hstmt". /* attached to "hstmt". */
RETCODE SQL_API SQLNumResultCols( RETCODE SQL_API SQLNumResultCols(
...@@ -155,12 +155,12 @@ char parse_ok; ...@@ -155,12 +155,12 @@ char parse_ok;
} }
// - - - - - - - - - /* - - - - - - - - - */
// Return information about the database column the user wants /* Return information about the database column the user wants */
// information about. /* information about. */
RETCODE SQL_API SQLDescribeCol( RETCODE SQL_API SQLDescribeCol(
HSTMT hstmt, HSTMT hstmt,
UWORD icol, UWORD icol,
...@@ -264,7 +264,7 @@ RETCODE result; ...@@ -264,7 +264,7 @@ RETCODE result;
col_name = QR_get_fieldname(res, icol); col_name = QR_get_fieldname(res, icol);
fieldtype = QR_get_field_type(res, icol); fieldtype = QR_get_field_type(res, icol);
precision = pgtype_precision(stmt, fieldtype, icol, globals.unknown_sizes); // atoi(ci->unknown_sizes) precision = pgtype_precision(stmt, fieldtype, icol, globals.unknown_sizes); /* atoi(ci->unknown_sizes) */
} }
mylog("describeCol: col %d fieldname = '%s'\n", icol, col_name); mylog("describeCol: col %d fieldname = '%s'\n", icol, col_name);
...@@ -308,7 +308,7 @@ RETCODE result; ...@@ -308,7 +308,7 @@ RETCODE result;
if (pcbColDef) { if (pcbColDef) {
if ( precision < 0) if ( precision < 0)
precision = 0; // "I dont know" precision = 0; /* "I dont know" */
*pcbColDef = precision; *pcbColDef = precision;
...@@ -339,7 +339,7 @@ RETCODE result; ...@@ -339,7 +339,7 @@ RETCODE result;
return result; return result;
} }
// Returns result column descriptor information for a result set. /* Returns result column descriptor information for a result set. */
RETCODE SQL_API SQLColAttributes( RETCODE SQL_API SQLColAttributes(
HSTMT hstmt, HSTMT hstmt,
...@@ -377,8 +377,8 @@ int len = 0, value = 0; ...@@ -377,8 +377,8 @@ int len = 0, value = 0;
icol--; icol--;
unknown_sizes = globals.unknown_sizes; // atoi(ci->unknown_sizes); unknown_sizes = globals.unknown_sizes; /* atoi(ci->unknown_sizes); */
if (unknown_sizes == UNKNOWNS_AS_DONTKNOW) // not appropriate for SQLColAttributes() if (unknown_sizes == UNKNOWNS_AS_DONTKNOW) /* not appropriate for SQLColAttributes() */
unknown_sizes = UNKNOWNS_AS_MAX; unknown_sizes = UNKNOWNS_AS_MAX;
parse_ok = FALSE; parse_ok = FALSE;
...@@ -483,7 +483,7 @@ int len = 0, value = 0; ...@@ -483,7 +483,7 @@ int len = 0, value = 0;
mylog("SQLColAttr: COLUMN_LABEL = '%s'\n", p); mylog("SQLColAttr: COLUMN_LABEL = '%s'\n", p);
break; break;
} // otherwise same as column name -- FALL THROUGH!!! } /* otherwise same as column name -- FALL THROUGH!!! */
case SQL_COLUMN_NAME: case SQL_COLUMN_NAME:
...@@ -593,7 +593,7 @@ int len = 0, value = 0; ...@@ -593,7 +593,7 @@ int len = 0, value = 0;
return result; return result;
} }
// Returns result data for a single column in the current row. /* Returns result data for a single column in the current row. */
RETCODE SQL_API SQLGetData( RETCODE SQL_API SQLGetData(
HSTMT hstmt, HSTMT hstmt,
...@@ -657,10 +657,10 @@ mylog("SQLGetData: enter, stmt=%u\n", stmt); ...@@ -657,10 +657,10 @@ mylog("SQLGetData: enter, stmt=%u\n", stmt);
else { else {
// use zero-based column numbers /* use zero-based column numbers */
icol--; icol--;
// make sure the column number is valid /* make sure the column number is valid */
num_cols = QR_NumResultCols(res); num_cols = QR_NumResultCols(res);
if (icol >= num_cols) { if (icol >= num_cols) {
stmt->errormsg = "Invalid column number."; stmt->errormsg = "Invalid column number.";
...@@ -671,7 +671,7 @@ mylog("SQLGetData: enter, stmt=%u\n", stmt); ...@@ -671,7 +671,7 @@ mylog("SQLGetData: enter, stmt=%u\n", stmt);
} }
if ( stmt->manual_result || ! globals.use_declarefetch) { if ( stmt->manual_result || ! globals.use_declarefetch) {
// make sure we're positioned on a valid row /* make sure we're positioned on a valid row */
num_rows = QR_get_num_tuples(res); num_rows = QR_get_num_tuples(res);
if((stmt->currTuple < 0) || if((stmt->currTuple < 0) ||
(stmt->currTuple >= num_rows)) { (stmt->currTuple >= num_rows)) {
...@@ -765,8 +765,8 @@ mylog("SQLGetData: enter, stmt=%u\n", stmt); ...@@ -765,8 +765,8 @@ mylog("SQLGetData: enter, stmt=%u\n", stmt);
// Returns data for bound columns in the current row ("hstmt->iCursor"), /* Returns data for bound columns in the current row ("hstmt->iCursor"), */
// advances the cursor. /* advances the cursor. */
RETCODE SQL_API SQLFetch( RETCODE SQL_API SQLFetch(
HSTMT hstmt) HSTMT hstmt)
...@@ -815,8 +815,8 @@ mylog("SQLFetch: stmt = %u, stmt->result= %u\n", stmt, stmt->result); ...@@ -815,8 +815,8 @@ mylog("SQLFetch: stmt = %u, stmt->result= %u\n", stmt, stmt->result);
} }
if (stmt->bindings == NULL) { if (stmt->bindings == NULL) {
// just to avoid a crash if the user insists on calling this /* just to avoid a crash if the user insists on calling this */
// function even if SQL_ExecDirect has reported an Error /* function even if SQL_ExecDirect has reported an Error */
stmt->errormsg = "Bindings were not allocated properly."; stmt->errormsg = "Bindings were not allocated properly.";
stmt->errornumber = STMT_SEQUENCE_ERROR; stmt->errornumber = STMT_SEQUENCE_ERROR;
SC_log_error(func, "", stmt); SC_log_error(func, "", stmt);
...@@ -829,7 +829,7 @@ mylog("SQLFetch: stmt = %u, stmt->result= %u\n", stmt, stmt->result); ...@@ -829,7 +829,7 @@ mylog("SQLFetch: stmt = %u, stmt->result= %u\n", stmt, stmt->result);
return SC_fetch(stmt); return SC_fetch(stmt);
} }
// This fetchs a block of data (rowset). /* This fetchs a block of data (rowset). */
RETCODE SQL_API SQLExtendedFetch( RETCODE SQL_API SQLExtendedFetch(
HSTMT hstmt, HSTMT hstmt,
...@@ -892,8 +892,8 @@ mylog("SQLExtendedFetch: stmt=%u\n", stmt); ...@@ -892,8 +892,8 @@ mylog("SQLExtendedFetch: stmt=%u\n", stmt);
} }
if (stmt->bindings == NULL) { if (stmt->bindings == NULL) {
// just to avoid a crash if the user insists on calling this /* just to avoid a crash if the user insists on calling this */
// function even if SQL_ExecDirect has reported an Error /* function even if SQL_ExecDirect has reported an Error */
stmt->errormsg = "Bindings were not allocated properly."; stmt->errormsg = "Bindings were not allocated properly.";
stmt->errornumber = STMT_SEQUENCE_ERROR; stmt->errornumber = STMT_SEQUENCE_ERROR;
SC_log_error(func, "", stmt); SC_log_error(func, "", stmt);
...@@ -1050,7 +1050,7 @@ mylog("SQLExtendedFetch: stmt=%u\n", stmt); ...@@ -1050,7 +1050,7 @@ mylog("SQLExtendedFetch: stmt=%u\n", stmt);
truncated = error = FALSE; truncated = error = FALSE;
for (i = 0; i < stmt->options.rowset_size; i++) { for (i = 0; i < stmt->options.rowset_size; i++) {
stmt->bind_row = i; // set the binding location stmt->bind_row = i; /* set the binding location */
result = SC_fetch(stmt); result = SC_fetch(stmt);
/* Determine Function status */ /* Determine Function status */
...@@ -1100,8 +1100,8 @@ mylog("SQLExtendedFetch: stmt=%u\n", stmt); ...@@ -1100,8 +1100,8 @@ mylog("SQLExtendedFetch: stmt=%u\n", stmt);
} }
// This determines whether there are more results sets available for /* This determines whether there are more results sets available for */
// the "hstmt". /* the "hstmt". */
/* CC: return SQL_NO_DATA_FOUND since we do not support multiple result sets */ /* CC: return SQL_NO_DATA_FOUND since we do not support multiple result sets */
RETCODE SQL_API SQLMoreResults( RETCODE SQL_API SQLMoreResults(
...@@ -1110,8 +1110,8 @@ RETCODE SQL_API SQLMoreResults( ...@@ -1110,8 +1110,8 @@ RETCODE SQL_API SQLMoreResults(
return SQL_NO_DATA_FOUND; return SQL_NO_DATA_FOUND;
} }
// This positions the cursor within a rowset, that was positioned using SQLExtendedFetch. /* This positions the cursor within a rowset, that was positioned using SQLExtendedFetch. */
// This will be useful (so far) only when using SQLGetData after SQLExtendedFetch. /* This will be useful (so far) only when using SQLGetData after SQLExtendedFetch. */
RETCODE SQL_API SQLSetPos( RETCODE SQL_API SQLSetPos(
HSTMT hstmt, HSTMT hstmt,
UWORD irow, UWORD irow,
...@@ -1172,7 +1172,7 @@ BindInfoClass *bindings = stmt->bindings; ...@@ -1172,7 +1172,7 @@ BindInfoClass *bindings = stmt->bindings;
} }
// Sets options that control the behavior of cursors. /* Sets options that control the behavior of cursors. */
RETCODE SQL_API SQLSetScrollOptions( RETCODE SQL_API SQLSetScrollOptions(
HSTMT hstmt, HSTMT hstmt,
...@@ -1187,7 +1187,7 @@ static char *func = "SQLSetScrollOptions"; ...@@ -1187,7 +1187,7 @@ static char *func = "SQLSetScrollOptions";
} }
// Set the cursor name on a statement handle /* Set the cursor name on a statement handle */
RETCODE SQL_API SQLSetCursorName( RETCODE SQL_API SQLSetCursorName(
HSTMT hstmt, HSTMT hstmt,
...@@ -1218,7 +1218,7 @@ mylog("SQLSetCursorName: hstmt=%u, szCursor=%u, cbCursorMax=%d\n", hstmt, szCurs ...@@ -1218,7 +1218,7 @@ mylog("SQLSetCursorName: hstmt=%u, szCursor=%u, cbCursorMax=%d\n", hstmt, szCurs
return SQL_SUCCESS; return SQL_SUCCESS;
} }
// Return the cursor name for a statement handle /* Return the cursor name for a statement handle */
RETCODE SQL_API SQLGetCursorName( RETCODE SQL_API SQLGetCursorName(
HSTMT hstmt, HSTMT hstmt,
......
This diff is collapsed.
...@@ -277,8 +277,8 @@ SOCK_get_next_byte(SocketClass *self) ...@@ -277,8 +277,8 @@ 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 -> /* there are no more bytes left in the buffer -> */
// 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);
...@@ -308,7 +308,7 @@ int bytes_sent; ...@@ -308,7 +308,7 @@ int bytes_sent;
self->buffer_out[self->buffer_filled_out++] = next_byte; self->buffer_out[self->buffer_filled_out++] = next_byte;
if (self->buffer_filled_out == globals.socket_buffersize) { if (self->buffer_filled_out == globals.socket_buffersize) {
// buffer is full, so write it out /* buffer is full, so write it out */
bytes_sent = send(self->socket, (char *)self->buffer_out, globals.socket_buffersize, 0); bytes_sent = send(self->socket, (char *)self->buffer_out, globals.socket_buffersize, 0);
if (bytes_sent != globals.socket_buffersize) { if (bytes_sent != globals.socket_buffersize) {
self->errornumber = SOCKET_WRITE_ERROR; self->errornumber = SOCKET_WRITE_ERROR;
......
...@@ -152,7 +152,7 @@ StatementClass *stmt = (StatementClass *) hstmt; ...@@ -152,7 +152,7 @@ StatementClass *stmt = (StatementClass *) hstmt;
/* 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) */
if (!SC_recycle_statement(stmt)) { if (!SC_recycle_statement(stmt)) {
// errormsg passed in above /* errormsg passed in above */
SC_log_error(func, "", stmt); SC_log_error(func, "", stmt);
return SQL_ERROR; return SQL_ERROR;
} }
...@@ -178,10 +178,10 @@ StatementClass *stmt = (StatementClass *) hstmt; ...@@ -178,10 +178,10 @@ StatementClass *stmt = (StatementClass *) hstmt;
void void
InitializeStatementOptions(StatementOptions *opt) InitializeStatementOptions(StatementOptions *opt)
{ {
opt->maxRows = 0; // driver returns all rows opt->maxRows = 0; /* driver returns all rows */
opt->maxLength = 0; // driver returns all data for char/binary opt->maxLength = 0; /* driver returns all data for char/binary */
opt->rowset_size = 1; opt->rowset_size = 1;
opt->keyset_size = 0; // fully keyset driven is the default opt->keyset_size = 0; /* fully keyset driven is the default */
opt->scroll_concurrency = SQL_CONCUR_READ_ONLY; opt->scroll_concurrency = SQL_CONCUR_READ_ONLY;
opt->cursor_type = SQL_CURSOR_FORWARD_ONLY; opt->cursor_type = SQL_CURSOR_FORWARD_ONLY;
opt->bind_size = 0; /* default is to bind by column */ opt->bind_size = 0; /* default is to bind by column */
...@@ -447,7 +447,7 @@ mylog("recycle statement: self= %u\n", self); ...@@ -447,7 +447,7 @@ mylog("recycle statement: self= %u\n", self);
/****************************************************************/ /****************************************************************/
self->status = STMT_READY; self->status = STMT_READY;
self->manual_result = FALSE; // very important self->manual_result = FALSE; /* very important */
self->currTuple = -1; self->currTuple = -1;
self->rowset_start = -1; self->rowset_start = -1;
...@@ -461,9 +461,9 @@ mylog("recycle statement: self= %u\n", self); ...@@ -461,9 +461,9 @@ mylog("recycle statement: self= %u\n", self);
self->lobj_fd = -1; self->lobj_fd = -1;
// 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 SQLParamData/SQLPutData is called. /* the next 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);
return TRUE; return TRUE;
...@@ -517,8 +517,8 @@ SC_clear_error(StatementClass *self) ...@@ -517,8 +517,8 @@ SC_clear_error(StatementClass *self)
} }
// This function creates an error msg which is the concatenation /* This function creates an error msg which is the concatenation */
// of the result, statement, connection, and socket messages. /* of the result, statement, connection, and socket messages. */
char * char *
SC_create_errormsg(StatementClass *self) SC_create_errormsg(StatementClass *self)
{ {
...@@ -557,7 +557,7 @@ SC_get_error(StatementClass *self, int *number, char **message) ...@@ -557,7 +557,7 @@ SC_get_error(StatementClass *self, int *number, char **message)
{ {
char rv; char rv;
// Create a very informative errormsg if it hasn't been done yet. /* Create a very informative errormsg if it hasn't been done yet. */
if ( ! self->errormsg_created) { if ( ! self->errormsg_created) {
self->errormsg = SC_create_errormsg(self); self->errormsg = SC_create_errormsg(self);
self->errormsg_created = TRUE; self->errormsg_created = TRUE;
...@@ -595,7 +595,7 @@ Int2 num_cols, lf; ...@@ -595,7 +595,7 @@ Int2 num_cols, lf;
Oid type; Oid type;
char *value; char *value;
ColumnInfoClass *ci; ColumnInfoClass *ci;
// TupleField *tupleField; /* TupleField *tupleField; */
self->last_fetch_count = 0; self->last_fetch_count = 0;
ci = QR_get_fields(res); /* the column info */ ci = QR_get_fields(res); /* the column info */
...@@ -619,14 +619,14 @@ ColumnInfoClass *ci; ...@@ -619,14 +619,14 @@ ColumnInfoClass *ci;
} }
else { else {
// read from the cache or the physical next tuple /* read from the cache or the physical next tuple */
retval = QR_next_tuple(res); retval = QR_next_tuple(res);
if (retval < 0) { if (retval < 0) {
mylog("**** SQLFetch: end_tuples\n"); mylog("**** SQLFetch: end_tuples\n");
return SQL_NO_DATA_FOUND; return SQL_NO_DATA_FOUND;
} }
else if (retval > 0) else if (retval > 0)
(self->currTuple)++; // all is well (self->currTuple)++; /* all is well */
else { else {
mylog("SQLFetch: error\n"); mylog("SQLFetch: error\n");
...@@ -663,9 +663,9 @@ ColumnInfoClass *ci; ...@@ -663,9 +663,9 @@ ColumnInfoClass *ci;
self->bindings[lf].data_left = -1; self->bindings[lf].data_left = -1;
if (self->bindings[lf].buffer != NULL) { 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 */ type = CI_get_oid(ci, lf); /* speed things up */
mylog("type = %d\n", type); mylog("type = %d\n", type);
...@@ -783,9 +783,9 @@ QueryInfo qi; ...@@ -783,9 +783,9 @@ QueryInfo qi;
self->status = STMT_EXECUTING; self->status = STMT_EXECUTING;
// If it's a SELECT statement, use a cursor. /* If it's a SELECT statement, use a cursor. */
// Note that the declare cursor has already been prepended to the statement /* Note that the declare cursor has already been prepended to the statement */
// in copy_statement... /* in copy_statement... */
if (self->statement_type == STMT_TYPE_SELECT) { if (self->statement_type == STMT_TYPE_SELECT) {
char fetch[128]; char fetch[128];
...@@ -821,11 +821,11 @@ QueryInfo qi; ...@@ -821,11 +821,11 @@ QueryInfo qi;
} }
else { // not a SELECT statement so don't use a cursor else { /* not a SELECT statement so don't use a cursor */
mylog(" it's NOT a select statement: stmt=%u\n", self); mylog(" it's NOT a select statement: stmt=%u\n", self);
self->result = CC_send_query(conn, self->stmt_with_params, NULL); self->result = CC_send_query(conn, self->stmt_with_params, NULL);
// If we are in autocommit, we must send the commit. /* If we are in autocommit, we must send the commit. */
if ( ! self->internal && CC_is_in_autocommit(conn) && STMT_UPDATE(self)) { if ( ! self->internal && CC_is_in_autocommit(conn) && STMT_UPDATE(self)) {
res = CC_send_query(conn, "COMMIT", NULL); res = CC_send_query(conn, "COMMIT", NULL);
QR_Destructor(res); QR_Destructor(res);
...@@ -929,7 +929,7 @@ SC_log_error(char *func, char *desc, StatementClass *self) ...@@ -929,7 +929,7 @@ SC_log_error(char *func, char *desc, StatementClass *self)
qlog(" status=%d, inTuples=%d\n", res->status, res->inTuples); qlog(" status=%d, inTuples=%d\n", res->status, res->inTuples);
} }
// Log the connection error if there is one /* Log the connection error if there is one */
CC_log_error(func, desc, self->hdbc); CC_log_error(func, desc, self->hdbc);
} }
else else
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
void set_tuplefield_null(TupleField *tuple_field) void set_tuplefield_null(TupleField *tuple_field)
{ {
tuple_field->len = 0; tuple_field->len = 0;
tuple_field->value = NULL; // strdup(""); tuple_field->value = NULL; /* strdup(""); */
} }
void set_tuplefield_string(TupleField *tuple_field, char *string) void set_tuplefield_string(TupleField *tuple_field, char *string)
......
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