Commit 5ad62747 authored by Bruce Momjian's avatar Bruce Momjian

More ODBC formatting cleanup.

parent 08265ef9
...@@ -192,7 +192,6 @@ SQLBindCol( ...@@ -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;
...@@ -382,10 +381,8 @@ SQLNumParams( ...@@ -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) ...@@ -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) ...@@ -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, */
......
...@@ -77,7 +77,6 @@ CI_read_fields(ColumnInfoClass * self, ConnectionClass * conn) ...@@ -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) ...@@ -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) ...@@ -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 ...@@ -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;
......
...@@ -239,7 +239,6 @@ CC_Constructor() ...@@ -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() ...@@ -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() ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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 ...@@ -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) ...@@ -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) ...@@ -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 */
......
...@@ -185,16 +185,11 @@ copy_and_convert_field(StatementClass * stmt, Int4 field_type, void *value, Int2 ...@@ -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 ...@@ -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 ...@@ -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 ...@@ -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 ...@@ -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 ...@@ -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 ...@@ -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 ...@@ -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 ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -1304,7 +1278,6 @@ convert_escape(char *value)
} }
return escape; return escape;
} }
...@@ -1473,7 +1446,6 @@ conv_from_octal(unsigned char *s) ...@@ -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) ...@@ -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) ...@@ -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, ...@@ -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, ...@@ -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, ...@@ -1804,5 +1772,4 @@ convert_lo(StatementClass * stmt, void *value, Int2 fCType, PTR rgbValue,
return result; return result;
} }
...@@ -49,7 +49,6 @@ extern GLOBAL_VALUES globals; ...@@ -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
...@@ -223,7 +222,6 @@ driver_optionsProc(HWND hdlg, ...@@ -223,7 +222,6 @@ driver_optionsProc(HWND hdlg,
break; break;
} }
} }
return FALSE; return FALSE;
...@@ -351,7 +349,6 @@ makeConnectString(char *connect_string, ConnInfo * ci) ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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);
} }
} }
......
...@@ -147,7 +147,6 @@ dialog: ...@@ -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: ...@@ -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,
...@@ -390,7 +388,6 @@ dconn_get_connect_attributes(UCHAR FAR * connect_string, ConnInfo * ci) ...@@ -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);
} }
......
...@@ -212,7 +212,6 @@ SQLError( ...@@ -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( ...@@ -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( ...@@ -322,7 +320,6 @@ SQLError(
/* general error */ /* general error */
break; break;
} }
} }
else else
{ {
...@@ -337,7 +334,6 @@ SQLError( ...@@ -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)
{ {
......
...@@ -274,7 +274,6 @@ SQLExecute( ...@@ -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,7 +320,6 @@ SQLExecute( ...@@ -321,7 +320,6 @@ SQLExecute(
return SC_execute(stmt); return SC_execute(stmt);
} }
...@@ -363,7 +361,6 @@ SQLTransact( ...@@ -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( ...@@ -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( ...@@ -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);
...@@ -447,8 +437,6 @@ SQLCancel( ...@@ -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( ...@@ -490,7 +478,6 @@ SQLCancel(
stmt->put_data = FALSE; stmt->put_data = FALSE;
return SQL_SUCCESS; return SQL_SUCCESS;
} }
/* - - - - - - - - - */ /* - - - - - - - - - */
...@@ -720,7 +707,6 @@ SQLPutData( ...@@ -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( ...@@ -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( ...@@ -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( ...@@ -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( ...@@ -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;
} }
} }
} }
......
...@@ -698,7 +698,6 @@ SQLGetInfo( ...@@ -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)
...@@ -824,7 +823,6 @@ SQLGetFunctions( ...@@ -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( ...@@ -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:
...@@ -1330,7 +1325,6 @@ SQLTables( ...@@ -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( ...@@ -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( ...@@ -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], "");
...@@ -1685,12 +1677,10 @@ SQLColumns( ...@@ -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( ...@@ -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( ...@@ -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( ...@@ -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)
{ {
...@@ -1983,11 +1970,9 @@ SQLSpecialColumns( ...@@ -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))
...@@ -2152,7 +2137,6 @@ SQLStatistics( ...@@ -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( ...@@ -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( ...@@ -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( ...@@ -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( ...@@ -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( ...@@ -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( ...@@ -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( ...@@ -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( ...@@ -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));
...@@ -2571,7 +2547,6 @@ SQLPrimaryKeys( ...@@ -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]);
...@@ -2897,7 +2872,6 @@ SQLForeignKeys( ...@@ -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( ...@@ -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( ...@@ -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( ...@@ -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( ...@@ -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( ...@@ -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));
......
...@@ -76,7 +76,6 @@ lo_close(ConnectionClass * conn, int fd) ...@@ -76,7 +76,6 @@ lo_close(ConnectionClass * conn, int fd)
else else
return retval; return retval;
} }
......
...@@ -185,7 +185,6 @@ strncpy_null(char *dst, const char *src, int len) ...@@ -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) ...@@ -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);
......
...@@ -102,18 +102,15 @@ set_statement_option(ConnectionClass * conn, ...@@ -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, ...@@ -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, ...@@ -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)
...@@ -312,7 +307,6 @@ SQLSetConnectOption( ...@@ -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( ...@@ -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)
...@@ -509,7 +502,6 @@ SQLGetConnectOption( ...@@ -509,7 +502,6 @@ SQLGetConnectOption(
return SQL_ERROR; return SQL_ERROR;
break; break;
} }
} }
return SQL_SUCCESS; return SQL_SUCCESS;
......
...@@ -78,7 +78,6 @@ getNextToken(char *s, char *token, int smax, char *delim, char *quote, char *dqu ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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;
......
...@@ -109,7 +109,6 @@ sqltype_to_pgtype(SWORD fSqlType) ...@@ -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;
...@@ -203,7 +202,8 @@ pgtype_to_sqltype(StatementClass * stmt, Int4 type) ...@@ -203,7 +202,8 @@ pgtype_to_sqltype(StatementClass * stmt, Int4 type)
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) ...@@ -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 ...@@ -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 ...@@ -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 ...@@ -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,7 +680,6 @@ pgtype_scale(StatementClass * stmt, Int4 type, int col) ...@@ -681,7 +680,6 @@ 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:
...@@ -698,7 +696,8 @@ pgtype_scale(StatementClass * stmt, Int4 type, int col) ...@@ -698,7 +696,8 @@ pgtype_scale(StatementClass * stmt, Int4 type, int col)
*/ */
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);
...@@ -721,7 +720,8 @@ pgtype_radix(StatementClass * stmt, Int4 type) ...@@ -721,7 +720,8 @@ pgtype_radix(StatementClass * stmt, Int4 type)
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,7 +739,6 @@ pgtype_auto_increment(StatementClass * stmt, Int4 type) ...@@ -739,7 +739,6 @@ pgtype_auto_increment(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:
...@@ -755,7 +754,8 @@ pgtype_auto_increment(StatementClass * stmt, Int4 type) ...@@ -755,7 +754,8 @@ pgtype_auto_increment(StatementClass * stmt, Int4 type)
case PG_TYPE_TIME: case PG_TYPE_TIME:
case PG_TYPE_ABSTIME: case PG_TYPE_ABSTIME:
case PG_TYPE_DATETIME: case PG_TYPE_DATETIME:
case PG_TYPE_TIMESTAMP:return FALSE; case PG_TYPE_TIMESTAMP:
return FALSE;
default: default:
return -1; return -1;
...@@ -776,7 +776,8 @@ pgtype_case_sensitive(StatementClass * stmt, Int4 type) ...@@ -776,7 +776,8 @@ pgtype_case_sensitive(StatementClass * stmt, Int4 type)
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) ...@@ -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;
} }
...@@ -807,7 +809,8 @@ pgtype_searchable(StatementClass * stmt, Int4 type) ...@@ -807,7 +809,8 @@ pgtype_searchable(StatementClass * stmt, Int4 type)
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;
...@@ -820,7 +823,8 @@ pgtype_unsigned(StatementClass * stmt, Int4 type) ...@@ -820,7 +823,8 @@ 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) ...@@ -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) ...@@ -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:
......
...@@ -59,7 +59,6 @@ DllMain(HANDLE hInst, ULONG ul_reason_for_call, LPVOID lpReserved) ...@@ -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;
} }
......
...@@ -110,7 +110,6 @@ QR_Constructor(void) ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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)
......
...@@ -81,7 +81,6 @@ SQLRowCount( ...@@ -81,7 +81,6 @@ SQLRowCount(
} }
else else
{ {
res = SC_get_Result(stmt); res = SC_get_Result(stmt);
if (res && pcrow) if (res && pcrow)
{ {
...@@ -135,7 +134,6 @@ SQLNumResultCols( ...@@ -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( ...@@ -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);
...@@ -229,7 +226,6 @@ SQLDescribeCol( ...@@ -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( ...@@ -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( ...@@ -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" */
...@@ -430,7 +424,6 @@ SQLColAttributes( ...@@ -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( ...@@ -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( ...@@ -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( ...@@ -652,7 +643,6 @@ SQLColAttributes(
if (pfDesc) if (pfDesc)
*pfDesc = value; *pfDesc = value;
} }
...@@ -707,7 +697,6 @@ SQLGetData( ...@@ -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( ...@@ -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--;
...@@ -1031,10 +1018,7 @@ SQLExtendedFetch( ...@@ -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( ...@@ -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( ...@@ -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( ...@@ -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( ...@@ -1220,7 +1195,6 @@ SQLExtendedFetch(
return SQL_SUCCESS_WITH_INFO; return SQL_SUCCESS_WITH_INFO;
else else
return SQL_SUCCESS; return SQL_SUCCESS;
} }
...@@ -1301,7 +1275,6 @@ SQLSetPos( ...@@ -1301,7 +1275,6 @@ 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. */
......
...@@ -50,7 +50,6 @@ typedef struct tagSETUPDLG ...@@ -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;
...@@ -214,7 +213,6 @@ ConfigDlgProc(HWND hdlg, ...@@ -214,7 +213,6 @@ ConfigDlgProc(HWND hdlg,
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, ...@@ -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
...@@ -370,7 +367,6 @@ ParseAttributes(LPCSTR lpszAttributes, LPSETUPDLG lpsetupdlg) ...@@ -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';
} }
......
...@@ -70,7 +70,6 @@ SOCK_Constructor() ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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++];
} }
......
...@@ -180,13 +180,9 @@ SQLFreeStmt(HSTMT hstmt, ...@@ -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, ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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);
......
...@@ -25,7 +25,6 @@ TL_Constructor(UInt4 fieldcnt) ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment