Skip to content

Commit 1c55168

Browse files
committed
Run pgindent on ODBC code only, to reformat new comments.
1 parent 296e7ba commit 1c55168

23 files changed

+294
-234
lines changed

src/interfaces/odbc/bind.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ SQLBindParameter(
145145

146146
/* Data at exec macro only valid for C char/binary data */
147147
if (pcbValue && (*pcbValue == SQL_DATA_AT_EXEC ||
148-
*pcbValue <= SQL_LEN_DATA_AT_EXEC_OFFSET))
148+
*pcbValue <= SQL_LEN_DATA_AT_EXEC_OFFSET))
149149
stmt->parameters[ipar].data_at_exec = TRUE;
150150
else
151151
stmt->parameters[ipar].data_at_exec = FALSE;
@@ -160,7 +160,7 @@ SQLBindParameter(
160160
}
161161

162162

163-
/* Associate a user-supplied buffer with a database column. */
163+
/* Associate a user-supplied buffer with a database column. */
164164
RETCODE SQL_API
165165
SQLBindCol(
166166
HSTMT hstmt,
@@ -220,10 +220,9 @@ SQLBindCol(
220220
}
221221

222222
/*
223-
* Allocate enough bindings if not already done.
224-
* Most likely, execution of a statement would have setup the
225-
* necessary bindings. But some apps call BindCol before any
226-
* statement is executed.
223+
* Allocate enough bindings if not already done. Most likely,
224+
* execution of a statement would have setup the necessary bindings.
225+
* But some apps call BindCol before any statement is executed.
227226
*/
228227
if (icol > stmt->bindings_allocated)
229228
extend_bindings(stmt, icol);
@@ -467,10 +466,11 @@ extend_bindings(StatementClass *stmt, int num_columns)
467466
stmt->bindings = new_bindings;
468467
stmt->bindings_allocated = num_columns;
469468
}
469+
470470
/*
471-
* There is no reason to zero out extra bindings if there are
472-
* more than needed. If an app has allocated extra bindings,
473-
* let it worry about it by unbinding those columns.
471+
* There is no reason to zero out extra bindings if there are more
472+
* than needed. If an app has allocated extra bindings, let it worry
473+
* about it by unbinding those columns.
474474
*/
475475

476476
/* SQLBindCol(1..) ... SQLBindCol(10...) # got 10 bindings */

src/interfaces/odbc/columninfo.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,8 @@ CI_read_fields(ColumnInfoClass *self, ConnectionClass *conn)
6161
Oid new_adtid;
6262
Int2 new_adtsize;
6363
Int4 new_atttypmod = -1;
64-
/* MAX_COLUMN_LEN may be sufficient but for safety */
64+
65+
/* MAX_COLUMN_LEN may be sufficient but for safety */
6566
char new_field_name[2 * MAX_COLUMN_LEN + 1];
6667
SocketClass *sock;
6768
ConnInfo *ci;
@@ -152,7 +153,7 @@ CI_set_num_fields(ColumnInfoClass *self, int new_num_fields)
152153
self->num_fields = new_num_fields;
153154

154155
self->name = (char **) malloc(sizeof(char *) * self->num_fields);
155-
memset(self->name, 0, sizeof(char *) * self->num_fields);
156+
memset(self->name, 0, sizeof(char *) * self->num_fields);
156157
self->adtid = (Oid *) malloc(sizeof(Oid) * self->num_fields);
157158
self->adtsize = (Int2 *) malloc(sizeof(Int2) * self->num_fields);
158159
self->display_size = (Int2 *) malloc(sizeof(Int2) * self->num_fields);

src/interfaces/odbc/connection.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -762,7 +762,7 @@ CC_connect(ConnectionClass *self, char do_password)
762762
CC_set_translation(self);
763763

764764
/*
765-
* Send any initial settings
765+
* Send any initial settings
766766
*/
767767

768768
/*
@@ -915,8 +915,10 @@ CC_send_query(ConnectionClass *self, char *query, QueryInfo *qi)
915915
char swallow;
916916
int id;
917917
SocketClass *sock = self->sock;
918+
918919
/* ERROR_MSG_LENGTH is suffcient */
919920
static char msgbuffer[ERROR_MSG_LENGTH + 1];
921+
920922
/* QR_set_command() dups this string so doesn't need static */
921923
char cmdbuffer[ERROR_MSG_LENGTH + 1];
922924

@@ -1210,6 +1212,7 @@ CC_send_function(ConnectionClass *self, int fnid, void *result_buf, int *actual_
12101212
c,
12111213
done;
12121214
SocketClass *sock = self->sock;
1215+
12131216
/* ERROR_MSG_LENGTH is sufficient */
12141217
static char msgbuffer[ERROR_MSG_LENGTH + 1];
12151218
int i;
@@ -1590,8 +1593,8 @@ CC_lookup_pg_version(ConnectionClass *self)
15901593
}
15911594

15921595
/*
1593-
* Extract the Major and Minor numbers from the string.
1594-
* This assumes the string starts 'Postgresql X.X'
1596+
* Extract the Major and Minor numbers from the string. This assumes
1597+
* the string starts 'Postgresql X.X'
15951598
*/
15961599
strcpy(szVersion, "0.0");
15971600
if (sscanf(self->pg_version, "%*s %d.%d", &major, &minor) >= 2)

src/interfaces/odbc/convert.c

Lines changed: 25 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ extern GLOBAL_VALUES globals;
6969
* How to map ODBC scalar functions {fn func(args)} to Postgres.
7070
* This is just a simple substitution. List augmented from:
7171
* http://www.merant.com/datadirect/download/docs/odbc16/Odbcref/rappc.htm
72-
* - thomas 2000-04-03
72+
* - thomas 2000-04-03
7373
*/
7474
char *mapFuncs[][2] = {
7575
/* { "ASCII", "ascii" }, */
@@ -199,9 +199,7 @@ copy_and_convert_field(StatementClass *stmt, Int4 field_type, void *value, Int2
199199
*/
200200

201201
if (bind_size > 0)
202-
{
203202
pcbValueOffset = rgbValueOffset = (bind_size * bind_row);
204-
}
205203
else
206204
{
207205
pcbValueOffset = bind_row * sizeof(SDWORD);
@@ -221,9 +219,10 @@ copy_and_convert_field(StatementClass *stmt, Int4 field_type, void *value, Int2
221219

222220
if (!value)
223221
{
222+
224223
/*
225-
* handle a null just by returning SQL_NULL_DATA in pcbValue,
226-
* and doing nothing to the buffer.
224+
* handle a null just by returning SQL_NULL_DATA in pcbValue, and
225+
* doing nothing to the buffer.
227226
*/
228227
if (pcbValue)
229228
*(SDWORD *) ((char *) pcbValue + pcbValueOffset) = SQL_NULL_DATA;
@@ -242,18 +241,18 @@ copy_and_convert_field(StatementClass *stmt, Int4 field_type, void *value, Int2
242241
}
243242

244243
/*
245-
* First convert any specific postgres types into more
246-
* useable data.
244+
* First convert any specific postgres types into more useable data.
247245
*
248-
* NOTE: Conversions from PG char/varchar of a date/time/timestamp
249-
* value to SQL_C_DATE,SQL_C_TIME, SQL_C_TIMESTAMP not supported
246+
* NOTE: Conversions from PG char/varchar of a date/time/timestamp value
247+
* to SQL_C_DATE,SQL_C_TIME, SQL_C_TIMESTAMP not supported
250248
*/
251249
switch (field_type)
252250
{
253-
/*
254-
* $$$ need to add parsing for date/time/timestamp strings in
255-
* PG_TYPE_CHAR,VARCHAR $$$
256-
*/
251+
252+
/*
253+
* $$$ need to add parsing for date/time/timestamp strings in
254+
* PG_TYPE_CHAR,VARCHAR $$$
255+
*/
257256
case PG_TYPE_DATE:
258257
sscanf(value, "%4d-%2d-%2d", &st.y, &st.m, &st.d);
259258
break;
@@ -269,9 +268,10 @@ copy_and_convert_field(StatementClass *stmt, Int4 field_type, void *value, Int2
269268
sscanf(value, "%4d-%2d-%2d %2d:%2d:%2d", &st.y, &st.m, &st.d, &st.hh, &st.mm, &st.ss);
270269
else
271270
{
271+
272272
/*
273-
* The timestamp is invalid so set
274-
* something conspicuous, like the epoch
273+
* The timestamp is invalid so set something conspicuous,
274+
* like the epoch
275275
*/
276276
t = 0;
277277
tim = localtime(&t);
@@ -295,7 +295,7 @@ copy_and_convert_field(StatementClass *stmt, Int4 field_type, void *value, Int2
295295
}
296296
break;
297297

298-
/* This is for internal use by SQLStatistics() */
298+
/* This is for internal use by SQLStatistics() */
299299
case PG_TYPE_INT2VECTOR:
300300
{
301301
int nval,
@@ -379,6 +379,7 @@ copy_and_convert_field(StatementClass *stmt, Int4 field_type, void *value, Int2
379379
if (fCType == SQL_C_CHAR)
380380
{
381381
/* Special character formatting as required */
382+
382383
/*
383384
* These really should return error if cbValueMax is not big
384385
* enough.
@@ -483,6 +484,7 @@ copy_and_convert_field(StatementClass *stmt, Int4 field_type, void *value, Int2
483484
}
484485
else
485486
{
487+
486488
/*
487489
* for SQL_C_CHAR, it's probably ok to leave currency symbols in.
488490
* But to convert to numeric types, it is necessary to get rid of
@@ -780,8 +782,10 @@ copy_statement_with_parameters(StatementClass *stmt)
780782

781783
#ifdef MULTIBYTE
782784
char *end = multibyte_strchr(begin, '}');
785+
783786
#else
784787
char *end = strchr(begin, '}');
788+
785789
#endif
786790

787791
if (!end)
@@ -806,6 +810,7 @@ copy_statement_with_parameters(StatementClass *stmt)
806810
*end = '}';
807811
continue;
808812
}
813+
809814
/*
810815
* Can you have parameter markers inside of quotes? I dont think
811816
* so. All the queries I've seen expect the driver to put quotes
@@ -1101,9 +1106,7 @@ copy_statement_with_parameters(StatementClass *stmt)
11011106
case SQL_LONGVARBINARY:
11021107

11031108
if (stmt->parameters[param_number].data_at_exec)
1104-
{
11051109
lobj_oid = stmt->parameters[param_number].lobj_oid;
1106-
}
11071110
else
11081111
{
11091112
/* begin transaction if needed */
@@ -1308,14 +1311,16 @@ convert_escape(char *value)
13081311

13091312
if ((strcmp(key, "d") == 0) ||
13101313
(strcmp(key, "t") == 0) ||
1311-
(strcmp(key, "oj") == 0) || /* {oj syntax support for 7.1 servers */
1314+
(strcmp(key, "oj") == 0) || /* {oj syntax support for 7.1
1315+
* servers */
13121316
(strcmp(key, "ts") == 0))
13131317
{
13141318
/* Literal; return the escape part as-is */
13151319
strncpy(escape, value, sizeof(escape) - 1);
13161320
}
13171321
else if (strcmp(key, "fn") == 0)
13181322
{
1323+
13191324
/*
13201325
* Function invocation Separate off the func name, skipping
13211326
* trailing whitespace.
@@ -1722,7 +1727,7 @@ convert_lo(StatementClass *stmt, void *value, Int2 fCType, PTR rgbValue,
17221727
BindInfoClass *bindInfo = NULL;
17231728

17241729

1725-
/* If using SQLGetData, then current_col will be set */
1730+
/* If using SQLGetData, then current_col will be set */
17261731
if (stmt->current_col >= 0)
17271732
{
17281733
bindInfo = &stmt->bindings[stmt->current_col];

src/interfaces/odbc/dlg_specific.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ extern GLOBAL_VALUES globals;
5656
void
5757
SetDlgStuff(HWND hdlg, ConnInfo *ci)
5858
{
59+
5960
/*
6061
* If driver attribute NOT present, then set the datasource name and
6162
* description
@@ -269,7 +270,7 @@ ds_optionsProc(HWND hdlg,
269270
else
270271
/* latest */
271272
CheckDlgButton(hdlg, DS_PG64, 1);
272-
273+
273274
CheckDlgButton(hdlg, DS_SHOWOIDCOLUMN, atoi(ci->show_oid_column));
274275
CheckDlgButton(hdlg, DS_FAKEOIDINDEX, atoi(ci->fake_oid_index));
275276
CheckDlgButton(hdlg, DS_ROWVERSIONING, atoi(ci->row_versioning));
@@ -791,6 +792,7 @@ getGlobalDefaults(char *section, char *filename, char override)
791792
/* Dont allow override of an override! */
792793
if (!override)
793794
{
795+
794796
/*
795797
* ConnSettings is stored in the driver section and per datasource
796798
* for override

src/interfaces/odbc/drvconn.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,9 @@ SQLDriverConnect(
112112
dconn_get_connect_attributes(connStrIn, ci);
113113

114114
/*
115-
* If the ConnInfo in the hdbc is missing anything,
116-
* this function will fill them in from the registry (assuming
117-
* of course there is a DSN given -- if not, it does nothing!)
115+
* If the ConnInfo in the hdbc is missing anything, this function will
116+
* fill them in from the registry (assuming of course there is a DSN
117+
* given -- if not, it does nothing!)
118118
*/
119119
getDSNinfo(ci, CONN_DONT_OVERWRITE);
120120

@@ -175,7 +175,7 @@ SQLDriverConnect(
175175
ci->database[0] == '\0' ||
176176
ci->port[0] == '\0')
177177
{
178-
/* (password_required && ci->password[0] == '\0')) */
178+
/* (password_required && ci->password[0] == '\0')) */
179179

180180
return SQL_NO_DATA_FOUND;
181181
}
@@ -217,6 +217,7 @@ SQLDriverConnect(
217217

218218
if (szConnStrOut)
219219
{
220+
220221
/*
221222
* Return the completed string to the caller. The correct method
222223
* is to only construct the connect string if a dialog was put up,

src/interfaces/odbc/environ.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,7 @@ SQLError(
308308
break;
309309
case CONN_TRANSACT_IN_PROGRES:
310310
strcpy(szSqlState, "S1010");
311+
311312
/*
312313
* when the user tries to switch commit mode in a
313314
* transaction
@@ -441,8 +442,8 @@ EN_Destructor(EnvironmentClass *self)
441442
mylog("in EN_Destructor, self=%u\n", self);
442443

443444
/*
444-
* the error messages are static strings distributed throughout
445-
* the source--they should not be freed
445+
* the error messages are static strings distributed throughout the
446+
* source--they should not be freed
446447
*/
447448

448449
/* Free any connections belonging to this environment */

0 commit comments

Comments
 (0)