Back out odbc changes until 7.1.
This commit is contained in:
parent
e39a118694
commit
a8020a78ec
@ -34,7 +34,7 @@
|
||||
#include <sqlext.h>
|
||||
#endif
|
||||
|
||||
/* Bind parameters on a statement handle */
|
||||
// Bind parameters on a statement handle
|
||||
|
||||
RETCODE SQL_API SQLBindParameter(
|
||||
HSTMT hstmt,
|
||||
@ -75,18 +75,18 @@ static char *func="SQLBindParameter";
|
||||
|
||||
stmt->parameters_allocated = ipar;
|
||||
|
||||
/* copy the old parameters over */
|
||||
// copy the old parameters over
|
||||
for(i = 0; i < old_parameters_allocated; i++) {
|
||||
/* a structure copy should work */
|
||||
// a structure copy should work
|
||||
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)
|
||||
free(old_parameters);
|
||||
|
||||
/* zero out the newly allocated parameters (in case they skipped some, */
|
||||
/* so we don't accidentally try to use them later) */
|
||||
// zero out the newly allocated parameters (in case they skipped some,
|
||||
// so we don't accidentally try to use them later)
|
||||
for(; i < stmt->parameters_allocated; i++) {
|
||||
stmt->parameters[i].buflen = 0;
|
||||
stmt->parameters[i].buffer = 0;
|
||||
@ -105,7 +105,7 @@ static char *func="SQLBindParameter";
|
||||
|
||||
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].buffer = rgbValue;
|
||||
stmt->parameters[ipar].used = pcbValue;
|
||||
@ -140,9 +140,9 @@ static char *func="SQLBindParameter";
|
||||
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(
|
||||
HSTMT hstmt,
|
||||
UWORD icol,
|
||||
@ -195,14 +195,14 @@ mylog("**** SQLBindCol: stmt = %u, icol = %d\n", stmt, icol);
|
||||
return SQL_SUCCESS;
|
||||
}
|
||||
|
||||
/* allocate enough bindings if not already done */
|
||||
/* Most likely, execution of a statement would have setup the */
|
||||
/* necessary bindings. But some apps call BindCol before any */
|
||||
/* statement is executed. */
|
||||
// allocate enough bindings if not already done
|
||||
// Most likely, execution of a statement would have setup the
|
||||
// necessary bindings. But some apps call BindCol before any
|
||||
// statement is executed.
|
||||
if ( icol > stmt->bindings_allocated)
|
||||
extend_bindings(stmt, icol);
|
||||
|
||||
/* check to see if the bindings were allocated */
|
||||
// check to see if the bindings were allocated
|
||||
if ( ! stmt->bindings) {
|
||||
stmt->errormsg = "Could not allocate memory for bindings.";
|
||||
stmt->errornumber = STMT_NO_MEMORY_ERROR;
|
||||
@ -234,14 +234,14 @@ mylog("**** SQLBindCol: stmt = %u, icol = %d\n", stmt, icol);
|
||||
return SQL_SUCCESS;
|
||||
}
|
||||
|
||||
/* - - - - - - - - - */
|
||||
// - - - - - - - - -
|
||||
|
||||
/* Returns the description of a parameter marker. */
|
||||
/* This function is listed as not being supported by SQLGetFunctions() because it is */
|
||||
/* 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, */
|
||||
/* it is best to say this function is not supported and let the application assume a */
|
||||
/* data type (most likely varchar). */
|
||||
// Returns the description of a parameter marker.
|
||||
// This function is listed as not being supported by SQLGetFunctions() because it is
|
||||
// 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,
|
||||
// it is best to say this function is not supported and let the application assume a
|
||||
// data type (most likely varchar).
|
||||
|
||||
RETCODE SQL_API SQLDescribeParam(
|
||||
HSTMT hstmt,
|
||||
@ -270,8 +270,8 @@ static char *func = "SQLDescribeParam";
|
||||
|
||||
ipar--;
|
||||
|
||||
/* This implementation is not very good, since it is supposed to describe */
|
||||
/* parameter markers, not bound parameters. */
|
||||
// This implementation is not very good, since it is supposed to describe
|
||||
// parameter markers, not bound parameters.
|
||||
if(pfSqlType)
|
||||
*pfSqlType = stmt->parameters[ipar].SQLType;
|
||||
|
||||
@ -287,9 +287,9 @@ static char *func = "SQLDescribeParam";
|
||||
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(
|
||||
HSTMT hstmt,
|
||||
@ -304,15 +304,15 @@ static char *func = "SQLParamOptions";
|
||||
return SQL_ERROR;
|
||||
}
|
||||
|
||||
/* - - - - - - - - - */
|
||||
// - - - - - - - - -
|
||||
|
||||
/* This function should really talk to the dbms to determine the number of */
|
||||
/* "parameter markers" (not bound parameters) in the statement. But, since */
|
||||
/* 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 */
|
||||
/* like it does for SQLDescribeParam is that some applications don't care and try */
|
||||
/* to call it anyway. */
|
||||
/* If the statement does not have parameters, it should just return 0. */
|
||||
// This function should really talk to the dbms to determine the number of
|
||||
// "parameter markers" (not bound parameters) in the statement. But, since
|
||||
// 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
|
||||
// like it does for SQLDescribeParam is that some applications don't care and try
|
||||
// to call it anyway.
|
||||
// If the statement does not have parameters, it should just return 0.
|
||||
RETCODE SQL_API SQLNumParams(
|
||||
HSTMT hstmt,
|
||||
SWORD FAR *pcpar)
|
||||
@ -338,7 +338,7 @@ static char *func = "SQLNumParams";
|
||||
|
||||
|
||||
if(!stmt->statement) {
|
||||
/* no statement has been allocated */
|
||||
// no statement has been allocated
|
||||
stmt->errormsg = "SQLNumParams called with no statement ready.";
|
||||
stmt->errornumber = STMT_SEQUENCE_ERROR;
|
||||
SC_log_error(func, "", stmt);
|
||||
@ -419,13 +419,13 @@ mylog("%s: entering ... stmt=%u, bindings_allocated=%d, num_columns=%d\n", func,
|
||||
stmt->bindings_allocated = num_columns;
|
||||
|
||||
}
|
||||
/* There is no reason to zero out extra bindings if there are */
|
||||
/* more than needed. If an app has allocated extra bindings, */
|
||||
/* let it worry about it by unbinding those columns. */
|
||||
// There is no reason to zero out extra bindings if there are
|
||||
// more than needed. If an app has allocated extra bindings,
|
||||
// let it worry about it by unbinding those columns.
|
||||
|
||||
/* SQLBindCol(1..) ... SQLBindCol(10...) # got 10 bindings */
|
||||
/* SQLExecDirect(...) # returns 5 cols */
|
||||
/* SQLExecDirect(...) # returns 10 cols (now OK) */
|
||||
// SQLBindCol(1..) ... SQLBindCol(10...) # got 10 bindings
|
||||
// SQLExecDirect(...) # returns 5 cols
|
||||
// SQLExecDirect(...) # returns 10 cols (now OK)
|
||||
|
||||
mylog("exit extend_bindings\n");
|
||||
}
|
||||
|
@ -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)
|
||||
{
|
||||
|
||||
/* check bounds */
|
||||
// check bounds
|
||||
if((field_num < 0) || (field_num >= self->num_fields)) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* store the info */
|
||||
// store the info
|
||||
self->name[field_num] = strdup(new_name);
|
||||
self->adtid[field_num] = new_adtid;
|
||||
self->adtsize[field_num] = new_adtsize;
|
||||
|
@ -70,7 +70,7 @@ static char *func="SQLAllocConnect";
|
||||
}
|
||||
|
||||
|
||||
/* - - - - - - - - - */
|
||||
// - - - - - - - - -
|
||||
|
||||
RETCODE SQL_API SQLConnect(
|
||||
HDBC hdbc,
|
||||
@ -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);
|
||||
|
||||
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);
|
||||
return SQL_ERROR;
|
||||
}
|
||||
@ -121,7 +121,7 @@ static char *func = "SQLConnect";
|
||||
return SQL_SUCCESS;
|
||||
}
|
||||
|
||||
/* - - - - - - - - - */
|
||||
// - - - - - - - - -
|
||||
|
||||
RETCODE SQL_API SQLBrowseConnect(
|
||||
HDBC hdbc,
|
||||
@ -138,7 +138,7 @@ static char *func="SQLBrowseConnect";
|
||||
return SQL_SUCCESS;
|
||||
}
|
||||
|
||||
/* - - - - - - - - - */
|
||||
// - - - - - - - - -
|
||||
|
||||
/* Drop any hstmts open on hdbc and disconnect from database */
|
||||
RETCODE SQL_API SQLDisconnect(
|
||||
@ -176,7 +176,7 @@ static char *func = "SQLDisconnect";
|
||||
}
|
||||
|
||||
|
||||
/* - - - - - - - - - */
|
||||
// - - - - - - - - -
|
||||
|
||||
RETCODE SQL_API SQLFreeConnect(
|
||||
HDBC hdbc)
|
||||
@ -229,7 +229,7 @@ ConnectionClass *rv;
|
||||
rv->errormsg_created = FALSE;
|
||||
|
||||
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));
|
||||
|
||||
@ -334,8 +334,8 @@ CC_clear_error(ConnectionClass *self)
|
||||
self->errormsg_created = FALSE;
|
||||
}
|
||||
|
||||
/* Used to cancel a transaction */
|
||||
/* We are almost always in the middle of a transaction. */
|
||||
// Used to cancel a transaction
|
||||
// We are almost always in the middle of a transaction.
|
||||
char
|
||||
CC_abort(ConnectionClass *self)
|
||||
{
|
||||
@ -371,9 +371,9 @@ StatementClass *stmt;
|
||||
|
||||
mylog("in CC_Cleanup, self=%u\n", self);
|
||||
|
||||
/* Cancel an ongoing transaction */
|
||||
/* We are always in the middle of a transaction, */
|
||||
/* even if we are in auto commit. */
|
||||
// Cancel an ongoing transaction
|
||||
// We are always in the middle of a transaction,
|
||||
// even if we are in auto commit.
|
||||
if (self->sock)
|
||||
CC_abort(self);
|
||||
|
||||
@ -549,7 +549,7 @@ static char *func="CC_connect";
|
||||
|
||||
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);
|
||||
|
||||
if ( PROTOCOL_63(ci))
|
||||
@ -579,9 +579,9 @@ static char *func="CC_connect";
|
||||
mylog("gonna do authentication\n");
|
||||
|
||||
|
||||
/* *************************************************** */
|
||||
/* Now get the authentication request from backend */
|
||||
/* *************************************************** */
|
||||
// ***************************************************
|
||||
// Now get the authentication request from backend
|
||||
// ***************************************************
|
||||
|
||||
if ( ! PROTOCOL_62(ci)) do {
|
||||
|
||||
@ -790,7 +790,7 @@ int rv;
|
||||
|
||||
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) {
|
||||
self->errormsg = CC_create_errormsg(self);
|
||||
self->errormsg_created = TRUE;
|
||||
@ -802,7 +802,7 @@ int rv;
|
||||
}
|
||||
rv = (self->errornumber != 0);
|
||||
|
||||
self->errornumber = 0; /* clear the error */
|
||||
self->errornumber = 0; // clear the error
|
||||
|
||||
mylog("exit CC_get_error\n");
|
||||
|
||||
@ -826,13 +826,13 @@ char swallow;
|
||||
int id;
|
||||
SocketClass *sock = self->sock;
|
||||
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);
|
||||
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) {
|
||||
self->errornumber = CONNECTION_MSG_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
|
||||
mylog("~~~ NOTICE: '%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 */
|
||||
/* 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
|
||||
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)) {
|
||||
self->errornumber = CONNECTION_COULD_NOT_RECEIVE;
|
||||
self->errormsg = QR_get_message(result_in);
|
||||
@ -1186,7 +1186,7 @@ int i;
|
||||
mylog("send_function(G): 'N' - %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 */
|
||||
return TRUE;
|
||||
@ -1206,9 +1206,9 @@ int i;
|
||||
char
|
||||
CC_send_settings(ConnectionClass *self)
|
||||
{
|
||||
/* char ini_query[MAX_MESSAGE_LEN]; */
|
||||
// char ini_query[MAX_MESSAGE_LEN];
|
||||
ConnInfo *ci = &(self->connInfo);
|
||||
/* QResultClass *res; */
|
||||
// QResultClass *res;
|
||||
HSTMT hstmt;
|
||||
StatementClass *stmt;
|
||||
RETCODE result;
|
||||
|
@ -65,66 +65,66 @@ extern GLOBAL_VALUES globals;
|
||||
* - thomas 2000-04-03
|
||||
*/
|
||||
char *mapFuncs[][2] = {
|
||||
/* { "ASCII", "ascii" }, */
|
||||
// { "ASCII", "ascii" },
|
||||
{ "CHAR", "ichar" },
|
||||
{ "CONCAT", "textcat" },
|
||||
/* { "DIFFERENCE", "difference" }, */
|
||||
/* { "INSERT", "insert" }, */
|
||||
// { "DIFFERENCE", "difference" },
|
||||
// { "INSERT", "insert" },
|
||||
{ "LCASE", "lower" },
|
||||
{ "LEFT", "ltrunc" },
|
||||
{ "LOCATE", "strpos" },
|
||||
{ "LENGTH", "char_length"},
|
||||
/* { "LTRIM", "ltrim" }, */
|
||||
// { "LTRIM", "ltrim" },
|
||||
{ "RIGHT", "rtrunc" },
|
||||
/* { "REPEAT", "repeat" }, */
|
||||
/* { "REPLACE", "replace" }, */
|
||||
/* { "RTRIM", "rtrim" }, */
|
||||
/* { "SOUNDEX", "soundex" }, */
|
||||
// { "REPEAT", "repeat" },
|
||||
// { "REPLACE", "replace" },
|
||||
// { "RTRIM", "rtrim" },
|
||||
// { "SOUNDEX", "soundex" },
|
||||
{ "SUBSTRING", "substr" },
|
||||
{ "UCASE", "upper" },
|
||||
|
||||
/* { "ABS", "abs" }, */
|
||||
/* { "ACOS", "acos" }, */
|
||||
/* { "ASIN", "asin" }, */
|
||||
/* { "ATAN", "atan" }, */
|
||||
/* { "ATAN2", "atan2" }, */
|
||||
// { "ABS", "abs" },
|
||||
// { "ACOS", "acos" },
|
||||
// { "ASIN", "asin" },
|
||||
// { "ATAN", "atan" },
|
||||
// { "ATAN2", "atan2" },
|
||||
{ "CEILING", "ceil" },
|
||||
/* { "COS", "cos" }, */
|
||||
/* { "COT", "cot" }, */
|
||||
/* { "DEGREES", "degrees" }, */
|
||||
/* { "EXP", "exp" }, */
|
||||
/* { "FLOOR", "floor" }, */
|
||||
// { "COS", "cos" },
|
||||
// { "COT", "cot" },
|
||||
// { "DEGREES", "degrees" },
|
||||
// { "EXP", "exp" },
|
||||
// { "FLOOR", "floor" },
|
||||
{ "LOG", "ln" },
|
||||
{ "LOG10", "log" },
|
||||
/* { "MOD", "mod" }, */
|
||||
/* { "PI", "pi" }, */
|
||||
// { "MOD", "mod" },
|
||||
// { "PI", "pi" },
|
||||
{ "POWER", "pow" },
|
||||
/* { "RADIANS", "radians" }, */
|
||||
// { "RADIANS", "radians" },
|
||||
{ "RAND", "random" },
|
||||
/* { "ROUND", "round" }, */
|
||||
/* { "SIGN", "sign" }, */
|
||||
/* { "SIN", "sin" }, */
|
||||
/* { "SQRT", "sqrt" }, */
|
||||
/* { "TAN", "tan" }, */
|
||||
// { "ROUND", "round" },
|
||||
// { "SIGN", "sign" },
|
||||
// { "SIN", "sin" },
|
||||
// { "SQRT", "sqrt" },
|
||||
// { "TAN", "tan" },
|
||||
{ "TRUNCATE", "trunc" },
|
||||
|
||||
/* { "CURDATE", "curdate" }, */
|
||||
/* { "CURTIME", "curtime" }, */
|
||||
/* { "DAYNAME", "dayname" }, */
|
||||
/* { "DAYOFMONTH", "dayofmonth" }, */
|
||||
/* { "DAYOFWEEK", "dayofweek" }, */
|
||||
/* { "DAYOFYEAR", "dayofyear" }, */
|
||||
/* { "HOUR", "hour" }, */
|
||||
/* { "MINUTE", "minute" }, */
|
||||
/* { "MONTH", "month" }, */
|
||||
/* { "MONTHNAME", "monthname" }, */
|
||||
/* { "NOW", "now" }, */
|
||||
/* { "QUARTER", "quarter" }, */
|
||||
/* { "SECOND", "second" }, */
|
||||
/* { "WEEK", "week" }, */
|
||||
/* { "YEAR", "year" }, */
|
||||
// { "CURDATE", "curdate" },
|
||||
// { "CURTIME", "curtime" },
|
||||
// { "DAYNAME", "dayname" },
|
||||
// { "DAYOFMONTH", "dayofmonth" },
|
||||
// { "DAYOFWEEK", "dayofweek" },
|
||||
// { "DAYOFYEAR", "dayofyear" },
|
||||
// { "HOUR", "hour" },
|
||||
// { "MINUTE", "minute" },
|
||||
// { "MONTH", "month" },
|
||||
// { "MONTHNAME", "monthname" },
|
||||
// { "NOW", "now" },
|
||||
// { "QUARTER", "quarter" },
|
||||
// { "SECOND", "second" },
|
||||
// { "WEEK", "week" },
|
||||
// { "YEAR", "year" },
|
||||
|
||||
/* { "DATABASE", "database" }, */
|
||||
// { "DATABASE", "database" },
|
||||
{ "IFNULL", "coalesce" },
|
||||
{ "USER", "odbc_user" },
|
||||
{ 0, 0 }
|
||||
@ -270,7 +270,7 @@ copy_and_convert_field(StatementClass *stmt, Int4 field_type, void *value, Int2
|
||||
case PG_TYPE_INT2VECTOR: {
|
||||
int nval, i;
|
||||
char *vp;
|
||||
/* this is an array of eight integers */
|
||||
// this is an array of eight integers
|
||||
short *short_array = (short *) ( (char *) rgbValue + rgbValueOffset);
|
||||
|
||||
len = 16;
|
||||
@ -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
|
||||
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);
|
||||
|
||||
/***** THIS IS NOT PROPERLY IMPLEMENTED *****/
|
||||
@ -495,7 +495,7 @@ copy_and_convert_field(StatementClass *stmt, Int4 field_type, void *value, Int2
|
||||
} else {
|
||||
*((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;
|
||||
|
||||
case SQL_C_STINYINT:
|
||||
@ -575,8 +575,8 @@ copy_and_convert_field(StatementClass *stmt, Int4 field_type, void *value, Int2
|
||||
|
||||
case SQL_C_BINARY:
|
||||
|
||||
/* truncate if necessary */
|
||||
/* convert octal escapes to bytes */
|
||||
// truncate if necessary
|
||||
// convert octal escapes to bytes
|
||||
|
||||
len = convert_from_pgbinary(value, tempBuf, sizeof(tempBuf));
|
||||
ptr = tempBuf;
|
||||
@ -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) {
|
||||
*(SDWORD *) ((char *)pcbValue + pcbValueOffset) = len;
|
||||
}
|
||||
@ -674,7 +674,7 @@ int lobj_fd, retval;
|
||||
if ( stmt->cursor_name[0] == '\0')
|
||||
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) {
|
||||
sprintf(new_statement, "declare %s cursor for ", stmt->cursor_name);
|
||||
npos = strlen(new_statement);
|
||||
@ -690,13 +690,13 @@ int lobj_fd, retval;
|
||||
|
||||
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 &&
|
||||
old_statement[opos+1] == '\n') {
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Handle literals (date, time, timestamp) and ODBC scalar functions */
|
||||
// Handle literals (date, time, timestamp) and ODBC scalar functions
|
||||
else if (old_statement[opos] == '{') {
|
||||
char *esc;
|
||||
char *begin = &old_statement[opos + 1];
|
||||
@ -779,7 +779,7 @@ int lobj_fd, retval;
|
||||
|
||||
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)
|
||||
param_ctype = sqltype_to_default_ctype(param_sqltype);
|
||||
|
||||
@ -878,10 +878,10 @@ int lobj_fd, retval;
|
||||
|
||||
}
|
||||
default:
|
||||
/* error */
|
||||
// error
|
||||
stmt->errormsg = "Unrecognized C_parameter type in copy_statement_with_parameters";
|
||||
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);
|
||||
return SQL_ERROR;
|
||||
}
|
||||
@ -1062,8 +1062,8 @@ int lobj_fd, retval;
|
||||
|
||||
break;
|
||||
|
||||
/* because of no conversion operator for bool and int4, SQL_BIT */
|
||||
/* must be quoted (0 or 1 is ok to use inside the quotes) */
|
||||
// because of no conversion operator for bool and int4, SQL_BIT
|
||||
// must be quoted (0 or 1 is ok to use inside the quotes)
|
||||
|
||||
default: /* a numeric type or SQL_BIT */
|
||||
if (param_sqltype == SQL_BIT)
|
||||
@ -1087,7 +1087,7 @@ int lobj_fd, retval;
|
||||
|
||||
} /* end, for */
|
||||
|
||||
/* make sure new_statement is always null-terminated */
|
||||
// make sure new_statement is always null-terminated
|
||||
new_statement[npos] = '\0';
|
||||
|
||||
|
||||
@ -1194,7 +1194,7 @@ size_t i = 0, out = 0;
|
||||
|
||||
for (i = 0; i < strlen(s); i++) {
|
||||
if (s[i] == '$' || s[i] == ',' || s[i] == ')')
|
||||
; /* skip these characters */
|
||||
; // skip these characters
|
||||
else if (s[i] == '(')
|
||||
s[out++] = '-';
|
||||
else
|
||||
@ -1358,7 +1358,7 @@ int i, y=0, val;
|
||||
return y;
|
||||
}
|
||||
|
||||
/* convert octal escapes to bytes */
|
||||
// convert octal escapes to bytes
|
||||
int
|
||||
convert_from_pgbinary(unsigned char *value, unsigned char *rgbValue, int cbValueMax)
|
||||
{
|
||||
@ -1378,7 +1378,7 @@ int o=0;
|
||||
o++;
|
||||
}
|
||||
|
||||
rgbValue[o] = '\0'; /* extra protection */
|
||||
rgbValue[o] = '\0'; // extra protection
|
||||
|
||||
return o;
|
||||
}
|
||||
@ -1402,7 +1402,7 @@ static char x[6];
|
||||
return x;
|
||||
}
|
||||
|
||||
/* convert non-ascii bytes to octal escape sequences */
|
||||
// convert non-ascii bytes to octal escape sequences
|
||||
int
|
||||
convert_to_pgbinary(unsigned char *in, char *out, int len)
|
||||
{
|
||||
|
@ -156,7 +156,7 @@ int CALLBACK driver_optionsProc(HWND hdlg,
|
||||
|
||||
globals.fetch_max = GetDlgItemInt(hdlg, DRV_CACHE_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));
|
||||
|
||||
@ -165,7 +165,7 @@ int CALLBACK driver_optionsProc(HWND hdlg,
|
||||
|
||||
updateGlobals();
|
||||
|
||||
/* fall through */
|
||||
// fall through
|
||||
|
||||
case IDCANCEL:
|
||||
EndDialog(hdlg, GET_WM_COMMAND_ID(wParam, lParam) == IDOK);
|
||||
@ -230,7 +230,7 @@ char buf[128];
|
||||
switch (wMsg) {
|
||||
case WM_INITDIALOG:
|
||||
ci = (ConnInfo *) lParam;
|
||||
SetWindowLong(hdlg, DWL_USER, lParam); /* save for OK */
|
||||
SetWindowLong(hdlg, DWL_USER, lParam); // save for OK
|
||||
|
||||
/* Change window caption */
|
||||
if (ci->driver[0])
|
||||
@ -301,7 +301,7 @@ char buf[128];
|
||||
GetDlgItemText(hdlg, DS_CONNSETTINGS, ci->conn_settings, sizeof(ci->conn_settings));
|
||||
|
||||
|
||||
/* fall through */
|
||||
// fall through
|
||||
|
||||
case IDCANCEL:
|
||||
EndDialog(hdlg, GET_WM_COMMAND_ID(wParam, lParam) == IDOK);
|
||||
@ -389,7 +389,7 @@ copyAttributes(ConnInfo *ci, char *attribute, char *value)
|
||||
|
||||
else if (stricmp(attribute, INI_CONNSETTINGS) == 0) {
|
||||
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);
|
||||
@ -428,8 +428,8 @@ getDSNinfo(ConnInfo *ci, char overwrite)
|
||||
char *DSN = ci->dsn;
|
||||
char encoded_conn_settings[LARGE_REGISTRY_LEN];
|
||||
|
||||
/* 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 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[0] == '\0') {
|
||||
if ( ci->driver[0] != '\0')
|
||||
return;
|
||||
@ -437,10 +437,10 @@ char encoded_conn_settings[LARGE_REGISTRY_LEN];
|
||||
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';
|
||||
|
||||
/* Proceed with getting info for the given DSN. */
|
||||
// Proceed with getting info for the given DSN.
|
||||
|
||||
if ( ci->desc[0] == '\0' || overwrite)
|
||||
SQLGetPrivateProfileString(DSN, INI_KDESC, "", ci->desc, sizeof(ci->desc), ODBC_INI);
|
||||
@ -600,7 +600,7 @@ void getGlobalDefaults(char *section, char *filename, char override)
|
||||
char temp[256];
|
||||
|
||||
|
||||
/* Fetch Count is stored in driver section */
|
||||
// Fetch Count is stored in driver section
|
||||
SQLGetPrivateProfileString(section, INI_FETCH, "",
|
||||
temp, sizeof(temp), filename);
|
||||
if ( temp[0] ) {
|
||||
@ -613,7 +613,7 @@ char temp[256];
|
||||
globals.fetch_max = FETCH_MAX;
|
||||
|
||||
|
||||
/* Socket Buffersize is stored in driver section */
|
||||
// Socket Buffersize is stored in driver section
|
||||
SQLGetPrivateProfileString(section, INI_SOCKET, "",
|
||||
temp, sizeof(temp), filename);
|
||||
if ( temp[0] )
|
||||
@ -622,7 +622,7 @@ char temp[256];
|
||||
globals.socket_buffersize = SOCK_BUFFER_SIZE;
|
||||
|
||||
|
||||
/* Debug is stored in the driver section */
|
||||
// Debug is stored in the driver section
|
||||
SQLGetPrivateProfileString(section, INI_DEBUG, "",
|
||||
temp, sizeof(temp), filename);
|
||||
if ( temp[0] )
|
||||
@ -631,7 +631,7 @@ char temp[256];
|
||||
globals.debug = DEFAULT_DEBUG;
|
||||
|
||||
|
||||
/* CommLog is stored in the driver section */
|
||||
// CommLog is stored in the driver section
|
||||
SQLGetPrivateProfileString(section, INI_COMMLOG, "",
|
||||
temp, sizeof(temp), filename);
|
||||
if ( temp[0] )
|
||||
@ -640,7 +640,7 @@ char temp[256];
|
||||
globals.commlog = DEFAULT_COMMLOG;
|
||||
|
||||
|
||||
/* Optimizer is stored in the driver section only */
|
||||
// Optimizer is stored in the driver section only
|
||||
SQLGetPrivateProfileString(section, INI_OPTIMIZER, "",
|
||||
temp, sizeof(temp), filename);
|
||||
if ( temp[0] )
|
||||
@ -648,7 +648,7 @@ char temp[256];
|
||||
else if ( ! override)
|
||||
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, "",
|
||||
temp, sizeof(temp), filename);
|
||||
if ( temp[0] )
|
||||
@ -656,7 +656,7 @@ char temp[256];
|
||||
else if ( ! override)
|
||||
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, "",
|
||||
temp, sizeof(temp), filename);
|
||||
if ( temp[0] )
|
||||
@ -665,7 +665,7 @@ char temp[256];
|
||||
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, "",
|
||||
temp, sizeof(temp), filename);
|
||||
if ( temp[0] )
|
||||
@ -674,7 +674,7 @@ char temp[256];
|
||||
globals.unknown_sizes = DEFAULT_UNKNOWNSIZES;
|
||||
|
||||
|
||||
/* Lie about supported functions? */
|
||||
// Lie about supported functions?
|
||||
SQLGetPrivateProfileString(section, INI_LIE, "",
|
||||
temp, sizeof(temp), filename);
|
||||
if ( temp[0] )
|
||||
@ -682,7 +682,7 @@ char temp[256];
|
||||
else if ( ! override)
|
||||
globals.lie = DEFAULT_LIE;
|
||||
|
||||
/* Parse statements */
|
||||
// Parse statements
|
||||
SQLGetPrivateProfileString(section, INI_PARSE, "",
|
||||
temp, sizeof(temp), filename);
|
||||
if ( temp[0] )
|
||||
@ -690,7 +690,7 @@ char temp[256];
|
||||
else if ( ! override)
|
||||
globals.parse = DEFAULT_PARSE;
|
||||
|
||||
/* SQLCancel calls SQLFreeStmt in Driver Manager */
|
||||
// SQLCancel calls SQLFreeStmt in Driver Manager
|
||||
SQLGetPrivateProfileString(section, INI_CANCELASFREESTMT, "",
|
||||
temp, sizeof(temp), filename);
|
||||
if ( temp[0] )
|
||||
@ -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, "",
|
||||
temp, sizeof(temp), filename);
|
||||
if ( temp[0] )
|
||||
@ -709,7 +709,7 @@ char temp[256];
|
||||
globals.use_declarefetch = DEFAULT_USEDECLAREFETCH;
|
||||
|
||||
|
||||
/* Max Varchar Size */
|
||||
// Max Varchar Size
|
||||
SQLGetPrivateProfileString(section, INI_MAXVARCHARSIZE, "",
|
||||
temp, sizeof(temp), filename);
|
||||
if ( temp[0] )
|
||||
@ -717,7 +717,7 @@ char temp[256];
|
||||
else if ( ! override)
|
||||
globals.max_varchar_size = MAX_VARCHAR_SIZE;
|
||||
|
||||
/* Max TextField Size */
|
||||
// Max TextField Size
|
||||
SQLGetPrivateProfileString(section, INI_MAXLONGVARCHARSIZE, "",
|
||||
temp, sizeof(temp), filename);
|
||||
if ( temp[0] )
|
||||
@ -725,7 +725,7 @@ char temp[256];
|
||||
else if ( ! override)
|
||||
globals.max_longvarchar_size = TEXT_FIELD_SIZE;
|
||||
|
||||
/* Text As LongVarchar */
|
||||
// Text As LongVarchar
|
||||
SQLGetPrivateProfileString(section, INI_TEXTASLONGVARCHAR, "",
|
||||
temp, sizeof(temp), filename);
|
||||
if ( temp[0] )
|
||||
@ -733,7 +733,7 @@ char temp[256];
|
||||
else if ( ! override)
|
||||
globals.text_as_longvarchar = DEFAULT_TEXTASLONGVARCHAR;
|
||||
|
||||
/* Unknowns As LongVarchar */
|
||||
// Unknowns As LongVarchar
|
||||
SQLGetPrivateProfileString(section, INI_UNKNOWNSASLONGVARCHAR, "",
|
||||
temp, sizeof(temp), filename);
|
||||
if ( temp[0] )
|
||||
@ -741,7 +741,7 @@ char temp[256];
|
||||
else if ( ! override)
|
||||
globals.unknowns_as_longvarchar = DEFAULT_UNKNOWNSASLONGVARCHAR;
|
||||
|
||||
/* Bools As Char */
|
||||
// Bools As Char
|
||||
SQLGetPrivateProfileString(section, INI_BOOLSASCHAR, "",
|
||||
temp, sizeof(temp), filename);
|
||||
if ( temp[0] )
|
||||
@ -749,8 +749,8 @@ char temp[256];
|
||||
else if ( ! override)
|
||||
globals.bools_as_char = DEFAULT_BOOLSASCHAR;
|
||||
|
||||
/* Extra Systable prefixes */
|
||||
/* Use @@@ to distinguish between blank extra prefixes and no key entry */
|
||||
// Extra Systable prefixes
|
||||
// Use @@@ to distinguish between blank extra prefixes and no key entry
|
||||
SQLGetPrivateProfileString(section, INI_EXTRASYSTABLEPREFIXES, "@@@",
|
||||
temp, sizeof(temp), filename);
|
||||
if ( strcmp(temp, "@@@" ))
|
||||
@ -761,14 +761,14 @@ char temp[256];
|
||||
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) {
|
||||
|
||||
/* 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, "",
|
||||
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, "",
|
||||
temp, sizeof(temp), filename);
|
||||
if ( temp[0] )
|
||||
|
@ -91,15 +91,15 @@
|
||||
/* Connection Defaults */
|
||||
#define DEFAULT_PORT "5432"
|
||||
#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_TEXTASLONGVARCHAR 1
|
||||
#define DEFAULT_UNKNOWNSASLONGVARCHAR 0
|
||||
#define DEFAULT_BOOLSASCHAR 1
|
||||
#define DEFAULT_OPTIMIZER 1 /* disable */
|
||||
#define DEFAULT_KSQO 1 /* on */
|
||||
#define DEFAULT_UNIQUEINDEX 0 /* dont recognize */
|
||||
#define DEFAULT_COMMLOG 0 /* dont log */
|
||||
#define DEFAULT_OPTIMIZER 1 // disable
|
||||
#define DEFAULT_KSQO 1 // on
|
||||
#define DEFAULT_UNIQUEINDEX 0 // dont recognize
|
||||
#define DEFAULT_COMMLOG 0 // dont log
|
||||
#define DEFAULT_DEBUG 0
|
||||
#define DEFAULT_UNKNOWNSIZES UNKNOWNS_AS_MAX
|
||||
|
||||
@ -107,7 +107,7 @@
|
||||
#define DEFAULT_FAKEOIDINDEX 0
|
||||
#define DEFAULT_SHOWOIDCOLUMN 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_PARSE 0
|
||||
|
||||
|
@ -103,15 +103,15 @@ int len = 0;
|
||||
|
||||
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);
|
||||
|
||||
/* If the ConnInfo in the hdbc is missing anything, */
|
||||
/* this function will fill them in from the registry (assuming */
|
||||
/* of course there is a DSN given -- if not, it does nothing!) */
|
||||
// If the ConnInfo in the hdbc is missing anything,
|
||||
// this function will fill them in from the registry (assuming
|
||||
// of course there is a DSN given -- if not, it does nothing!)
|
||||
getDSNinfo(ci, CONN_DONT_OVERWRITE);
|
||||
|
||||
/* Fill in any default parameters if they are not there. */
|
||||
// Fill in any default parameters if they are not there.
|
||||
getDSNdefaults(ci);
|
||||
|
||||
#ifdef WIN32
|
||||
@ -164,13 +164,13 @@ dialog:
|
||||
ci->server[0] == '\0' ||
|
||||
ci->database[0] == '\0' ||
|
||||
ci->port[0] == '\0') {
|
||||
/* (password_required && ci->password[0] == '\0')) */
|
||||
// (password_required && ci->password[0] == '\0'))
|
||||
|
||||
return SQL_NO_DATA_FOUND;
|
||||
}
|
||||
|
||||
|
||||
/* do the actual connect */
|
||||
// do the actual connect
|
||||
retval = CC_connect(conn, password_required);
|
||||
if (retval < 0) { /* need a password */
|
||||
if (fDriverCompletion == SQL_DRIVER_NOPROMPT) {
|
||||
@ -187,7 +187,7 @@ dialog:
|
||||
}
|
||||
}
|
||||
else if (retval == 0) {
|
||||
/* error msg filled in above */
|
||||
// error msg filled in above
|
||||
CC_log_error(func, "Error from CC_Connect", conn);
|
||||
return SQL_ERROR;
|
||||
}
|
||||
@ -273,7 +273,7 @@ ConnInfo *ci;
|
||||
ShowWindow(GetDlgItem(hdlg, IDC_DESCTEXT), 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);
|
||||
|
||||
@ -354,15 +354,15 @@ char *strtok_arg;
|
||||
continue;
|
||||
|
||||
*equals = '\0';
|
||||
attribute = pair; /* ex. DSN */
|
||||
value = equals + 1; /* ex. 'CEO co1' */
|
||||
attribute = pair; // ex. DSN
|
||||
value = equals + 1; // ex. 'CEO co1'
|
||||
|
||||
mylog("attribute = '%s', value = '%s'\n", attribute, value);
|
||||
|
||||
if( !attribute || !value)
|
||||
continue;
|
||||
|
||||
/* Copy the appropriate value to the conninfo */
|
||||
// Copy the appropriate value to the conninfo
|
||||
copyAttributes(ci, attribute, value);
|
||||
|
||||
}
|
||||
|
@ -57,7 +57,7 @@ mylog("**** in SQLFreeEnv: env = %u ** \n", env);
|
||||
return SQL_ERROR;
|
||||
}
|
||||
|
||||
/* Returns the next SQL error information. */
|
||||
// Returns the next SQL error information.
|
||||
|
||||
RETCODE SQL_API SQLError(
|
||||
HENV henv,
|
||||
@ -75,7 +75,7 @@ int status;
|
||||
mylog("**** SQLError: henv=%u, hdbc=%u, hstmt=%u\n", henv, hdbc, hstmt);
|
||||
|
||||
if (SQL_NULL_HSTMT != hstmt) {
|
||||
/* CC: return an error of a hstmt */
|
||||
// CC: return an error of a hstmt
|
||||
StatementClass *stmt = (StatementClass *) hstmt;
|
||||
|
||||
if (SC_get_error(stmt, &status, &msg)) {
|
||||
@ -102,47 +102,47 @@ int status;
|
||||
if (NULL != szSqlState)
|
||||
|
||||
switch (status) {
|
||||
/* now determine the SQLSTATE to be returned */
|
||||
// now determine the SQLSTATE to be returned
|
||||
case STMT_TRUNCATED:
|
||||
strcpy(szSqlState, "01004");
|
||||
/* data truncated */
|
||||
// data truncated
|
||||
break;
|
||||
case STMT_INFO_ONLY:
|
||||
strcpy(szSqlState, "00000");
|
||||
/* just information that is returned, no error */
|
||||
// just information that is returned, no error
|
||||
break;
|
||||
case STMT_BAD_ERROR:
|
||||
strcpy(szSqlState, "08S01");
|
||||
/* communication link failure */
|
||||
// communication link failure
|
||||
break;
|
||||
case STMT_CREATE_TABLE_ERROR:
|
||||
strcpy(szSqlState, "S0001");
|
||||
/* table already exists */
|
||||
// table already exists
|
||||
break;
|
||||
case STMT_STATUS_ERROR:
|
||||
case STMT_SEQUENCE_ERROR:
|
||||
strcpy(szSqlState, "S1010");
|
||||
/* Function sequence error */
|
||||
// Function sequence error
|
||||
break;
|
||||
case STMT_NO_MEMORY_ERROR:
|
||||
strcpy(szSqlState, "S1001");
|
||||
/* memory allocation failure */
|
||||
// memory allocation failure
|
||||
break;
|
||||
case STMT_COLNUM_ERROR:
|
||||
strcpy(szSqlState, "S1002");
|
||||
/* invalid column number */
|
||||
// invalid column number
|
||||
break;
|
||||
case STMT_NO_STMTSTRING:
|
||||
strcpy(szSqlState, "S1001");
|
||||
/* having no stmtstring is also a malloc problem */
|
||||
// having no stmtstring is also a malloc problem
|
||||
break;
|
||||
case STMT_ERROR_TAKEN_FROM_BACKEND:
|
||||
strcpy(szSqlState, "S1000");
|
||||
/* general error */
|
||||
// general error
|
||||
break;
|
||||
case STMT_INTERNAL_ERROR:
|
||||
strcpy(szSqlState, "S1000");
|
||||
/* general error */
|
||||
// general error
|
||||
break;
|
||||
case STMT_ROW_OUT_OF_RANGE:
|
||||
strcpy(szSqlState, "S1107");
|
||||
@ -153,7 +153,7 @@ int status;
|
||||
break;
|
||||
|
||||
case STMT_NOT_IMPLEMENTED_ERROR:
|
||||
strcpy(szSqlState, "S1C00"); /* == 'driver not capable' */
|
||||
strcpy(szSqlState, "S1C00"); // == 'driver not capable'
|
||||
break;
|
||||
case STMT_OPTION_OUT_OF_RANGE_ERROR:
|
||||
strcpy(szSqlState, "S1092");
|
||||
@ -181,7 +181,7 @@ int status;
|
||||
break;
|
||||
case STMT_INVALID_ARGUMENT_NO:
|
||||
strcpy(szSqlState, "S1009");
|
||||
/* invalid argument value */
|
||||
// invalid argument value
|
||||
break;
|
||||
case STMT_INVALID_CURSOR_POSITION:
|
||||
strcpy(szSqlState, "S1109");
|
||||
@ -198,7 +198,7 @@ int status;
|
||||
case STMT_EXEC_ERROR:
|
||||
default:
|
||||
strcpy(szSqlState, "S1000");
|
||||
/* also a general error */
|
||||
// also a general error
|
||||
break;
|
||||
}
|
||||
|
||||
@ -250,15 +250,15 @@ int status;
|
||||
case STMT_TRUNCATED:
|
||||
case CONN_TRUNCATED:
|
||||
strcpy(szSqlState, "01004");
|
||||
/* data truncated */
|
||||
// data truncated
|
||||
break;
|
||||
case CONN_INIREAD_ERROR:
|
||||
strcpy(szSqlState, "IM002");
|
||||
/* data source not found */
|
||||
// data source not found
|
||||
break;
|
||||
case CONN_OPENDB_ERROR:
|
||||
strcpy(szSqlState, "08001");
|
||||
/* unable to connect to data source */
|
||||
// unable to connect to data source
|
||||
break;
|
||||
case CONN_INVALID_AUTHENTICATION:
|
||||
case CONN_AUTH_TYPE_UNSUPPORTED:
|
||||
@ -266,23 +266,23 @@ int status;
|
||||
break;
|
||||
case CONN_STMT_ALLOC_ERROR:
|
||||
strcpy(szSqlState, "S1001");
|
||||
/* memory allocation failure */
|
||||
// memory allocation failure
|
||||
break;
|
||||
case CONN_IN_USE:
|
||||
strcpy(szSqlState, "S1000");
|
||||
/* general error */
|
||||
// general error
|
||||
break;
|
||||
case CONN_UNSUPPORTED_OPTION:
|
||||
strcpy(szSqlState, "IM001");
|
||||
/* driver does not support this function */
|
||||
// driver does not support this function
|
||||
case CONN_INVALID_ARGUMENT_NO:
|
||||
strcpy(szSqlState, "S1009");
|
||||
/* invalid argument value */
|
||||
// invalid argument value
|
||||
break;
|
||||
case CONN_TRANSACT_IN_PROGRES:
|
||||
strcpy(szSqlState, "S1010");
|
||||
/* when the user tries to switch commit mode in a transaction */
|
||||
/* -> function sequence error */
|
||||
// when the user tries to switch commit mode in a transaction
|
||||
// -> function sequence error
|
||||
break;
|
||||
case CONN_NO_MEMORY_ERROR:
|
||||
strcpy(szSqlState, "S1001");
|
||||
@ -299,7 +299,7 @@ int status;
|
||||
|
||||
default:
|
||||
strcpy(szSqlState, "S1000");
|
||||
/* general error */
|
||||
// general error
|
||||
break;
|
||||
}
|
||||
|
||||
@ -341,12 +341,12 @@ int status;
|
||||
if(szSqlState) {
|
||||
switch(status) {
|
||||
case ENV_ALLOC_ERROR:
|
||||
/* memory allocation failure */
|
||||
// memory allocation failure
|
||||
strcpy(szSqlState, "S1001");
|
||||
break;
|
||||
default:
|
||||
strcpy(szSqlState, "S1000");
|
||||
/* general error */
|
||||
// general error
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -405,8 +405,8 @@ char rv = 1;
|
||||
|
||||
mylog("in EN_Destructor, self=%u\n", self);
|
||||
|
||||
/* the error messages are static strings distributed throughout */
|
||||
/* the source--they should not be freed */
|
||||
// the error messages are static strings distributed throughout
|
||||
// the source--they should not be freed
|
||||
|
||||
/* Free any connections belonging to this environment */
|
||||
for (lf = 0; lf < MAX_CONNECTIONS; lf++) {
|
||||
|
@ -39,7 +39,7 @@
|
||||
extern GLOBAL_VALUES globals;
|
||||
|
||||
|
||||
/* Perform a Prepare on the SQL statement */
|
||||
// Perform a Prepare on the SQL statement
|
||||
RETCODE SQL_API SQLPrepare(HSTMT hstmt,
|
||||
UCHAR FAR *szSqlStr,
|
||||
SDWORD cbSqlStr)
|
||||
@ -108,7 +108,7 @@ StatementClass *self = (StatementClass *) hstmt;
|
||||
self->prepare = TRUE;
|
||||
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)) {
|
||||
self->errornumber = STMT_EXEC_ERROR;
|
||||
self->errormsg = "Connection is readonly, only select statements are allowed.";
|
||||
@ -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(
|
||||
HSTMT hstmt,
|
||||
@ -144,8 +144,8 @@ static char *func = "SQLExecDirect";
|
||||
if (stmt->statement)
|
||||
free(stmt->statement);
|
||||
|
||||
/* keep a copy of the un-parametrized statement, in case */
|
||||
/* they try to execute this statement again */
|
||||
// keep a copy of the un-parametrized statement, in case
|
||||
// they try to execute this statement again
|
||||
stmt->statement = make_string(szSqlStr, cbSqlStr, NULL);
|
||||
if ( ! stmt->statement) {
|
||||
stmt->errornumber = STMT_NO_MEMORY_ERROR;
|
||||
@ -158,15 +158,15 @@ static char *func = "SQLExecDirect";
|
||||
|
||||
stmt->prepare = FALSE;
|
||||
|
||||
/* If an SQLPrepare was performed prior to this, but was left in */
|
||||
/* the premature state because an error occurred prior to SQLExecute */
|
||||
/* then set the statement to finished so it can be recycled. */
|
||||
// If an SQLPrepare was performed prior to this, but was left in
|
||||
// the premature state because an error occurred prior to SQLExecute
|
||||
// then set the statement to finished so it can be recycled.
|
||||
if ( stmt->status == STMT_PREMATURE )
|
||||
stmt->status = STMT_FINISHED;
|
||||
|
||||
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)) {
|
||||
stmt->errornumber = STMT_EXEC_ERROR;
|
||||
stmt->errormsg = "Connection is readonly, only select statements are allowed.";
|
||||
@ -182,7 +182,7 @@ static char *func = "SQLExecDirect";
|
||||
return result;
|
||||
}
|
||||
|
||||
/* Execute a prepared SQL statement */
|
||||
// Execute a prepared SQL statement
|
||||
RETCODE SQL_API SQLExecute(
|
||||
HSTMT hstmt)
|
||||
{
|
||||
@ -272,15 +272,15 @@ int i, retval;
|
||||
stmt->data_at_exec++;
|
||||
}
|
||||
}
|
||||
/* If there are some data at execution parameters, return need data */
|
||||
/* SQLParamData and SQLPutData will be used to send params and execute the statement. */
|
||||
// If there are some data at execution parameters, return need data
|
||||
// SQLParamData and SQLPutData will be used to send params and execute the statement.
|
||||
if (stmt->data_at_exec > 0)
|
||||
return SQL_NEED_DATA;
|
||||
|
||||
|
||||
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);
|
||||
if( retval != SQL_SUCCESS)
|
||||
/* error msg passed from above */
|
||||
@ -296,7 +296,7 @@ int i, retval;
|
||||
|
||||
|
||||
|
||||
/* - - - - - - - - - */
|
||||
// - - - - - - - - -
|
||||
RETCODE SQL_API SQLTransact(
|
||||
HENV henv,
|
||||
HDBC hdbc,
|
||||
@ -355,7 +355,7 @@ int lf;
|
||||
CC_set_no_trans(conn);
|
||||
|
||||
if ( ! res) {
|
||||
/* error msg will be in the connection */
|
||||
// error msg will be in the connection
|
||||
CC_log_error(func, "", conn);
|
||||
return SQL_ERROR;
|
||||
}
|
||||
@ -371,10 +371,10 @@ int lf;
|
||||
return SQL_SUCCESS;
|
||||
}
|
||||
|
||||
/* - - - - - - - - - */
|
||||
// - - - - - - - - -
|
||||
|
||||
RETCODE SQL_API SQLCancel(
|
||||
HSTMT hstmt) /* Statement to cancel. */
|
||||
HSTMT hstmt) // Statement to cancel.
|
||||
{
|
||||
static char *func="SQLCancel";
|
||||
StatementClass *stmt = (StatementClass *) hstmt;
|
||||
@ -386,13 +386,13 @@ FARPROC addr;
|
||||
|
||||
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) {
|
||||
SC_log_error(func, "", NULL);
|
||||
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) {
|
||||
|
||||
|
||||
@ -423,9 +423,9 @@ FARPROC addr;
|
||||
return SQL_SUCCESS;
|
||||
}
|
||||
|
||||
/* In the middle of SQLParamData/SQLPutData, so cancel that. */
|
||||
/* Note, any previous data-at-exec buffers will be freed in the recycle */
|
||||
/* if they call SQLExecDirect or SQLExecute again. */
|
||||
// In the middle of SQLParamData/SQLPutData, so cancel that.
|
||||
// Note, any previous data-at-exec buffers will be freed in the recycle
|
||||
// if they call SQLExecDirect or SQLExecute again.
|
||||
|
||||
stmt->data_at_exec = -1;
|
||||
stmt->current_exec_param = -1;
|
||||
@ -435,11 +435,11 @@ FARPROC addr;
|
||||
|
||||
}
|
||||
|
||||
/* - - - - - - - - - */
|
||||
// - - - - - - - - -
|
||||
|
||||
/* Returns the SQL string as modified by the driver. */
|
||||
/* Currently, just copy the input string without modification */
|
||||
/* observing buffer limits and truncation. */
|
||||
// Returns the SQL string as modified by the driver.
|
||||
// Currently, just copy the input string without modification
|
||||
// observing buffer limits and truncation.
|
||||
RETCODE SQL_API SQLNativeSql(
|
||||
HDBC hdbc,
|
||||
UCHAR FAR *szSqlStrIn,
|
||||
@ -485,10 +485,10 @@ RETCODE result;
|
||||
return result;
|
||||
}
|
||||
|
||||
/* - - - - - - - - - */
|
||||
// - - - - - - - - -
|
||||
|
||||
/* Supplies parameter data at execution time. Used in conjuction with */
|
||||
/* SQLPutData. */
|
||||
// Supplies parameter data at execution time. Used in conjuction with
|
||||
// SQLPutData.
|
||||
|
||||
RETCODE SQL_API SQLParamData(
|
||||
HSTMT hstmt,
|
||||
@ -583,10 +583,10 @@ int i, retval;
|
||||
return SQL_NEED_DATA;
|
||||
}
|
||||
|
||||
/* - - - - - - - - - */
|
||||
// - - - - - - - - -
|
||||
|
||||
/* Supplies parameter data at execution time. Used in conjunction with */
|
||||
/* SQLParamData. */
|
||||
// Supplies parameter data at execution time. Used in conjunction with
|
||||
// SQLParamData.
|
||||
|
||||
RETCODE SQL_API SQLPutData(
|
||||
HSTMT hstmt,
|
||||
|
@ -1,19 +1,19 @@
|
||||
/* GetPrivateProfileString() -- approximate implementation of */
|
||||
/* Windows NT System Services version of GetPrivateProfileString() */
|
||||
/* probably doesn't handle the NULL key for section name or value key */
|
||||
/* correctly also, doesn't provide Microsoft backwards compatability */
|
||||
/* wrt TAB characters in the value string -- Microsoft terminates value */
|
||||
/* at the first TAB, but I couldn't discover what the behavior should */
|
||||
/* be regarding TABS in quoted strings so, I treat tabs like any other */
|
||||
/* characters -- NO comments following value string separated by a TAB */
|
||||
/* are allowed (that is an anachronism anyway) */
|
||||
/* Added code to search for ODBC_INI file in users home directory on */
|
||||
/* Unix */
|
||||
// GetPrivateProfileString() -- approximate implementation of
|
||||
// Windows NT System Services version of GetPrivateProfileString()
|
||||
// probably doesn't handle the NULL key for section name or value key
|
||||
// correctly also, doesn't provide Microsoft backwards compatability
|
||||
// wrt TAB characters in the value string -- Microsoft terminates value
|
||||
// at the first TAB, but I couldn't discover what the behavior should
|
||||
// be regarding TABS in quoted strings so, I treat tabs like any other
|
||||
// characters -- NO comments following value string separated by a TAB
|
||||
// are allowed (that is an anachronism anyway)
|
||||
// Added code to search for ODBC_INI file in users home directory on
|
||||
// Unix
|
||||
|
||||
#ifndef WIN32
|
||||
|
||||
#if HAVE_CONFIG_H
|
||||
#include "config.h" /* produced by configure */
|
||||
#include "config.h" // produced by configure
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
@ -38,12 +38,12 @@
|
||||
|
||||
|
||||
DWORD
|
||||
GetPrivateProfileString(char *theSection, /* section name */
|
||||
char *theKey, /* search key name */
|
||||
char *theDefault, /* default value if not found */
|
||||
char *theReturnBuffer, /* return value stored here */
|
||||
size_t theReturnBufferLength, /* byte length of return buffer */
|
||||
char *theIniFileName) /* pathname of ini file to search */
|
||||
GetPrivateProfileString(char *theSection, // section name
|
||||
char *theKey, // search key name
|
||||
char *theDefault, // default value if not found
|
||||
char *theReturnBuffer, // return value stored here
|
||||
size_t theReturnBufferLength, // byte length of return buffer
|
||||
char *theIniFileName) // pathname of ini file to search
|
||||
{
|
||||
char buf[MAXPGPATH];
|
||||
char* ptr = 0;
|
||||
@ -61,7 +61,7 @@ GetPrivateProfileString(char *theSection, /* section name */
|
||||
int j = 0;
|
||||
|
||||
j = strlen(theIniFileName) + 1;
|
||||
ptr = (char*)getpwuid(getuid()); /* get user info */
|
||||
ptr = (char*)getpwuid(getuid()); // get user info
|
||||
|
||||
if( ptr == NULL)
|
||||
{
|
||||
@ -70,7 +70,7 @@ GetPrivateProfileString(char *theSection, /* section name */
|
||||
|
||||
sprintf(buf,"%s",theIniFileName);
|
||||
}
|
||||
ptr = ((struct passwd*)ptr)->pw_dir; /* get user home dir */
|
||||
ptr = ((struct passwd*)ptr)->pw_dir; // get user home dir
|
||||
if( ptr == NULL || *ptr == '\0' )
|
||||
ptr = "/home";
|
||||
|
||||
@ -120,9 +120,9 @@ GetPrivateProfileString(char *theSection, /* section name */
|
||||
|
||||
if(aFile == NULL)
|
||||
{
|
||||
/* no ini file specified, return the default */
|
||||
// no ini file specified, return the default
|
||||
|
||||
++aLength; /* room for NULL char */
|
||||
++aLength; // room for NULL char
|
||||
aLength = theReturnBufferLength < aLength ?
|
||||
theReturnBufferLength : aLength;
|
||||
strncpy(theReturnBuffer, theDefault, aLength);
|
||||
@ -134,19 +134,19 @@ GetPrivateProfileString(char *theSection, /* section name */
|
||||
while(fgets(aLine, sizeof(aLine), aFile) != NULL)
|
||||
{
|
||||
aLineLength = strlen(aLine);
|
||||
/* strip final '\n' */
|
||||
// strip final '\n'
|
||||
if(aLineLength > 0 && aLine[aLineLength - 1] == '\n')
|
||||
{
|
||||
aLine[aLineLength - 1] = '\0';
|
||||
}
|
||||
switch(*aLine)
|
||||
{
|
||||
case ' ': /* blank line */
|
||||
case ';': /* comment line */
|
||||
case ' ': // blank line
|
||||
case ';': // comment line
|
||||
continue;
|
||||
break;
|
||||
|
||||
case '[': /* section marker */
|
||||
case '[': // section marker
|
||||
|
||||
if( (aString = strchr(aLine, ']')) )
|
||||
{
|
||||
@ -156,7 +156,7 @@ GetPrivateProfileString(char *theSection, /* section name */
|
||||
while (isspace(*aString)) aString--;
|
||||
*(aString+1) = '\0';
|
||||
|
||||
/* accept as matched if NULL key or exact match */
|
||||
// accept as matched if NULL key or exact match
|
||||
|
||||
if(!theSection || !strcmp(aStart, theSection))
|
||||
{
|
||||
@ -168,18 +168,18 @@ GetPrivateProfileString(char *theSection, /* section name */
|
||||
|
||||
default:
|
||||
|
||||
/* try to match value keys if in proper section */
|
||||
// try to match value keys if in proper section
|
||||
|
||||
if(aSectionFound)
|
||||
{
|
||||
/* try to match requested key */
|
||||
// try to match requested key
|
||||
|
||||
if( (aString = aValue = strchr(aLine, '=')) )
|
||||
{
|
||||
*aValue = '\0';
|
||||
++aValue;
|
||||
|
||||
/* strip leading blanks in value field */
|
||||
// strip leading blanks in value field
|
||||
|
||||
while(*aValue == ' ' && aValue < aLine + sizeof(aLine))
|
||||
{
|
||||
@ -198,7 +198,7 @@ GetPrivateProfileString(char *theSection, /* section name */
|
||||
aStart = aLine;
|
||||
while(isspace(*aStart)) aStart++;
|
||||
|
||||
/* strip trailing blanks from key */
|
||||
// strip trailing blanks from key
|
||||
|
||||
if(aString)
|
||||
{
|
||||
@ -208,16 +208,16 @@ GetPrivateProfileString(char *theSection, /* section name */
|
||||
}
|
||||
}
|
||||
|
||||
/* see if key is matched */
|
||||
// see if key is matched
|
||||
|
||||
if(theKey == NULL || !strcmp(theKey, aStart))
|
||||
{
|
||||
/* matched -- first, terminate value part */
|
||||
// matched -- first, terminate value part
|
||||
|
||||
aKeyFound = TRUE;
|
||||
aLength = strlen(aValue);
|
||||
|
||||
/* remove trailing blanks from aValue if any */
|
||||
// remove trailing blanks from aValue if any
|
||||
|
||||
aString = aValue + aLength - 1;
|
||||
|
||||
@ -227,12 +227,12 @@ GetPrivateProfileString(char *theSection, /* section name */
|
||||
--aLength;
|
||||
}
|
||||
|
||||
/* unquote value if quoted */
|
||||
// unquote value if quoted
|
||||
|
||||
if(aLength >= 2 && aValue[0] == '"' &&
|
||||
aValue[aLength - 1] == '"')
|
||||
{
|
||||
/* string quoted with double quotes */
|
||||
// string quoted with double quotes
|
||||
|
||||
aValue[aLength - 1] = '\0';
|
||||
++aValue;
|
||||
@ -240,7 +240,7 @@ GetPrivateProfileString(char *theSection, /* section name */
|
||||
}
|
||||
else
|
||||
{
|
||||
/* single quotes allowed also... */
|
||||
// single quotes allowed also...
|
||||
|
||||
if(aLength >= 2 && aValue[0] == '\'' &&
|
||||
aValue[aLength - 1] == '\'')
|
||||
@ -251,13 +251,13 @@ GetPrivateProfileString(char *theSection, /* section name */
|
||||
}
|
||||
}
|
||||
|
||||
/* compute maximum length copyable */
|
||||
// compute maximum length copyable
|
||||
|
||||
aLineLength = (aLength <
|
||||
theReturnBufferLength - aReturnLength) ? aLength :
|
||||
theReturnBufferLength - aReturnLength;
|
||||
|
||||
/* do the copy to return buffer */
|
||||
// do the copy to return buffer
|
||||
|
||||
if(aLineLength)
|
||||
{
|
||||
@ -289,8 +289,8 @@ GetPrivateProfileString(char *theSection, /* section name */
|
||||
fclose(aFile);
|
||||
}
|
||||
|
||||
if(!aKeyFound) { /* key wasn't found return default */
|
||||
++aLength; /* room for NULL char */
|
||||
if(!aKeyFound) { // key wasn't found return default
|
||||
++aLength; // room for NULL char
|
||||
aLength = theReturnBufferLength < aLength ?
|
||||
theReturnBufferLength : aLength;
|
||||
strncpy(theReturnBuffer, theDefault, aLength);
|
||||
@ -301,24 +301,22 @@ GetPrivateProfileString(char *theSection, /* section name */
|
||||
}
|
||||
|
||||
DWORD
|
||||
WritePrivateProfileString(char *theSection, /* section name */
|
||||
char *theKey, /* write key name */
|
||||
char *theBuffer, /* input buffer */
|
||||
char *theIniFileName) /* pathname of ini file to write */
|
||||
WritePrivateProfileString(char *theSection, // section name
|
||||
char *theKey, // write key name
|
||||
char *theBuffer, // input buffer
|
||||
char *theIniFileName) // pathname of ini file to write
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if 0
|
||||
/* Ok. What the hell's the default behaviour for a null input buffer, and null
|
||||
* section name. For now if either are null I ignore the request, until
|
||||
* I find out different.
|
||||
*/
|
||||
DWORD
|
||||
WritePrivateProfileString(char *theSection, /* section name */
|
||||
char *theKey, /* write key name */
|
||||
char *theBuffer, /* input buffer */
|
||||
char *theIniFileName) /* pathname of ini file to write */
|
||||
WritePrivateProfileString(char *theSection, // section name
|
||||
char *theKey, // write key name
|
||||
char *theBuffer, // input buffer
|
||||
char *theIniFileName) // pathname of ini file to write
|
||||
{
|
||||
char buf[MAXPGPATH];
|
||||
char* ptr = 0;
|
||||
@ -334,7 +332,7 @@ WritePrivateProfileString(char *theSection, /* section name */
|
||||
BOOL keyFound = FALSE;
|
||||
int j = 0;
|
||||
|
||||
/* If this isn't correct processing we'll change it later */
|
||||
// If this isn't correct processing we'll change it later
|
||||
if(theSection == NULL || theKey == NULL || theBuffer == NULL ||
|
||||
theIniFileName == NULL) return 0;
|
||||
|
||||
@ -342,7 +340,7 @@ WritePrivateProfileString(char *theSection, /* section name */
|
||||
if(aLength == 0) return 0;
|
||||
|
||||
j = strlen(theIniFileName) + 1;
|
||||
ptr = (char*)getpwuid(getuid()); /* get user info */
|
||||
ptr = (char*)getpwuid(getuid()); // get user info
|
||||
|
||||
if( ptr == NULL)
|
||||
{
|
||||
@ -351,15 +349,15 @@ WritePrivateProfileString(char *theSection, /* section name */
|
||||
|
||||
sprintf(buf,"%s",theIniFileName);
|
||||
}
|
||||
ptr = ((struct passwd*)ptr)->pw_dir; /* get user home dir */
|
||||
ptr = ((struct passwd*)ptr)->pw_dir; // get user home dir
|
||||
if( ptr == NULL || *ptr == '\0' )
|
||||
ptr = "/home";
|
||||
|
||||
/* This doesn't make it so we find an ini file but allows normal */
|
||||
/* processing to continue further on down. The likelihood is that */
|
||||
/* the file won't be found and thus the default value will be */
|
||||
/* returned. */
|
||||
/* */
|
||||
// This doesn't make it so we find an ini file but allows normal
|
||||
// processing to continue further on down. The likelihood is that
|
||||
// the file won't be found and thus the default value will be
|
||||
// returned.
|
||||
//
|
||||
if( MAXPGPATH-1 < strlen(ptr) + j )
|
||||
{
|
||||
if( MAXPGPATH-1 < strlen(ptr) )
|
||||
@ -370,9 +368,9 @@ WritePrivateProfileString(char *theSection, /* section name */
|
||||
|
||||
sprintf( buf, "%s/%s",ptr,theIniFileName );
|
||||
|
||||
/* This code makes it so that a file in the users home dir */
|
||||
/* overrides a the "default" file as passed in */
|
||||
/* */
|
||||
// This code makes it so that a file in the users home dir
|
||||
// overrides a the "default" file as passed in
|
||||
//
|
||||
aFile = (FILE*)(buf ? fopen(buf, "r+") : NULL);
|
||||
if(!aFile) {
|
||||
sprintf(buf,"%s",theIniFileName);
|
||||
@ -383,32 +381,32 @@ WritePrivateProfileString(char *theSection, /* section name */
|
||||
|
||||
aLength = strlen(theBuffer);
|
||||
|
||||
/* We have to search for theKey, because if it already */
|
||||
/* exists we have to overwrite it. If it doesn't exist */
|
||||
/* we just write a new line to the file. */
|
||||
/* */
|
||||
// We have to search for theKey, because if it already
|
||||
// exists we have to overwrite it. If it doesn't exist
|
||||
// we just write a new line to the file.
|
||||
//
|
||||
while(fgets(aLine, sizeof(aLine), aFile) != NULL)
|
||||
{
|
||||
aLineLength = strlen(aLine);
|
||||
/* strip final '\n' */
|
||||
// strip final '\n'
|
||||
if(aLineLength > 0 && aLine[aLineLength - 1] == '\n')
|
||||
{
|
||||
aLine[aLineLength - 1] = '\0';
|
||||
}
|
||||
switch(*aLine)
|
||||
{
|
||||
case ' ': /* blank line */
|
||||
case ';': /* comment line */
|
||||
case ' ': // blank line
|
||||
case ';': // comment line
|
||||
continue;
|
||||
break;
|
||||
|
||||
case '[': /* section marker */
|
||||
case '[': // section marker
|
||||
|
||||
if( (aString = strchr(aLine, ']')) )
|
||||
{
|
||||
*aString = '\0';
|
||||
|
||||
/* accept as matched if key exact match */
|
||||
// accept as matched if key exact match
|
||||
|
||||
if(!strcmp(aLine + 1, theSection))
|
||||
{
|
||||
@ -420,18 +418,18 @@ WritePrivateProfileString(char *theSection, /* section name */
|
||||
|
||||
default:
|
||||
|
||||
/* try to match value keys if in proper section */
|
||||
// try to match value keys if in proper section
|
||||
|
||||
if(aSectionFound)
|
||||
{
|
||||
/* try to match requested key */
|
||||
// try to match requested key
|
||||
|
||||
if( (aString = aValue = strchr(aLine, '=')) )
|
||||
{
|
||||
*aValue = '\0';
|
||||
++aValue;
|
||||
|
||||
/* strip leading blanks in value field */
|
||||
// strip leading blanks in value field
|
||||
|
||||
while(*aValue == ' ' && aValue < aLine + sizeof(aLine))
|
||||
{
|
||||
@ -447,7 +445,7 @@ WritePrivateProfileString(char *theSection, /* section name */
|
||||
aValue = "";
|
||||
}
|
||||
|
||||
/* strip trailing blanks from key */
|
||||
// strip trailing blanks from key
|
||||
|
||||
if(aString)
|
||||
{
|
||||
@ -457,16 +455,16 @@ WritePrivateProfileString(char *theSection, /* section name */
|
||||
}
|
||||
}
|
||||
|
||||
/* see if key is matched */
|
||||
// see if key is matched
|
||||
|
||||
if(!strcmp(theKey, aLine))
|
||||
{
|
||||
keyFound = TRUE;
|
||||
/* matched -- first, terminate value part */
|
||||
// matched -- first, terminate value part
|
||||
|
||||
/* overwrite current value */
|
||||
// overwrite current value
|
||||
fseek(aFile,-aLineLength,SEEK_CUR);
|
||||
/* overwrite key and value */
|
||||
// overwrite key and value
|
||||
sprintf(aLine,"%s = %s\n",theKey,theBuffer);
|
||||
fputs(aLine,aFile);
|
||||
}
|
||||
@ -477,7 +475,7 @@ WritePrivateProfileString(char *theSection, /* section name */
|
||||
}
|
||||
}
|
||||
|
||||
if(!keyFound) { /* theKey wasn't in file so */
|
||||
if(!keyFound) { // theKey wasn't in file so
|
||||
if(aFile)
|
||||
{
|
||||
fclose(aFile);
|
||||
@ -485,7 +483,6 @@ WritePrivateProfileString(char *theSection, /* section name */
|
||||
|
||||
return aReturnLength > 0 ? aReturnLength - 1 : 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
*/
|
||||
|
||||
#endif
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* GetPrivateProfileString */
|
||||
/* for UNIX use */
|
||||
// GetPrivateProfileString
|
||||
// for UNIX use
|
||||
#ifndef GPPS_H
|
||||
#define GPPS_H
|
||||
|
||||
@ -17,18 +17,18 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
DWORD
|
||||
GetPrivateProfileString(char *theSection, /* section name */
|
||||
char *theKey, /* search key name */
|
||||
char *theDefault, /* default value if not found */
|
||||
char *theReturnBuffer, /* return valuse stored here */
|
||||
size_t theBufferLength, /* byte length of return buffer */
|
||||
char *theIniFileName); /* pathname of ini file to search */
|
||||
GetPrivateProfileString(char *theSection, // section name
|
||||
char *theKey, // search key name
|
||||
char *theDefault, // default value if not found
|
||||
char *theReturnBuffer, // return valuse stored here
|
||||
size_t theBufferLength, // byte length of return buffer
|
||||
char *theIniFileName); // pathname of ini file to search
|
||||
|
||||
DWORD
|
||||
WritePrivateProfileString(char *theSection, /* section name */
|
||||
char *theKey, /* write key name */
|
||||
char *theBuffer, /* input buffer */
|
||||
char *theIniFileName); /* pathname of ini file to write */
|
||||
WritePrivateProfileString(char *theSection, // section name
|
||||
char *theKey, // write key name
|
||||
char *theBuffer, // input buffer
|
||||
char *theIniFileName); // pathname of ini file to write
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -57,7 +57,7 @@
|
||||
extern GLOBAL_VALUES globals;
|
||||
|
||||
|
||||
/* - - - - - - - - - */
|
||||
// - - - - - - - - -
|
||||
|
||||
RETCODE SQL_API SQLGetInfo(
|
||||
HDBC hdbc,
|
||||
@ -196,7 +196,7 @@ RETCODE result;
|
||||
|
||||
case SQL_DEFAULT_TXN_ISOLATION: /* ODBC 1.0 */
|
||||
len = 4;
|
||||
value = SQL_TXN_READ_COMMITTED; /*SQL_TXN_SERIALIZABLE; */
|
||||
value = SQL_TXN_READ_COMMITTED; //SQL_TXN_SERIALIZABLE;
|
||||
break;
|
||||
|
||||
case SQL_DRIVER_NAME: /* ODBC 1.0 */
|
||||
@ -572,7 +572,7 @@ RETCODE result;
|
||||
|
||||
case SQL_TXN_ISOLATION_OPTION: /* ODBC 1.0 */
|
||||
len = 4;
|
||||
value = SQL_TXN_READ_COMMITTED; /* SQL_TXN_SERIALIZABLE; */
|
||||
value = SQL_TXN_READ_COMMITTED; // SQL_TXN_SERIALIZABLE;
|
||||
break;
|
||||
|
||||
case SQL_UNION: /* ODBC 2.0 */
|
||||
@ -632,7 +632,7 @@ RETCODE result;
|
||||
return result;
|
||||
}
|
||||
|
||||
/* - - - - - - - - - */
|
||||
// - - - - - - - - -
|
||||
|
||||
|
||||
RETCODE SQL_API SQLGetTypeInfo(
|
||||
@ -643,7 +643,7 @@ static char *func = "SQLGetTypeInfo";
|
||||
StatementClass *stmt = (StatementClass *) hstmt;
|
||||
TupleNode *row;
|
||||
int i;
|
||||
/* Int4 type; */
|
||||
// Int4 type;
|
||||
Int4 pgType;
|
||||
Int2 sqlType;
|
||||
|
||||
@ -721,7 +721,7 @@ Int2 sqlType;
|
||||
return SQL_SUCCESS;
|
||||
}
|
||||
|
||||
/* - - - - - - - - - */
|
||||
// - - - - - - - - -
|
||||
|
||||
RETCODE SQL_API SQLGetFunctions(
|
||||
HDBC hdbc,
|
||||
@ -748,7 +748,7 @@ static char *func="SQLGetFunctions";
|
||||
else {
|
||||
memset(pfExists, 0, sizeof(UWORD)*100);
|
||||
|
||||
/* ODBC core functions */
|
||||
// ODBC core functions
|
||||
pfExists[SQL_API_SQLALLOCCONNECT] = TRUE;
|
||||
pfExists[SQL_API_SQLALLOCENV] = TRUE;
|
||||
pfExists[SQL_API_SQLALLOCSTMT] = TRUE;
|
||||
@ -756,7 +756,7 @@ static char *func="SQLGetFunctions";
|
||||
pfExists[SQL_API_SQLCANCEL] = TRUE;
|
||||
pfExists[SQL_API_SQLCOLATTRIBUTES] = TRUE;
|
||||
pfExists[SQL_API_SQLCONNECT] = TRUE;
|
||||
pfExists[SQL_API_SQLDESCRIBECOL] = TRUE; /* partial */
|
||||
pfExists[SQL_API_SQLDESCRIBECOL] = TRUE; // partial
|
||||
pfExists[SQL_API_SQLDISCONNECT] = TRUE;
|
||||
pfExists[SQL_API_SQLERROR] = TRUE;
|
||||
pfExists[SQL_API_SQLEXECDIRECT] = TRUE;
|
||||
@ -767,36 +767,36 @@ static char *func="SQLGetFunctions";
|
||||
pfExists[SQL_API_SQLFREESTMT] = TRUE;
|
||||
pfExists[SQL_API_SQLGETCURSORNAME] = TRUE;
|
||||
pfExists[SQL_API_SQLNUMRESULTCOLS] = TRUE;
|
||||
pfExists[SQL_API_SQLPREPARE] = TRUE; /* complete? */
|
||||
pfExists[SQL_API_SQLPREPARE] = TRUE; // complete?
|
||||
pfExists[SQL_API_SQLROWCOUNT] = TRUE;
|
||||
pfExists[SQL_API_SQLSETCURSORNAME] = TRUE;
|
||||
pfExists[SQL_API_SQLSETPARAM] = FALSE; /* odbc 1.0 */
|
||||
pfExists[SQL_API_SQLSETPARAM] = FALSE; // odbc 1.0
|
||||
pfExists[SQL_API_SQLTRANSACT] = TRUE;
|
||||
|
||||
/* ODBC level 1 functions */
|
||||
// ODBC level 1 functions
|
||||
pfExists[SQL_API_SQLBINDPARAMETER] = TRUE;
|
||||
pfExists[SQL_API_SQLCOLUMNS] = TRUE;
|
||||
pfExists[SQL_API_SQLDRIVERCONNECT] = TRUE;
|
||||
pfExists[SQL_API_SQLGETCONNECTOPTION] = TRUE; /* partial */
|
||||
pfExists[SQL_API_SQLGETCONNECTOPTION] = TRUE; // partial
|
||||
pfExists[SQL_API_SQLGETDATA] = TRUE;
|
||||
pfExists[SQL_API_SQLGETFUNCTIONS] = TRUE;
|
||||
pfExists[SQL_API_SQLGETINFO] = TRUE;
|
||||
pfExists[SQL_API_SQLGETSTMTOPTION] = TRUE; /* partial */
|
||||
pfExists[SQL_API_SQLGETSTMTOPTION] = TRUE; // partial
|
||||
pfExists[SQL_API_SQLGETTYPEINFO] = TRUE;
|
||||
pfExists[SQL_API_SQLPARAMDATA] = TRUE;
|
||||
pfExists[SQL_API_SQLPUTDATA] = TRUE;
|
||||
pfExists[SQL_API_SQLSETCONNECTOPTION] = TRUE; /* partial */
|
||||
pfExists[SQL_API_SQLSETCONNECTOPTION] = TRUE; // partial
|
||||
pfExists[SQL_API_SQLSETSTMTOPTION] = TRUE;
|
||||
pfExists[SQL_API_SQLSPECIALCOLUMNS] = TRUE;
|
||||
pfExists[SQL_API_SQLSTATISTICS] = TRUE;
|
||||
pfExists[SQL_API_SQLTABLES] = TRUE;
|
||||
|
||||
/* ODBC level 2 functions */
|
||||
// ODBC level 2 functions
|
||||
pfExists[SQL_API_SQLBROWSECONNECT] = FALSE;
|
||||
pfExists[SQL_API_SQLCOLUMNPRIVILEGES] = FALSE;
|
||||
pfExists[SQL_API_SQLDATASOURCES] = FALSE; /* only implemented by DM */
|
||||
pfExists[SQL_API_SQLDESCRIBEPARAM] = FALSE; /* not properly implemented */
|
||||
pfExists[SQL_API_SQLDRIVERS] = FALSE; /* only implemented by DM */
|
||||
pfExists[SQL_API_SQLDATASOURCES] = FALSE; // only implemented by DM
|
||||
pfExists[SQL_API_SQLDESCRIBEPARAM] = FALSE; // not properly implemented
|
||||
pfExists[SQL_API_SQLDRIVERS] = FALSE; // only implemented by DM
|
||||
pfExists[SQL_API_SQLEXTENDEDFETCH] = TRUE;
|
||||
pfExists[SQL_API_SQLFOREIGNKEYS] = TRUE;
|
||||
pfExists[SQL_API_SQLMORERESULTS] = TRUE;
|
||||
@ -807,7 +807,7 @@ static char *func="SQLGetFunctions";
|
||||
pfExists[SQL_API_SQLPROCEDURECOLUMNS] = FALSE;
|
||||
pfExists[SQL_API_SQLPROCEDURES] = FALSE;
|
||||
pfExists[SQL_API_SQLSETPOS] = TRUE;
|
||||
pfExists[SQL_API_SQLSETSCROLLOPTIONS] = TRUE; /* odbc 1.0 */
|
||||
pfExists[SQL_API_SQLSETSCROLLOPTIONS] = TRUE; // odbc 1.0
|
||||
pfExists[SQL_API_SQLTABLEPRIVILEGES] = FALSE;
|
||||
}
|
||||
} else {
|
||||
@ -825,7 +825,7 @@ static char *func="SQLGetFunctions";
|
||||
case SQL_API_SQLCANCEL: *pfExists = TRUE; break;
|
||||
case SQL_API_SQLCOLATTRIBUTES: *pfExists = TRUE; break;
|
||||
case SQL_API_SQLCONNECT: *pfExists = TRUE; break;
|
||||
case SQL_API_SQLDESCRIBECOL: *pfExists = TRUE; break; /* partial */
|
||||
case SQL_API_SQLDESCRIBECOL: *pfExists = TRUE; break; // partial
|
||||
case SQL_API_SQLDISCONNECT: *pfExists = TRUE; break;
|
||||
case SQL_API_SQLERROR: *pfExists = TRUE; break;
|
||||
case SQL_API_SQLEXECDIRECT: *pfExists = TRUE; break;
|
||||
@ -839,33 +839,33 @@ static char *func="SQLGetFunctions";
|
||||
case SQL_API_SQLPREPARE: *pfExists = TRUE; break;
|
||||
case SQL_API_SQLROWCOUNT: *pfExists = TRUE; break;
|
||||
case SQL_API_SQLSETCURSORNAME: *pfExists = TRUE; break;
|
||||
case SQL_API_SQLSETPARAM: *pfExists = FALSE; break; /* odbc 1.0 */
|
||||
case SQL_API_SQLSETPARAM: *pfExists = FALSE; break; // odbc 1.0
|
||||
case SQL_API_SQLTRANSACT: *pfExists = TRUE; break;
|
||||
|
||||
/* ODBC level 1 functions */
|
||||
// ODBC level 1 functions
|
||||
case SQL_API_SQLBINDPARAMETER: *pfExists = TRUE; break;
|
||||
case SQL_API_SQLCOLUMNS: *pfExists = TRUE; break;
|
||||
case SQL_API_SQLDRIVERCONNECT: *pfExists = TRUE; break;
|
||||
case SQL_API_SQLGETCONNECTOPTION: *pfExists = TRUE; break; /* partial */
|
||||
case SQL_API_SQLGETCONNECTOPTION: *pfExists = TRUE; break; // partial
|
||||
case SQL_API_SQLGETDATA: *pfExists = TRUE; break;
|
||||
case SQL_API_SQLGETFUNCTIONS: *pfExists = TRUE; break;
|
||||
case SQL_API_SQLGETINFO: *pfExists = TRUE; break;
|
||||
case SQL_API_SQLGETSTMTOPTION: *pfExists = TRUE; break; /* partial */
|
||||
case SQL_API_SQLGETSTMTOPTION: *pfExists = TRUE; break; // partial
|
||||
case SQL_API_SQLGETTYPEINFO: *pfExists = TRUE; break;
|
||||
case SQL_API_SQLPARAMDATA: *pfExists = TRUE; break;
|
||||
case SQL_API_SQLPUTDATA: *pfExists = TRUE; break;
|
||||
case SQL_API_SQLSETCONNECTOPTION: *pfExists = TRUE; break; /* partial */
|
||||
case SQL_API_SQLSETCONNECTOPTION: *pfExists = TRUE; break; // partial
|
||||
case SQL_API_SQLSETSTMTOPTION: *pfExists = TRUE; break;
|
||||
case SQL_API_SQLSPECIALCOLUMNS: *pfExists = TRUE; break;
|
||||
case SQL_API_SQLSTATISTICS: *pfExists = TRUE; break;
|
||||
case SQL_API_SQLTABLES: *pfExists = TRUE; break;
|
||||
|
||||
/* ODBC level 2 functions */
|
||||
// ODBC level 2 functions
|
||||
case SQL_API_SQLBROWSECONNECT: *pfExists = FALSE; break;
|
||||
case SQL_API_SQLCOLUMNPRIVILEGES: *pfExists = FALSE; break;
|
||||
case SQL_API_SQLDATASOURCES: *pfExists = FALSE; break; /* only implemented by DM */
|
||||
case SQL_API_SQLDESCRIBEPARAM: *pfExists = FALSE; break; /* not properly implemented */
|
||||
case SQL_API_SQLDRIVERS: *pfExists = FALSE; break; /* only implemented by DM */
|
||||
case SQL_API_SQLDATASOURCES: *pfExists = FALSE; break; // only implemented by DM
|
||||
case SQL_API_SQLDESCRIBEPARAM: *pfExists = FALSE; break; // not properly implemented
|
||||
case SQL_API_SQLDRIVERS: *pfExists = FALSE; break; // only implemented by DM
|
||||
case SQL_API_SQLEXTENDEDFETCH: *pfExists = TRUE; break;
|
||||
case SQL_API_SQLFOREIGNKEYS: *pfExists = TRUE; break;
|
||||
case SQL_API_SQLMORERESULTS: *pfExists = TRUE; break;
|
||||
@ -876,7 +876,7 @@ static char *func="SQLGetFunctions";
|
||||
case SQL_API_SQLPROCEDURECOLUMNS: *pfExists = FALSE; break;
|
||||
case SQL_API_SQLPROCEDURES: *pfExists = FALSE; break;
|
||||
case SQL_API_SQLSETPOS: *pfExists = TRUE; break;
|
||||
case SQL_API_SQLSETSCROLLOPTIONS: *pfExists = TRUE; break; /* odbc 1.0 */
|
||||
case SQL_API_SQLSETSCROLLOPTIONS: *pfExists = TRUE; break; // odbc 1.0
|
||||
case SQL_API_SQLTABLEPRIVILEGES: *pfExists = FALSE; break;
|
||||
}
|
||||
}
|
||||
@ -935,9 +935,9 @@ mylog("%s: entering...stmt=%u\n", func, stmt);
|
||||
}
|
||||
tbl_stmt = (StatementClass *) htbl_stmt;
|
||||
|
||||
/* ********************************************************************** */
|
||||
/* Create the query to find out the tables */
|
||||
/* ********************************************************************** */
|
||||
// **********************************************************************
|
||||
// Create the query to find out the tables
|
||||
// **********************************************************************
|
||||
|
||||
strcpy(tables_query, "select relname, usename, relhasrules from pg_class, pg_user");
|
||||
strcat(tables_query, " where relkind = 'r'");
|
||||
@ -946,7 +946,7 @@ mylog("%s: entering...stmt=%u\n", func, stmt);
|
||||
my_strcat(tables_query, " and relname like '%.*s'", szTableName, cbTableName);
|
||||
|
||||
|
||||
/* Parse the extra systable prefix */
|
||||
// Parse the extra systable prefix
|
||||
strcpy(prefixes, globals.extra_systable_prefixes);
|
||||
i = 0;
|
||||
prefix[i] = strtok(prefixes, ";");
|
||||
@ -1012,7 +1012,7 @@ mylog("%s: entering...stmt=%u\n", func, stmt);
|
||||
strcat(tables_query, " and int4out(usesysid) = int4out(relowner)");
|
||||
strcat(tables_query, "order by relname");
|
||||
|
||||
/* ********************************************************************** */
|
||||
// **********************************************************************
|
||||
|
||||
result = SQLExecDirect(htbl_stmt, tables_query, strlen(tables_query));
|
||||
if((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO)) {
|
||||
@ -1061,11 +1061,11 @@ mylog("%s: entering...stmt=%u\n", func, stmt);
|
||||
return SQL_ERROR;
|
||||
}
|
||||
|
||||
/* the binding structure for a statement is not set up until */
|
||||
/* a statement is actually executed, so we'll have to do this ourselves. */
|
||||
// the binding structure for a statement is not set up until
|
||||
// a statement is actually executed, so we'll have to do this ourselves.
|
||||
extend_bindings(stmt, 5);
|
||||
|
||||
/* set the field names */
|
||||
// set the field names
|
||||
QR_set_num_fields(stmt->result, 5);
|
||||
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);
|
||||
@ -1073,7 +1073,7 @@ mylog("%s: entering...stmt=%u\n", func, stmt);
|
||||
QR_set_field_info(stmt->result, 3, "TABLE_TYPE", PG_TYPE_TEXT, MAX_INFO_STRING);
|
||||
QR_set_field_info(stmt->result, 4, "REMARKS", PG_TYPE_TEXT, 254);
|
||||
|
||||
/* add the tuples */
|
||||
// add the tuples
|
||||
result = SQLFetch(htbl_stmt);
|
||||
while((result == SQL_SUCCESS) || (result == SQL_SUCCESS_WITH_INFO)) {
|
||||
|
||||
@ -1118,11 +1118,11 @@ mylog("%s: entering...stmt=%u\n", func, stmt);
|
||||
|
||||
set_tuplefield_string(&row->tuple[0], "");
|
||||
|
||||
/* I have to hide the table owner from Access, otherwise it */
|
||||
/* insists on referring to the table as 'owner.table'. */
|
||||
/* (this is valid according to the ODBC SQL grammar, but */
|
||||
/* Postgres won't support it.) */
|
||||
/* set_tuplefield_string(&row->tuple[1], table_owner); */
|
||||
// I have to hide the table owner from Access, otherwise it
|
||||
// insists on referring to the table as 'owner.table'.
|
||||
// (this is valid according to the ODBC SQL grammar, but
|
||||
// Postgres won't support it.)
|
||||
// set_tuplefield_string(&row->tuple[1], table_owner);
|
||||
|
||||
mylog("SQLTables: table_name = '%s'\n", table_name);
|
||||
|
||||
@ -1143,11 +1143,11 @@ mylog("%s: entering...stmt=%u\n", func, stmt);
|
||||
return SQL_ERROR;
|
||||
}
|
||||
|
||||
/* also, things need to think that this statement is finished so */
|
||||
/* the results can be retrieved. */
|
||||
// also, things need to think that this statement is finished so
|
||||
// the results can be retrieved.
|
||||
stmt->status = STMT_FINISHED;
|
||||
|
||||
/* set up the current tuple pointer for SQLFetch */
|
||||
// set up the current tuple pointer for SQLFetch
|
||||
stmt->currTuple = -1;
|
||||
stmt->rowset_start = -1;
|
||||
stmt->current_col = -1;
|
||||
@ -1198,9 +1198,9 @@ ConnInfo *ci;
|
||||
|
||||
ci = &stmt->hdbc->connInfo;
|
||||
|
||||
/* ********************************************************************** */
|
||||
/* Create the query to find out the columns (Note: pre 6.3 did not have the atttypmod field) */
|
||||
/* ********************************************************************** */
|
||||
// **********************************************************************
|
||||
// Create the query to find out the columns (Note: pre 6.3 did not have the atttypmod field)
|
||||
// **********************************************************************
|
||||
sprintf(columns_query, "select u.usename, c.relname, a.attname, a.atttypid"
|
||||
", t.typname, a.attnum, a.attlen, %s, a.attnotnull, c.relhasrules"
|
||||
" from pg_user u, pg_class c, pg_attribute a, pg_type t"
|
||||
@ -1212,10 +1212,10 @@ ConnInfo *ci;
|
||||
my_strcat(columns_query, " and u.usename like '%.*s'", szTableOwner, cbTableOwner);
|
||||
my_strcat(columns_query, " and a.attname like '%.*s'", szColumnName, cbColumnName);
|
||||
|
||||
/* give the output in the order the columns were defined */
|
||||
/* when the table was created */
|
||||
// give the output in the order the columns were defined
|
||||
// when the table was created
|
||||
strcat(columns_query, " order by attnum");
|
||||
/* ********************************************************************** */
|
||||
// **********************************************************************
|
||||
|
||||
result = SQLAllocStmt( stmt->hdbc, &hcol_stmt);
|
||||
if((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO)) {
|
||||
@ -1347,12 +1347,12 @@ ConnInfo *ci;
|
||||
return SQL_ERROR;
|
||||
}
|
||||
|
||||
/* the binding structure for a statement is not set up until */
|
||||
/* a statement is actually executed, so we'll have to do this ourselves. */
|
||||
// the binding structure for a statement is not set up until
|
||||
// a statement is actually executed, so we'll have to do this ourselves.
|
||||
result_cols = 14;
|
||||
extend_bindings(stmt, result_cols);
|
||||
|
||||
/* set the field names */
|
||||
// set the field names
|
||||
QR_set_num_fields(stmt->result, result_cols);
|
||||
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);
|
||||
@ -1367,7 +1367,7 @@ ConnInfo *ci;
|
||||
QR_set_field_info(stmt->result, 10, "NULLABLE", PG_TYPE_INT2, 2);
|
||||
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, 13, "FIELD_TYPE", PG_TYPE_INT4, 4);
|
||||
|
||||
@ -1392,8 +1392,8 @@ ConnInfo *ci;
|
||||
(result_cols - 1) * sizeof(TupleField));
|
||||
|
||||
set_tuplefield_string(&row->tuple[0], "");
|
||||
/* see note in SQLTables() */
|
||||
/* set_tuplefield_string(&row->tuple[1], table_owner); */
|
||||
// see note in SQLTables()
|
||||
// set_tuplefield_string(&row->tuple[1], table_owner);
|
||||
set_tuplefield_string(&row->tuple[1], "");
|
||||
set_tuplefield_string(&row->tuple[2], table_name);
|
||||
set_tuplefield_string(&row->tuple[3], "oid");
|
||||
@ -1422,8 +1422,8 @@ ConnInfo *ci;
|
||||
|
||||
|
||||
set_tuplefield_string(&row->tuple[0], "");
|
||||
/* see note in SQLTables() */
|
||||
/* set_tuplefield_string(&row->tuple[1], table_owner); */
|
||||
// see note in SQLTables()
|
||||
// set_tuplefield_string(&row->tuple[1], table_owner);
|
||||
set_tuplefield_string(&row->tuple[1], "");
|
||||
set_tuplefield_string(&row->tuple[2], table_name);
|
||||
set_tuplefield_string(&row->tuple[3], field_name);
|
||||
@ -1449,7 +1449,7 @@ ConnInfo *ci;
|
||||
|
||||
if (field_type == PG_TYPE_NUMERIC) {
|
||||
if (mod_length >= 4)
|
||||
mod_length -= 4; /* the length is in atttypmod - 4 */
|
||||
mod_length -= 4; // the length is in atttypmod - 4
|
||||
|
||||
if (mod_length >= 0) {
|
||||
useStaticPrecision = FALSE;
|
||||
@ -1459,9 +1459,9 @@ ConnInfo *ci;
|
||||
|
||||
mylog("SQLColumns: field type is NUMERIC: field_type = %d, mod_length=%d, precision=%d, scale=%d\n", field_type, mod_length, precision, scale );
|
||||
|
||||
set_tuplefield_int4(&row->tuple[7], precision + 2); /* sign+dec.point */
|
||||
set_tuplefield_int4(&row->tuple[7], precision + 2); // sign+dec.point
|
||||
set_tuplefield_int4(&row->tuple[6], precision);
|
||||
set_tuplefield_int4(&row->tuple[12], precision + 2); /* sign+dec.point */
|
||||
set_tuplefield_int4(&row->tuple[12], precision + 2); // sign+dec.point
|
||||
set_nullfield_int2(&row->tuple[8], scale);
|
||||
}
|
||||
}
|
||||
@ -1473,7 +1473,7 @@ ConnInfo *ci;
|
||||
useStaticPrecision = FALSE;
|
||||
|
||||
if (mod_length >= 4)
|
||||
mod_length -= 4; /* the length is in atttypmod - 4 */
|
||||
mod_length -= 4; // the length is in atttypmod - 4
|
||||
|
||||
if (mod_length > globals.max_varchar_size || mod_length <= 0)
|
||||
mod_length = globals.max_varchar_size;
|
||||
@ -1514,8 +1514,8 @@ ConnInfo *ci;
|
||||
return SQL_ERROR;
|
||||
}
|
||||
|
||||
/* Put the row version column at the end so it might not be */
|
||||
/* mistaken for a key field. */
|
||||
// Put the row version column at the end so it might not be
|
||||
// mistaken for a key field.
|
||||
if ( relhasrules[0] != '1' && ! stmt->internal && atoi(ci->row_versioning)) {
|
||||
/* For Row Versioning fields */
|
||||
the_type = PG_TYPE_INT4;
|
||||
@ -1541,11 +1541,11 @@ ConnInfo *ci;
|
||||
QR_add_tuple(stmt->result, row);
|
||||
}
|
||||
|
||||
/* also, things need to think that this statement is finished so */
|
||||
/* the results can be retrieved. */
|
||||
// also, things need to think that this statement is finished so
|
||||
// the results can be retrieved.
|
||||
stmt->status = STMT_FINISHED;
|
||||
|
||||
/* set up the current tuple pointer for SQLFetch */
|
||||
// set up the current tuple pointer for SQLFetch
|
||||
stmt->currTuple = -1;
|
||||
stmt->rowset_start = -1;
|
||||
stmt->current_col = -1;
|
||||
@ -1590,9 +1590,9 @@ mylog("%s: entering...stmt=%u\n", func, stmt);
|
||||
stmt->manual_result = TRUE;
|
||||
|
||||
|
||||
/* ********************************************************************** */
|
||||
/* Create the query to find out if this is a view or not... */
|
||||
/* ********************************************************************** */
|
||||
// **********************************************************************
|
||||
// Create the query to find out if this is a view or not...
|
||||
// **********************************************************************
|
||||
sprintf(columns_query, "select c.relhasrules "
|
||||
"from pg_user u, pg_class c where "
|
||||
"u.usesysid = c.relowner");
|
||||
@ -1749,11 +1749,11 @@ mylog("%s: entering...stmt=%u\n", func, stmt);
|
||||
return SQL_ERROR;
|
||||
}
|
||||
|
||||
/* the binding structure for a statement is not set up until */
|
||||
/* a statement is actually executed, so we'll have to do this ourselves. */
|
||||
// the binding structure for a statement is not set up until
|
||||
// a statement is actually executed, so we'll have to do this ourselves.
|
||||
extend_bindings(stmt, 13);
|
||||
|
||||
/* set the field names */
|
||||
// set the field names
|
||||
QR_set_num_fields(stmt->result, 13);
|
||||
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);
|
||||
@ -1770,8 +1770,8 @@ mylog("%s: entering...stmt=%u\n", func, stmt);
|
||||
QR_set_field_info(stmt->result, 12, "FILTER_CONDITION", PG_TYPE_TEXT, MAX_INFO_STRING);
|
||||
|
||||
|
||||
/* only use the table name... the owner should be redundant, and */
|
||||
/* we never use qualifiers. */
|
||||
// only use the table name... the owner should be redundant, and
|
||||
// we never use qualifiers.
|
||||
table_name = make_string(szTableName, cbTableName, NULL);
|
||||
if ( ! table_name) {
|
||||
stmt->errormsg = "No table name passed to SQLStatistics.";
|
||||
@ -1780,8 +1780,8 @@ mylog("%s: entering...stmt=%u\n", func, stmt);
|
||||
return SQL_ERROR;
|
||||
}
|
||||
|
||||
/* we need to get a list of the field names first, */
|
||||
/* so we can return them later. */
|
||||
// we need to get a list of the field names first,
|
||||
// so we can return them later.
|
||||
result = SQLAllocStmt( stmt->hdbc, &hcol_stmt);
|
||||
if((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO)) {
|
||||
stmt->errormsg = "SQLAllocStmt failed in SQLStatistics for columns.";
|
||||
@ -1800,8 +1800,8 @@ mylog("%s: entering...stmt=%u\n", func, stmt);
|
||||
col_stmt->internal = FALSE;
|
||||
|
||||
if((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO)) {
|
||||
stmt->errormsg = col_stmt->errormsg; /* "SQLColumns failed in SQLStatistics."; */
|
||||
stmt->errornumber = col_stmt->errornumber; /* STMT_EXEC_ERROR; */
|
||||
stmt->errormsg = col_stmt->errormsg; // "SQLColumns failed in SQLStatistics.";
|
||||
stmt->errornumber = col_stmt->errornumber; // STMT_EXEC_ERROR;
|
||||
SQLFreeStmt(hcol_stmt, SQL_DROP);
|
||||
goto SEEYA;
|
||||
}
|
||||
@ -1831,7 +1831,7 @@ mylog("%s: entering...stmt=%u\n", func, stmt);
|
||||
result = SQLFetch(hcol_stmt);
|
||||
}
|
||||
if(result != SQL_NO_DATA_FOUND || total_columns == 0) {
|
||||
stmt->errormsg = SC_create_errormsg(hcol_stmt); /* "Couldn't get column names in SQLStatistics."; */
|
||||
stmt->errormsg = SC_create_errormsg(hcol_stmt); // "Couldn't get column names in SQLStatistics.";
|
||||
stmt->errornumber = col_stmt->errornumber;
|
||||
SQLFreeStmt(hcol_stmt, SQL_DROP);
|
||||
goto SEEYA;
|
||||
@ -1840,7 +1840,7 @@ mylog("%s: entering...stmt=%u\n", func, stmt);
|
||||
|
||||
SQLFreeStmt(hcol_stmt, SQL_DROP);
|
||||
|
||||
/* get a list of indexes on this table */
|
||||
// get a list of indexes on this table
|
||||
result = SQLAllocStmt( stmt->hdbc, &hindx_stmt);
|
||||
if((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO)) {
|
||||
stmt->errormsg = "SQLAllocStmt failed in SQLStatistics for indices.";
|
||||
@ -1858,48 +1858,48 @@ mylog("%s: entering...stmt=%u\n", func, stmt);
|
||||
|
||||
result = SQLExecDirect(hindx_stmt, index_query, strlen(index_query));
|
||||
if((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO)) {
|
||||
stmt->errormsg = SC_create_errormsg(hindx_stmt); /* "Couldn't execute index query (w/SQLExecDirect) in SQLStatistics."; */
|
||||
stmt->errormsg = SC_create_errormsg(hindx_stmt); // "Couldn't execute index query (w/SQLExecDirect) in SQLStatistics.";
|
||||
stmt->errornumber = indx_stmt->errornumber;
|
||||
SQLFreeStmt(hindx_stmt, SQL_DROP);
|
||||
goto SEEYA;
|
||||
|
||||
}
|
||||
|
||||
/* bind the index name column */
|
||||
// bind the index name column
|
||||
result = SQLBindCol(hindx_stmt, 1, SQL_C_CHAR,
|
||||
index_name, MAX_INFO_STRING, &index_name_len);
|
||||
if((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO)) {
|
||||
stmt->errormsg = indx_stmt->errormsg; /* "Couldn't bind column in SQLStatistics."; */
|
||||
stmt->errormsg = indx_stmt->errormsg; // "Couldn't bind column in SQLStatistics.";
|
||||
stmt->errornumber = indx_stmt->errornumber;
|
||||
SQLFreeStmt(hindx_stmt, SQL_DROP);
|
||||
goto SEEYA;
|
||||
|
||||
}
|
||||
/* bind the vector column */
|
||||
// bind the vector column
|
||||
result = SQLBindCol(hindx_stmt, 2, SQL_C_DEFAULT,
|
||||
fields_vector, 16, &fields_vector_len);
|
||||
if((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO)) {
|
||||
stmt->errormsg = indx_stmt->errormsg; /* "Couldn't bind column in SQLStatistics."; */
|
||||
stmt->errormsg = indx_stmt->errormsg; // "Couldn't bind column in SQLStatistics.";
|
||||
stmt->errornumber = indx_stmt->errornumber;
|
||||
SQLFreeStmt(hindx_stmt, SQL_DROP);
|
||||
goto SEEYA;
|
||||
|
||||
}
|
||||
/* bind the "is unique" column */
|
||||
// bind the "is unique" column
|
||||
result = SQLBindCol(hindx_stmt, 3, SQL_C_CHAR,
|
||||
isunique, sizeof(isunique), NULL);
|
||||
if((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO)) {
|
||||
stmt->errormsg = indx_stmt->errormsg; /* "Couldn't bind column in SQLStatistics."; */
|
||||
stmt->errormsg = indx_stmt->errormsg; // "Couldn't bind column in SQLStatistics.";
|
||||
stmt->errornumber = indx_stmt->errornumber;
|
||||
SQLFreeStmt(hindx_stmt, SQL_DROP);
|
||||
goto SEEYA;
|
||||
}
|
||||
|
||||
/* bind the "is clustered" column */
|
||||
// bind the "is clustered" column
|
||||
result = SQLBindCol(hindx_stmt, 4, SQL_C_CHAR,
|
||||
isclustered, sizeof(isclustered), NULL);
|
||||
if((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO)) {
|
||||
stmt->errormsg = indx_stmt->errormsg; /* "Couldn't bind column in SQLStatistics."; */
|
||||
stmt->errormsg = indx_stmt->errormsg; // "Couldn't bind column in SQLStatistics.";
|
||||
stmt->errornumber = indx_stmt->errornumber;
|
||||
SQLFreeStmt(hindx_stmt, SQL_DROP);
|
||||
goto SEEYA;
|
||||
@ -1920,22 +1920,22 @@ mylog("%s: entering...stmt=%u\n", func, stmt);
|
||||
row = (TupleNode *)malloc(sizeof(TupleNode) +
|
||||
(13 - 1) * sizeof(TupleField));
|
||||
|
||||
/* no table qualifier */
|
||||
// no table qualifier
|
||||
set_tuplefield_string(&row->tuple[0], "");
|
||||
/* don't set the table owner, else Access tries to use it */
|
||||
// don't set the table owner, else Access tries to use it
|
||||
set_tuplefield_string(&row->tuple[1], "");
|
||||
set_tuplefield_string(&row->tuple[2], table_name);
|
||||
|
||||
/* non-unique index? */
|
||||
// non-unique index?
|
||||
set_tuplefield_int2(&row->tuple[3], (Int2) (globals.unique_index ? FALSE : TRUE));
|
||||
|
||||
/* no index qualifier */
|
||||
// no index qualifier
|
||||
set_tuplefield_string(&row->tuple[4], "");
|
||||
|
||||
sprintf(buf, "%s_idx_fake_oid", table_name);
|
||||
set_tuplefield_string(&row->tuple[5], buf);
|
||||
|
||||
/* Clustered index? I think non-clustered should be type OTHER not HASHED */
|
||||
// Clustered index? I think non-clustered should be type OTHER not HASHED
|
||||
set_tuplefield_int2(&row->tuple[6], (Int2) SQL_INDEX_OTHER);
|
||||
set_tuplefield_int2(&row->tuple[7], (Int2) 1);
|
||||
|
||||
@ -1951,33 +1951,33 @@ mylog("%s: entering...stmt=%u\n", func, stmt);
|
||||
result = SQLFetch(hindx_stmt);
|
||||
while((result == SQL_SUCCESS) || (result == SQL_SUCCESS_WITH_INFO)) {
|
||||
|
||||
/* If only requesting unique indexs, then just return those. */
|
||||
// If only requesting unique indexs, then just return those.
|
||||
if (fUnique == SQL_INDEX_ALL ||
|
||||
(fUnique == SQL_INDEX_UNIQUE && atoi(isunique))) {
|
||||
i = 0;
|
||||
/* add a row in this table for each field in the index */
|
||||
// add a row in this table for each field in the index
|
||||
while(i < 8 && fields_vector[i] != 0) {
|
||||
|
||||
row = (TupleNode *)malloc(sizeof(TupleNode) +
|
||||
(13 - 1) * sizeof(TupleField));
|
||||
|
||||
/* no table qualifier */
|
||||
// no table qualifier
|
||||
set_tuplefield_string(&row->tuple[0], "");
|
||||
/* don't set the table owner, else Access tries to use it */
|
||||
// don't set the table owner, else Access tries to use it
|
||||
set_tuplefield_string(&row->tuple[1], "");
|
||||
set_tuplefield_string(&row->tuple[2], table_name);
|
||||
|
||||
/* non-unique index? */
|
||||
// non-unique index?
|
||||
if (globals.unique_index)
|
||||
set_tuplefield_int2(&row->tuple[3], (Int2) (atoi(isunique) ? FALSE : TRUE));
|
||||
else
|
||||
set_tuplefield_int2(&row->tuple[3], TRUE);
|
||||
|
||||
/* no index qualifier */
|
||||
// no index qualifier
|
||||
set_tuplefield_string(&row->tuple[4], "");
|
||||
set_tuplefield_string(&row->tuple[5], index_name);
|
||||
|
||||
/* Clustered index? I think non-clustered should be type OTHER not HASHED */
|
||||
// Clustered index? I think non-clustered should be type OTHER not HASHED
|
||||
set_tuplefield_int2(&row->tuple[6], (Int2) (atoi(isclustered) ? SQL_INDEX_CLUSTERED : SQL_INDEX_OTHER));
|
||||
set_tuplefield_int2(&row->tuple[7], (Int2) (i+1));
|
||||
|
||||
@ -2007,7 +2007,7 @@ mylog("%s: entering...stmt=%u\n", func, stmt);
|
||||
result = SQLFetch(hindx_stmt);
|
||||
}
|
||||
if(result != SQL_NO_DATA_FOUND) {
|
||||
stmt->errormsg = SC_create_errormsg(hindx_stmt); /* "SQLFetch failed in SQLStatistics."; */
|
||||
stmt->errormsg = SC_create_errormsg(hindx_stmt); // "SQLFetch failed in SQLStatistics.";
|
||||
stmt->errornumber = indx_stmt->errornumber;
|
||||
SQLFreeStmt(hindx_stmt, SQL_DROP);
|
||||
goto SEEYA;
|
||||
@ -2015,11 +2015,11 @@ mylog("%s: entering...stmt=%u\n", func, stmt);
|
||||
|
||||
SQLFreeStmt(hindx_stmt, SQL_DROP);
|
||||
|
||||
/* also, things need to think that this statement is finished so */
|
||||
/* the results can be retrieved. */
|
||||
// also, things need to think that this statement is finished so
|
||||
// the results can be retrieved.
|
||||
stmt->status = STMT_FINISHED;
|
||||
|
||||
/* set up the current tuple pointer for SQLFetch */
|
||||
// set up the current tuple pointer for SQLFetch
|
||||
stmt->currTuple = -1;
|
||||
stmt->rowset_start = -1;
|
||||
stmt->current_col = -1;
|
||||
@ -2108,12 +2108,12 @@ Int2 result_cols;
|
||||
return SQL_ERROR;
|
||||
}
|
||||
|
||||
/* the binding structure for a statement is not set up until */
|
||||
/* a statement is actually executed, so we'll have to do this ourselves. */
|
||||
// the binding structure for a statement is not set up until
|
||||
// a statement is actually executed, so we'll have to do this ourselves.
|
||||
result_cols = 6;
|
||||
extend_bindings(stmt, result_cols);
|
||||
|
||||
/* set the field names */
|
||||
// set the field names
|
||||
QR_set_num_fields(stmt->result, result_cols);
|
||||
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);
|
||||
@ -2218,11 +2218,11 @@ Int2 result_cols;
|
||||
SQLFreeStmt(htbl_stmt, SQL_DROP);
|
||||
|
||||
|
||||
/* also, things need to think that this statement is finished so */
|
||||
/* the results can be retrieved. */
|
||||
// also, things need to think that this statement is finished so
|
||||
// the results can be retrieved.
|
||||
stmt->status = STMT_FINISHED;
|
||||
|
||||
/* set up the current tuple pointer for SQLFetch */
|
||||
// set up the current tuple pointer for SQLFetch
|
||||
stmt->currTuple = -1;
|
||||
stmt->rowset_start = -1;
|
||||
stmt->current_col = -1;
|
||||
@ -2281,12 +2281,12 @@ Int2 result_cols;
|
||||
return SQL_ERROR;
|
||||
}
|
||||
|
||||
/* the binding structure for a statement is not set up until */
|
||||
/* a statement is actually executed, so we'll have to do this ourselves. */
|
||||
// the binding structure for a statement is not set up until
|
||||
// a statement is actually executed, so we'll have to do this ourselves.
|
||||
result_cols = 14;
|
||||
extend_bindings(stmt, result_cols);
|
||||
|
||||
/* set the field names */
|
||||
// set the field names
|
||||
QR_set_num_fields(stmt->result, result_cols);
|
||||
QR_set_field_info(stmt->result, 0, "PKTABLE_QUALIFIER", PG_TYPE_TEXT, MAX_INFO_STRING);
|
||||
QR_set_field_info(stmt->result, 1, "PKTABLE_OWNER", PG_TYPE_TEXT, MAX_INFO_STRING);
|
||||
@ -2303,11 +2303,11 @@ Int2 result_cols;
|
||||
QR_set_field_info(stmt->result, 12, "PK_NAME", PG_TYPE_TEXT, MAX_INFO_STRING);
|
||||
QR_set_field_info(stmt->result, 13, "TRIGGER_NAME", PG_TYPE_TEXT, MAX_INFO_STRING);
|
||||
|
||||
/* also, things need to think that this statement is finished so */
|
||||
/* the results can be retrieved. */
|
||||
// also, things need to think that this statement is finished so
|
||||
// the results can be retrieved.
|
||||
stmt->status = STMT_FINISHED;
|
||||
|
||||
/* set up the current tuple pointer for SQLFetch */
|
||||
// set up the current tuple pointer for SQLFetch
|
||||
stmt->currTuple = -1;
|
||||
stmt->rowset_start = -1;
|
||||
stmt->current_col = -1;
|
||||
@ -2475,7 +2475,7 @@ Int2 result_cols;
|
||||
|
||||
set_tuplefield_string(&row->tuple[2], prel);
|
||||
|
||||
/* Get to the primary key */
|
||||
// Get to the primary key
|
||||
ptr += strlen(ptr) + 1;
|
||||
|
||||
mylog("prel = '%s', ptr = '%s'\n", prel, ptr);
|
||||
@ -2499,7 +2499,7 @@ Int2 result_cols;
|
||||
|
||||
QR_add_tuple(stmt->result, row);
|
||||
|
||||
/* next foreign key */
|
||||
// next foreign key
|
||||
fkptr += strlen(fkptr) + 1;
|
||||
|
||||
}
|
||||
@ -2609,13 +2609,13 @@ Int2 result_cols;
|
||||
}
|
||||
|
||||
while (result == SQL_SUCCESS) {
|
||||
/* Get the number of tables */
|
||||
// Get the number of tables
|
||||
ptr = args;
|
||||
ntabs = atoi(args);
|
||||
ptr += strlen(ptr) + 1;
|
||||
|
||||
|
||||
/* Handle action (i.e., 'cascade', 'restrict', 'setnull') */
|
||||
// Handle action (i.e., 'cascade', 'restrict', 'setnull')
|
||||
switch(tolower(ptr[0])) {
|
||||
case 'c':
|
||||
action = SQL_CASCADE;
|
||||
@ -2634,7 +2634,7 @@ Int2 result_cols;
|
||||
rule_type >>= TRIGGER_SHIFT;
|
||||
ptr += strlen(ptr) + 1;
|
||||
|
||||
/* Calculate the number of key parts */
|
||||
// Calculate the number of key parts
|
||||
pkeys = (nargs - ( 2 + ntabs)) / (ntabs + 1);
|
||||
pkey_ptr = ptr;
|
||||
|
||||
@ -2644,10 +2644,10 @@ Int2 result_cols;
|
||||
ntabs = 0;
|
||||
}
|
||||
|
||||
/* Get to the last primary keypart */
|
||||
// Get to the last primary keypart
|
||||
for (i = 1; i < pkeys; i++) {
|
||||
|
||||
/* If keypart doesnt match, skip this entry */
|
||||
// If keypart doesnt match, skip this entry
|
||||
if ( keyresult != SQL_SUCCESS || strcmp(pkey, ptr)) {
|
||||
ntabs = 0;
|
||||
break;
|
||||
@ -2660,7 +2660,7 @@ Int2 result_cols;
|
||||
mylog("Foreign Key Case#1: nargs = %d, ntabs = %d, pkeys = %d\n", nargs, ntabs, pkeys);
|
||||
|
||||
|
||||
/* Get Foreign Key Tables */
|
||||
// Get Foreign Key Tables
|
||||
for (i = 0; i < ntabs; i++) {
|
||||
|
||||
seq = 0;
|
||||
@ -2685,7 +2685,7 @@ Int2 result_cols;
|
||||
set_tuplefield_string(&row->tuple[5], "");
|
||||
set_tuplefield_string(&row->tuple[6], frel);
|
||||
|
||||
/* Get to the foreign key */
|
||||
// Get to the foreign key
|
||||
ptr += strlen(ptr) + 1;
|
||||
|
||||
set_tuplefield_string(&row->tuple[7], ptr);
|
||||
@ -2705,7 +2705,7 @@ Int2 result_cols;
|
||||
|
||||
QR_add_tuple(stmt->result, row);
|
||||
|
||||
/* next primary key */
|
||||
// next primary key
|
||||
pkptr += strlen(pkptr) + 1;
|
||||
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ int retval, result_len;
|
||||
argv[0].u.integer = mode;
|
||||
|
||||
if ( ! CC_send_function(conn, LO_CREAT, &retval, &result_len, 1, argv, 1))
|
||||
return 0; /* invalid oid */
|
||||
return 0; // invalid oid
|
||||
else
|
||||
return retval;
|
||||
|
||||
|
@ -169,10 +169,10 @@ my_strcpy(char *dst, int dst_len, char *src, int src_len)
|
||||
return strlen(dst);
|
||||
}
|
||||
|
||||
/* strncpy copies up to len characters, and doesn't terminate */
|
||||
/* the destination string if src has len characters or more. */
|
||||
/* instead, I want it to copy up to len-1 characters and always */
|
||||
/* terminate the destination string. */
|
||||
// strncpy copies up to len characters, and doesn't terminate
|
||||
// the destination string if src has len characters or more.
|
||||
// instead, I want it to copy up to len-1 characters and always
|
||||
// terminate the destination string.
|
||||
char *strncpy_null(char *dst, const char *src, int len)
|
||||
{
|
||||
int i;
|
||||
@ -199,9 +199,9 @@ int i;
|
||||
return dst;
|
||||
}
|
||||
|
||||
/* 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. */
|
||||
/* 2. If buf is not supplied, malloc space and return this string */
|
||||
// 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.
|
||||
// 2. If buf is not supplied, malloc space and return this string
|
||||
char *
|
||||
make_string(char *s, int len, char *buf)
|
||||
{
|
||||
@ -227,10 +227,10 @@ char *str;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Concatenate a single formatted argument to a given buffer handling the SQL_NTS thing. */
|
||||
/* "fmt" must contain somewhere in it the single form '%.*s' */
|
||||
/* This is heavily used in creating queries for info routines (SQLTables, SQLColumns). */
|
||||
/* This routine could be modified to use vsprintf() to handle multiple arguments. */
|
||||
// Concatenate a single formatted argument to a given buffer handling the SQL_NTS thing.
|
||||
// "fmt" must contain somewhere in it the single form '%.*s'
|
||||
// This is heavily used in creating queries for info routines (SQLTables, SQLColumns).
|
||||
// This routine could be modified to use vsprintf() to handle multiple arguments.
|
||||
char *
|
||||
my_strcat(char *buf, char *fmt, char *s, int len)
|
||||
{
|
||||
|
@ -50,7 +50,7 @@
|
||||
#ifndef WIN32
|
||||
#define mylog(args...) /* GNU convention for variable arguments */
|
||||
#else
|
||||
#define mylog /* mylog */
|
||||
#define mylog // mylog
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@ -66,7 +66,7 @@
|
||||
#ifndef WIN32
|
||||
#define qlog(args...) /* GNU convention for variable arguments */
|
||||
#else
|
||||
#define qlog /* qlog */
|
||||
#define qlog // qlog
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
@ -110,8 +110,8 @@ char changed = FALSE;
|
||||
else {
|
||||
if (vParam == SQL_CURSOR_FORWARD_ONLY || vParam == SQL_CURSOR_STATIC) {
|
||||
|
||||
if (conn) conn->stmtOptions.cursor_type = vParam; /* valid type */
|
||||
if (stmt) stmt->options.cursor_type = vParam; /* valid type */
|
||||
if (conn) conn->stmtOptions.cursor_type = vParam; // valid type
|
||||
if (stmt) stmt->options.cursor_type = vParam; // valid type
|
||||
}
|
||||
else {
|
||||
|
||||
@ -161,7 +161,7 @@ char changed = FALSE;
|
||||
|
||||
case SQL_QUERY_TIMEOUT: /* ignored */
|
||||
mylog("SetStmtOption: SQL_QUERY_TIMEOUT, vParam = %d\n", vParam);
|
||||
/* "0" returned in SQLGetStmtOption */
|
||||
// "0" returned in SQLGetStmtOption
|
||||
break;
|
||||
|
||||
case SQL_RETRIEVE_DATA: /* ignored, but saved */
|
||||
@ -390,7 +390,7 @@ int i;
|
||||
return SQL_SUCCESS;
|
||||
}
|
||||
|
||||
/* - - - - - - - - - */
|
||||
// - - - - - - - - -
|
||||
|
||||
/* This function just can tell you whether you are in Autcommit mode or not */
|
||||
RETCODE SQL_API SQLGetConnectOption(
|
||||
@ -465,7 +465,7 @@ ConnectionClass *conn = (ConnectionClass *) hdbc;
|
||||
return SQL_SUCCESS;
|
||||
}
|
||||
|
||||
/* - - - - - - - - - */
|
||||
// - - - - - - - - -
|
||||
|
||||
RETCODE SQL_API SQLSetStmtOption(
|
||||
HSTMT hstmt,
|
||||
@ -477,9 +477,9 @@ StatementClass *stmt = (StatementClass *) hstmt;
|
||||
|
||||
mylog("%s: entering...\n", func);
|
||||
|
||||
/* thought we could fake Access out by just returning SQL_SUCCESS */
|
||||
/* all the time, but it tries to set a huge value for SQL_MAX_LENGTH */
|
||||
/* and expects the driver to reduce it to the real value */
|
||||
// thought we could fake Access out by just returning SQL_SUCCESS
|
||||
// all the time, but it tries to set a huge value for SQL_MAX_LENGTH
|
||||
// and expects the driver to reduce it to the real value
|
||||
|
||||
if( ! stmt) {
|
||||
SC_log_error(func, "", NULL);
|
||||
@ -490,7 +490,7 @@ StatementClass *stmt = (StatementClass *) hstmt;
|
||||
}
|
||||
|
||||
|
||||
/* - - - - - - - - - */
|
||||
// - - - - - - - - -
|
||||
|
||||
RETCODE SQL_API SQLGetStmtOption(
|
||||
HSTMT hstmt,
|
||||
@ -503,9 +503,9 @@ QResultClass *res;
|
||||
|
||||
mylog("%s: entering...\n", func);
|
||||
|
||||
/* thought we could fake Access out by just returning SQL_SUCCESS */
|
||||
/* all the time, but it tries to set a huge value for SQL_MAX_LENGTH */
|
||||
/* and expects the driver to reduce it to the real value */
|
||||
// thought we could fake Access out by just returning SQL_SUCCESS
|
||||
// all the time, but it tries to set a huge value for SQL_MAX_LENGTH
|
||||
// and expects the driver to reduce it to the real value
|
||||
|
||||
if( ! stmt) {
|
||||
SC_log_error(func, "", NULL);
|
||||
@ -519,7 +519,7 @@ QResultClass *res;
|
||||
res = stmt->result;
|
||||
|
||||
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) ||
|
||||
(stmt->currTuple >= QR_get_num_tuples(res))) {
|
||||
stmt->errormsg = "Not positioned on a valid row.";
|
||||
@ -618,4 +618,4 @@ QResultClass *res;
|
||||
return SQL_SUCCESS;
|
||||
}
|
||||
|
||||
/* - - - - - - - - - */
|
||||
// - - - - - - - - -
|
||||
|
@ -56,7 +56,7 @@ char qc, in_escape = FALSE;
|
||||
|
||||
/* skip leading delimiters */
|
||||
while (isspace(s[i]) || s[i] == ',') {
|
||||
/* mylog("skipping '%c'\n", s[i]); */
|
||||
// mylog("skipping '%c'\n", s[i]);
|
||||
i++;
|
||||
}
|
||||
|
||||
@ -128,7 +128,7 @@ char qc, in_escape = FALSE;
|
||||
i++;
|
||||
}
|
||||
|
||||
/* mylog("done -- s[%d] = '%c'\n", i, s[i]); */
|
||||
// mylog("done -- s[%d] = '%c'\n", i, s[i]);
|
||||
|
||||
token[out] = '\0';
|
||||
|
||||
@ -156,7 +156,7 @@ char qc, in_escape = FALSE;
|
||||
}
|
||||
|
||||
|
||||
#if 0
|
||||
/*
|
||||
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, 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);
|
||||
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, 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, 13, "FIELD_TYPE", PG_TYPE_INT4, 4);
|
||||
#endif
|
||||
*/
|
||||
|
||||
void
|
||||
getColInfo(COL_INFO *col_info, FIELD_INFO *fi, int k)
|
||||
@ -676,7 +676,7 @@ RETCODE result;
|
||||
total_cols--; /* makes up for the star */
|
||||
|
||||
/* Allocate some more field pointers if necessary */
|
||||
/*------------------------------------------------------------- */
|
||||
//-------------------------------------------------------------
|
||||
old_size = (stmt->nfld / FLD_INCR * FLD_INCR + FLD_INCR);
|
||||
need = total_cols - (old_size - stmt->nfld);
|
||||
|
||||
@ -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--) {
|
||||
mylog("copying field %d to %d\n", j, total_cols + j);
|
||||
fi[total_cols + j] = fi[j];
|
||||
}
|
||||
mylog("done copying fields\n");
|
||||
|
||||
/*------------------------------------------------------------- */
|
||||
/* Set the new number of fields */
|
||||
//-------------------------------------------------------------
|
||||
// Set the new number of fields
|
||||
stmt->nfld += total_cols;
|
||||
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);
|
||||
@ -720,7 +720,7 @@ RETCODE result;
|
||||
|
||||
for (n = 0; n < cols; 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) {
|
||||
mylog("allocating field info at %d\n", n + i);
|
||||
fi[n + i] = (FIELD_INFO *) malloc( sizeof(FIELD_INFO));
|
||||
@ -744,7 +744,7 @@ RETCODE result;
|
||||
mylog("i now at %d\n", i);
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------- */
|
||||
//-------------------------------------------------------------
|
||||
}
|
||||
|
||||
/* 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)
|
||||
|
||||
Int2 sqltype_to_default_ctype(Int2 sqltype)
|
||||
{
|
||||
/* from the table on page 623 of ODBC 2.0 Programmer's Reference */
|
||||
/* (Appendix D) */
|
||||
// from the table on page 623 of ODBC 2.0 Programmer's Reference
|
||||
// (Appendix D)
|
||||
switch(sqltype) {
|
||||
case SQL_CHAR:
|
||||
case SQL_VARCHAR:
|
||||
|
@ -16,9 +16,7 @@
|
||||
/* in table pg_type */
|
||||
|
||||
|
||||
#if 0
|
||||
#define PG_TYPE_LO ???? /* waiting for permanent type */
|
||||
#endif
|
||||
// #define PG_TYPE_LO ???? /* waiting for permanent type */
|
||||
|
||||
#define PG_TYPE_BOOL 16
|
||||
#define PG_TYPE_BYTEA 17
|
||||
|
@ -83,7 +83,7 @@ typedef UInt4 Oid;
|
||||
/* Info limits */
|
||||
#define MAX_INFO_STRING 128
|
||||
#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
|
||||
|
||||
|
||||
|
@ -125,14 +125,14 @@ QR_Destructor(QResultClass *self)
|
||||
if (self->manual_tuples)
|
||||
TL_Destructor(self->manual_tuples);
|
||||
|
||||
/* If conn is defined, then we may have used "backend_tuples", */
|
||||
/* so in case we need to, free it up. Also, close the cursor. */
|
||||
// If conn is defined, then we may have used "backend_tuples",
|
||||
// so in case we need to, free it up. Also, close the cursor.
|
||||
if (self->conn && self->conn->sock && CC_is_in_trans(self->conn))
|
||||
QR_close(self); /* close the cursor if there is one */
|
||||
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)
|
||||
free(self->cursor);
|
||||
|
||||
@ -192,7 +192,7 @@ int num_fields = self->num_fields;
|
||||
free(tuple[lf].value);
|
||||
}
|
||||
}
|
||||
tuple += num_fields; /* next row */
|
||||
tuple += num_fields; // next row
|
||||
}
|
||||
|
||||
free(self->backend_tuples);
|
||||
@ -204,17 +204,17 @@ int num_fields = self->num_fields;
|
||||
mylog("QResult: free memory out\n");
|
||||
}
|
||||
|
||||
/* This function is called by send_query() */
|
||||
// This function is called by send_query()
|
||||
char
|
||||
QR_fetch_tuples(QResultClass *self, ConnectionClass *conn, char *cursor)
|
||||
{
|
||||
int tuple_size;
|
||||
|
||||
/* If called from send_query the first time (conn != NULL), */
|
||||
/* then set the inTuples state, */
|
||||
/* and read the tuples. If conn is NULL, */
|
||||
/* it implies that we are being called from next_tuple(), */
|
||||
/* like to get more rows so don't call next_tuple again! */
|
||||
// If called from send_query the first time (conn != NULL),
|
||||
// then set the inTuples state,
|
||||
// and read the tuples. If conn is NULL,
|
||||
// it implies that we are being called from next_tuple(),
|
||||
// like to get more rows so don't call next_tuple again!
|
||||
if (conn != NULL) {
|
||||
self->conn = conn;
|
||||
|
||||
@ -232,8 +232,8 @@ int tuple_size;
|
||||
self->cursor = strdup(cursor);
|
||||
}
|
||||
|
||||
/* Read the field attributes. */
|
||||
/* $$$$ Should do some error control HERE! $$$$ */
|
||||
// Read the field attributes.
|
||||
// $$$$ Should do some error control HERE! $$$$
|
||||
if ( CI_read_fields(self->fields, self->conn)) {
|
||||
self->status = PGRES_FIELDS_OK;
|
||||
self->num_fields = CI_get_num_fields(self->fields);
|
||||
@ -272,8 +272,8 @@ int tuple_size;
|
||||
}
|
||||
else {
|
||||
|
||||
/* Always have to read the field attributes. */
|
||||
/* But we dont have to reallocate memory for them! */
|
||||
// Always have to read the field attributes.
|
||||
// But we dont have to reallocate memory for them!
|
||||
|
||||
if ( ! CI_read_fields(NULL, self->conn)) {
|
||||
self->status = PGRES_BAD_RESPONSE;
|
||||
@ -284,8 +284,8 @@ int tuple_size;
|
||||
}
|
||||
}
|
||||
|
||||
/* Close the cursor and end the transaction (if no cursors left) */
|
||||
/* We only close cursor/end the transaction if a cursor was used. */
|
||||
// Close the cursor and end the transaction (if no cursors left)
|
||||
// We only close cursor/end the transaction if a cursor was used.
|
||||
int
|
||||
QR_close(QResultClass *self)
|
||||
{
|
||||
@ -331,7 +331,7 @@ QResultClass *res;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* This function is called by fetch_tuples() AND SQLFetch() */
|
||||
// This function is called by fetch_tuples() AND SQLFetch()
|
||||
int
|
||||
QR_next_tuple(QResultClass *self)
|
||||
{
|
||||
@ -346,7 +346,7 @@ int end_tuple = self->rowset_size + self->base;
|
||||
char corrected = FALSE;
|
||||
TupleField *the_tuples = self->backend_tuples;
|
||||
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];
|
||||
QueryInfo qi;
|
||||
|
||||
@ -357,7 +357,7 @@ QueryInfo qi;
|
||||
return TRUE;
|
||||
}
|
||||
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);
|
||||
self->tupleField = NULL;
|
||||
self->status = PGRES_END_TUPLES;
|
||||
@ -417,7 +417,7 @@ QueryInfo qi;
|
||||
|
||||
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.result_in = self;
|
||||
qi.cursor = NULL;
|
||||
@ -479,7 +479,7 @@ QueryInfo qi;
|
||||
}
|
||||
|
||||
self->fcount++;
|
||||
break; /* continue reading */
|
||||
break; // continue reading
|
||||
|
||||
|
||||
case 'C': /* End of tuple list */
|
||||
@ -498,7 +498,7 @@ QueryInfo qi;
|
||||
self->tupleField = self->backend_tuples + (offset * self->num_fields);
|
||||
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");
|
||||
mylog("_next_tuple: 'C': DONE (fcount == 0)\n");
|
||||
return -1; /* end of tuples */
|
||||
@ -546,7 +546,7 @@ Int2 bitmap_pos;
|
||||
Int2 bitcnt;
|
||||
Int4 len;
|
||||
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);
|
||||
ColumnInfoClass *flds;
|
||||
|
||||
|
@ -37,31 +37,31 @@ typedef enum QueryResultCode_ QueryResultCode;
|
||||
|
||||
|
||||
struct QResultClass_ {
|
||||
ColumnInfoClass *fields; /* the Column information */
|
||||
TupleListClass *manual_tuples; /* manual result tuple list */
|
||||
ConnectionClass *conn; /* the connection this result is using (backend) */
|
||||
ColumnInfoClass *fields; // the Column information
|
||||
TupleListClass *manual_tuples; // manual result tuple list
|
||||
ConnectionClass *conn; // the connection this result is using (backend)
|
||||
|
||||
/* Stuff for declare/fetch tuples */
|
||||
int fetch_count; /* logical rows read so far */
|
||||
int fcount; /* actual rows read in the fetch */
|
||||
// Stuff for declare/fetch tuples
|
||||
int fetch_count; // logical rows read so far
|
||||
int fcount; // actual rows read in the fetch
|
||||
int currTuple;
|
||||
int base;
|
||||
|
||||
int num_fields; /* number of fields in the result */
|
||||
int num_fields; // number of fields in the result
|
||||
int cache_size;
|
||||
int rowset_size;
|
||||
|
||||
QueryResultCode status;
|
||||
|
||||
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 *notice;
|
||||
|
||||
TupleField *backend_tuples; /* data from the backend (the tuple cache) */
|
||||
TupleField *tupleField; /* current backend tuple being retrieved */
|
||||
TupleField *backend_tuples; // data from the backend (the tuple cache)
|
||||
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)
|
||||
@ -97,7 +97,7 @@ struct QResultClass_ {
|
||||
#define QR_get_notice(self) (self->notice)
|
||||
#define QR_get_status(self) (self->status)
|
||||
|
||||
/* Core Functions */
|
||||
// Core Functions
|
||||
QResultClass *QR_Constructor(void);
|
||||
void QR_Destructor(QResultClass *self);
|
||||
char QR_read_tuple(QResultClass *self, char binary);
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*{{NO_DEPENDENCIES}} */
|
||||
/* Microsoft Developer Studio generated include file. */
|
||||
/* Used by psqlodbc.rc */
|
||||
/* */
|
||||
//{{NO_DEPENDENCIES}}
|
||||
// Microsoft Developer Studio generated include file.
|
||||
// Used by psqlodbc.rc
|
||||
//
|
||||
#define IDS_BADDSN 1
|
||||
#define IDS_MSGTITLE 2
|
||||
#define DLG_OPTIONS_DRV 102
|
||||
@ -50,8 +50,8 @@
|
||||
#define DS_PG64 1057
|
||||
#define DS_PG63 1058
|
||||
|
||||
/* Next default values for new objects */
|
||||
/* */
|
||||
// Next default values for new objects
|
||||
//
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
#define _APS_NEXT_RESOURCE_VALUE 104
|
||||
|
@ -78,7 +78,7 @@ char *msg, *ptr;
|
||||
if (res && pcrow) {
|
||||
msg = QR_get_command(res);
|
||||
mylog("*** msg = '%s'\n", msg);
|
||||
trim(msg); /* get rid of trailing spaces */
|
||||
trim(msg); // get rid of trailing spaces
|
||||
ptr = strrchr(msg, ' ');
|
||||
if (ptr) {
|
||||
*pcrow = atoi(ptr+1);
|
||||
@ -99,8 +99,8 @@ char *msg, *ptr;
|
||||
}
|
||||
|
||||
|
||||
/* This returns the number of columns associated with the database */
|
||||
/* attached to "hstmt". */
|
||||
// This returns the number of columns associated with the database
|
||||
// attached to "hstmt".
|
||||
|
||||
|
||||
RETCODE SQL_API SQLNumResultCols(
|
||||
@ -155,12 +155,12 @@ char parse_ok;
|
||||
}
|
||||
|
||||
|
||||
/* - - - - - - - - - */
|
||||
// - - - - - - - - -
|
||||
|
||||
|
||||
|
||||
/* Return information about the database column the user wants */
|
||||
/* information about. */
|
||||
// Return information about the database column the user wants
|
||||
// information about.
|
||||
RETCODE SQL_API SQLDescribeCol(
|
||||
HSTMT hstmt,
|
||||
UWORD icol,
|
||||
@ -264,7 +264,7 @@ RETCODE result;
|
||||
col_name = QR_get_fieldname(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);
|
||||
@ -308,7 +308,7 @@ RETCODE result;
|
||||
if (pcbColDef) {
|
||||
|
||||
if ( precision < 0)
|
||||
precision = 0; /* "I dont know" */
|
||||
precision = 0; // "I dont know"
|
||||
|
||||
*pcbColDef = precision;
|
||||
|
||||
@ -339,7 +339,7 @@ RETCODE 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(
|
||||
HSTMT hstmt,
|
||||
@ -377,8 +377,8 @@ int len = 0, value = 0;
|
||||
|
||||
icol--;
|
||||
|
||||
unknown_sizes = globals.unknown_sizes; /* atoi(ci->unknown_sizes); */
|
||||
if (unknown_sizes == UNKNOWNS_AS_DONTKNOW) /* not appropriate for SQLColAttributes() */
|
||||
unknown_sizes = globals.unknown_sizes; // atoi(ci->unknown_sizes);
|
||||
if (unknown_sizes == UNKNOWNS_AS_DONTKNOW) // not appropriate for SQLColAttributes()
|
||||
unknown_sizes = UNKNOWNS_AS_MAX;
|
||||
|
||||
parse_ok = FALSE;
|
||||
@ -483,7 +483,7 @@ int len = 0, value = 0;
|
||||
mylog("SQLColAttr: COLUMN_LABEL = '%s'\n", p);
|
||||
break;
|
||||
|
||||
} /* otherwise same as column name -- FALL THROUGH!!! */
|
||||
} // otherwise same as column name -- FALL THROUGH!!!
|
||||
|
||||
case SQL_COLUMN_NAME:
|
||||
|
||||
@ -593,7 +593,7 @@ int len = 0, value = 0;
|
||||
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(
|
||||
HSTMT hstmt,
|
||||
@ -657,10 +657,10 @@ mylog("SQLGetData: enter, stmt=%u\n", stmt);
|
||||
|
||||
else {
|
||||
|
||||
/* use zero-based column numbers */
|
||||
// use zero-based column numbers
|
||||
icol--;
|
||||
|
||||
/* make sure the column number is valid */
|
||||
// make sure the column number is valid
|
||||
num_cols = QR_NumResultCols(res);
|
||||
if (icol >= num_cols) {
|
||||
stmt->errormsg = "Invalid column number.";
|
||||
@ -671,7 +671,7 @@ mylog("SQLGetData: enter, stmt=%u\n", stmt);
|
||||
}
|
||||
|
||||
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);
|
||||
if((stmt->currTuple < 0) ||
|
||||
(stmt->currTuple >= num_rows)) {
|
||||
@ -765,8 +765,8 @@ mylog("SQLGetData: enter, stmt=%u\n", stmt);
|
||||
|
||||
|
||||
|
||||
/* Returns data for bound columns in the current row ("hstmt->iCursor"), */
|
||||
/* advances the cursor. */
|
||||
// Returns data for bound columns in the current row ("hstmt->iCursor"),
|
||||
// advances the cursor.
|
||||
|
||||
RETCODE SQL_API SQLFetch(
|
||||
HSTMT hstmt)
|
||||
@ -815,8 +815,8 @@ mylog("SQLFetch: stmt = %u, stmt->result= %u\n", stmt, stmt->result);
|
||||
}
|
||||
|
||||
if (stmt->bindings == NULL) {
|
||||
/* just to avoid a crash if the user insists on calling this */
|
||||
/* function even if SQL_ExecDirect has reported an Error */
|
||||
// just to avoid a crash if the user insists on calling this
|
||||
// function even if SQL_ExecDirect has reported an Error
|
||||
stmt->errormsg = "Bindings were not allocated properly.";
|
||||
stmt->errornumber = STMT_SEQUENCE_ERROR;
|
||||
SC_log_error(func, "", stmt);
|
||||
@ -829,7 +829,7 @@ mylog("SQLFetch: stmt = %u, stmt->result= %u\n", stmt, stmt->result);
|
||||
return SC_fetch(stmt);
|
||||
}
|
||||
|
||||
/* This fetchs a block of data (rowset). */
|
||||
// This fetchs a block of data (rowset).
|
||||
|
||||
RETCODE SQL_API SQLExtendedFetch(
|
||||
HSTMT hstmt,
|
||||
@ -892,8 +892,8 @@ mylog("SQLExtendedFetch: stmt=%u\n", stmt);
|
||||
}
|
||||
|
||||
if (stmt->bindings == NULL) {
|
||||
/* just to avoid a crash if the user insists on calling this */
|
||||
/* function even if SQL_ExecDirect has reported an Error */
|
||||
// just to avoid a crash if the user insists on calling this
|
||||
// function even if SQL_ExecDirect has reported an Error
|
||||
stmt->errormsg = "Bindings were not allocated properly.";
|
||||
stmt->errornumber = STMT_SEQUENCE_ERROR;
|
||||
SC_log_error(func, "", stmt);
|
||||
@ -1050,7 +1050,7 @@ mylog("SQLExtendedFetch: stmt=%u\n", stmt);
|
||||
truncated = error = FALSE;
|
||||
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);
|
||||
|
||||
/* Determine Function status */
|
||||
@ -1100,8 +1100,8 @@ mylog("SQLExtendedFetch: stmt=%u\n", stmt);
|
||||
}
|
||||
|
||||
|
||||
/* This determines whether there are more results sets available for */
|
||||
/* the "hstmt". */
|
||||
// This determines whether there are more results sets available for
|
||||
// the "hstmt".
|
||||
|
||||
/* CC: return SQL_NO_DATA_FOUND since we do not support multiple result sets */
|
||||
RETCODE SQL_API SQLMoreResults(
|
||||
@ -1110,8 +1110,8 @@ RETCODE SQL_API SQLMoreResults(
|
||||
return SQL_NO_DATA_FOUND;
|
||||
}
|
||||
|
||||
/* 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 positions the cursor within a rowset, that was positioned using SQLExtendedFetch.
|
||||
// This will be useful (so far) only when using SQLGetData after SQLExtendedFetch.
|
||||
RETCODE SQL_API SQLSetPos(
|
||||
HSTMT hstmt,
|
||||
UWORD irow,
|
||||
@ -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(
|
||||
HSTMT hstmt,
|
||||
@ -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(
|
||||
HSTMT hstmt,
|
||||
@ -1218,7 +1218,7 @@ mylog("SQLSetCursorName: hstmt=%u, szCursor=%u, cbCursorMax=%d\n", hstmt, szCurs
|
||||
return SQL_SUCCESS;
|
||||
}
|
||||
|
||||
/* Return the cursor name for a statement handle */
|
||||
// Return the cursor name for a statement handle
|
||||
|
||||
RETCODE SQL_API SQLGetCursorName(
|
||||
HSTMT hstmt,
|
||||
|
@ -29,33 +29,33 @@
|
||||
extern HINSTANCE NEAR s_hModule; /* Saved module handle. */
|
||||
extern GLOBAL_VALUES globals;
|
||||
|
||||
/* Constants --------------------------------------------------------------- */
|
||||
// Constants ---------------------------------------------------------------
|
||||
#define MIN(x,y) ((x) < (y) ? (x) : (y))
|
||||
|
||||
#ifdef WIN32
|
||||
#define MAXPGPATH (255+1)
|
||||
#endif
|
||||
|
||||
#define MAXKEYLEN (15+1) /* Max keyword length */
|
||||
#define MAXDESC (255+1) /* Max description length */
|
||||
#define MAXDSNAME (32+1) /* Max data source name length */
|
||||
#define MAXKEYLEN (15+1) // Max keyword length
|
||||
#define MAXDESC (255+1) // Max description length
|
||||
#define MAXDSNAME (32+1) // Max data source name length
|
||||
|
||||
|
||||
/* Globals ----------------------------------------------------------------- */
|
||||
/* NOTE: All these are used by the dialog procedures */
|
||||
// Globals -----------------------------------------------------------------
|
||||
// NOTE: All these are used by the dialog procedures
|
||||
typedef struct tagSETUPDLG {
|
||||
HWND hwndParent; /* Parent window handle */
|
||||
LPCSTR lpszDrvr; /* Driver description */
|
||||
HWND hwndParent; // Parent window handle
|
||||
LPCSTR lpszDrvr; // Driver description
|
||||
ConnInfo ci;
|
||||
char szDSN[MAXDSNAME]; /* Original data source name */
|
||||
BOOL fNewDSN; /* New data source flag */
|
||||
BOOL fDefault; /* Default data source flag */
|
||||
char szDSN[MAXDSNAME]; // Original data source name
|
||||
BOOL fNewDSN; // New data source flag
|
||||
BOOL fDefault; // Default data source flag
|
||||
|
||||
} SETUPDLG, FAR *LPSETUPDLG;
|
||||
|
||||
|
||||
|
||||
/* Prototypes -------------------------------------------------------------- */
|
||||
// Prototypes --------------------------------------------------------------
|
||||
void INTFUNC CenterDialog(HWND hdlg);
|
||||
int CALLBACK ConfigDlgProc(HWND hdlg, WORD wMsg, WPARAM wParam, LPARAM lParam);
|
||||
void INTFUNC ParseAttributes (LPCSTR lpszAttributes, LPSETUPDLG lpsetupdlg);
|
||||
@ -78,49 +78,49 @@ BOOL CALLBACK ConfigDSN (HWND hwnd,
|
||||
LPCSTR lpszDriver,
|
||||
LPCSTR lpszAttributes)
|
||||
{
|
||||
BOOL fSuccess; /* Success/fail flag */
|
||||
BOOL fSuccess; // Success/fail flag
|
||||
GLOBALHANDLE hglbAttr;
|
||||
LPSETUPDLG lpsetupdlg;
|
||||
|
||||
|
||||
/* Allocate attribute array */
|
||||
// Allocate attribute array
|
||||
hglbAttr = GlobalAlloc(GMEM_MOVEABLE | GMEM_ZEROINIT, sizeof(SETUPDLG));
|
||||
if (!hglbAttr)
|
||||
return FALSE;
|
||||
lpsetupdlg = (LPSETUPDLG)GlobalLock(hglbAttr);
|
||||
|
||||
/* Parse attribute string */
|
||||
// Parse attribute string
|
||||
if (lpszAttributes)
|
||||
ParseAttributes(lpszAttributes, lpsetupdlg);
|
||||
|
||||
/* Save original data source name */
|
||||
// Save original data source name
|
||||
if (lpsetupdlg->ci.dsn[0])
|
||||
lstrcpy(lpsetupdlg->szDSN, lpsetupdlg->ci.dsn);
|
||||
else
|
||||
lpsetupdlg->szDSN[0] = '\0';
|
||||
|
||||
/* Remove data source */
|
||||
// Remove data source
|
||||
if (ODBC_REMOVE_DSN == fRequest) {
|
||||
/* Fail if no data source name was supplied */
|
||||
// Fail if no data source name was supplied
|
||||
if (!lpsetupdlg->ci.dsn[0])
|
||||
fSuccess = FALSE;
|
||||
|
||||
/* Otherwise remove data source from ODBC.INI */
|
||||
// Otherwise remove data source from ODBC.INI
|
||||
else
|
||||
fSuccess = SQLRemoveDSNFromIni(lpsetupdlg->ci.dsn);
|
||||
}
|
||||
|
||||
/* Add or Configure data source */
|
||||
// Add or Configure data source
|
||||
else {
|
||||
/* Save passed variables for global access (e.g., dialog access) */
|
||||
// Save passed variables for global access (e.g., dialog access)
|
||||
lpsetupdlg->hwndParent = hwnd;
|
||||
lpsetupdlg->lpszDrvr = lpszDriver;
|
||||
lpsetupdlg->fNewDSN = (ODBC_ADD_DSN == fRequest);
|
||||
lpsetupdlg->fDefault = !lstrcmpi(lpsetupdlg->ci.dsn, INI_DSN);
|
||||
|
||||
/* Display the appropriate dialog (if parent window handle supplied) */
|
||||
// Display the appropriate dialog (if parent window handle supplied)
|
||||
if (hwnd) {
|
||||
/* Display dialog(s) */
|
||||
// Display dialog(s)
|
||||
fSuccess = (IDOK == DialogBoxParam(s_hModule,
|
||||
MAKEINTRESOURCE(DLG_CONFIG),
|
||||
hwnd,
|
||||
@ -202,7 +202,7 @@ int CALLBACK ConfigDlgProc(HWND hdlg,
|
||||
{
|
||||
|
||||
switch (wMsg) {
|
||||
/* Initialize the dialog */
|
||||
// Initialize the dialog
|
||||
case WM_INITDIALOG:
|
||||
{
|
||||
LPSETUPDLG lpsetupdlg = (LPSETUPDLG) lParam;
|
||||
@ -212,19 +212,19 @@ int CALLBACK ConfigDlgProc(HWND hdlg,
|
||||
ShowWindow(GetDlgItem(hdlg, DRV_MSG_LABEL), SW_HIDE);
|
||||
|
||||
SetWindowLong(hdlg, DWL_USER, lParam);
|
||||
CenterDialog(hdlg); /* Center dialog */
|
||||
CenterDialog(hdlg); // Center dialog
|
||||
|
||||
/* NOTE: Values supplied in the attribute string will always */
|
||||
/* override settings in ODBC.INI */
|
||||
// NOTE: Values supplied in the attribute string will always
|
||||
// override settings in ODBC.INI
|
||||
|
||||
/* Get the rest of the common attributes */
|
||||
// Get the rest of the common attributes
|
||||
getDSNinfo(ci, CONN_DONT_OVERWRITE);
|
||||
|
||||
/* Fill in any defaults */
|
||||
// Fill in any defaults
|
||||
getDSNdefaults(ci);
|
||||
|
||||
|
||||
/* Initialize dialog fields */
|
||||
// Initialize dialog fields
|
||||
SetDlgStuff(hdlg, ci);
|
||||
|
||||
|
||||
@ -238,22 +238,22 @@ int CALLBACK ConfigDlgProc(HWND hdlg,
|
||||
|
||||
SendDlgItemMessage(hdlg, IDC_DESC,
|
||||
EM_LIMITTEXT, (WPARAM)(MAXDESC-1), 0L);
|
||||
return TRUE; /* Focus was not set */
|
||||
return TRUE; // Focus was not set
|
||||
}
|
||||
|
||||
|
||||
/* Process buttons */
|
||||
// Process buttons
|
||||
case WM_COMMAND:
|
||||
|
||||
switch (GET_WM_COMMAND_ID(wParam, lParam)) {
|
||||
/* Ensure the OK button is enabled only when a data source name */
|
||||
/* is entered */
|
||||
// Ensure the OK button is enabled only when a data source name
|
||||
// is entered
|
||||
case IDC_DSNAME:
|
||||
if (GET_WM_COMMAND_CMD(wParam, lParam) == EN_CHANGE)
|
||||
{
|
||||
char szItem[MAXDSNAME]; /* Edit control text */
|
||||
char szItem[MAXDSNAME]; // Edit control text
|
||||
|
||||
/* Enable/disable the OK button */
|
||||
// Enable/disable the OK button
|
||||
EnableWindow(GetDlgItem(hdlg, IDOK),
|
||||
GetDlgItemText(hdlg, IDC_DSNAME,
|
||||
szItem, sizeof(szItem)));
|
||||
@ -262,27 +262,27 @@ int CALLBACK ConfigDlgProc(HWND hdlg,
|
||||
}
|
||||
break;
|
||||
|
||||
/* Accept results */
|
||||
// Accept results
|
||||
case IDOK:
|
||||
{
|
||||
LPSETUPDLG lpsetupdlg;
|
||||
|
||||
lpsetupdlg = (LPSETUPDLG)GetWindowLong(hdlg, DWL_USER);
|
||||
/* Retrieve dialog values */
|
||||
// Retrieve dialog values
|
||||
if (!lpsetupdlg->fDefault)
|
||||
GetDlgItemText(hdlg, IDC_DSNAME,
|
||||
lpsetupdlg->ci.dsn,
|
||||
sizeof(lpsetupdlg->ci.dsn));
|
||||
|
||||
|
||||
/* Get Dialog Values */
|
||||
// Get Dialog Values
|
||||
GetDlgStuff(hdlg, &lpsetupdlg->ci);
|
||||
|
||||
/* Update ODBC.INI */
|
||||
// Update ODBC.INI
|
||||
SetDSNAttributes(hdlg, lpsetupdlg);
|
||||
}
|
||||
|
||||
/* Return to caller */
|
||||
// Return to caller
|
||||
case IDCANCEL:
|
||||
EndDialog(hdlg, wParam);
|
||||
return TRUE;
|
||||
@ -310,7 +310,7 @@ int CALLBACK ConfigDlgProc(HWND hdlg,
|
||||
break;
|
||||
}
|
||||
|
||||
/* Message not processed */
|
||||
// Message not processed
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@ -331,16 +331,16 @@ char value[MAXPGPATH];
|
||||
memset(&lpsetupdlg->ci, 0, sizeof(ConnInfo));
|
||||
|
||||
for (lpsz=lpszAttributes; *lpsz; lpsz++)
|
||||
{ /* Extract key name (e.g., DSN), it must be terminated by an equals */
|
||||
{ // Extract key name (e.g., DSN), it must be terminated by an equals
|
||||
lpszStart = lpsz;
|
||||
for (;; lpsz++)
|
||||
{
|
||||
if (!*lpsz)
|
||||
return; /* No key was found */
|
||||
return; // No key was found
|
||||
else if (*lpsz == '=')
|
||||
break; /* Valid key found */
|
||||
break; // Valid key found
|
||||
}
|
||||
/* Determine the key's index in the key table (-1 if not found) */
|
||||
// Determine the key's index in the key table (-1 if not found)
|
||||
cbKey = lpsz - lpszStart;
|
||||
if (cbKey < sizeof(aszKey))
|
||||
{
|
||||
@ -349,17 +349,17 @@ char value[MAXPGPATH];
|
||||
aszKey[cbKey] = '\0';
|
||||
}
|
||||
|
||||
/* Locate end of key value */
|
||||
// Locate end of key value
|
||||
lpszStart = ++lpsz;
|
||||
for (; *lpsz; lpsz++);
|
||||
|
||||
|
||||
/* lpsetupdlg->aAttr[iElement].fSupplied = TRUE; */
|
||||
// lpsetupdlg->aAttr[iElement].fSupplied = TRUE;
|
||||
_fmemcpy(value, lpszStart, MIN(lpsz-lpszStart+1, MAXPGPATH));
|
||||
|
||||
mylog("aszKey='%s', value='%s'\n", aszKey, value);
|
||||
|
||||
/* Copy the appropriate value to the conninfo */
|
||||
// Copy the appropriate value to the conninfo
|
||||
copyAttributes(&lpsetupdlg->ci, aszKey, value);
|
||||
}
|
||||
return;
|
||||
@ -374,15 +374,15 @@ char value[MAXPGPATH];
|
||||
|
||||
BOOL INTFUNC SetDSNAttributes(HWND hwndParent, LPSETUPDLG lpsetupdlg)
|
||||
{
|
||||
LPCSTR lpszDSN; /* Pointer to data source name */
|
||||
LPCSTR lpszDSN; // Pointer to data source name
|
||||
|
||||
lpszDSN = lpsetupdlg->ci.dsn;
|
||||
|
||||
/* Validate arguments */
|
||||
// Validate arguments
|
||||
if (lpsetupdlg->fNewDSN && !*lpsetupdlg->ci.dsn)
|
||||
return FALSE;
|
||||
|
||||
/* Write the data source name */
|
||||
// Write the data source name
|
||||
if (!SQLWriteDSNToIni(lpszDSN, lpsetupdlg->lpszDrvr))
|
||||
{
|
||||
if (hwndParent)
|
||||
@ -399,11 +399,11 @@ LPCSTR lpszDSN; /* Pointer to da
|
||||
}
|
||||
|
||||
|
||||
/* Update ODBC.INI */
|
||||
// Update ODBC.INI
|
||||
writeDSNinfo(&lpsetupdlg->ci);
|
||||
|
||||
|
||||
/* If the data source name has changed, remove the old name */
|
||||
// If the data source name has changed, remove the old name
|
||||
if (lstrcmpi(lpsetupdlg->szDSN, lpsetupdlg->ci.dsn))
|
||||
{
|
||||
SQLRemoveDSNFromIni(lpsetupdlg->szDSN);
|
||||
|
@ -277,8 +277,8 @@ SOCK_get_next_byte(SocketClass *self)
|
||||
{
|
||||
|
||||
if (self->buffer_read_in >= self->buffer_filled_in) {
|
||||
/* there are no more bytes left in the buffer -> */
|
||||
/* reload the buffer */
|
||||
// there are no more bytes left in the buffer ->
|
||||
// reload the buffer
|
||||
|
||||
self->buffer_read_in = 0;
|
||||
self->buffer_filled_in = recv(self->socket, (char *)self->buffer_in, globals.socket_buffersize, 0);
|
||||
@ -308,7 +308,7 @@ int bytes_sent;
|
||||
self->buffer_out[self->buffer_filled_out++] = next_byte;
|
||||
|
||||
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);
|
||||
if (bytes_sent != globals.socket_buffersize) {
|
||||
self->errornumber = SOCKET_WRITE_ERROR;
|
||||
|
@ -152,7 +152,7 @@ StatementClass *stmt = (StatementClass *) hstmt;
|
||||
/* this should discard all the results, but leave the statement */
|
||||
/* itself in place (it can be executed again) */
|
||||
if (!SC_recycle_statement(stmt)) {
|
||||
/* errormsg passed in above */
|
||||
// errormsg passed in above
|
||||
SC_log_error(func, "", stmt);
|
||||
return SQL_ERROR;
|
||||
}
|
||||
@ -178,10 +178,10 @@ StatementClass *stmt = (StatementClass *) hstmt;
|
||||
void
|
||||
InitializeStatementOptions(StatementOptions *opt)
|
||||
{
|
||||
opt->maxRows = 0; /* driver returns all rows */
|
||||
opt->maxLength = 0; /* driver returns all data for char/binary */
|
||||
opt->maxRows = 0; // driver returns all rows
|
||||
opt->maxLength = 0; // driver returns all data for char/binary
|
||||
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->cursor_type = SQL_CURSOR_FORWARD_ONLY;
|
||||
opt->bind_size = 0; /* default is to bind by column */
|
||||
@ -447,7 +447,7 @@ mylog("recycle statement: self= %u\n", self);
|
||||
/****************************************************************/
|
||||
|
||||
self->status = STMT_READY;
|
||||
self->manual_result = FALSE; /* very important */
|
||||
self->manual_result = FALSE; // very important
|
||||
|
||||
self->currTuple = -1;
|
||||
self->rowset_start = -1;
|
||||
@ -461,9 +461,9 @@ mylog("recycle statement: self= %u\n", self);
|
||||
|
||||
self->lobj_fd = -1;
|
||||
|
||||
/* Free any data at exec params before the statement is executed */
|
||||
/* again. If not, then there will be a memory leak when */
|
||||
/* the next SQLParamData/SQLPutData is called. */
|
||||
// Free any data at exec params before the statement is executed
|
||||
// again. If not, then there will be a memory leak when
|
||||
// the next SQLParamData/SQLPutData is called.
|
||||
SC_free_params(self, STMT_FREE_PARAMS_DATA_AT_EXEC_ONLY);
|
||||
|
||||
return TRUE;
|
||||
@ -517,8 +517,8 @@ SC_clear_error(StatementClass *self)
|
||||
}
|
||||
|
||||
|
||||
/* This function creates an error msg which is the concatenation */
|
||||
/* of the result, statement, connection, and socket messages. */
|
||||
// This function creates an error msg which is the concatenation
|
||||
// of the result, statement, connection, and socket messages.
|
||||
char *
|
||||
SC_create_errormsg(StatementClass *self)
|
||||
{
|
||||
@ -557,7 +557,7 @@ SC_get_error(StatementClass *self, int *number, char **message)
|
||||
{
|
||||
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) {
|
||||
self->errormsg = SC_create_errormsg(self);
|
||||
self->errormsg_created = TRUE;
|
||||
@ -595,7 +595,7 @@ Int2 num_cols, lf;
|
||||
Oid type;
|
||||
char *value;
|
||||
ColumnInfoClass *ci;
|
||||
/* TupleField *tupleField; */
|
||||
// TupleField *tupleField;
|
||||
|
||||
self->last_fetch_count = 0;
|
||||
ci = QR_get_fields(res); /* the column info */
|
||||
@ -619,14 +619,14 @@ ColumnInfoClass *ci;
|
||||
}
|
||||
else {
|
||||
|
||||
/* read from the cache or the physical next tuple */
|
||||
// read from the cache or the physical next tuple
|
||||
retval = QR_next_tuple(res);
|
||||
if (retval < 0) {
|
||||
mylog("**** SQLFetch: end_tuples\n");
|
||||
return SQL_NO_DATA_FOUND;
|
||||
}
|
||||
else if (retval > 0)
|
||||
(self->currTuple)++; /* all is well */
|
||||
(self->currTuple)++; // all is well
|
||||
|
||||
else {
|
||||
mylog("SQLFetch: error\n");
|
||||
@ -663,9 +663,9 @@ ColumnInfoClass *ci;
|
||||
self->bindings[lf].data_left = -1;
|
||||
|
||||
if (self->bindings[lf].buffer != NULL) {
|
||||
/* this column has a binding */
|
||||
// this column has a binding
|
||||
|
||||
/* type = QR_get_field_type(res, lf); */
|
||||
// type = QR_get_field_type(res, lf);
|
||||
type = CI_get_oid(ci, lf); /* speed things up */
|
||||
|
||||
mylog("type = %d\n", type);
|
||||
@ -783,9 +783,9 @@ QueryInfo qi;
|
||||
self->status = STMT_EXECUTING;
|
||||
|
||||
|
||||
/* If it's a SELECT statement, use a cursor. */
|
||||
/* Note that the declare cursor has already been prepended to the statement */
|
||||
/* in copy_statement... */
|
||||
// If it's a SELECT statement, use a cursor.
|
||||
// Note that the declare cursor has already been prepended to the statement
|
||||
// in copy_statement...
|
||||
if (self->statement_type == STMT_TYPE_SELECT) {
|
||||
|
||||
char fetch[128];
|
||||
@ -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);
|
||||
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)) {
|
||||
res = CC_send_query(conn, "COMMIT", NULL);
|
||||
QR_Destructor(res);
|
||||
@ -929,7 +929,7 @@ SC_log_error(char *func, char *desc, StatementClass *self)
|
||||
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);
|
||||
}
|
||||
else
|
||||
|
@ -22,7 +22,7 @@
|
||||
void set_tuplefield_null(TupleField *tuple_field)
|
||||
{
|
||||
tuple_field->len = 0;
|
||||
tuple_field->value = NULL; /* strdup(""); */
|
||||
tuple_field->value = NULL; // strdup("");
|
||||
}
|
||||
|
||||
void set_tuplefield_string(TupleField *tuple_field, char *string)
|
||||
|
Loading…
Reference in New Issue
Block a user