Skip to content

Commit d264b53

Browse files
committed
Rename readonly to onlyread in odbc. Use varargs properly.
1 parent daf6ffb commit d264b53

File tree

6 files changed

+27
-29
lines changed

6 files changed

+27
-29
lines changed

src/interfaces/odbc/connection.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ typedef struct {
147147
char conn_settings[LARGE_REGISTRY_LEN];
148148
char protocol[SMALL_REGISTRY_LEN];
149149
char port[SMALL_REGISTRY_LEN];
150-
char readonly[SMALL_REGISTRY_LEN];
150+
char onlyread[SMALL_REGISTRY_LEN];
151151
char fake_oid_index[SMALL_REGISTRY_LEN];
152152
char show_oid_column[SMALL_REGISTRY_LEN];
153153
char row_versioning[SMALL_REGISTRY_LEN];
@@ -230,7 +230,7 @@ struct ConnectionClass_ {
230230
#define CC_get_server(x) (x->connInfo.server)
231231
#define CC_get_DSN(x) (x->connInfo.dsn)
232232
#define CC_get_username(x) (x->connInfo.username)
233-
#define CC_is_readonly(x) (x->connInfo.readonly[0] == '1')
233+
#define CC_is_onlyread(x) (x->connInfo.onlyread[0] == '1')
234234

235235

236236
/* for CC_DSN_info */

src/interfaces/odbc/dlg_specific.c

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ int CALLBACK driver_optionsProc(HWND hdlg,
8989
CheckDlgButton(hdlg, DRV_OPTIMIZER, globals.disable_optimizer);
9090
CheckDlgButton(hdlg, DRV_KSQO, globals.ksqo);
9191
CheckDlgButton(hdlg, DRV_UNIQUEINDEX, globals.unique_index);
92-
CheckDlgButton(hdlg, DRV_READONLY, globals.readonly);
92+
CheckDlgButton(hdlg, DRV_READONLY, globals.onlyread);
9393
CheckDlgButton(hdlg, DRV_USEDECLAREFETCH, globals.use_declarefetch);
9494

9595
/* Unknown (Default) Data Type sizes */
@@ -133,7 +133,7 @@ int CALLBACK driver_optionsProc(HWND hdlg,
133133
globals.disable_optimizer = IsDlgButtonChecked(hdlg, DRV_OPTIMIZER);
134134
globals.ksqo = IsDlgButtonChecked(hdlg, DRV_KSQO);
135135
globals.unique_index = IsDlgButtonChecked(hdlg, DRV_UNIQUEINDEX);
136-
globals.readonly = IsDlgButtonChecked(hdlg, DRV_READONLY);
136+
globals.onlyread = IsDlgButtonChecked(hdlg, DRV_READONLY);
137137
globals.use_declarefetch = IsDlgButtonChecked(hdlg, DRV_USEDECLAREFETCH);
138138

139139
/* Unknown (Default) Data Type sizes */
@@ -241,7 +241,7 @@ char buf[128];
241241
}
242242

243243
/* Readonly */
244-
CheckDlgButton(hdlg, DS_READONLY, atoi(ci->readonly));
244+
CheckDlgButton(hdlg, DS_READONLY, atoi(ci->onlyread));
245245

246246
/* Protocol */
247247
if (strncmp(ci->protocol, PG62, strlen(PG62)) == 0)
@@ -279,7 +279,7 @@ char buf[128];
279279
mylog("IDOK: got ci = %u\n", ci);
280280

281281
/* Readonly */
282-
sprintf(ci->readonly, "%d", IsDlgButtonChecked(hdlg, DS_READONLY));
282+
sprintf(ci->onlyread, "%d", IsDlgButtonChecked(hdlg, DS_READONLY));
283283

284284
/* Protocol */
285285
if ( IsDlgButtonChecked(hdlg, DS_PG62))
@@ -335,7 +335,7 @@ char encoded_conn_settings[LARGE_REGISTRY_LEN];
335335
/* extra info */
336336
sprintf(&connect_string[strlen(connect_string)],
337337
";READONLY=%s;PROTOCOL=%s;FAKEOIDINDEX=%s;SHOWOIDCOLUMN=%s;ROWVERSIONING=%s;SHOWSYSTEMTABLES=%s;CONNSETTINGS=%s",
338-
ci->readonly,
338+
ci->onlyread,
339339
ci->protocol,
340340
ci->fake_oid_index,
341341
ci->show_oid_column,
@@ -370,7 +370,7 @@ copyAttributes(ConnInfo *ci, char *attribute, char *value)
370370
strcpy(ci->port, value);
371371

372372
else if (stricmp(attribute, INI_READONLY) == 0)
373-
strcpy(ci->readonly, value);
373+
strcpy(ci->onlyread, value);
374374

375375
else if (stricmp(attribute, INI_PROTOCOL) == 0)
376376
strcpy(ci->protocol, value);
@@ -392,7 +392,7 @@ copyAttributes(ConnInfo *ci, char *attribute, char *value)
392392
// strcpy(ci->conn_settings, value);
393393
}
394394

395-
mylog("copyAttributes: DSN='%s',server='%s',dbase='%s',user='%s',passwd='%s',port='%s',readonly='%s',protocol='%s', conn_settings='%s')\n", ci->dsn, ci->server,ci->database,ci->username,ci->password,ci->port,ci->readonly,ci->protocol,ci->conn_settings);
395+
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);
396396

397397
}
398398

@@ -402,8 +402,8 @@ getDSNdefaults(ConnInfo *ci)
402402
if (ci->port[0] == '\0')
403403
strcpy(ci->port, DEFAULT_PORT);
404404

405-
if (ci->readonly[0] == '\0')
406-
sprintf(ci->readonly, "%d", globals.readonly);
405+
if (ci->onlyread[0] == '\0')
406+
sprintf(ci->onlyread, "%d", globals.onlyread);
407407

408408
if (ci->protocol[0] == '\0')
409409
strcpy(ci->protocol, globals.protocol);
@@ -460,8 +460,8 @@ char encoded_conn_settings[LARGE_REGISTRY_LEN];
460460
if ( ci->port[0] == '\0' || overwrite)
461461
SQLGetPrivateProfileString(DSN, INI_PORT, "", ci->port, sizeof(ci->port), ODBC_INI);
462462

463-
if ( ci->readonly[0] == '\0' || overwrite)
464-
SQLGetPrivateProfileString(DSN, INI_READONLY, "", ci->readonly, sizeof(ci->readonly), ODBC_INI);
463+
if ( ci->onlyread[0] == '\0' || overwrite)
464+
SQLGetPrivateProfileString(DSN, INI_READONLY, "", ci->onlyread, sizeof(ci->onlyread), ODBC_INI);
465465

466466
if ( ci->show_oid_column[0] == '\0' || overwrite)
467467
SQLGetPrivateProfileString(DSN, INI_SHOWOIDCOLUMN, "", ci->show_oid_column, sizeof(ci->show_oid_column), ODBC_INI);
@@ -501,8 +501,8 @@ char encoded_conn_settings[LARGE_REGISTRY_LEN];
501501
ci->database,
502502
ci->username,
503503
ci->password);
504-
qlog(" readonly='%s',protocol='%s',showoid='%s',fakeoidindex='%s',showsystable='%s'\n",
505-
ci->readonly,
504+
qlog(" onlyread='%s',protocol='%s',showoid='%s',fakeoidindex='%s',showsystable='%s'\n",
505+
ci->onlyread,
506506
ci->protocol,
507507
ci->show_oid_column,
508508
ci->fake_oid_index,
@@ -557,7 +557,7 @@ char encoded_conn_settings[LARGE_REGISTRY_LEN];
557557

558558
SQLWritePrivateProfileString(DSN,
559559
INI_READONLY,
560-
ci->readonly,
560+
ci->onlyread,
561561
ODBC_INI);
562562

563563
SQLWritePrivateProfileString(DSN,
@@ -772,9 +772,9 @@ char temp[256];
772772
SQLGetPrivateProfileString(section, INI_READONLY, "",
773773
temp, sizeof(temp), filename);
774774
if ( temp[0] )
775-
globals.readonly = atoi(temp);
775+
globals.onlyread = atoi(temp);
776776
else
777-
globals.readonly = DEFAULT_READONLY;
777+
globals.onlyread = DEFAULT_READONLY;
778778

779779
/* Default state for future DSN's protocol attribute
780780
This isn't a real driver option YET. This is more
@@ -818,7 +818,7 @@ char tmp[128];
818818
SQLWritePrivateProfileString(DBMS_NAME,
819819
INI_UNIQUEINDEX, tmp, ODBCINST_INI);
820820

821-
sprintf(tmp, "%d", globals.readonly);
821+
sprintf(tmp, "%d", globals.onlyread);
822822
SQLWritePrivateProfileString(DBMS_NAME,
823823
INI_READONLY, tmp, ODBCINST_INI);
824824

src/interfaces/odbc/execute.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,8 @@ StatementClass *self = (StatementClass *) hstmt;
108108
self->prepare = TRUE;
109109
self->statement_type = statement_type(self->statement);
110110

111-
// Check if connection is readonly (only selects are allowed)
112-
if ( CC_is_readonly(self->hdbc) && STMT_UPDATE(self)) {
111+
// Check if connection is onlyread (only selects are allowed)
112+
if ( CC_is_onlyread(self->hdbc) && STMT_UPDATE(self)) {
113113
self->errornumber = STMT_EXEC_ERROR;
114114
self->errormsg = "Connection is readonly, only select statements are allowed.";
115115
SC_log_error(func, "", self);
@@ -159,8 +159,8 @@ static char *func = "SQLExecDirect";
159159
stmt->prepare = FALSE;
160160
stmt->statement_type = statement_type(stmt->statement);
161161

162-
// Check if connection is readonly (only selects are allowed)
163-
if ( CC_is_readonly(stmt->hdbc) && STMT_UPDATE(stmt)) {
162+
// Check if connection is onlyread (only selects are allowed)
163+
if ( CC_is_onlyread(stmt->hdbc) && STMT_UPDATE(stmt)) {
164164
stmt->errornumber = STMT_EXEC_ERROR;
165165
stmt->errormsg = "Connection is readonly, only select statements are allowed.";
166166
SC_log_error(func, "", stmt);
@@ -727,5 +727,3 @@ char *buffer;
727727

728728
return SQL_SUCCESS;
729729
}
730-
731-

src/interfaces/odbc/info.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ RETCODE result;
173173
break;
174174

175175
case SQL_DATA_SOURCE_READ_ONLY: /* ODBC 1.0 */
176-
p = CC_is_readonly(conn) ? "Y" : "N";
176+
p = CC_is_onlyread(conn) ? "Y" : "N";
177177
break;
178178

179179
case SQL_DATABASE_NAME: /* Support for old ODBC 1.0 Apps */

src/interfaces/odbc/misc.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ mylog(va_alist)
6161
va_dcl
6262
{
6363
char *fmt;
64-
char *args;
64+
va_list args;
6565
char filebuf[80];
6666
FILE* LOGFP = globals.mylogFP;
6767

@@ -95,7 +95,7 @@ void qlog(va_alist)
9595
va_dcl
9696
{
9797
char *fmt;
98-
char *args;
98+
va_list args;
9999
char filebuf[80];
100100
FILE* LOGFP = globals.qlogFP;
101101

src/interfaces/odbc/psqlodbc.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ typedef struct GlobalValues_
113113
char disable_optimizer;
114114
char ksqo;
115115
char unique_index;
116-
char readonly;
116+
char onlyread; /* readonly is reserved on Digital C++ compiler */
117117
char use_declarefetch;
118118
char text_as_longvarchar;
119119
char unknowns_as_longvarchar;

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy