Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit a8020a7

Browse files
committed
Back out odbc changes until 7.1.
1 parent e39a118 commit a8020a7

28 files changed

+662
-667
lines changed

src/interfaces/odbc/bind.c

+40-40
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
#include <sqlext.h>
3535
#endif
3636

37-
/* Bind parameters on a statement handle */
37+
// Bind parameters on a statement handle
3838

3939
RETCODE SQL_API SQLBindParameter(
4040
HSTMT hstmt,
@@ -75,18 +75,18 @@ static char *func="SQLBindParameter";
7575

7676
stmt->parameters_allocated = ipar;
7777

78-
/* copy the old parameters over */
78+
// copy the old parameters over
7979
for(i = 0; i < old_parameters_allocated; i++) {
80-
/* a structure copy should work */
80+
// a structure copy should work
8181
stmt->parameters[i] = old_parameters[i];
8282
}
8383

84-
/* get rid of the old parameters, if there were any */
84+
// get rid of the old parameters, if there were any
8585
if(old_parameters)
8686
free(old_parameters);
8787

88-
/* zero out the newly allocated parameters (in case they skipped some, */
89-
/* so we don't accidentally try to use them later) */
88+
// zero out the newly allocated parameters (in case they skipped some,
89+
// so we don't accidentally try to use them later)
9090
for(; i < stmt->parameters_allocated; i++) {
9191
stmt->parameters[i].buflen = 0;
9292
stmt->parameters[i].buffer = 0;
@@ -105,7 +105,7 @@ static char *func="SQLBindParameter";
105105

106106
ipar--; /* use zero based column numbers for the below part */
107107

108-
/* store the given info */
108+
// store the given info
109109
stmt->parameters[ipar].buflen = cbValueMax;
110110
stmt->parameters[ipar].buffer = rgbValue;
111111
stmt->parameters[ipar].used = pcbValue;
@@ -140,9 +140,9 @@ static char *func="SQLBindParameter";
140140
return SQL_SUCCESS;
141141
}
142142

143-
/* - - - - - - - - - */
143+
// - - - - - - - - -
144144

145-
/* Associate a user-supplied buffer with a database column. */
145+
// Associate a user-supplied buffer with a database column.
146146
RETCODE SQL_API SQLBindCol(
147147
HSTMT hstmt,
148148
UWORD icol,
@@ -195,14 +195,14 @@ mylog("**** SQLBindCol: stmt = %u, icol = %d\n", stmt, icol);
195195
return SQL_SUCCESS;
196196
}
197197

198-
/* allocate enough bindings if not already done */
199-
/* Most likely, execution of a statement would have setup the */
200-
/* necessary bindings. But some apps call BindCol before any */
201-
/* statement is executed. */
198+
// allocate enough bindings if not already done
199+
// Most likely, execution of a statement would have setup the
200+
// necessary bindings. But some apps call BindCol before any
201+
// statement is executed.
202202
if ( icol > stmt->bindings_allocated)
203203
extend_bindings(stmt, icol);
204204

205-
/* check to see if the bindings were allocated */
205+
// check to see if the bindings were allocated
206206
if ( ! stmt->bindings) {
207207
stmt->errormsg = "Could not allocate memory for bindings.";
208208
stmt->errornumber = STMT_NO_MEMORY_ERROR;
@@ -234,14 +234,14 @@ mylog("**** SQLBindCol: stmt = %u, icol = %d\n", stmt, icol);
234234
return SQL_SUCCESS;
235235
}
236236

237-
/* - - - - - - - - - */
237+
// - - - - - - - - -
238238

239-
/* Returns the description of a parameter marker. */
240-
/* This function is listed as not being supported by SQLGetFunctions() because it is */
241-
/* used to describe "parameter markers" (not bound parameters), in which case, */
242-
/* the dbms should return info on the markers. Since Postgres doesn't support that, */
243-
/* it is best to say this function is not supported and let the application assume a */
244-
/* data type (most likely varchar). */
239+
// Returns the description of a parameter marker.
240+
// This function is listed as not being supported by SQLGetFunctions() because it is
241+
// used to describe "parameter markers" (not bound parameters), in which case,
242+
// the dbms should return info on the markers. Since Postgres doesn't support that,
243+
// it is best to say this function is not supported and let the application assume a
244+
// data type (most likely varchar).
245245

246246
RETCODE SQL_API SQLDescribeParam(
247247
HSTMT hstmt,
@@ -270,8 +270,8 @@ static char *func = "SQLDescribeParam";
270270

271271
ipar--;
272272

273-
/* This implementation is not very good, since it is supposed to describe */
274-
/* parameter markers, not bound parameters. */
273+
// This implementation is not very good, since it is supposed to describe
274+
// parameter markers, not bound parameters.
275275
if(pfSqlType)
276276
*pfSqlType = stmt->parameters[ipar].SQLType;
277277

@@ -287,9 +287,9 @@ static char *func = "SQLDescribeParam";
287287
return SQL_SUCCESS;
288288
}
289289

290-
/* - - - - - - - - - */
290+
// - - - - - - - - -
291291

292-
/* Sets multiple values (arrays) for the set of parameter markers. */
292+
// Sets multiple values (arrays) for the set of parameter markers.
293293

294294
RETCODE SQL_API SQLParamOptions(
295295
HSTMT hstmt,
@@ -304,15 +304,15 @@ static char *func = "SQLParamOptions";
304304
return SQL_ERROR;
305305
}
306306

307-
/* - - - - - - - - - */
307+
// - - - - - - - - -
308308

309-
/* This function should really talk to the dbms to determine the number of */
310-
/* "parameter markers" (not bound parameters) in the statement. But, since */
311-
/* Postgres doesn't support that, the driver should just count the number of markers */
312-
/* and return that. The reason the driver just can't say this function is unsupported */
313-
/* like it does for SQLDescribeParam is that some applications don't care and try */
314-
/* to call it anyway. */
315-
/* If the statement does not have parameters, it should just return 0. */
309+
// This function should really talk to the dbms to determine the number of
310+
// "parameter markers" (not bound parameters) in the statement. But, since
311+
// Postgres doesn't support that, the driver should just count the number of markers
312+
// and return that. The reason the driver just can't say this function is unsupported
313+
// like it does for SQLDescribeParam is that some applications don't care and try
314+
// to call it anyway.
315+
// If the statement does not have parameters, it should just return 0.
316316
RETCODE SQL_API SQLNumParams(
317317
HSTMT hstmt,
318318
SWORD FAR *pcpar)
@@ -338,7 +338,7 @@ static char *func = "SQLNumParams";
338338

339339

340340
if(!stmt->statement) {
341-
/* no statement has been allocated */
341+
// no statement has been allocated
342342
stmt->errormsg = "SQLNumParams called with no statement ready.";
343343
stmt->errornumber = STMT_SEQUENCE_ERROR;
344344
SC_log_error(func, "", stmt);
@@ -419,13 +419,13 @@ mylog("%s: entering ... stmt=%u, bindings_allocated=%d, num_columns=%d\n", func,
419419
stmt->bindings_allocated = num_columns;
420420

421421
}
422-
/* There is no reason to zero out extra bindings if there are */
423-
/* more than needed. If an app has allocated extra bindings, */
424-
/* let it worry about it by unbinding those columns. */
422+
// There is no reason to zero out extra bindings if there are
423+
// more than needed. If an app has allocated extra bindings,
424+
// let it worry about it by unbinding those columns.
425425

426-
/* SQLBindCol(1..) ... SQLBindCol(10...) # got 10 bindings */
427-
/* SQLExecDirect(...) # returns 5 cols */
428-
/* SQLExecDirect(...) # returns 10 cols (now OK) */
426+
// SQLBindCol(1..) ... SQLBindCol(10...) # got 10 bindings
427+
// SQLExecDirect(...) # returns 5 cols
428+
// SQLExecDirect(...) # returns 10 cols (now OK)
429429

430430
mylog("exit extend_bindings\n");
431431
}

src/interfaces/odbc/columninfo.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -144,12 +144,12 @@ CI_set_field_info(ColumnInfoClass *self, int field_num, char *new_name,
144144
Oid new_adtid, Int2 new_adtsize, Int4 new_atttypmod)
145145
{
146146

147-
/* check bounds */
147+
// check bounds
148148
if((field_num < 0) || (field_num >= self->num_fields)) {
149149
return;
150150
}
151151

152-
/* store the info */
152+
// store the info
153153
self->name[field_num] = strdup(new_name);
154154
self->adtid[field_num] = new_adtid;
155155
self->adtsize[field_num] = new_adtsize;

src/interfaces/odbc/connection.c

+24-24
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ static char *func="SQLAllocConnect";
7070
}
7171

7272

73-
/* - - - - - - - - - */
73+
// - - - - - - - - -
7474

7575
RETCODE SQL_API SQLConnect(
7676
HDBC hdbc,
@@ -111,7 +111,7 @@ static char *func = "SQLConnect";
111111
qlog("conn = %u, %s(DSN='%s', UID='%s', PWD='%s')\n", conn, func, ci->dsn, ci->username, ci->password);
112112

113113
if ( CC_connect(conn, FALSE) <= 0) {
114-
/* Error messages are filled in */
114+
// Error messages are filled in
115115
CC_log_error(func, "Error on CC_connect", conn);
116116
return SQL_ERROR;
117117
}
@@ -121,7 +121,7 @@ static char *func = "SQLConnect";
121121
return SQL_SUCCESS;
122122
}
123123

124-
/* - - - - - - - - - */
124+
// - - - - - - - - -
125125

126126
RETCODE SQL_API SQLBrowseConnect(
127127
HDBC hdbc,
@@ -138,7 +138,7 @@ static char *func="SQLBrowseConnect";
138138
return SQL_SUCCESS;
139139
}
140140

141-
/* - - - - - - - - - */
141+
// - - - - - - - - -
142142

143143
/* Drop any hstmts open on hdbc and disconnect from database */
144144
RETCODE SQL_API SQLDisconnect(
@@ -176,7 +176,7 @@ static char *func = "SQLDisconnect";
176176
}
177177

178178

179-
/* - - - - - - - - - */
179+
// - - - - - - - - -
180180

181181
RETCODE SQL_API SQLFreeConnect(
182182
HDBC hdbc)
@@ -229,7 +229,7 @@ ConnectionClass *rv;
229229
rv->errormsg_created = FALSE;
230230

231231
rv->status = CONN_NOT_CONNECTED;
232-
rv->transact_status = CONN_IN_AUTOCOMMIT; /* autocommit by default */
232+
rv->transact_status = CONN_IN_AUTOCOMMIT; // autocommit by default
233233

234234
memset(&rv->connInfo, 0, sizeof(ConnInfo));
235235

@@ -334,8 +334,8 @@ CC_clear_error(ConnectionClass *self)
334334
self->errormsg_created = FALSE;
335335
}
336336

337-
/* Used to cancel a transaction */
338-
/* We are almost always in the middle of a transaction. */
337+
// Used to cancel a transaction
338+
// We are almost always in the middle of a transaction.
339339
char
340340
CC_abort(ConnectionClass *self)
341341
{
@@ -371,9 +371,9 @@ StatementClass *stmt;
371371

372372
mylog("in CC_Cleanup, self=%u\n", self);
373373

374-
/* Cancel an ongoing transaction */
375-
/* We are always in the middle of a transaction, */
376-
/* even if we are in auto commit. */
374+
// Cancel an ongoing transaction
375+
// We are always in the middle of a transaction,
376+
// even if we are in auto commit.
377377
if (self->sock)
378378
CC_abort(self);
379379

@@ -549,7 +549,7 @@ static char *func="CC_connect";
549549

550550
mylog("sizeof startup packet = %d\n", sizeof(StartupPacket));
551551

552-
/* Send length of Authentication Block */
552+
// Send length of Authentication Block
553553
SOCK_put_int(sock, 4+sizeof(StartupPacket), 4);
554554

555555
if ( PROTOCOL_63(ci))
@@ -579,9 +579,9 @@ static char *func="CC_connect";
579579
mylog("gonna do authentication\n");
580580

581581

582-
/* *************************************************** */
583-
/* Now get the authentication request from backend */
584-
/* *************************************************** */
582+
// ***************************************************
583+
// Now get the authentication request from backend
584+
// ***************************************************
585585

586586
if ( ! PROTOCOL_62(ci)) do {
587587

@@ -790,7 +790,7 @@ int rv;
790790

791791
mylog("enter CC_get_error\n");
792792

793-
/* Create a very informative errormsg if it hasn't been done yet. */
793+
// Create a very informative errormsg if it hasn't been done yet.
794794
if ( ! self->errormsg_created) {
795795
self->errormsg = CC_create_errormsg(self);
796796
self->errormsg_created = TRUE;
@@ -802,7 +802,7 @@ int rv;
802802
}
803803
rv = (self->errornumber != 0);
804804

805-
self->errornumber = 0; /* clear the error */
805+
self->errornumber = 0; // clear the error
806806

807807
mylog("exit CC_get_error\n");
808808

@@ -826,13 +826,13 @@ char swallow;
826826
int id;
827827
SocketClass *sock = self->sock;
828828
static char msgbuffer[MAX_MESSAGE_LEN+1];
829-
char cmdbuffer[MAX_MESSAGE_LEN+1]; /* QR_set_command() dups this string so dont need static */
829+
char cmdbuffer[MAX_MESSAGE_LEN+1]; // QR_set_command() dups this string so dont need static
830830

831831

832832
mylog("send_query(): conn=%u, query='%s'\n", self, query);
833833
qlog("conn=%u, query='%s'\n", self, query);
834834

835-
/* Indicate that we are sending a query to the backend */
835+
// Indicate that we are sending a query to the backend
836836
if(strlen(query) > MAX_MESSAGE_LEN-2) {
837837
self->errornumber = CONNECTION_MSG_TOO_LONG;
838838
self->errormsg = "Query string is too long";
@@ -971,7 +971,7 @@ char cmdbuffer[MAX_MESSAGE_LEN+1]; /* QR_set_command() dups this string so dont
971971
mylog("~~~ NOTICE: '%s'\n", cmdbuffer);
972972
qlog("NOTICE from backend during send_query: '%s'\n", cmdbuffer);
973973

974-
continue; /* dont return a result -- continue reading */
974+
continue; // dont return a result -- continue reading
975975

976976
case 'I' : /* The server sends an empty query */
977977
/* There is a closing '\0' following the 'I', so we eat it */
@@ -1034,7 +1034,7 @@ char cmdbuffer[MAX_MESSAGE_LEN+1]; /* QR_set_command() dups this string so dont
10341034
return NULL;
10351035
}
10361036
}
1037-
else { /* next fetch, so reuse an existing result */
1037+
else { // next fetch, so reuse an existing result
10381038
if ( ! QR_fetch_tuples(result_in, NULL, NULL)) {
10391039
self->errornumber = CONNECTION_COULD_NOT_RECEIVE;
10401040
self->errormsg = QR_get_message(result_in);
@@ -1186,7 +1186,7 @@ int i;
11861186
mylog("send_function(G): 'N' - %s\n", msgbuffer);
11871187
qlog("NOTICE from backend during send_function: '%s'\n", msgbuffer);
11881188

1189-
continue; /* dont return a result -- continue reading */
1189+
continue; // dont return a result -- continue reading
11901190

11911191
case '0': /* empty result */
11921192
return TRUE;
@@ -1206,9 +1206,9 @@ int i;
12061206
char
12071207
CC_send_settings(ConnectionClass *self)
12081208
{
1209-
/* char ini_query[MAX_MESSAGE_LEN]; */
1209+
// char ini_query[MAX_MESSAGE_LEN];
12101210
ConnInfo *ci = &(self->connInfo);
1211-
/* QResultClass *res; */
1211+
// QResultClass *res;
12121212
HSTMT hstmt;
12131213
StatementClass *stmt;
12141214
RETCODE result;

0 commit comments

Comments
 (0)