More ODBC formatting cleanup.

This commit is contained in:
Bruce Momjian 2001-02-10 07:11:28 +00:00
parent 08265ef9c2
commit 5ad627479c
21 changed files with 145 additions and 363 deletions

View File

@ -35,7 +35,7 @@
/* Bind parameters on a statement handle */ /* Bind parameters on a statement handle */
RETCODE SQL_API RETCODE SQL_API
SQLBindParameter( SQLBindParameter(
HSTMT hstmt, HSTMT hstmt,
UWORD ipar, UWORD ipar,
@ -156,7 +156,7 @@ SQLBindParameter(
/* - - - - - - - - - */ /* - - - - - - - - - */
/* Associate a user-supplied buffer with a database column. */ /* Associate a user-supplied buffer with a database column. */
RETCODE SQL_API RETCODE SQL_API
SQLBindCol( SQLBindCol(
HSTMT hstmt, HSTMT hstmt,
UWORD icol, UWORD icol,
@ -192,7 +192,6 @@ SQLBindCol(
/* If the bookmark column is being bound, then just save it */ /* If the bookmark column is being bound, then just save it */
if (icol == 0) if (icol == 0)
{ {
if (rgbValue == NULL) if (rgbValue == NULL)
{ {
stmt->bookmark.buffer = NULL; stmt->bookmark.buffer = NULL;
@ -268,7 +267,7 @@ SQLBindCol(
/* it is best to say this function is not supported and let the application assume a */ /* it is best to say this function is not supported and let the application assume a */
/* data type (most likely varchar). */ /* data type (most likely varchar). */
RETCODE SQL_API RETCODE SQL_API
SQLDescribeParam( SQLDescribeParam(
HSTMT hstmt, HSTMT hstmt,
UWORD ipar, UWORD ipar,
@ -322,7 +321,7 @@ SQLDescribeParam(
/* Sets multiple values (arrays) for the set of parameter markers. */ /* Sets multiple values (arrays) for the set of parameter markers. */
RETCODE SQL_API RETCODE SQL_API
SQLParamOptions( SQLParamOptions(
HSTMT hstmt, HSTMT hstmt,
UDWORD crow, UDWORD crow,
@ -345,7 +344,7 @@ SQLParamOptions(
/* like it does for SQLDescribeParam is that some applications don't care and try */ /* like it does for SQLDescribeParam is that some applications don't care and try */
/* to call it anyway. */ /* to call it anyway. */
/* If the statement does not have parameters, it should just return 0. */ /* If the statement does not have parameters, it should just return 0. */
RETCODE SQL_API RETCODE SQL_API
SQLNumParams( SQLNumParams(
HSTMT hstmt, HSTMT hstmt,
SWORD FAR * pcpar) SWORD FAR * pcpar)
@ -382,10 +381,8 @@ SQLNumParams(
} }
else else
{ {
for (i = 0; i < strlen(stmt->statement); i++) for (i = 0; i < strlen(stmt->statement); i++)
{ {
if (stmt->statement[i] == '?' && !in_quote) if (stmt->statement[i] == '?' && !in_quote)
(*pcpar)++; (*pcpar)++;
else else
@ -436,7 +433,6 @@ extend_bindings(StatementClass * stmt, int num_columns)
/* entries into the new structure */ /* entries into the new structure */
if (stmt->bindings_allocated < num_columns) if (stmt->bindings_allocated < num_columns)
{ {
new_bindings = create_empty_bindings(num_columns); new_bindings = create_empty_bindings(num_columns);
if (!new_bindings) if (!new_bindings)
{ {
@ -461,7 +457,6 @@ extend_bindings(StatementClass * stmt, int num_columns)
stmt->bindings = new_bindings; stmt->bindings = new_bindings;
stmt->bindings_allocated = num_columns; stmt->bindings_allocated = num_columns;
} }
/* There is no reason to zero out extra bindings if there are */ /* There is no reason to zero out extra bindings if there are */
/* more than needed. If an app has allocated extra bindings, */ /* more than needed. If an app has allocated extra bindings, */

View File

@ -77,7 +77,6 @@ CI_read_fields(ColumnInfoClass * self, ConnectionClass * conn)
/* now read in the descriptions */ /* now read in the descriptions */
for (lf = 0; lf < new_num_fields; lf++) for (lf = 0; lf < new_num_fields; lf++)
{ {
SOCK_get_string(sock, new_field_name, MAX_MESSAGE_LEN); SOCK_get_string(sock, new_field_name, MAX_MESSAGE_LEN);
new_adtid = (Oid) SOCK_get_int(sock, 4); new_adtid = (Oid) SOCK_get_int(sock, 4);
new_adtsize = (Int2) SOCK_get_int(sock, 2); new_adtsize = (Int2) SOCK_get_int(sock, 2);
@ -85,7 +84,6 @@ CI_read_fields(ColumnInfoClass * self, ConnectionClass * conn)
/* If 6.4 protocol, then read the atttypmod field */ /* If 6.4 protocol, then read the atttypmod field */
if (PG_VERSION_GE(conn, 6.4)) if (PG_VERSION_GE(conn, 6.4))
{ {
mylog("READING ATTTYPMOD\n"); mylog("READING ATTTYPMOD\n");
new_atttypmod = (Int4) SOCK_get_int(sock, 4); new_atttypmod = (Int4) SOCK_get_int(sock, 4);
@ -93,7 +91,6 @@ CI_read_fields(ColumnInfoClass * self, ConnectionClass * conn)
new_atttypmod -= 4; new_atttypmod -= 4;
if (new_atttypmod < 0) if (new_atttypmod < 0)
new_atttypmod = -1; new_atttypmod = -1;
} }
mylog("CI_read_fields: fieldname='%s', adtid=%d, adtsize=%d, atttypmod=%d\n", new_field_name, new_adtid, new_adtsize, new_atttypmod); mylog("CI_read_fields: fieldname='%s', adtid=%d, adtsize=%d, atttypmod=%d\n", new_field_name, new_adtid, new_adtsize, new_atttypmod);
@ -146,7 +143,6 @@ void
CI_set_field_info(ColumnInfoClass * self, int field_num, char *new_name, CI_set_field_info(ColumnInfoClass * self, int field_num, char *new_name,
Oid new_adtid, Int2 new_adtsize, Int4 new_atttypmod) Oid new_adtid, Int2 new_adtsize, Int4 new_atttypmod)
{ {
/* check bounds */ /* check bounds */
if ((field_num < 0) || (field_num >= self->num_fields)) if ((field_num < 0) || (field_num >= self->num_fields))
return; return;

View File

@ -34,7 +34,7 @@
extern GLOBAL_VALUES globals; extern GLOBAL_VALUES globals;
RETCODE SQL_API RETCODE SQL_API
SQLAllocConnect( SQLAllocConnect(
HENV henv, HENV henv,
HDBC FAR * phdbc) HDBC FAR * phdbc)
@ -75,7 +75,7 @@ SQLAllocConnect(
/* - - - - - - - - - */ /* - - - - - - - - - */
RETCODE SQL_API RETCODE SQL_API
SQLConnect( SQLConnect(
HDBC hdbc, HDBC hdbc,
UCHAR FAR * szDSN, UCHAR FAR * szDSN,
@ -132,7 +132,7 @@ SQLConnect(
/* - - - - - - - - - */ /* - - - - - - - - - */
RETCODE SQL_API RETCODE SQL_API
SQLBrowseConnect( SQLBrowseConnect(
HDBC hdbc, HDBC hdbc,
UCHAR FAR * szConnStrIn, UCHAR FAR * szConnStrIn,
@ -151,7 +151,7 @@ SQLBrowseConnect(
/* - - - - - - - - - */ /* - - - - - - - - - */
/* Drop any hstmts open on hdbc and disconnect from database */ /* Drop any hstmts open on hdbc and disconnect from database */
RETCODE SQL_API RETCODE SQL_API
SQLDisconnect( SQLDisconnect(
HDBC hdbc) HDBC hdbc)
{ {
@ -191,7 +191,7 @@ SQLDisconnect(
/* - - - - - - - - - */ /* - - - - - - - - - */
RETCODE SQL_API RETCODE SQL_API
SQLFreeConnect( SQLFreeConnect(
HDBC hdbc) HDBC hdbc)
{ {
@ -239,7 +239,6 @@ CC_Constructor()
if (rv != NULL) if (rv != NULL)
{ {
rv->henv = NULL; /* not yet associated with an environment */ rv->henv = NULL; /* not yet associated with an environment */
rv->errormsg = NULL; rv->errormsg = NULL;
@ -280,7 +279,6 @@ CC_Constructor()
/* Statements under this conn will inherit these options */ /* Statements under this conn will inherit these options */
InitializeStatementOptions(&rv->stmtOptions); InitializeStatementOptions(&rv->stmtOptions);
} }
return rv; return rv;
} }
@ -289,7 +287,6 @@ CC_Constructor()
char char
CC_Destructor(ConnectionClass * self) CC_Destructor(ConnectionClass * self)
{ {
mylog("enter CC_Destructor, self=%u\n", self); mylog("enter CC_Destructor, self=%u\n", self);
if (self->status == CONN_EXECUTING) if (self->status == CONN_EXECUTING)
@ -380,7 +377,6 @@ CC_abort(ConnectionClass * self)
QR_Destructor(res); QR_Destructor(res);
else else
return FALSE; return FALSE;
} }
return TRUE; return TRUE;
@ -499,12 +495,10 @@ CC_connect(ConnectionClass * self, char do_password)
mylog("%s: entering...\n", func); mylog("%s: entering...\n", func);
if (do_password) if (do_password)
sock = self->sock; /* already connected, just authenticate */ sock = self->sock; /* already connected, just authenticate */
else else
{ {
qlog("Global Options: Version='%s', fetch=%d, socket=%d, unknown_sizes=%d, max_varchar_size=%d, max_longvarchar_size=%d\n", qlog("Global Options: Version='%s', fetch=%d, socket=%d, unknown_sizes=%d, max_varchar_size=%d, max_longvarchar_size=%d\n",
POSTGRESDRIVERVERSION, POSTGRESDRIVERVERSION,
globals.fetch_max, globals.fetch_max,
@ -606,7 +600,6 @@ CC_connect(ConnectionClass * self, char do_password)
do do
{ {
if (do_password) if (do_password)
beresp = 'R'; beresp = 'R';
else else
@ -690,7 +683,6 @@ CC_connect(ConnectionClass * self, char do_password)
self->errornumber = CONN_INVALID_AUTHENTICATION; self->errornumber = CONN_INVALID_AUTHENTICATION;
return 0; return 0;
} }
} while (areq != AUTH_REQ_OK); } while (areq != AUTH_REQ_OK);
CC_clear_error(self); /* clear any password error */ CC_clear_error(self); /* clear any password error */
@ -738,7 +730,6 @@ CC_connect(ConnectionClass * self, char do_password)
mylog("%s: returning...\n", func); mylog("%s: returning...\n", func);
return 1; return 1;
} }
char char
@ -955,7 +946,6 @@ CC_send_query(ConnectionClass * self, char *query, QueryInfo * qi)
} }
else else
{ {
char clear = 0; char clear = 0;
mylog("send_query: ok - 'C' - %s\n", cmdbuffer); mylog("send_query: ok - 'C' - %s\n", cmdbuffer);
@ -1187,7 +1177,6 @@ CC_send_function(ConnectionClass * self, int fnid, void *result_buf, int *actual
for (i = 0; i < nargs; ++i) for (i = 0; i < nargs; ++i)
{ {
mylog(" arg[%d]: len = %d, isint = %d, integer = %d, ptr = %u\n", i, args[i].len, args[i].isint, args[i].u.integer, args[i].u.ptr); mylog(" arg[%d]: len = %d, isint = %d, integer = %d, ptr = %u\n", i, args[i].len, args[i].isint, args[i].u.integer, args[i].u.ptr);
SOCK_put_int(sock, args[i].len, 4); SOCK_put_int(sock, args[i].len, 4);
@ -1343,7 +1332,6 @@ CC_send_settings(ConnectionClass * self)
status = FALSE; status = FALSE;
mylog("%s: result %d, status %d from set geqo\n", func, result, status); mylog("%s: result %d, status %d from set geqo\n", func, result, status);
} }
/* KSQO */ /* KSQO */
@ -1354,7 +1342,6 @@ CC_send_settings(ConnectionClass * self)
status = FALSE; status = FALSE;
mylog("%s: result %d, status %d from set ksqo\n", func, result, status); mylog("%s: result %d, status %d from set ksqo\n", func, result, status);
} }
/* Global settings */ /* Global settings */

View File

@ -185,16 +185,11 @@ copy_and_convert_field(StatementClass * stmt, Int4 field_type, void *value, Int2
/* pcbValueOffset is for computing any pcbValue location */ /* pcbValueOffset is for computing any pcbValue location */
if (bind_size > 0) if (bind_size > 0)
{
pcbValueOffset = rgbValueOffset = (bind_size * bind_row); pcbValueOffset = rgbValueOffset = (bind_size * bind_row);
}
else else
{ {
pcbValueOffset = bind_row * sizeof(SDWORD); pcbValueOffset = bind_row * sizeof(SDWORD);
rgbValueOffset = bind_row * cbValueMax; rgbValueOffset = bind_row * cbValueMax;
} }
memset(&st, 0, sizeof(SIMPLE_TIME)); memset(&st, 0, sizeof(SIMPLE_TIME));
@ -238,7 +233,6 @@ copy_and_convert_field(StatementClass * stmt, Int4 field_type, void *value, Int2
*********************************************************************/ *********************************************************************/
switch (field_type) switch (field_type)
{ {
/* /*
* $$$ need to add parsing for date/time/timestamp strings in * $$$ need to add parsing for date/time/timestamp strings in
* PG_TYPE_CHAR,VARCHAR $$$ * PG_TYPE_CHAR,VARCHAR $$$
@ -255,10 +249,7 @@ copy_and_convert_field(StatementClass * stmt, Int4 field_type, void *value, Int2
case PG_TYPE_DATETIME: case PG_TYPE_DATETIME:
case PG_TYPE_TIMESTAMP: case PG_TYPE_TIMESTAMP:
if (strnicmp(value, "invalid", 7) != 0) if (strnicmp(value, "invalid", 7) != 0)
{
sscanf(value, "%4d-%2d-%2d %2d:%2d:%2d", &st.y, &st.m, &st.d, &st.hh, &st.mm, &st.ss); sscanf(value, "%4d-%2d-%2d %2d:%2d:%2d", &st.y, &st.m, &st.d, &st.hh, &st.mm, &st.ss);
}
else else
{ /* The timestamp is invalid so set { /* The timestamp is invalid so set
* something conspicuous, like the epoch */ * something conspicuous, like the epoch */
@ -365,8 +356,6 @@ copy_and_convert_field(StatementClass * stmt, Int4 field_type, void *value, Int2
if (fCType == SQL_C_CHAR) if (fCType == SQL_C_CHAR)
{ {
/* Special character formatting as required */ /* Special character formatting as required */
/* /*
@ -447,7 +436,6 @@ copy_and_convert_field(StatementClass * stmt, Int4 field_type, void *value, Int2
if (cbValueMax > 0) if (cbValueMax > 0)
{ {
copy_len = (len >= cbValueMax) ? cbValueMax - 1 : len; copy_len = (len >= cbValueMax) ? cbValueMax - 1 : len;
/* Copy the data */ /* Copy the data */
@ -474,7 +462,6 @@ copy_and_convert_field(StatementClass * stmt, Int4 field_type, void *value, Int2
} }
else else
{ {
/* /*
* for SQL_C_CHAR, it's probably ok to leave currency symbols in. * for SQL_C_CHAR, it's probably ok to leave currency symbols in.
* But to convert to numeric types, it is necessary to get rid of * But to convert to numeric types, it is necessary to get rid of
@ -624,7 +611,6 @@ copy_and_convert_field(StatementClass * stmt, Int4 field_type, void *value, Int2
if (stmt->current_col >= 0) if (stmt->current_col >= 0)
{ {
/* No more data left for this column */ /* No more data left for this column */
if (stmt->bindings[stmt->current_col].data_left == 0) if (stmt->bindings[stmt->current_col].data_left == 0)
return COPY_NO_DATA_FOUND; return COPY_NO_DATA_FOUND;
@ -642,7 +628,6 @@ copy_and_convert_field(StatementClass * stmt, Int4 field_type, void *value, Int2
/* First call to SQLGetData so initialize data_left */ /* First call to SQLGetData so initialize data_left */
else else
stmt->bindings[stmt->current_col].data_left = len; stmt->bindings[stmt->current_col].data_left = len;
} }
if (cbValueMax > 0) if (cbValueMax > 0)
@ -677,7 +662,6 @@ copy_and_convert_field(StatementClass * stmt, Int4 field_type, void *value, Int2
*(SDWORD *) ((char *) pcbValue + pcbValueOffset) = len; *(SDWORD *) ((char *) pcbValue + pcbValueOffset) = len;
return result; return result;
} }
@ -748,7 +732,6 @@ copy_statement_with_parameters(StatementClass * stmt)
for (opos = 0; opos < oldstmtlen; opos++) for (opos = 0; opos < oldstmtlen; opos++)
{ {
/* Squeeze carriage-return/linefeed pairs to linefeed only */ /* Squeeze carriage-return/linefeed pairs to linefeed only */
if (old_statement[opos] == '\r' && opos + 1 < oldstmtlen && if (old_statement[opos] == '\r' && opos + 1 < oldstmtlen &&
old_statement[opos + 1] == '\n') old_statement[opos + 1] == '\n')
@ -955,7 +938,6 @@ copy_statement_with_parameters(StatementClass * stmt)
mylog("m=%d,d=%d,y=%d,hh=%d,mm=%d,ss=%d\n", st.m, st.d, st.y, st.hh, st.mm, st.ss); mylog("m=%d,d=%d,y=%d,hh=%d,mm=%d,ss=%d\n", st.m, st.d, st.y, st.hh, st.mm, st.ss);
break; break;
} }
default: default:
/* error */ /* error */
@ -1065,14 +1047,9 @@ copy_statement_with_parameters(StatementClass * stmt)
case SQL_LONGVARBINARY: case SQL_LONGVARBINARY:
if (stmt->parameters[param_number].data_at_exec) if (stmt->parameters[param_number].data_at_exec)
{
lobj_oid = stmt->parameters[param_number].lobj_oid; lobj_oid = stmt->parameters[param_number].lobj_oid;
}
else else
{ {
/* begin transaction if needed */ /* begin transaction if needed */
if (!CC_is_in_trans(stmt->hdbc)) if (!CC_is_in_trans(stmt->hdbc))
{ {
@ -1188,9 +1165,7 @@ copy_statement_with_parameters(StatementClass * stmt)
new_statement[npos++] = '\''; /* Close Quote */ new_statement[npos++] = '\''; /* Close Quote */
break; break;
} }
} /* end, for */ } /* end, for */
/* make sure new_statement is always null-terminated */ /* make sure new_statement is always null-terminated */
@ -1253,7 +1228,6 @@ convert_escape(char *value)
} }
else if (strcmp(key, "fn") == 0) else if (strcmp(key, "fn") == 0)
{ {
/* /*
* Function invocation Separate off the func name, skipping * Function invocation Separate off the func name, skipping
* trailing whitespace. * trailing whitespace.
@ -1304,7 +1278,6 @@ convert_escape(char *value)
} }
return escape; return escape;
} }
@ -1473,7 +1446,6 @@ conv_from_octal(unsigned char *s)
y += (s[i] - 48) * (int) pow(8, 3 - i); y += (s[i] - 48) * (int) pow(8, 3 - i);
return y; return y;
} }
unsigned int unsigned int
@ -1485,7 +1457,6 @@ conv_from_hex(unsigned char *s)
for (i = 1; i <= 2; i++) for (i = 1; i <= 2; i++)
{ {
if (s[i] >= 'a' && s[i] <= 'f') if (s[i] >= 'a' && s[i] <= 'f')
val = s[i] - 'a' + 10; val = s[i] - 'a' + 10;
else if (s[i] >= 'A' && s[i] <= 'F') else if (s[i] >= 'A' && s[i] <= 'F')
@ -1563,7 +1534,6 @@ convert_to_pgbinary(unsigned char *in, char *out, int len)
strcpy(&out[o], conv_to_octal(in[i])); strcpy(&out[o], conv_to_octal(in[i]));
o += 5; o += 5;
} }
} }
mylog("convert_to_pgbinary: returning %d, out='%.*s'\n", o, o, out); mylog("convert_to_pgbinary: returning %d, out='%.*s'\n", o, o, out);
@ -1661,7 +1631,6 @@ convert_lo(StatementClass * stmt, void *value, Int2 fCType, PTR rgbValue,
if (!bindInfo || bindInfo->data_left == -1) if (!bindInfo || bindInfo->data_left == -1)
{ {
/* begin transaction if needed */ /* begin transaction if needed */
if (!CC_is_in_trans(stmt->hdbc)) if (!CC_is_in_trans(stmt->hdbc))
{ {
@ -1700,7 +1669,6 @@ convert_lo(StatementClass * stmt, void *value, Int2 fCType, PTR rgbValue,
retval = lo_lseek(stmt->hdbc, stmt->lobj_fd, 0L, SEEK_END); retval = lo_lseek(stmt->hdbc, stmt->lobj_fd, 0L, SEEK_END);
if (retval >= 0) if (retval >= 0)
{ {
left = lo_tell(stmt->hdbc, stmt->lobj_fd); left = lo_tell(stmt->hdbc, stmt->lobj_fd);
if (bindInfo) if (bindInfo)
bindInfo->data_left = left; bindInfo->data_left = left;
@ -1804,5 +1772,4 @@ convert_lo(StatementClass * stmt, void *value, Int2 fCType, PTR rgbValue,
return result; return result;
} }

View File

@ -49,7 +49,6 @@ extern GLOBAL_VALUES globals;
void void
SetDlgStuff(HWND hdlg, ConnInfo * ci) SetDlgStuff(HWND hdlg, ConnInfo * ci)
{ {
/* /*
* If driver attribute NOT present, then set the datasource name and * If driver attribute NOT present, then set the datasource name and
* description * description
@ -81,7 +80,7 @@ GetDlgStuff(HWND hdlg, ConnInfo * ci)
int CALLBACK int CALLBACK
driver_optionsProc(HWND hdlg, driver_optionsProc(HWND hdlg,
WORD wMsg, WORD wMsg,
WPARAM wParam, WPARAM wParam,
@ -223,13 +222,12 @@ driver_optionsProc(HWND hdlg,
break; break;
} }
} }
return FALSE; return FALSE;
} }
int CALLBACK int CALLBACK
ds_optionsProc(HWND hdlg, ds_optionsProc(HWND hdlg,
WORD wMsg, WORD wMsg,
WPARAM wParam, WPARAM wParam,
@ -351,7 +349,6 @@ makeConnectString(char *connect_string, ConnInfo * ci)
void void
copyAttributes(ConnInfo * ci, char *attribute, char *value) copyAttributes(ConnInfo * ci, char *attribute, char *value)
{ {
if (stricmp(attribute, "DSN") == 0) if (stricmp(attribute, "DSN") == 0)
strcpy(ci->dsn, value); strcpy(ci->dsn, value);
@ -398,7 +395,6 @@ copyAttributes(ConnInfo * ci, char *attribute, char *value)
} }
mylog("copyAttributes: DSN='%s',server='%s',dbase='%s',user='%s',passwd='%s',port='%s',onlyread='%s',protocol='%s', conn_settings='%s')\n", ci->dsn, ci->server, ci->database, ci->username, ci->password, ci->port, ci->onlyread, ci->protocol, ci->conn_settings); mylog("copyAttributes: DSN='%s',server='%s',dbase='%s',user='%s',passwd='%s',port='%s',onlyread='%s',protocol='%s', conn_settings='%s')\n", ci->dsn, ci->server, ci->database, ci->username, ci->password, ci->port, ci->onlyread, ci->protocol, ci->conn_settings);
} }
void void
@ -520,7 +516,6 @@ getDSNinfo(ConnInfo * ci, char overwrite)
qlog(" translation_dll='%s',translation_option='%s'\n", qlog(" translation_dll='%s',translation_option='%s'\n",
ci->translation_dll, ci->translation_dll,
ci->translation_option); ci->translation_option);
} }
@ -778,7 +773,6 @@ getGlobalDefaults(char *section, char *filename, char override)
/* Dont allow override of an override! */ /* Dont allow override of an override! */
if (!override) if (!override)
{ {
/* /*
* ConnSettings is stored in the driver section and per datasource * ConnSettings is stored in the driver section and per datasource
* for override * for override
@ -805,7 +799,6 @@ getGlobalDefaults(char *section, char *filename, char override)
strcpy(globals.protocol, temp); strcpy(globals.protocol, temp);
else else
strcpy(globals.protocol, DEFAULT_PROTOCOL); strcpy(globals.protocol, DEFAULT_PROTOCOL);
} }
} }

View File

@ -65,7 +65,7 @@ extern HINSTANCE NEAR s_hModule;/* Saved module handle. */
extern GLOBAL_VALUES globals; extern GLOBAL_VALUES globals;
RETCODE SQL_API RETCODE SQL_API
SQLDriverConnect( SQLDriverConnect(
HDBC hdbc, HDBC hdbc,
HWND hwnd, HWND hwnd,
@ -147,7 +147,6 @@ dialog:
ci->port[0] == '\0' || ci->port[0] == '\0' ||
password_required) password_required)
{ {
dialog_result = dconn_DoDialog(hwnd, ci); dialog_result = dconn_DoDialog(hwnd, ci);
if (dialog_result != SQL_SUCCESS) if (dialog_result != SQL_SUCCESS)
return dialog_result; return dialog_result;
@ -216,7 +215,6 @@ dialog:
if (szConnStrOut) if (szConnStrOut)
{ {
/* /*
* Return the completed string to the caller. The correct method * Return the completed string to the caller. The correct method
* is to only construct the connect string if a dialog was put up, * is to only construct the connect string if a dialog was put up,
@ -269,7 +267,7 @@ dconn_DoDialog(HWND hwnd, ConnInfo * ci)
} }
BOOL FAR PASCAL BOOL FAR PASCAL
dconn_FDriverConnectProc( dconn_FDriverConnectProc(
HWND hdlg, HWND hdlg,
UINT wMsg, UINT wMsg,
@ -390,7 +388,6 @@ dconn_get_connect_attributes(UCHAR FAR * connect_string, ConnInfo * ci)
/* Copy the appropriate value to the conninfo */ /* Copy the appropriate value to the conninfo */
copyAttributes(ci, attribute, value); copyAttributes(ci, attribute, value);
} }

View File

@ -22,7 +22,7 @@
ConnectionClass *conns[MAX_CONNECTIONS]; ConnectionClass *conns[MAX_CONNECTIONS];
RETCODE SQL_API RETCODE SQL_API
SQLAllocEnv(HENV FAR * phenv) SQLAllocEnv(HENV FAR * phenv)
{ {
static char *func = "SQLAllocEnv"; static char *func = "SQLAllocEnv";
@ -41,7 +41,7 @@ SQLAllocEnv(HENV FAR * phenv)
return SQL_SUCCESS; return SQL_SUCCESS;
} }
RETCODE SQL_API RETCODE SQL_API
SQLFreeEnv(HENV henv) SQLFreeEnv(HENV henv)
{ {
static char *func = "SQLFreeEnv"; static char *func = "SQLFreeEnv";
@ -62,7 +62,7 @@ SQLFreeEnv(HENV henv)
/* Returns the next SQL error information. */ /* Returns the next SQL error information. */
RETCODE SQL_API RETCODE SQL_API
SQLError( SQLError(
HENV henv, HENV henv,
HDBC hdbc, HDBC hdbc,
@ -212,7 +212,6 @@ SQLError(
} }
mylog(" szSqlState = '%s', szError='%s'\n", szSqlState, szErrorMsg); mylog(" szSqlState = '%s', szError='%s'\n", szSqlState, szErrorMsg);
} }
else else
{ {
@ -227,7 +226,6 @@ SQLError(
return SQL_NO_DATA_FOUND; return SQL_NO_DATA_FOUND;
} }
return SQL_SUCCESS; return SQL_SUCCESS;
} }
else if (SQL_NULL_HDBC != hdbc) else if (SQL_NULL_HDBC != hdbc)
{ {
@ -322,7 +320,6 @@ SQLError(
/* general error */ /* general error */
break; break;
} }
} }
else else
{ {
@ -337,7 +334,6 @@ SQLError(
return SQL_NO_DATA_FOUND; return SQL_NO_DATA_FOUND;
} }
return SQL_SUCCESS; return SQL_SUCCESS;
} }
else if (SQL_NULL_HENV != henv) else if (SQL_NULL_HENV != henv)
{ {

View File

@ -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 RETCODE SQL_API
SQLPrepare(HSTMT hstmt, SQLPrepare(HSTMT hstmt,
UCHAR FAR * szSqlStr, UCHAR FAR * szSqlStr,
SDWORD cbSqlStr) SDWORD cbSqlStr)
@ -133,7 +133,7 @@ SQLPrepare(HSTMT hstmt,
/* Performs the equivalent of SQLPrepare, followed by SQLExecute. */ /* Performs the equivalent of SQLPrepare, followed by SQLExecute. */
RETCODE SQL_API RETCODE SQL_API
SQLExecDirect( SQLExecDirect(
HSTMT hstmt, HSTMT hstmt,
UCHAR FAR * szSqlStr, UCHAR FAR * szSqlStr,
@ -195,7 +195,7 @@ SQLExecDirect(
} }
/* Execute a prepared SQL statement */ /* Execute a prepared SQL statement */
RETCODE SQL_API RETCODE SQL_API
SQLExecute( SQLExecute(
HSTMT hstmt) HSTMT hstmt)
{ {
@ -274,7 +274,6 @@ SQLExecute(
if ((stmt->prepare && stmt->status != STMT_READY) || if ((stmt->prepare && stmt->status != STMT_READY) ||
(stmt->status != STMT_ALLOCATED && stmt->status != STMT_READY)) (stmt->status != STMT_ALLOCATED && stmt->status != STMT_READY))
{ {
stmt->errornumber = STMT_STATUS_ERROR; stmt->errornumber = STMT_STATUS_ERROR;
stmt->errormsg = "The handle does not point to a statement that is ready to be executed"; stmt->errormsg = "The handle does not point to a statement that is ready to be executed";
SC_log_error(func, "", stmt); SC_log_error(func, "", stmt);
@ -321,14 +320,13 @@ SQLExecute(
return SC_execute(stmt); return SC_execute(stmt);
} }
/* - - - - - - - - - */ /* - - - - - - - - - */
RETCODE SQL_API RETCODE SQL_API
SQLTransact( SQLTransact(
HENV henv, HENV henv,
HDBC hdbc, HDBC hdbc,
@ -363,7 +361,6 @@ SQLTransact(
if (conn && conn->henv == henv) if (conn && conn->henv == henv)
if (SQLTransact(henv, (HDBC) conn, fType) != SQL_SUCCESS) if (SQLTransact(henv, (HDBC) conn, fType) != SQL_SUCCESS)
return SQL_ERROR; return SQL_ERROR;
} }
return SQL_SUCCESS; return SQL_SUCCESS;
} }
@ -371,15 +368,9 @@ SQLTransact(
conn = (ConnectionClass *) hdbc; conn = (ConnectionClass *) hdbc;
if (fType == SQL_COMMIT) if (fType == SQL_COMMIT)
{
stmt_string = "COMMIT"; stmt_string = "COMMIT";
}
else if (fType == SQL_ROLLBACK) else if (fType == SQL_ROLLBACK)
{
stmt_string = "ROLLBACK"; stmt_string = "ROLLBACK";
}
else else
{ {
conn->errornumber = CONN_INVALID_ARGUMENT_NO; conn->errornumber = CONN_INVALID_ARGUMENT_NO;
@ -391,7 +382,6 @@ SQLTransact(
/* If manual commit and in transaction, then proceed. */ /* If manual commit and in transaction, then proceed. */
if (!CC_is_in_autocommit(conn) && CC_is_in_trans(conn)) if (!CC_is_in_autocommit(conn) && CC_is_in_trans(conn))
{ {
mylog("SQLTransact: sending on conn %d '%s'\n", conn, stmt_string); mylog("SQLTransact: sending on conn %d '%s'\n", conn, stmt_string);
res = CC_send_query(conn, stmt_string, NULL); res = CC_send_query(conn, stmt_string, NULL);
@ -418,7 +408,7 @@ SQLTransact(
/* - - - - - - - - - */ /* - - - - - - - - - */
RETCODE SQL_API RETCODE SQL_API
SQLCancel( SQLCancel(
HSTMT hstmt) /* Statement to cancel. */ HSTMT hstmt) /* Statement to cancel. */
{ {
@ -447,8 +437,6 @@ SQLCancel(
*/ */
if (stmt->data_at_exec < 0) if (stmt->data_at_exec < 0)
{ {
/* /*
* MAJOR HACK for Windows to reset the driver manager's cursor * MAJOR HACK for Windows to reset the driver manager's cursor
* state: Because of what seems like a bug in the Odbc driver * state: Because of what seems like a bug in the Odbc driver
@ -490,7 +478,6 @@ SQLCancel(
stmt->put_data = FALSE; stmt->put_data = FALSE;
return SQL_SUCCESS; return SQL_SUCCESS;
} }
/* - - - - - - - - - */ /* - - - - - - - - - */
@ -498,7 +485,7 @@ SQLCancel(
/* Returns the SQL string as modified by the driver. */ /* Returns the SQL string as modified by the driver. */
/* Currently, just copy the input string without modification */ /* Currently, just copy the input string without modification */
/* observing buffer limits and truncation. */ /* observing buffer limits and truncation. */
RETCODE SQL_API RETCODE SQL_API
SQLNativeSql( SQLNativeSql(
HDBC hdbc, HDBC hdbc,
UCHAR FAR * szSqlStrIn, UCHAR FAR * szSqlStrIn,
@ -552,7 +539,7 @@ SQLNativeSql(
/* Supplies parameter data at execution time. Used in conjuction with */ /* Supplies parameter data at execution time. Used in conjuction with */
/* SQLPutData. */ /* SQLPutData. */
RETCODE SQL_API RETCODE SQL_API
SQLParamData( SQLParamData(
HSTMT hstmt, HSTMT hstmt,
PTR FAR * prgbValue) PTR FAR * prgbValue)
@ -663,7 +650,7 @@ SQLParamData(
/* Supplies parameter data at execution time. Used in conjunction with */ /* Supplies parameter data at execution time. Used in conjunction with */
/* SQLParamData. */ /* SQLParamData. */
RETCODE SQL_API RETCODE SQL_API
SQLPutData( SQLPutData(
HSTMT hstmt, HSTMT hstmt,
PTR rgbValue, PTR rgbValue,
@ -720,7 +707,6 @@ SQLPutData(
/* Handle Long Var Binary with Large Objects */ /* Handle Long Var Binary with Large Objects */
if (current_param->SQLType == SQL_LONGVARBINARY) if (current_param->SQLType == SQL_LONGVARBINARY)
{ {
/* begin transaction if needed */ /* begin transaction if needed */
if (!CC_is_in_trans(stmt->hdbc)) if (!CC_is_in_trans(stmt->hdbc))
{ {
@ -774,7 +760,6 @@ SQLPutData(
retval = lo_write(stmt->hdbc, stmt->lobj_fd, rgbValue, cbValue); retval = lo_write(stmt->hdbc, stmt->lobj_fd, rgbValue, cbValue);
mylog("lo_write: cbValue=%d, wrote %d bytes\n", cbValue, retval); mylog("lo_write: cbValue=%d, wrote %d bytes\n", cbValue, retval);
} }
else else
{ /* for handling text fields and small { /* for handling text fields and small
@ -814,17 +799,14 @@ SQLPutData(
if (current_param->SQLType == SQL_LONGVARBINARY) if (current_param->SQLType == SQL_LONGVARBINARY)
{ {
/* the large object fd is in EXEC_buffer */ /* the large object fd is in EXEC_buffer */
retval = lo_write(stmt->hdbc, stmt->lobj_fd, rgbValue, cbValue); retval = lo_write(stmt->hdbc, stmt->lobj_fd, rgbValue, cbValue);
mylog("lo_write(2): cbValue = %d, wrote %d bytes\n", cbValue, retval); mylog("lo_write(2): cbValue = %d, wrote %d bytes\n", cbValue, retval);
*current_param->EXEC_used += cbValue; *current_param->EXEC_used += cbValue;
} }
else else
{ {
buffer = current_param->EXEC_buffer; buffer = current_param->EXEC_buffer;
if (cbValue == SQL_NTS) if (cbValue == SQL_NTS)
@ -845,11 +827,9 @@ SQLPutData(
/* reassign buffer incase realloc moved it */ /* reassign buffer incase realloc moved it */
current_param->EXEC_buffer = buffer; current_param->EXEC_buffer = buffer;
} }
else if (cbValue > 0) else if (cbValue > 0)
{ {
old_pos = *current_param->EXEC_used; old_pos = *current_param->EXEC_used;
*current_param->EXEC_used += cbValue; *current_param->EXEC_used += cbValue;
@ -871,14 +851,12 @@ SQLPutData(
/* reassign buffer incase realloc moved it */ /* reassign buffer incase realloc moved it */
current_param->EXEC_buffer = buffer; current_param->EXEC_buffer = buffer;
} }
else else
{ {
SC_log_error(func, "bad cbValue", stmt); SC_log_error(func, "bad cbValue", stmt);
return SQL_ERROR; return SQL_ERROR;
} }
} }
} }

View File

@ -58,7 +58,7 @@ extern GLOBAL_VALUES globals;
/* - - - - - - - - - */ /* - - - - - - - - - */
RETCODE SQL_API RETCODE SQL_API
SQLGetInfo( SQLGetInfo(
HDBC hdbc, HDBC hdbc,
UWORD fInfoType, UWORD fInfoType,
@ -698,7 +698,6 @@ SQLGetInfo(
if (rgbInfoValue) if (rgbInfoValue)
{ {
if (len == 2) if (len == 2)
*((WORD *) rgbInfoValue) = (WORD) value; *((WORD *) rgbInfoValue) = (WORD) value;
else if (len == 4) else if (len == 4)
@ -715,7 +714,7 @@ SQLGetInfo(
/* - - - - - - - - - */ /* - - - - - - - - - */
RETCODE SQL_API RETCODE SQL_API
SQLGetTypeInfo( SQLGetTypeInfo(
HSTMT hstmt, HSTMT hstmt,
SWORD fSqlType) SWORD fSqlType)
@ -812,7 +811,7 @@ SQLGetTypeInfo(
/* - - - - - - - - - */ /* - - - - - - - - - */
RETCODE SQL_API RETCODE SQL_API
SQLGetFunctions( SQLGetFunctions(
HDBC hdbc, HDBC hdbc,
UWORD fFunction, UWORD fFunction,
@ -824,7 +823,6 @@ SQLGetFunctions(
if (fFunction == SQL_API_ALL_FUNCTIONS) if (fFunction == SQL_API_ALL_FUNCTIONS)
{ {
if (globals.lie) if (globals.lie)
{ {
int i; int i;
@ -910,13 +908,10 @@ SQLGetFunctions(
} }
else else
{ {
if (globals.lie) if (globals.lie)
*pfExists = TRUE; *pfExists = TRUE;
else else
{ {
switch (fFunction) switch (fFunction)
{ {
case SQL_API_SQLALLOCCONNECT: case SQL_API_SQLALLOCCONNECT:
@ -1100,7 +1095,7 @@ SQLGetFunctions(
RETCODE SQL_API RETCODE SQL_API
SQLTables( SQLTables(
HSTMT hstmt, HSTMT hstmt,
UCHAR FAR * szTableQualifier, UCHAR FAR * szTableQualifier,
@ -1330,7 +1325,6 @@ SQLTables(
result = SQLFetch(htbl_stmt); result = SQLFetch(htbl_stmt);
while ((result == SQL_SUCCESS) || (result == SQL_SUCCESS_WITH_INFO)) while ((result == SQL_SUCCESS) || (result == SQL_SUCCESS_WITH_INFO))
{ {
/* /*
* Determine if this table name is a system table. If treating * Determine if this table name is a system table. If treating
* system tables as regular tables, then no need to do this test. * system tables as regular tables, then no need to do this test.
@ -1338,7 +1332,6 @@ SQLTables(
systable = FALSE; systable = FALSE;
if (!atoi(ci->show_system_tables)) if (!atoi(ci->show_system_tables))
{ {
if (strncmp(table_name, POSTGRES_SYS_PREFIX, strlen(POSTGRES_SYS_PREFIX)) == 0) if (strncmp(table_name, POSTGRES_SYS_PREFIX, strlen(POSTGRES_SYS_PREFIX)) == 0)
systable = TRUE; systable = TRUE;
@ -1379,7 +1372,6 @@ SQLTables(
(view && show_views) || (view && show_views) ||
(regular_table && show_regular_tables)) (regular_table && show_regular_tables))
{ {
row = (TupleNode *) malloc(sizeof(TupleNode) + (5 - 1) * sizeof(TupleField)); row = (TupleNode *) malloc(sizeof(TupleNode) + (5 - 1) * sizeof(TupleField));
set_tuplefield_string(&row->tuple[0], ""); set_tuplefield_string(&row->tuple[0], "");
@ -1427,7 +1419,7 @@ SQLTables(
RETCODE SQL_API RETCODE SQL_API
SQLColumns( SQLColumns(
HSTMT hstmt, HSTMT hstmt,
UCHAR FAR * szTableQualifier, UCHAR FAR * szTableQualifier,
@ -1685,12 +1677,10 @@ SQLColumns(
if (result != SQL_ERROR && !stmt->internal) if (result != SQL_ERROR && !stmt->internal)
{ {
if (relhasrules[0] != '1' && if (relhasrules[0] != '1' &&
(atoi(ci->show_oid_column) || (atoi(ci->show_oid_column) ||
strncmp(table_name, POSTGRES_SYS_PREFIX, strlen(POSTGRES_SYS_PREFIX)) == 0)) strncmp(table_name, POSTGRES_SYS_PREFIX, strlen(POSTGRES_SYS_PREFIX)) == 0))
{ {
/* For OID fields */ /* For OID fields */
the_type = PG_TYPE_OID; the_type = PG_TYPE_OID;
row = (TupleNode *) malloc(sizeof(TupleNode) + row = (TupleNode *) malloc(sizeof(TupleNode) +
@ -1718,7 +1708,6 @@ SQLColumns(
QR_add_tuple(stmt->result, row); QR_add_tuple(stmt->result, row);
} }
} }
while ((result == SQL_SUCCESS) || (result == SQL_SUCCESS_WITH_INFO)) while ((result == SQL_SUCCESS) || (result == SQL_SUCCESS_WITH_INFO))
@ -1779,7 +1768,6 @@ SQLColumns(
if ((field_type == PG_TYPE_VARCHAR) || if ((field_type == PG_TYPE_VARCHAR) ||
(field_type == PG_TYPE_BPCHAR)) (field_type == PG_TYPE_BPCHAR))
{ {
useStaticPrecision = FALSE; useStaticPrecision = FALSE;
if (mod_length >= 4) if (mod_length >= 4)
@ -1815,7 +1803,6 @@ SQLColumns(
result = SQLFetch(hcol_stmt); result = SQLFetch(hcol_stmt);
} }
if (result != SQL_NO_DATA_FOUND) if (result != SQL_NO_DATA_FOUND)
{ {
@ -1868,7 +1855,7 @@ SQLColumns(
return SQL_SUCCESS; return SQL_SUCCESS;
} }
RETCODE SQL_API RETCODE SQL_API
SQLSpecialColumns( SQLSpecialColumns(
HSTMT hstmt, HSTMT hstmt,
UWORD fColType, UWORD fColType,
@ -1983,11 +1970,9 @@ SQLSpecialColumns(
set_tuplefield_int2(&row->tuple[7], SQL_PC_PSEUDO); set_tuplefield_int2(&row->tuple[7], SQL_PC_PSEUDO);
QR_add_tuple(stmt->result, row); QR_add_tuple(stmt->result, row);
} }
else if (fColType == SQL_ROWVER) else if (fColType == SQL_ROWVER)
{ {
Int2 the_type = PG_TYPE_INT4; Int2 the_type = PG_TYPE_INT4;
if (atoi(ci->row_versioning)) if (atoi(ci->row_versioning))
@ -2019,7 +2004,7 @@ SQLSpecialColumns(
return SQL_SUCCESS; return SQL_SUCCESS;
} }
RETCODE SQL_API RETCODE SQL_API
SQLStatistics( SQLStatistics(
HSTMT hstmt, HSTMT hstmt,
UCHAR FAR * szTableQualifier, UCHAR FAR * szTableQualifier,
@ -2152,7 +2137,6 @@ SQLStatistics(
stmt->errornumber = col_stmt->errornumber; stmt->errornumber = col_stmt->errornumber;
SQLFreeStmt(hcol_stmt, SQL_DROP); SQLFreeStmt(hcol_stmt, SQL_DROP);
goto SEEYA; goto SEEYA;
} }
result = SQLFetch(hcol_stmt); result = SQLFetch(hcol_stmt);
@ -2179,7 +2163,6 @@ SQLStatistics(
stmt->errornumber = col_stmt->errornumber; stmt->errornumber = col_stmt->errornumber;
SQLFreeStmt(hcol_stmt, SQL_DROP); SQLFreeStmt(hcol_stmt, SQL_DROP);
goto SEEYA; goto SEEYA;
} }
SQLFreeStmt(hcol_stmt, SQL_DROP); SQLFreeStmt(hcol_stmt, SQL_DROP);
@ -2191,7 +2174,6 @@ SQLStatistics(
stmt->errormsg = "SQLAllocStmt failed in SQLStatistics for indices."; stmt->errormsg = "SQLAllocStmt failed in SQLStatistics for indices.";
stmt->errornumber = STMT_NO_MEMORY_ERROR; stmt->errornumber = STMT_NO_MEMORY_ERROR;
goto SEEYA; goto SEEYA;
} }
indx_stmt = (StatementClass *) hindx_stmt; indx_stmt = (StatementClass *) hindx_stmt;
@ -2211,7 +2193,6 @@ SQLStatistics(
stmt->errornumber = indx_stmt->errornumber; stmt->errornumber = indx_stmt->errornumber;
SQLFreeStmt(hindx_stmt, SQL_DROP); SQLFreeStmt(hindx_stmt, SQL_DROP);
goto SEEYA; goto SEEYA;
} }
/* bind the index name column */ /* bind the index name column */
@ -2224,7 +2205,6 @@ SQLStatistics(
stmt->errornumber = indx_stmt->errornumber; stmt->errornumber = indx_stmt->errornumber;
SQLFreeStmt(hindx_stmt, SQL_DROP); SQLFreeStmt(hindx_stmt, SQL_DROP);
goto SEEYA; goto SEEYA;
} }
/* bind the vector column */ /* bind the vector column */
result = SQLBindCol(hindx_stmt, 2, SQL_C_DEFAULT, result = SQLBindCol(hindx_stmt, 2, SQL_C_DEFAULT,
@ -2236,7 +2216,6 @@ SQLStatistics(
stmt->errornumber = indx_stmt->errornumber; stmt->errornumber = indx_stmt->errornumber;
SQLFreeStmt(hindx_stmt, SQL_DROP); SQLFreeStmt(hindx_stmt, SQL_DROP);
goto SEEYA; goto SEEYA;
} }
/* bind the "is unique" column */ /* bind the "is unique" column */
result = SQLBindCol(hindx_stmt, 3, SQL_C_CHAR, result = SQLBindCol(hindx_stmt, 3, SQL_C_CHAR,
@ -2260,7 +2239,6 @@ SQLStatistics(
stmt->errornumber = indx_stmt->errornumber; stmt->errornumber = indx_stmt->errornumber;
SQLFreeStmt(hindx_stmt, SQL_DROP); SQLFreeStmt(hindx_stmt, SQL_DROP);
goto SEEYA; goto SEEYA;
} }
result = SQLBindCol(hindx_stmt, 5, SQL_C_CHAR, result = SQLBindCol(hindx_stmt, 5, SQL_C_CHAR,
@ -2313,7 +2291,6 @@ SQLStatistics(
result = SQLFetch(hindx_stmt); result = SQLFetch(hindx_stmt);
while ((result == SQL_SUCCESS) || (result == SQL_SUCCESS_WITH_INFO)) 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 || if (fUnique == SQL_INDEX_ALL ||
(fUnique == SQL_INDEX_UNIQUE && atoi(isunique))) (fUnique == SQL_INDEX_UNIQUE && atoi(isunique)))
@ -2322,7 +2299,6 @@ SQLStatistics(
/* 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) while (i < 8 && fields_vector[i] != 0)
{ {
row = (TupleNode *) malloc(sizeof(TupleNode) + row = (TupleNode *) malloc(sizeof(TupleNode) +
(13 - 1) * sizeof(TupleField)); (13 - 1) * sizeof(TupleField));
@ -2417,7 +2393,7 @@ SEEYA:
return SQL_SUCCESS; return SQL_SUCCESS;
} }
RETCODE SQL_API RETCODE SQL_API
SQLColumnPrivileges( SQLColumnPrivileges(
HSTMT hstmt, HSTMT hstmt,
UCHAR FAR * szTableQualifier, UCHAR FAR * szTableQualifier,
@ -2443,7 +2419,7 @@ SQLColumnPrivileges(
/* SQLPrimaryKeys() /* SQLPrimaryKeys()
* Retrieve the primary key columns for the specified table. * Retrieve the primary key columns for the specified table.
*/ */
RETCODE SQL_API RETCODE SQL_API
SQLPrimaryKeys( SQLPrimaryKeys(
HSTMT hstmt, HSTMT hstmt,
UCHAR FAR * szTableQualifier, UCHAR FAR * szTableQualifier,
@ -2571,7 +2547,6 @@ SQLPrimaryKeys(
while ((result == SQL_SUCCESS) || (result == SQL_SUCCESS_WITH_INFO)) while ((result == SQL_SUCCESS) || (result == SQL_SUCCESS_WITH_INFO))
{ {
row = (TupleNode *) malloc(sizeof(TupleNode) + (result_cols - 1) * sizeof(TupleField)); row = (TupleNode *) malloc(sizeof(TupleNode) + (result_cols - 1) * sizeof(TupleField));
set_tuplefield_null(&row->tuple[0]); set_tuplefield_null(&row->tuple[0]);
@ -2620,7 +2595,7 @@ SQLPrimaryKeys(
return SQL_SUCCESS; return SQL_SUCCESS;
} }
RETCODE SQL_API RETCODE SQL_API
SQLForeignKeys( SQLForeignKeys(
HSTMT hstmt, HSTMT hstmt,
UCHAR FAR * szPkTableQualifier, UCHAR FAR * szPkTableQualifier,
@ -2897,7 +2872,6 @@ SQLForeignKeys(
while (result == SQL_SUCCESS) while (result == SQL_SUCCESS)
{ {
/* Compute the number of keyparts. */ /* Compute the number of keyparts. */
num_keys = (trig_nargs - 4) / 2; num_keys = (trig_nargs - 4) / 2;
@ -2912,7 +2886,6 @@ SQLForeignKeys(
/* If there is a pk table specified, then check it. */ /* If there is a pk table specified, then check it. */
if (pk_table_needed[0] != '\0') if (pk_table_needed[0] != '\0')
{ {
/* If it doesn't match, then continue */ /* If it doesn't match, then continue */
if (strcmp(pk_table, pk_table_needed)) if (strcmp(pk_table, pk_table_needed))
{ {
@ -3001,7 +2974,6 @@ SQLForeignKeys(
for (k = 0; k < num_keys; k++) for (k = 0; k < num_keys; k++)
{ {
row = (TupleNode *) malloc(sizeof(TupleNode) + (result_cols - 1) * sizeof(TupleField)); row = (TupleNode *) malloc(sizeof(TupleNode) + (result_cols - 1) * sizeof(TupleField));
mylog("%s: pk_table = '%s', pkey_ptr = '%s'\n", func, pk_table, pkey_ptr); mylog("%s: pk_table = '%s', pkey_ptr = '%s'\n", func, pk_table, pkey_ptr);
@ -3049,7 +3021,6 @@ SQLForeignKeys(
*/ */
else if (pk_table_needed[0] != '\0') else if (pk_table_needed[0] != '\0')
{ {
sprintf(tables_query, "SELECT pg_trigger.tgargs, " sprintf(tables_query, "SELECT pg_trigger.tgargs, "
" pg_trigger.tgnargs, " " pg_trigger.tgnargs, "
" pg_trigger.tgdeferrable, " " pg_trigger.tgdeferrable, "
@ -3171,7 +3142,6 @@ SQLForeignKeys(
while (result == SQL_SUCCESS) while (result == SQL_SUCCESS)
{ {
/* Calculate the number of key parts */ /* Calculate the number of key parts */
num_keys = (trig_nargs - 4) / 2;; num_keys = (trig_nargs - 4) / 2;;
@ -3227,7 +3197,6 @@ SQLForeignKeys(
for (k = 0; k < num_keys; k++) for (k = 0; k < num_keys; k++)
{ {
mylog("pkey_ptr = '%s', fk_table = '%s', fkey_ptr = '%s'\n", pkey_ptr, fk_table, fkey_ptr); mylog("pkey_ptr = '%s', fk_table = '%s', fkey_ptr = '%s'\n", pkey_ptr, fk_table, fkey_ptr);
row = (TupleNode *) malloc(sizeof(TupleNode) + (result_cols - 1) * sizeof(TupleField)); row = (TupleNode *) malloc(sizeof(TupleNode) + (result_cols - 1) * sizeof(TupleField));
@ -3290,7 +3259,7 @@ SQLForeignKeys(
RETCODE SQL_API RETCODE SQL_API
SQLProcedureColumns( SQLProcedureColumns(
HSTMT hstmt, HSTMT hstmt,
UCHAR FAR * szProcQualifier, UCHAR FAR * szProcQualifier,
@ -3310,7 +3279,7 @@ SQLProcedureColumns(
return SQL_ERROR; return SQL_ERROR;
} }
RETCODE SQL_API RETCODE SQL_API
SQLProcedures( SQLProcedures(
HSTMT hstmt, HSTMT hstmt,
UCHAR FAR * szProcQualifier, UCHAR FAR * szProcQualifier,
@ -3328,7 +3297,7 @@ SQLProcedures(
return SQL_ERROR; return SQL_ERROR;
} }
RETCODE SQL_API RETCODE SQL_API
SQLTablePrivileges( SQLTablePrivileges(
HSTMT hstmt, HSTMT hstmt,
UCHAR FAR * szTableQualifier, UCHAR FAR * szTableQualifier,

View File

@ -76,7 +76,6 @@ lo_close(ConnectionClass * conn, int fd)
else else
return retval; return retval;
} }

View File

@ -185,7 +185,6 @@ strncpy_null(char *dst, const char *src, int len)
if (NULL != dst) if (NULL != dst)
{ {
/* Just in case, check for special lengths */ /* Just in case, check for special lengths */
if (len == SQL_NULL_DATA) if (len == SQL_NULL_DATA)
{ {
@ -241,7 +240,6 @@ make_string(char *s, int len, char *buf)
char * char *
my_strcat(char *buf, char *fmt, char *s, int len) my_strcat(char *buf, char *fmt, char *s, int len)
{ {
if (s && (len > 0 || (len == SQL_NTS && strlen(s) > 0))) if (s && (len > 0 || (len == SQL_NTS && strlen(s) > 0)))
{ {
int length = (len > 0) ? len : strlen(s); int length = (len > 0) ? len : strlen(s);

View File

@ -102,18 +102,15 @@ set_statement_option(ConnectionClass * conn,
if (globals.lie) if (globals.lie)
{ {
if (conn) if (conn)
conn->stmtOptions.cursor_type = vParam; conn->stmtOptions.cursor_type = vParam;
if (stmt) if (stmt)
stmt->options.cursor_type = vParam; stmt->options.cursor_type = vParam;
} }
else else
{ {
if (globals.use_declarefetch) if (globals.use_declarefetch)
{ {
if (conn) if (conn)
conn->stmtOptions.cursor_type = SQL_CURSOR_FORWARD_ONLY; conn->stmtOptions.cursor_type = SQL_CURSOR_FORWARD_ONLY;
if (stmt) if (stmt)
@ -126,7 +123,6 @@ set_statement_option(ConnectionClass * conn,
{ {
if (vParam == SQL_CURSOR_FORWARD_ONLY || vParam == SQL_CURSOR_STATIC) if (vParam == SQL_CURSOR_FORWARD_ONLY || vParam == SQL_CURSOR_STATIC)
{ {
if (conn) if (conn)
conn->stmtOptions.cursor_type = vParam; /* valid type */ conn->stmtOptions.cursor_type = vParam; /* valid type */
if (stmt) if (stmt)
@ -134,7 +130,6 @@ set_statement_option(ConnectionClass * conn,
} }
else else
{ {
if (conn) if (conn)
conn->stmtOptions.cursor_type = SQL_CURSOR_STATIC; conn->stmtOptions.cursor_type = SQL_CURSOR_STATIC;
if (stmt) if (stmt)
@ -289,7 +284,7 @@ set_statement_option(ConnectionClass * conn,
/* Implements only SQL_AUTOCOMMIT */ /* Implements only SQL_AUTOCOMMIT */
RETCODE SQL_API RETCODE SQL_API
SQLSetConnectOption( SQLSetConnectOption(
HDBC hdbc, HDBC hdbc,
UWORD fOption, UWORD fOption,
@ -312,7 +307,6 @@ SQLSetConnectOption(
switch (fOption) switch (fOption)
{ {
/* /*
* Statement Options (apply to all stmts on the connection and * Statement Options (apply to all stmts on the connection and
* become defaults for new stmts) * become defaults for new stmts)
@ -423,7 +417,6 @@ SQLSetConnectOption(
CC_log_error(func, option, conn); CC_log_error(func, option, conn);
return SQL_ERROR; return SQL_ERROR;
} }
} }
if (changed) if (changed)
@ -439,7 +432,7 @@ SQLSetConnectOption(
/* - - - - - - - - - */ /* - - - - - - - - - */
/* This function just can tell you whether you are in Autcommit mode or not */ /* This function just can tell you whether you are in Autcommit mode or not */
RETCODE SQL_API RETCODE SQL_API
SQLGetConnectOption( SQLGetConnectOption(
HDBC hdbc, HDBC hdbc,
UWORD fOption, UWORD fOption,
@ -509,7 +502,6 @@ SQLGetConnectOption(
return SQL_ERROR; return SQL_ERROR;
break; break;
} }
} }
return SQL_SUCCESS; return SQL_SUCCESS;
@ -517,7 +509,7 @@ SQLGetConnectOption(
/* - - - - - - - - - */ /* - - - - - - - - - */
RETCODE SQL_API RETCODE SQL_API
SQLSetStmtOption( SQLSetStmtOption(
HSTMT hstmt, HSTMT hstmt,
UWORD fOption, UWORD fOption,
@ -544,7 +536,7 @@ SQLSetStmtOption(
/* - - - - - - - - - */ /* - - - - - - - - - */
RETCODE SQL_API RETCODE SQL_API
SQLGetStmtOption( SQLGetStmtOption(
HSTMT hstmt, HSTMT hstmt,
UWORD fOption, UWORD fOption,

View File

@ -78,7 +78,6 @@ getNextToken(char *s, char *token, int smax, char *delim, char *quote, char *dqu
while (!isspace((unsigned char) s[i]) && s[i] != ',' && while (!isspace((unsigned char) s[i]) && s[i] != ',' &&
s[i] != '\0' && out != smax) s[i] != '\0' && out != smax)
{ {
/* Handle quoted stuff */ /* Handle quoted stuff */
if (out == 0 && (s[i] == '\"' || s[i] == '\'')) if (out == 0 && (s[i] == '\"' || s[i] == '\''))
{ {
@ -279,7 +278,6 @@ parse_statement(StatementClass * stmt)
while ((ptr = getNextToken(ptr, token, sizeof(token), &delim, &quote, &dquote, &numeric)) != NULL) while ((ptr = getNextToken(ptr, token, sizeof(token), &delim, &quote, &dquote, &numeric)) != NULL)
{ {
unquoted = !(quote || dquote); unquoted = !(quote || dquote);
mylog("unquoted=%d, quote=%d, dquote=%d, numeric=%d, delim='%c', token='%s', ptr='%s'\n", unquoted, quote, dquote, numeric, delim, token, ptr); mylog("unquoted=%d, quote=%d, dquote=%d, numeric=%d, delim='%c', token='%s', ptr='%s'\n", unquoted, quote, dquote, numeric, delim, token, ptr);
@ -323,7 +321,6 @@ parse_statement(StatementClass * stmt)
!stricmp(token, "group") || !stricmp(token, "group") ||
!stricmp(token, "having"))) !stricmp(token, "having")))
{ {
in_select = FALSE; in_select = FALSE;
in_from = FALSE; in_from = FALSE;
in_where = TRUE; in_where = TRUE;
@ -334,7 +331,6 @@ parse_statement(StatementClass * stmt)
if (in_select) if (in_select)
{ {
if (in_distinct) if (in_distinct)
{ {
mylog("in distinct\n"); mylog("in distinct\n");
@ -389,7 +385,6 @@ parse_statement(StatementClass * stmt)
if (!in_field) if (!in_field)
{ {
if (!token[0]) if (!token[0])
continue; continue;
@ -522,12 +517,10 @@ parse_statement(StatementClass * stmt)
fi[stmt->nfld - 1]->expr = TRUE; fi[stmt->nfld - 1]->expr = TRUE;
fi[stmt->nfld - 1]->name[0] = '\0'; fi[stmt->nfld - 1]->name[0] = '\0';
mylog("*** setting expression\n"); mylog("*** setting expression\n");
} }
if (in_from) if (in_from)
{ {
if (!in_table) if (!in_table)
{ {
if (!token[0]) if (!token[0])
@ -581,7 +574,6 @@ parse_statement(StatementClass * stmt)
/* Resolve field names with tables */ /* Resolve field names with tables */
for (i = 0; i < stmt->nfld; i++) for (i = 0; i < stmt->nfld; i++)
{ {
if (fi[i]->func || fi[i]->expr || fi[i]->numeric) if (fi[i]->func || fi[i]->expr || fi[i]->numeric)
{ {
fi[i]->ti = NULL; fi[i]->ti = NULL;
@ -641,7 +633,6 @@ parse_statement(StatementClass * stmt)
/* Call SQLColumns for each table and store the result */ /* Call SQLColumns for each table and store the result */
for (i = 0; i < stmt->ntab; i++) for (i = 0; i < stmt->ntab; i++)
{ {
/* See if already got it */ /* See if already got it */
char found = FALSE; char found = FALSE;
@ -657,7 +648,6 @@ parse_statement(StatementClass * stmt)
if (!found) if (!found)
{ {
mylog("PARSE: Getting SQLColumns for table[%d]='%s'\n", i, ti[i]->name); mylog("PARSE: Getting SQLColumns for table[%d]='%s'\n", i, ti[i]->name);
result = SQLAllocStmt(stmt->hdbc, &hcol_stmt); result = SQLAllocStmt(stmt->hdbc, &hcol_stmt);
@ -681,7 +671,6 @@ parse_statement(StatementClass * stmt)
mylog(" Success\n"); mylog(" Success\n");
if (!(conn->ntables % COL_INCR)) if (!(conn->ntables % COL_INCR))
{ {
mylog("PARSE: Allocing col_info at ntables=%d\n", conn->ntables); mylog("PARSE: Allocing col_info at ntables=%d\n", conn->ntables);
conn->col_info = (COL_INFO **) realloc(conn->col_info, (conn->ntables + COL_INCR) * sizeof(COL_INFO *)); conn->col_info = (COL_INFO **) realloc(conn->col_info, (conn->ntables + COL_INCR) * sizeof(COL_INFO *));
@ -741,7 +730,6 @@ parse_statement(StatementClass * stmt)
for (i = 0; i < stmt->nfld;) for (i = 0; i < stmt->nfld;)
{ {
/* Dont worry about functions or quotes */ /* Dont worry about functions or quotes */
if (fi[i]->func || fi[i]->quote || fi[i]->numeric) if (fi[i]->func || fi[i]->quote || fi[i]->numeric)
{ {
@ -752,7 +740,6 @@ parse_statement(StatementClass * stmt)
/* Stars get expanded to all fields in the table */ /* Stars get expanded to all fields in the table */
else if (fi[i]->name[0] == '*') else if (fi[i]->name[0] == '*')
{ {
char do_all_tables; char do_all_tables;
int total_cols, int total_cols,
old_size, old_size,
@ -823,7 +810,6 @@ parse_statement(StatementClass * stmt)
for (k = 0; k < (do_all_tables ? stmt->ntab : 1); k++) for (k = 0; k < (do_all_tables ? stmt->ntab : 1); k++)
{ {
TABLE_INFO *the_ti = do_all_tables ? ti[k] : fi[i]->ti; TABLE_INFO *the_ti = do_all_tables ? ti[k] : fi[i]->ti;
cols = QR_get_num_tuples(the_ti->col_info->result); cols = QR_get_num_tuples(the_ti->col_info->result);
@ -867,7 +853,6 @@ parse_statement(StatementClass * stmt)
*/ */
else if (fi[i]->ti) else if (fi[i]->ti)
{ {
if (!searchColInfo(fi[i]->ti->col_info, fi[i])) if (!searchColInfo(fi[i]->ti->col_info, fi[i]))
parse = FALSE; parse = FALSE;

View File

@ -109,7 +109,6 @@ sqltype_to_pgtype(SWORD fSqlType)
switch (fSqlType) switch (fSqlType)
{ {
case SQL_BINARY: case SQL_BINARY:
pgType = PG_TYPE_BYTEA; pgType = PG_TYPE_BYTEA;
break; break;
@ -199,11 +198,12 @@ pgtype_to_sqltype(StatementClass * stmt, Int4 type)
{ {
switch (type) switch (type)
{ {
case PG_TYPE_CHAR: case PG_TYPE_CHAR:
case PG_TYPE_CHAR2: case PG_TYPE_CHAR2:
case PG_TYPE_CHAR4: case PG_TYPE_CHAR4:
case PG_TYPE_CHAR8: case PG_TYPE_CHAR8:
case PG_TYPE_NAME:return SQL_CHAR; case PG_TYPE_NAME:
return SQL_CHAR;
case PG_TYPE_BPCHAR: case PG_TYPE_BPCHAR:
return SQL_CHAR; return SQL_CHAR;
@ -271,7 +271,8 @@ pgtype_to_ctype(StatementClass * stmt, Int4 type)
{ {
switch (type) switch (type)
{ {
case PG_TYPE_INT8:return SQL_C_CHAR; case PG_TYPE_INT8:
return SQL_C_CHAR;
case PG_TYPE_NUMERIC: case PG_TYPE_NUMERIC:
return SQL_C_CHAR; return SQL_C_CHAR;
case PG_TYPE_INT2: case PG_TYPE_INT2:
@ -531,11 +532,10 @@ getCharPrecision(StatementClass * stmt, Int4 type, int col, int handle_unknown_s
Int4 Int4
pgtype_precision(StatementClass * stmt, Int4 type, int col, int handle_unknown_size_as) pgtype_precision(StatementClass * stmt, Int4 type, int col, int handle_unknown_size_as)
{ {
switch (type) switch (type)
{ {
case PG_TYPE_CHAR:
case PG_TYPE_CHAR:return 1; return 1;
case PG_TYPE_CHAR2: case PG_TYPE_CHAR2:
return 2; return 2;
case PG_TYPE_CHAR4: case PG_TYPE_CHAR4:
@ -597,10 +597,10 @@ pgtype_precision(StatementClass * stmt, Int4 type, int col, int handle_unknown_s
Int4 Int4
pgtype_display_size(StatementClass * stmt, Int4 type, int col, int handle_unknown_size_as) pgtype_display_size(StatementClass * stmt, Int4 type, int col, int handle_unknown_size_as)
{ {
switch (type) switch (type)
{ {
case PG_TYPE_INT2:return 6; case PG_TYPE_INT2:
return 6;
case PG_TYPE_OID: case PG_TYPE_OID:
case PG_TYPE_XID: case PG_TYPE_XID:
@ -636,11 +636,10 @@ pgtype_display_size(StatementClass * stmt, Int4 type, int col, int handle_unknow
Int4 Int4
pgtype_length(StatementClass * stmt, Int4 type, int col, int handle_unknown_size_as) pgtype_length(StatementClass * stmt, Int4 type, int col, int handle_unknown_size_as)
{ {
switch (type) switch (type)
{ {
case PG_TYPE_INT2:
case PG_TYPE_INT2:return 2; return 2;
case PG_TYPE_OID: case PG_TYPE_OID:
case PG_TYPE_XID: case PG_TYPE_XID:
@ -681,24 +680,24 @@ pgtype_scale(StatementClass * stmt, Int4 type, int col)
{ {
switch (type) switch (type)
{ {
case PG_TYPE_INT2:
case PG_TYPE_INT2: case PG_TYPE_OID:
case PG_TYPE_OID: case PG_TYPE_XID:
case PG_TYPE_XID: case PG_TYPE_INT4:
case PG_TYPE_INT4: case PG_TYPE_INT8:
case PG_TYPE_INT8: case PG_TYPE_FLOAT4:
case PG_TYPE_FLOAT4: case PG_TYPE_FLOAT8:
case PG_TYPE_FLOAT8: case PG_TYPE_MONEY:
case PG_TYPE_MONEY: case PG_TYPE_BOOL:
case PG_TYPE_BOOL:
/* /*
* Number of digits to the right of the decimal point in * Number of digits to the right of the decimal point in
* "yyyy-mm=dd hh:mm:ss[.f...]" * "yyyy-mm=dd hh:mm:ss[.f...]"
*/ */
case PG_TYPE_ABSTIME: case PG_TYPE_ABSTIME:
case PG_TYPE_DATETIME: case PG_TYPE_DATETIME:
case PG_TYPE_TIMESTAMP:return 0; case PG_TYPE_TIMESTAMP:
return 0;
case PG_TYPE_NUMERIC: case PG_TYPE_NUMERIC:
return getNumericScale(stmt, type, col); return getNumericScale(stmt, type, col);
@ -714,14 +713,15 @@ pgtype_radix(StatementClass * stmt, Int4 type)
{ {
switch (type) switch (type)
{ {
case PG_TYPE_INT2: case PG_TYPE_INT2:
case PG_TYPE_OID: case PG_TYPE_OID:
case PG_TYPE_INT4: case PG_TYPE_INT4:
case PG_TYPE_INT8: case PG_TYPE_INT8:
case PG_TYPE_NUMERIC: case PG_TYPE_NUMERIC:
case PG_TYPE_FLOAT4: case PG_TYPE_FLOAT4:
case PG_TYPE_MONEY: case PG_TYPE_MONEY:
case PG_TYPE_FLOAT8:return 10; case PG_TYPE_FLOAT8:
return 10;
default: default:
return -1; return -1;
@ -739,23 +739,23 @@ pgtype_auto_increment(StatementClass * stmt, Int4 type)
{ {
switch (type) switch (type)
{ {
case PG_TYPE_INT2:
case PG_TYPE_OID:
case PG_TYPE_XID:
case PG_TYPE_INT4:
case PG_TYPE_FLOAT4:
case PG_TYPE_MONEY:
case PG_TYPE_BOOL:
case PG_TYPE_FLOAT8:
case PG_TYPE_INT8:
case PG_TYPE_NUMERIC:
case PG_TYPE_INT2: case PG_TYPE_DATE:
case PG_TYPE_OID: case PG_TYPE_TIME:
case PG_TYPE_XID: case PG_TYPE_ABSTIME:
case PG_TYPE_INT4: case PG_TYPE_DATETIME:
case PG_TYPE_FLOAT4: case PG_TYPE_TIMESTAMP:
case PG_TYPE_MONEY: return FALSE;
case PG_TYPE_BOOL:
case PG_TYPE_FLOAT8:
case PG_TYPE_INT8:
case PG_TYPE_NUMERIC:
case PG_TYPE_DATE:
case PG_TYPE_TIME:
case PG_TYPE_ABSTIME:
case PG_TYPE_DATETIME:
case PG_TYPE_TIMESTAMP:return FALSE;
default: default:
return -1; return -1;
@ -767,16 +767,17 @@ pgtype_case_sensitive(StatementClass * stmt, Int4 type)
{ {
switch (type) switch (type)
{ {
case PG_TYPE_CHAR: case PG_TYPE_CHAR:
case PG_TYPE_CHAR2: case PG_TYPE_CHAR2:
case PG_TYPE_CHAR4: case PG_TYPE_CHAR4:
case PG_TYPE_CHAR8: case PG_TYPE_CHAR8:
case PG_TYPE_VARCHAR: case PG_TYPE_VARCHAR:
case PG_TYPE_BPCHAR: case PG_TYPE_BPCHAR:
case PG_TYPE_TEXT: case PG_TYPE_TEXT:
case PG_TYPE_NAME:return TRUE; case PG_TYPE_NAME:
return TRUE;
default: default:
return FALSE; return FALSE;
@ -788,7 +789,8 @@ pgtype_money(StatementClass * stmt, Int4 type)
{ {
switch (type) switch (type)
{ {
case PG_TYPE_MONEY:return TRUE; case PG_TYPE_MONEY:
return TRUE;
default: default:
return FALSE; return FALSE;
} }
@ -799,15 +801,16 @@ pgtype_searchable(StatementClass * stmt, Int4 type)
{ {
switch (type) switch (type)
{ {
case PG_TYPE_CHAR: case PG_TYPE_CHAR:
case PG_TYPE_CHAR2: case PG_TYPE_CHAR2:
case PG_TYPE_CHAR4: case PG_TYPE_CHAR4:
case PG_TYPE_CHAR8: case PG_TYPE_CHAR8:
case PG_TYPE_VARCHAR: case PG_TYPE_VARCHAR:
case PG_TYPE_BPCHAR: case PG_TYPE_BPCHAR:
case PG_TYPE_TEXT: case PG_TYPE_TEXT:
case PG_TYPE_NAME:return SQL_SEARCHABLE; case PG_TYPE_NAME:
return SQL_SEARCHABLE;
default: default:
return SQL_ALL_EXCEPT_LIKE; return SQL_ALL_EXCEPT_LIKE;
@ -819,8 +822,9 @@ pgtype_unsigned(StatementClass * stmt, Int4 type)
{ {
switch (type) switch (type)
{ {
case PG_TYPE_OID: case PG_TYPE_OID:
case PG_TYPE_XID:return TRUE; case PG_TYPE_XID:
return TRUE;
case PG_TYPE_INT2: case PG_TYPE_INT2:
case PG_TYPE_INT4: case PG_TYPE_INT4:
@ -841,7 +845,6 @@ pgtype_literal_prefix(StatementClass * stmt, Int4 type)
{ {
switch (type) switch (type)
{ {
case PG_TYPE_INT2: case PG_TYPE_INT2:
case PG_TYPE_OID: case PG_TYPE_OID:
case PG_TYPE_XID: case PG_TYPE_XID:
@ -862,7 +865,6 @@ pgtype_literal_suffix(StatementClass * stmt, Int4 type)
{ {
switch (type) switch (type)
{ {
case PG_TYPE_INT2: case PG_TYPE_INT2:
case PG_TYPE_OID: case PG_TYPE_OID:
case PG_TYPE_XID: case PG_TYPE_XID:
@ -898,12 +900,12 @@ sqltype_to_default_ctype(Int2 sqltype)
/* (Appendix D) */ /* (Appendix D) */
switch (sqltype) switch (sqltype)
{ {
case SQL_CHAR: case SQL_CHAR:
case SQL_VARCHAR: case SQL_VARCHAR:
case SQL_LONGVARCHAR: case SQL_LONGVARCHAR:
case SQL_DECIMAL: case SQL_DECIMAL:
case SQL_NUMERIC: case SQL_NUMERIC:
case SQL_BIGINT: case SQL_BIGINT:
return SQL_C_CHAR; return SQL_C_CHAR;
case SQL_BIT: case SQL_BIT:

View File

@ -38,7 +38,7 @@ RETCODE SQL_API SQLDummyOrdinal(void);
HINSTANCE NEAR s_hModule; /* Saved module handle. */ HINSTANCE NEAR s_hModule; /* Saved module handle. */
/* This is where the Driver Manager attaches to this Driver */ /* This is where the Driver Manager attaches to this Driver */
BOOL WINAPI BOOL WINAPI
DllMain(HANDLE hInst, ULONG ul_reason_for_call, LPVOID lpReserved) DllMain(HANDLE hInst, ULONG ul_reason_for_call, LPVOID lpReserved)
{ {
WORD wVersionRequested; WORD wVersionRequested;
@ -59,7 +59,6 @@ DllMain(HANDLE hInst, ULONG ul_reason_for_call, LPVOID lpReserved)
if (LOBYTE(wsaData.wVersion) != 1 || if (LOBYTE(wsaData.wVersion) != 1 ||
HIBYTE(wsaData.wVersion) != 1) HIBYTE(wsaData.wVersion) != 1)
{ {
WSACleanup(); WSACleanup();
return FALSE; return FALSE;
} }
@ -137,7 +136,7 @@ _fini(void)
Driver Manager do this. Also, the ordinal values of the Driver Manager do this. Also, the ordinal values of the
functions must match the value of fFunction in SQLGetFunctions() functions must match the value of fFunction in SQLGetFunctions()
*/ */
RETCODE SQL_API RETCODE SQL_API
SQLDummyOrdinal(void) SQLDummyOrdinal(void)
{ {
return SQL_SUCCESS; return SQL_SUCCESS;

View File

@ -110,7 +110,6 @@ QR_Constructor(void)
rv->cache_size = globals.fetch_max; rv->cache_size = globals.fetch_max;
rv->rowset_size = 1; rv->rowset_size = 1;
} }
mylog("exit QR_Constructor\n"); mylog("exit QR_Constructor\n");
@ -152,7 +151,6 @@ QR_Destructor(QResultClass * self)
free(self); free(self);
mylog("QResult: exit DESTRUCTOR\n"); mylog("QResult: exit DESTRUCTOR\n");
} }
void void
@ -186,7 +184,6 @@ QR_free_memory(QResultClass * self)
if (self->backend_tuples) if (self->backend_tuples)
{ {
for (row = 0; row < fcount; row++) for (row = 0; row < fcount; row++)
{ {
mylog("row = %d, num_fields = %d\n", row, num_fields); mylog("row = %d, num_fields = %d\n", row, num_fields);
@ -284,7 +281,6 @@ QR_fetch_tuples(QResultClass * self, ConnectionClass * conn, char *cursor)
} }
else else
{ {
/* Always have to read the field attributes. */ /* Always have to read the field attributes. */
/* But we dont have to reallocate memory for them! */ /* But we dont have to reallocate memory for them! */
@ -343,7 +339,6 @@ QR_close(QResultClass * self)
return FALSE; return FALSE;
} }
} }
} }
return TRUE; return TRUE;
@ -389,7 +384,6 @@ QR_next_tuple(QResultClass * self)
} }
else else
{ {
/* /*
* See if we need to fetch another group of rows. We may be being * See if we need to fetch another group of rows. We may be being
* called from send_query(), and if so, don't send another fetch, * called from send_query(), and if so, don't send another fetch,
@ -399,7 +393,6 @@ QR_next_tuple(QResultClass * self)
if (!self->inTuples) if (!self->inTuples)
{ {
if (!globals.use_declarefetch) if (!globals.use_declarefetch)
{ {
mylog("next_tuple: ALL_ROWS: done, fcount = %d, fetch_count = %d\n", fcount, fetch_count); mylog("next_tuple: ALL_ROWS: done, fcount = %d, fetch_count = %d\n", fcount, fetch_count);
@ -433,7 +426,6 @@ QR_next_tuple(QResultClass * self)
offset = self->fetch_count; offset = self->fetch_count;
self->fetch_count++; self->fetch_count++;
} }
@ -486,7 +478,6 @@ QR_next_tuple(QResultClass * self)
for (;;) for (;;)
{ {
id = SOCK_get_char(sock); id = SOCK_get_char(sock);
switch (id) switch (id)
@ -533,7 +524,6 @@ QR_next_tuple(QResultClass * self)
self->inTuples = FALSE; self->inTuples = FALSE;
if (self->fcount > 0) if (self->fcount > 0)
{ {
qlog(" [ fetched %d rows ]\n", self->fcount); qlog(" [ fetched %d rows ]\n", self->fcount);
mylog("_next_tuple: 'C' fetch_max && fcount = %d\n", self->fcount); mylog("_next_tuple: 'C' fetch_max && fcount = %d\n", self->fcount);
@ -626,7 +616,6 @@ QR_read_tuple(QResultClass * self, char binary)
} }
else else
{ {
/* /*
* NO, the field is not null. so get at first the length of * NO, the field is not null. so get at first the length of
* the field (four bytes) * the field (four bytes)

View File

@ -43,7 +43,7 @@ extern GLOBAL_VALUES globals;
RETCODE SQL_API RETCODE SQL_API
SQLRowCount( SQLRowCount(
HSTMT hstmt, HSTMT hstmt,
SDWORD FAR * pcrow) SDWORD FAR * pcrow)
@ -81,7 +81,6 @@ SQLRowCount(
} }
else else
{ {
res = SC_get_Result(stmt); res = SC_get_Result(stmt);
if (res && pcrow) if (res && pcrow)
{ {
@ -114,7 +113,7 @@ SQLRowCount(
/* attached to "hstmt". */ /* attached to "hstmt". */
RETCODE SQL_API RETCODE SQL_API
SQLNumResultCols( SQLNumResultCols(
HSTMT hstmt, HSTMT hstmt,
SWORD FAR * pccol) SWORD FAR * pccol)
@ -135,7 +134,6 @@ SQLNumResultCols(
parse_ok = FALSE; parse_ok = FALSE;
if (globals.parse && stmt->statement_type == STMT_TYPE_SELECT) if (globals.parse && stmt->statement_type == STMT_TYPE_SELECT)
{ {
if (stmt->parse_status == STMT_PARSE_NONE) if (stmt->parse_status == STMT_PARSE_NONE)
{ {
mylog("SQLNumResultCols: calling parse_statement on stmt=%u\n", stmt); mylog("SQLNumResultCols: calling parse_statement on stmt=%u\n", stmt);
@ -152,7 +150,6 @@ SQLNumResultCols(
if (!parse_ok) if (!parse_ok)
{ {
SC_pre_execute(stmt); SC_pre_execute(stmt);
result = SC_get_Result(stmt); result = SC_get_Result(stmt);
@ -179,7 +176,7 @@ SQLNumResultCols(
/* Return information about the database column the user wants */ /* Return information about the database column the user wants */
/* information about. */ /* information about. */
RETCODE SQL_API RETCODE SQL_API
SQLDescribeCol( SQLDescribeCol(
HSTMT hstmt, HSTMT hstmt,
UWORD icol, UWORD icol,
@ -229,7 +226,6 @@ SQLDescribeCol(
parse_ok = FALSE; parse_ok = FALSE;
if (globals.parse && stmt->statement_type == STMT_TYPE_SELECT) if (globals.parse && stmt->statement_type == STMT_TYPE_SELECT)
{ {
if (stmt->parse_status == STMT_PARSE_NONE) if (stmt->parse_status == STMT_PARSE_NONE)
{ {
mylog("SQLDescribeCol: calling parse_statement on stmt=%u\n", stmt); mylog("SQLDescribeCol: calling parse_statement on stmt=%u\n", stmt);
@ -241,7 +237,6 @@ SQLDescribeCol(
if (stmt->parse_status != STMT_PARSE_FATAL && stmt->fi && stmt->fi[icol]) if (stmt->parse_status != STMT_PARSE_FATAL && stmt->fi && stmt->fi[icol])
{ {
if (icol >= stmt->nfld) if (icol >= stmt->nfld)
{ {
stmt->errornumber = STMT_INVALID_COLUMN_NUMBER_ERROR; stmt->errornumber = STMT_INVALID_COLUMN_NUMBER_ERROR;
@ -342,7 +337,6 @@ SQLDescribeCol(
/************************/ /************************/
if (pcbColDef) if (pcbColDef)
{ {
if (precision < 0) if (precision < 0)
precision = 0; /* "I dont know" */ precision = 0; /* "I dont know" */
@ -381,7 +375,7 @@ SQLDescribeCol(
/* Returns result column descriptor information for a result set. */ /* Returns result column descriptor information for a result set. */
RETCODE SQL_API RETCODE SQL_API
SQLColAttributes( SQLColAttributes(
HSTMT hstmt, HSTMT hstmt,
UWORD icol, UWORD icol,
@ -422,7 +416,7 @@ SQLColAttributes(
icol--; icol--;
unknown_sizes = globals.unknown_sizes; /* atoi(ci->unknown_sizes); unknown_sizes = globals.unknown_sizes; /* atoi(ci->unknown_sizes);
* */ * */
if (unknown_sizes == UNKNOWNS_AS_DONTKNOW) /* not appropriate for if (unknown_sizes == UNKNOWNS_AS_DONTKNOW) /* not appropriate for
* SQLColAttributes() */ * SQLColAttributes() */
unknown_sizes = UNKNOWNS_AS_MAX; unknown_sizes = UNKNOWNS_AS_MAX;
@ -430,7 +424,6 @@ SQLColAttributes(
parse_ok = FALSE; parse_ok = FALSE;
if (globals.parse && stmt->statement_type == STMT_TYPE_SELECT) if (globals.parse && stmt->statement_type == STMT_TYPE_SELECT)
{ {
if (stmt->parse_status == STMT_PARSE_NONE) if (stmt->parse_status == STMT_PARSE_NONE)
{ {
mylog("SQLColAttributes: calling parse_statement\n"); mylog("SQLColAttributes: calling parse_statement\n");
@ -453,7 +446,6 @@ SQLColAttributes(
if (stmt->parse_status != STMT_PARSE_FATAL && stmt->fi && stmt->fi[icol]) if (stmt->parse_status != STMT_PARSE_FATAL && stmt->fi && stmt->fi[icol])
{ {
if (icol >= cols) if (icol >= cols)
{ {
stmt->errornumber = STMT_INVALID_COLUMN_NUMBER_ERROR; stmt->errornumber = STMT_INVALID_COLUMN_NUMBER_ERROR;
@ -542,7 +534,6 @@ SQLColAttributes(
mylog("SQLColAttr: COLUMN_LABEL = '%s'\n", p); mylog("SQLColAttr: COLUMN_LABEL = '%s'\n", p);
break; break;
} /* otherwise same as column name -- FALL } /* otherwise same as column name -- FALL
* THROUGH!!! */ * THROUGH!!! */
@ -652,7 +643,6 @@ SQLColAttributes(
if (pfDesc) if (pfDesc)
*pfDesc = value; *pfDesc = value;
} }
@ -661,7 +651,7 @@ SQLColAttributes(
/* 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 RETCODE SQL_API
SQLGetData( SQLGetData(
HSTMT hstmt, HSTMT hstmt,
UWORD icol, UWORD icol,
@ -707,7 +697,6 @@ SQLGetData(
if (icol == 0) if (icol == 0)
{ {
if (stmt->options.use_bookmarks == SQL_UB_OFF) if (stmt->options.use_bookmarks == SQL_UB_OFF)
{ {
stmt->errornumber = STMT_COLNUM_ERROR; stmt->errornumber = STMT_COLNUM_ERROR;
@ -726,12 +715,10 @@ SQLGetData(
} }
get_bookmark = TRUE; get_bookmark = TRUE;
} }
else else
{ {
/* use zero-based column numbers */ /* use zero-based column numbers */
icol--; icol--;
@ -849,7 +836,7 @@ SQLGetData(
/* Returns data for bound columns in the current row ("hstmt->iCursor"), */ /* Returns data for bound columns in the current row ("hstmt->iCursor"), */
/* advances the cursor. */ /* advances the cursor. */
RETCODE SQL_API RETCODE SQL_API
SQLFetch( SQLFetch(
HSTMT hstmt) HSTMT hstmt)
{ {
@ -919,7 +906,7 @@ SQLFetch(
/* This fetchs a block of data (rowset). */ /* This fetchs a block of data (rowset). */
RETCODE SQL_API RETCODE SQL_API
SQLExtendedFetch( SQLExtendedFetch(
HSTMT hstmt, HSTMT hstmt,
UWORD fFetchType, UWORD fFetchType,
@ -1031,10 +1018,7 @@ SQLExtendedFetch(
stmt->rowset_start = 0; stmt->rowset_start = 0;
else else
{
stmt->rowset_start += (save_rowset_size > 0 ? save_rowset_size : stmt->options.rowset_size); stmt->rowset_start += (save_rowset_size > 0 ? save_rowset_size : stmt->options.rowset_size);
}
mylog("SQL_FETCH_NEXT: num_tuples=%d, currtuple=%d\n", num_tuples, stmt->currTuple); mylog("SQL_FETCH_NEXT: num_tuples=%d, currtuple=%d\n", num_tuples, stmt->currTuple);
break; break;
@ -1050,17 +1034,10 @@ SQLExtendedFetch(
*/ */
if (stmt->rowset_start >= num_tuples) if (stmt->rowset_start >= num_tuples)
{
stmt->rowset_start = num_tuples <= 0 ? 0 : (num_tuples - stmt->options.rowset_size); stmt->rowset_start = num_tuples <= 0 ? 0 : (num_tuples - stmt->options.rowset_size);
}
else else
{
stmt->rowset_start -= stmt->options.rowset_size; stmt->rowset_start -= stmt->options.rowset_size;
}
break; break;
case SQL_FETCH_FIRST: case SQL_FETCH_FIRST:
@ -1116,7 +1093,6 @@ SQLExtendedFetch(
default: default:
SC_log_error(func, "Unsupported SQLExtendedFetch Direction", stmt); SC_log_error(func, "Unsupported SQLExtendedFetch Direction", stmt);
return SQL_ERROR; return SQL_ERROR;
} }
@ -1172,7 +1148,6 @@ SQLExtendedFetch(
truncated = error = FALSE; truncated = error = FALSE;
for (i = 0; i < stmt->options.rowset_size; i++) for (i = 0; i < stmt->options.rowset_size; i++)
{ {
stmt->bind_row = i; /* set the binding location */ stmt->bind_row = i; /* set the binding location */
result = SC_fetch(stmt); result = SC_fetch(stmt);
@ -1220,7 +1195,6 @@ SQLExtendedFetch(
return SQL_SUCCESS_WITH_INFO; return SQL_SUCCESS_WITH_INFO;
else else
return SQL_SUCCESS; return SQL_SUCCESS;
} }
@ -1228,7 +1202,7 @@ SQLExtendedFetch(
/* the "hstmt". */ /* the "hstmt". */
/* CC: return SQL_NO_DATA_FOUND since we do not support multiple result sets */ /* CC: return SQL_NO_DATA_FOUND since we do not support multiple result sets */
RETCODE SQL_API RETCODE SQL_API
SQLMoreResults( SQLMoreResults(
HSTMT hstmt) HSTMT hstmt)
{ {
@ -1237,7 +1211,7 @@ SQLMoreResults(
/* This positions the cursor within a rowset, that was positioned using SQLExtendedFetch. */ /* This positions the cursor within a rowset, that was positioned using SQLExtendedFetch. */
/* This will be useful (so far) only when using SQLGetData after SQLExtendedFetch. */ /* This will be useful (so far) only when using SQLGetData after SQLExtendedFetch. */
RETCODE SQL_API RETCODE SQL_API
SQLSetPos( SQLSetPos(
HSTMT hstmt, HSTMT hstmt,
UWORD irow, UWORD irow,
@ -1301,12 +1275,11 @@ SQLSetPos(
stmt->currTuple = stmt->rowset_start + irow; stmt->currTuple = stmt->rowset_start + irow;
return SQL_SUCCESS; return SQL_SUCCESS;
} }
/* Sets options that control the behavior of cursors. */ /* Sets options that control the behavior of cursors. */
RETCODE SQL_API RETCODE SQL_API
SQLSetScrollOptions( SQLSetScrollOptions(
HSTMT hstmt, HSTMT hstmt,
UWORD fConcurrency, UWORD fConcurrency,
@ -1322,7 +1295,7 @@ SQLSetScrollOptions(
/* Set the cursor name on a statement handle */ /* Set the cursor name on a statement handle */
RETCODE SQL_API RETCODE SQL_API
SQLSetCursorName( SQLSetCursorName(
HSTMT hstmt, HSTMT hstmt,
UCHAR FAR * szCursor, UCHAR FAR * szCursor,
@ -1356,7 +1329,7 @@ SQLSetCursorName(
/* Return the cursor name for a statement handle */ /* Return the cursor name for a statement handle */
RETCODE SQL_API RETCODE SQL_API
SQLGetCursorName( SQLGetCursorName(
HSTMT hstmt, HSTMT hstmt,
UCHAR FAR * szCursor, UCHAR FAR * szCursor,

View File

@ -50,7 +50,6 @@ typedef struct tagSETUPDLG
char szDSN[MAXDSNAME]; /* Original data source name */ char szDSN[MAXDSNAME]; /* Original data source name */
BOOL fNewDSN; /* New data source flag */ BOOL fNewDSN; /* New data source flag */
BOOL fDefault; /* Default data source flag */ BOOL fDefault; /* Default data source flag */
} SETUPDLG, FAR * LPSETUPDLG; } SETUPDLG, FAR * LPSETUPDLG;
@ -73,7 +72,7 @@ BOOL INTFUNC SetDSNAttributes(HWND hwnd, LPSETUPDLG lpsetupdlg);
Output : TRUE success, FALSE otherwise Output : TRUE success, FALSE otherwise
--------------------------------------------------------------------------*/ --------------------------------------------------------------------------*/
BOOL CALLBACK BOOL CALLBACK
ConfigDSN(HWND hwnd, ConfigDSN(HWND hwnd,
WORD fRequest, WORD fRequest,
LPCSTR lpszDriver, LPCSTR lpszDriver,
@ -153,7 +152,7 @@ ConfigDSN(HWND hwnd,
Input : hdlg -- Dialog window handle Input : hdlg -- Dialog window handle
Output : None Output : None
--------------------------------------------------------------------------*/ --------------------------------------------------------------------------*/
void INTFUNC void INTFUNC
CenterDialog(HWND hdlg) CenterDialog(HWND hdlg)
{ {
HWND hwndFrame; HWND hwndFrame;
@ -208,13 +207,12 @@ CenterDialog(HWND hdlg)
--------------------------------------------------------------------------*/ --------------------------------------------------------------------------*/
int CALLBACK int CALLBACK
ConfigDlgProc(HWND hdlg, ConfigDlgProc(HWND hdlg,
WORD wMsg, WORD wMsg,
WPARAM wParam, WPARAM wParam,
LPARAM lParam) LPARAM lParam)
{ {
switch (wMsg) switch (wMsg)
{ {
/* Initialize the dialog */ /* Initialize the dialog */
@ -266,7 +264,6 @@ ConfigDlgProc(HWND hdlg,
switch (GET_WM_COMMAND_ID(wParam, lParam)) switch (GET_WM_COMMAND_ID(wParam, lParam))
{ {
/* /*
* Ensure the OK button is enabled only when a data * Ensure the OK button is enabled only when a data
* source name * source name
@ -344,7 +341,7 @@ ConfigDlgProc(HWND hdlg,
Input : lpszAttributes - Pointer to attribute string Input : lpszAttributes - Pointer to attribute string
Output : None (global aAttr normally updated) Output : None (global aAttr normally updated)
--------------------------------------------------------------------------*/ --------------------------------------------------------------------------*/
void INTFUNC void INTFUNC
ParseAttributes(LPCSTR lpszAttributes, LPSETUPDLG lpsetupdlg) ParseAttributes(LPCSTR lpszAttributes, LPSETUPDLG lpsetupdlg)
{ {
LPCSTR lpsz; LPCSTR lpsz;
@ -370,7 +367,6 @@ ParseAttributes(LPCSTR lpszAttributes, LPSETUPDLG lpsetupdlg)
cbKey = lpsz - lpszStart; cbKey = lpsz - lpszStart;
if (cbKey < sizeof(aszKey)) if (cbKey < sizeof(aszKey))
{ {
_fmemcpy(aszKey, lpszStart, cbKey); _fmemcpy(aszKey, lpszStart, cbKey);
aszKey[cbKey] = '\0'; aszKey[cbKey] = '\0';
} }
@ -398,7 +394,7 @@ ParseAttributes(LPCSTR lpszAttributes, LPSETUPDLG lpsetupdlg)
Output : TRUE if successful, FALSE otherwise Output : TRUE if successful, FALSE otherwise
--------------------------------------------------------------------------*/ --------------------------------------------------------------------------*/
BOOL INTFUNC BOOL INTFUNC
SetDSNAttributes(HWND hwndParent, LPSETUPDLG lpsetupdlg) SetDSNAttributes(HWND hwndParent, LPSETUPDLG lpsetupdlg)
{ {
LPCSTR lpszDSN; /* Pointer to data source name */ LPCSTR lpszDSN; /* Pointer to data source name */

View File

@ -70,7 +70,6 @@ SOCK_Constructor()
rv->reverse = FALSE; rv->reverse = FALSE;
} }
return rv; return rv;
} }
void void
@ -93,7 +92,6 @@ SOCK_Destructor(SocketClass * self)
free(self->buffer_out); free(self->buffer_out);
free(self); free(self);
} }
@ -145,7 +143,6 @@ SOCK_connect_to(SocketClass * self, unsigned short port, char *hostname)
if (connect(self->socket, (struct sockaddr *) & (sadr), if (connect(self->socket, (struct sockaddr *) & (sadr),
sizeof(sadr)) < 0) sizeof(sadr)) < 0)
{ {
self->errornumber = SOCKET_COULD_NOT_CONNECT; self->errornumber = SOCKET_COULD_NOT_CONNECT;
self->errormsg = "Could not connect to remote socket."; self->errormsg = "Could not connect to remote socket.";
closesocket(self->socket); closesocket(self->socket);
@ -290,7 +287,6 @@ SOCK_flush_output(SocketClass * self)
unsigned char unsigned char
SOCK_get_next_byte(SocketClass * self) SOCK_get_next_byte(SocketClass * self)
{ {
if (self->buffer_read_in >= self->buffer_filled_in) if (self->buffer_read_in >= self->buffer_filled_in)
{ {
/* there are no more bytes left in the buffer -> */ /* there are no more bytes left in the buffer -> */
@ -313,7 +309,6 @@ SOCK_get_next_byte(SocketClass * self)
self->errormsg = "Socket has been closed."; self->errormsg = "Socket has been closed.";
self->buffer_filled_in = 0; self->buffer_filled_in = 0;
} }
} }
return self->buffer_in[self->buffer_read_in++]; return self->buffer_in[self->buffer_read_in++];
} }

View File

@ -85,7 +85,7 @@ static struct
}; };
RETCODE SQL_API RETCODE SQL_API
SQLAllocStmt(HDBC hdbc, SQLAllocStmt(HDBC hdbc,
HSTMT FAR * phstmt) HSTMT FAR * phstmt)
{ {
@ -139,7 +139,7 @@ SQLAllocStmt(HDBC hdbc,
} }
RETCODE SQL_API RETCODE SQL_API
SQLFreeStmt(HSTMT hstmt, SQLFreeStmt(HSTMT hstmt,
UWORD fOption) UWORD fOption)
{ {
@ -180,13 +180,9 @@ SQLFreeStmt(HSTMT hstmt,
/* Destroy the statement and free any results, cursors, etc. */ /* Destroy the statement and free any results, cursors, etc. */
SC_Destructor(stmt); SC_Destructor(stmt);
} }
else if (fOption == SQL_UNBIND) else if (fOption == SQL_UNBIND)
{
SC_unbind_cols(stmt); SC_unbind_cols(stmt);
}
else if (fOption == SQL_CLOSE) else if (fOption == SQL_CLOSE)
{ {
/* this should discard all the results, but leave the statement */ /* this should discard all the results, but leave the statement */
@ -197,13 +193,9 @@ SQLFreeStmt(HSTMT hstmt,
SC_log_error(func, "", stmt); SC_log_error(func, "", stmt);
return SQL_ERROR; return SQL_ERROR;
} }
} }
else if (fOption == SQL_RESET_PARAMS) else if (fOption == SQL_RESET_PARAMS)
{
SC_free_params(stmt, STMT_FREE_PARAMS_ALL); SC_free_params(stmt, STMT_FREE_PARAMS_ALL);
}
else else
{ {
stmt->errormsg = "Invalid option passed to SQLFreeStmt."; stmt->errormsg = "Invalid option passed to SQLFreeStmt.";
@ -298,7 +290,6 @@ SC_Constructor(void)
char char
SC_Destructor(StatementClass * self) SC_Destructor(StatementClass * self)
{ {
mylog("SC_Destructor: self=%u, self->result=%u, self->hdbc=%u\n", self, self->result, self->hdbc); mylog("SC_Destructor: self=%u, self->result=%u, self->hdbc=%u\n", self, self->result, self->hdbc);
if (STMT_EXECUTING == self->status) if (STMT_EXECUTING == self->status)
{ {
@ -380,7 +371,6 @@ SC_free_params(StatementClass * self, char option)
{ {
if (self->parameters[i].data_at_exec == TRUE) if (self->parameters[i].data_at_exec == TRUE)
{ {
if (self->parameters[i].EXEC_used) if (self->parameters[i].EXEC_used)
{ {
free(self->parameters[i].EXEC_used); free(self->parameters[i].EXEC_used);
@ -469,7 +459,6 @@ SC_recycle_statement(StatementClass * self)
conn = SC_get_conn(self); conn = SC_get_conn(self);
if (!CC_is_in_autocommit(conn) && CC_is_in_trans(conn)) if (!CC_is_in_autocommit(conn) && CC_is_in_trans(conn))
{ {
CC_send_query(conn, "ABORT", NULL); CC_send_query(conn, "ABORT", NULL);
CC_set_no_trans(conn); CC_set_no_trans(conn);
} }
@ -548,7 +537,6 @@ SC_recycle_statement(StatementClass * self)
void void
SC_pre_execute(StatementClass * self) SC_pre_execute(StatementClass * self)
{ {
mylog("SC_pre_execute: status = %d\n", self->status); mylog("SC_pre_execute: status = %d\n", self->status);
if (self->status == STMT_READY) if (self->status == STMT_READY)
@ -690,11 +678,9 @@ SC_fetch(StatementClass * self)
if (self->manual_result || !globals.use_declarefetch) if (self->manual_result || !globals.use_declarefetch)
{ {
if (self->currTuple >= QR_get_num_tuples(res) - 1 || if (self->currTuple >= QR_get_num_tuples(res) - 1 ||
(self->options.maxRows > 0 && self->currTuple == self->options.maxRows - 1)) (self->options.maxRows > 0 && self->currTuple == self->options.maxRows - 1))
{ {
/* /*
* if at the end of the tuples, return "no data found" and set * if at the end of the tuples, return "no data found" and set
* the cursor past the end of the result set * the cursor past the end of the result set
@ -708,7 +694,6 @@ SC_fetch(StatementClass * self)
} }
else else
{ {
/* read from the cache or the physical next tuple */ /* read from the cache or the physical next tuple */
retval = QR_next_tuple(res); retval = QR_next_tuple(res);
if (retval < 0) if (retval < 0)
@ -751,7 +736,6 @@ SC_fetch(StatementClass * self)
for (lf = 0; lf < num_cols; lf++) for (lf = 0; lf < num_cols; lf++)
{ {
mylog("fetch: cols=%d, lf=%d, self = %u, self->bindings = %u, buffer[] = %u\n", num_cols, lf, self, self->bindings, self->bindings[lf].buffer); mylog("fetch: cols=%d, lf=%d, self = %u, self->bindings = %u, buffer[] = %u\n", num_cols, lf, self, self->bindings, self->bindings[lf].buffer);
/* reset for SQLGetData */ /* reset for SQLGetData */
@ -860,7 +844,6 @@ SC_execute(StatementClass * self)
if (!self->internal && !CC_is_in_trans(conn) && if (!self->internal && !CC_is_in_trans(conn) &&
((globals.use_declarefetch && self->statement_type == STMT_TYPE_SELECT) || (!CC_is_in_autocommit(conn) && STMT_UPDATE(self)))) ((globals.use_declarefetch && self->statement_type == STMT_TYPE_SELECT) || (!CC_is_in_autocommit(conn) && STMT_UPDATE(self))))
{ {
mylog(" about to begin a transaction on statement = %u\n", self); mylog(" about to begin a transaction on statement = %u\n", self);
res = CC_send_query(conn, "BEGIN", NULL); res = CC_send_query(conn, "BEGIN", NULL);
if (!res) if (!res)
@ -902,7 +885,6 @@ SC_execute(StatementClass * self)
/* in copy_statement... */ /* in copy_statement... */
if (self->statement_type == STMT_TYPE_SELECT) if (self->statement_type == STMT_TYPE_SELECT)
{ {
char fetch[128]; char fetch[128];
mylog(" Sending SELECT statement on stmt=%u, cursor_name='%s'\n", self, self->cursor_name); mylog(" Sending SELECT statement on stmt=%u, cursor_name='%s'\n", self, self->cursor_name);
@ -914,7 +896,6 @@ SC_execute(StatementClass * self)
if (globals.use_declarefetch && self->result != NULL && if (globals.use_declarefetch && self->result != NULL &&
QR_command_successful(self->result)) QR_command_successful(self->result))
{ {
QR_Destructor(self->result); QR_Destructor(self->result);
/* /*
@ -968,7 +949,6 @@ SC_execute(StatementClass * self)
/* Check the status of the result */ /* Check the status of the result */
if (self->result) if (self->result)
{ {
was_ok = QR_command_successful(self->result); was_ok = QR_command_successful(self->result);
was_nonfatal = QR_command_nonfatal(self->result); was_nonfatal = QR_command_nonfatal(self->result);

View File

@ -25,7 +25,6 @@ TL_Constructor(UInt4 fieldcnt)
rv = (TupleListClass *) malloc(sizeof(TupleListClass)); rv = (TupleListClass *) malloc(sizeof(TupleListClass));
if (rv) if (rv)
{ {
rv->num_fields = fieldcnt; rv->num_fields = fieldcnt;
rv->num_tuples = 0; rv->num_tuples = 0;
rv->list_start = NULL; rv->list_start = NULL;
@ -134,7 +133,6 @@ TL_get_fieldval(TupleListClass * self, Int4 tupleno, Int2 fieldno)
} }
else if (start_is_closer) else if (start_is_closer)
{ {
/* /*
* the shortest way is to start the search from the head of the * the shortest way is to start the search from the head of the
* list * list
@ -181,7 +179,6 @@ TL_get_fieldval(TupleListClass * self, Int4 tupleno, Int2 fieldno)
char char
TL_add_tuple(TupleListClass * self, TupleNode * new_field) TL_add_tuple(TupleListClass * self, TupleNode * new_field)
{ {
/* /*
* we append the tuple at the end of the doubly linked list of the * we append the tuple at the end of the doubly linked list of the
* tuples we have already read in * tuples we have already read in
@ -200,7 +197,6 @@ TL_add_tuple(TupleListClass * self, TupleNode * new_field)
} }
else else
{ {
/* /*
* there is already an element in the list, so add the new one at * there is already an element in the list, so add the new one at
* the end of the list * the end of the list