Commit d264b53d authored by Bruce Momjian's avatar Bruce Momjian

Rename readonly to onlyread in odbc. Use varargs properly.

parent daf6ffb6
...@@ -147,7 +147,7 @@ typedef struct { ...@@ -147,7 +147,7 @@ typedef struct {
char conn_settings[LARGE_REGISTRY_LEN]; char conn_settings[LARGE_REGISTRY_LEN];
char protocol[SMALL_REGISTRY_LEN]; char protocol[SMALL_REGISTRY_LEN];
char port[SMALL_REGISTRY_LEN]; char port[SMALL_REGISTRY_LEN];
char readonly[SMALL_REGISTRY_LEN]; char onlyread[SMALL_REGISTRY_LEN];
char fake_oid_index[SMALL_REGISTRY_LEN]; char fake_oid_index[SMALL_REGISTRY_LEN];
char show_oid_column[SMALL_REGISTRY_LEN]; char show_oid_column[SMALL_REGISTRY_LEN];
char row_versioning[SMALL_REGISTRY_LEN]; char row_versioning[SMALL_REGISTRY_LEN];
...@@ -230,7 +230,7 @@ struct ConnectionClass_ { ...@@ -230,7 +230,7 @@ struct ConnectionClass_ {
#define CC_get_server(x) (x->connInfo.server) #define CC_get_server(x) (x->connInfo.server)
#define CC_get_DSN(x) (x->connInfo.dsn) #define CC_get_DSN(x) (x->connInfo.dsn)
#define CC_get_username(x) (x->connInfo.username) #define CC_get_username(x) (x->connInfo.username)
#define CC_is_readonly(x) (x->connInfo.readonly[0] == '1') #define CC_is_onlyread(x) (x->connInfo.onlyread[0] == '1')
/* for CC_DSN_info */ /* for CC_DSN_info */
......
...@@ -89,7 +89,7 @@ int CALLBACK driver_optionsProc(HWND hdlg, ...@@ -89,7 +89,7 @@ int CALLBACK driver_optionsProc(HWND hdlg,
CheckDlgButton(hdlg, DRV_OPTIMIZER, globals.disable_optimizer); CheckDlgButton(hdlg, DRV_OPTIMIZER, globals.disable_optimizer);
CheckDlgButton(hdlg, DRV_KSQO, globals.ksqo); CheckDlgButton(hdlg, DRV_KSQO, globals.ksqo);
CheckDlgButton(hdlg, DRV_UNIQUEINDEX, globals.unique_index); CheckDlgButton(hdlg, DRV_UNIQUEINDEX, globals.unique_index);
CheckDlgButton(hdlg, DRV_READONLY, globals.readonly); CheckDlgButton(hdlg, DRV_READONLY, globals.onlyread);
CheckDlgButton(hdlg, DRV_USEDECLAREFETCH, globals.use_declarefetch); CheckDlgButton(hdlg, DRV_USEDECLAREFETCH, globals.use_declarefetch);
/* Unknown (Default) Data Type sizes */ /* Unknown (Default) Data Type sizes */
...@@ -133,7 +133,7 @@ int CALLBACK driver_optionsProc(HWND hdlg, ...@@ -133,7 +133,7 @@ int CALLBACK driver_optionsProc(HWND hdlg,
globals.disable_optimizer = IsDlgButtonChecked(hdlg, DRV_OPTIMIZER); globals.disable_optimizer = IsDlgButtonChecked(hdlg, DRV_OPTIMIZER);
globals.ksqo = IsDlgButtonChecked(hdlg, DRV_KSQO); globals.ksqo = IsDlgButtonChecked(hdlg, DRV_KSQO);
globals.unique_index = IsDlgButtonChecked(hdlg, DRV_UNIQUEINDEX); globals.unique_index = IsDlgButtonChecked(hdlg, DRV_UNIQUEINDEX);
globals.readonly = IsDlgButtonChecked(hdlg, DRV_READONLY); globals.onlyread = IsDlgButtonChecked(hdlg, DRV_READONLY);
globals.use_declarefetch = IsDlgButtonChecked(hdlg, DRV_USEDECLAREFETCH); globals.use_declarefetch = IsDlgButtonChecked(hdlg, DRV_USEDECLAREFETCH);
/* Unknown (Default) Data Type sizes */ /* Unknown (Default) Data Type sizes */
...@@ -241,7 +241,7 @@ char buf[128]; ...@@ -241,7 +241,7 @@ char buf[128];
} }
/* Readonly */ /* Readonly */
CheckDlgButton(hdlg, DS_READONLY, atoi(ci->readonly)); CheckDlgButton(hdlg, DS_READONLY, atoi(ci->onlyread));
/* Protocol */ /* Protocol */
if (strncmp(ci->protocol, PG62, strlen(PG62)) == 0) if (strncmp(ci->protocol, PG62, strlen(PG62)) == 0)
...@@ -279,7 +279,7 @@ char buf[128]; ...@@ -279,7 +279,7 @@ char buf[128];
mylog("IDOK: got ci = %u\n", ci); mylog("IDOK: got ci = %u\n", ci);
/* Readonly */ /* Readonly */
sprintf(ci->readonly, "%d", IsDlgButtonChecked(hdlg, DS_READONLY)); sprintf(ci->onlyread, "%d", IsDlgButtonChecked(hdlg, DS_READONLY));
/* Protocol */ /* Protocol */
if ( IsDlgButtonChecked(hdlg, DS_PG62)) if ( IsDlgButtonChecked(hdlg, DS_PG62))
...@@ -335,7 +335,7 @@ char encoded_conn_settings[LARGE_REGISTRY_LEN]; ...@@ -335,7 +335,7 @@ char encoded_conn_settings[LARGE_REGISTRY_LEN];
/* extra info */ /* extra info */
sprintf(&connect_string[strlen(connect_string)], sprintf(&connect_string[strlen(connect_string)],
";READONLY=%s;PROTOCOL=%s;FAKEOIDINDEX=%s;SHOWOIDCOLUMN=%s;ROWVERSIONING=%s;SHOWSYSTEMTABLES=%s;CONNSETTINGS=%s", ";READONLY=%s;PROTOCOL=%s;FAKEOIDINDEX=%s;SHOWOIDCOLUMN=%s;ROWVERSIONING=%s;SHOWSYSTEMTABLES=%s;CONNSETTINGS=%s",
ci->readonly, ci->onlyread,
ci->protocol, ci->protocol,
ci->fake_oid_index, ci->fake_oid_index,
ci->show_oid_column, ci->show_oid_column,
...@@ -370,7 +370,7 @@ copyAttributes(ConnInfo *ci, char *attribute, char *value) ...@@ -370,7 +370,7 @@ copyAttributes(ConnInfo *ci, char *attribute, char *value)
strcpy(ci->port, value); strcpy(ci->port, value);
else if (stricmp(attribute, INI_READONLY) == 0) else if (stricmp(attribute, INI_READONLY) == 0)
strcpy(ci->readonly, value); strcpy(ci->onlyread, value);
else if (stricmp(attribute, INI_PROTOCOL) == 0) else if (stricmp(attribute, INI_PROTOCOL) == 0)
strcpy(ci->protocol, value); strcpy(ci->protocol, value);
...@@ -392,7 +392,7 @@ copyAttributes(ConnInfo *ci, char *attribute, char *value) ...@@ -392,7 +392,7 @@ copyAttributes(ConnInfo *ci, char *attribute, char *value)
// strcpy(ci->conn_settings, value); // strcpy(ci->conn_settings, value);
} }
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); 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);
} }
...@@ -402,8 +402,8 @@ getDSNdefaults(ConnInfo *ci) ...@@ -402,8 +402,8 @@ getDSNdefaults(ConnInfo *ci)
if (ci->port[0] == '\0') if (ci->port[0] == '\0')
strcpy(ci->port, DEFAULT_PORT); strcpy(ci->port, DEFAULT_PORT);
if (ci->readonly[0] == '\0') if (ci->onlyread[0] == '\0')
sprintf(ci->readonly, "%d", globals.readonly); sprintf(ci->onlyread, "%d", globals.onlyread);
if (ci->protocol[0] == '\0') if (ci->protocol[0] == '\0')
strcpy(ci->protocol, globals.protocol); strcpy(ci->protocol, globals.protocol);
...@@ -460,8 +460,8 @@ char encoded_conn_settings[LARGE_REGISTRY_LEN]; ...@@ -460,8 +460,8 @@ char encoded_conn_settings[LARGE_REGISTRY_LEN];
if ( ci->port[0] == '\0' || overwrite) if ( ci->port[0] == '\0' || overwrite)
SQLGetPrivateProfileString(DSN, INI_PORT, "", ci->port, sizeof(ci->port), ODBC_INI); SQLGetPrivateProfileString(DSN, INI_PORT, "", ci->port, sizeof(ci->port), ODBC_INI);
if ( ci->readonly[0] == '\0' || overwrite) if ( ci->onlyread[0] == '\0' || overwrite)
SQLGetPrivateProfileString(DSN, INI_READONLY, "", ci->readonly, sizeof(ci->readonly), ODBC_INI); SQLGetPrivateProfileString(DSN, INI_READONLY, "", ci->onlyread, sizeof(ci->onlyread), ODBC_INI);
if ( ci->show_oid_column[0] == '\0' || overwrite) if ( ci->show_oid_column[0] == '\0' || overwrite)
SQLGetPrivateProfileString(DSN, INI_SHOWOIDCOLUMN, "", ci->show_oid_column, sizeof(ci->show_oid_column), ODBC_INI); 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]; ...@@ -501,8 +501,8 @@ char encoded_conn_settings[LARGE_REGISTRY_LEN];
ci->database, ci->database,
ci->username, ci->username,
ci->password); ci->password);
qlog(" readonly='%s',protocol='%s',showoid='%s',fakeoidindex='%s',showsystable='%s'\n", qlog(" onlyread='%s',protocol='%s',showoid='%s',fakeoidindex='%s',showsystable='%s'\n",
ci->readonly, ci->onlyread,
ci->protocol, ci->protocol,
ci->show_oid_column, ci->show_oid_column,
ci->fake_oid_index, ci->fake_oid_index,
...@@ -557,7 +557,7 @@ char encoded_conn_settings[LARGE_REGISTRY_LEN]; ...@@ -557,7 +557,7 @@ char encoded_conn_settings[LARGE_REGISTRY_LEN];
SQLWritePrivateProfileString(DSN, SQLWritePrivateProfileString(DSN,
INI_READONLY, INI_READONLY,
ci->readonly, ci->onlyread,
ODBC_INI); ODBC_INI);
SQLWritePrivateProfileString(DSN, SQLWritePrivateProfileString(DSN,
...@@ -772,9 +772,9 @@ char temp[256]; ...@@ -772,9 +772,9 @@ char temp[256];
SQLGetPrivateProfileString(section, INI_READONLY, "", SQLGetPrivateProfileString(section, INI_READONLY, "",
temp, sizeof(temp), filename); temp, sizeof(temp), filename);
if ( temp[0] ) if ( temp[0] )
globals.readonly = atoi(temp); globals.onlyread = atoi(temp);
else else
globals.readonly = DEFAULT_READONLY; globals.onlyread = DEFAULT_READONLY;
/* Default state for future DSN's protocol attribute /* Default state for future DSN's protocol attribute
This isn't a real driver option YET. This is more This isn't a real driver option YET. This is more
...@@ -818,7 +818,7 @@ char tmp[128]; ...@@ -818,7 +818,7 @@ char tmp[128];
SQLWritePrivateProfileString(DBMS_NAME, SQLWritePrivateProfileString(DBMS_NAME,
INI_UNIQUEINDEX, tmp, ODBCINST_INI); INI_UNIQUEINDEX, tmp, ODBCINST_INI);
sprintf(tmp, "%d", globals.readonly); sprintf(tmp, "%d", globals.onlyread);
SQLWritePrivateProfileString(DBMS_NAME, SQLWritePrivateProfileString(DBMS_NAME,
INI_READONLY, tmp, ODBCINST_INI); INI_READONLY, tmp, ODBCINST_INI);
......
...@@ -108,8 +108,8 @@ StatementClass *self = (StatementClass *) hstmt; ...@@ -108,8 +108,8 @@ StatementClass *self = (StatementClass *) hstmt;
self->prepare = TRUE; self->prepare = TRUE;
self->statement_type = statement_type(self->statement); self->statement_type = statement_type(self->statement);
// Check if connection is readonly (only selects are allowed) // Check if connection is onlyread (only selects are allowed)
if ( CC_is_readonly(self->hdbc) && STMT_UPDATE(self)) { if ( CC_is_onlyread(self->hdbc) && STMT_UPDATE(self)) {
self->errornumber = STMT_EXEC_ERROR; self->errornumber = STMT_EXEC_ERROR;
self->errormsg = "Connection is readonly, only select statements are allowed."; self->errormsg = "Connection is readonly, only select statements are allowed.";
SC_log_error(func, "", self); SC_log_error(func, "", self);
...@@ -159,8 +159,8 @@ static char *func = "SQLExecDirect"; ...@@ -159,8 +159,8 @@ static char *func = "SQLExecDirect";
stmt->prepare = FALSE; stmt->prepare = FALSE;
stmt->statement_type = statement_type(stmt->statement); stmt->statement_type = statement_type(stmt->statement);
// Check if connection is readonly (only selects are allowed) // Check if connection is onlyread (only selects are allowed)
if ( CC_is_readonly(stmt->hdbc) && STMT_UPDATE(stmt)) { if ( CC_is_onlyread(stmt->hdbc) && STMT_UPDATE(stmt)) {
stmt->errornumber = STMT_EXEC_ERROR; stmt->errornumber = STMT_EXEC_ERROR;
stmt->errormsg = "Connection is readonly, only select statements are allowed."; stmt->errormsg = "Connection is readonly, only select statements are allowed.";
SC_log_error(func, "", stmt); SC_log_error(func, "", stmt);
...@@ -727,5 +727,3 @@ char *buffer; ...@@ -727,5 +727,3 @@ char *buffer;
return SQL_SUCCESS; return SQL_SUCCESS;
} }
...@@ -173,7 +173,7 @@ RETCODE result; ...@@ -173,7 +173,7 @@ RETCODE result;
break; break;
case SQL_DATA_SOURCE_READ_ONLY: /* ODBC 1.0 */ case SQL_DATA_SOURCE_READ_ONLY: /* ODBC 1.0 */
p = CC_is_readonly(conn) ? "Y" : "N"; p = CC_is_onlyread(conn) ? "Y" : "N";
break; break;
case SQL_DATABASE_NAME: /* Support for old ODBC 1.0 Apps */ case SQL_DATABASE_NAME: /* Support for old ODBC 1.0 Apps */
......
...@@ -61,7 +61,7 @@ mylog(va_alist) ...@@ -61,7 +61,7 @@ mylog(va_alist)
va_dcl va_dcl
{ {
char *fmt; char *fmt;
char *args; va_list args;
char filebuf[80]; char filebuf[80];
FILE* LOGFP = globals.mylogFP; FILE* LOGFP = globals.mylogFP;
...@@ -95,7 +95,7 @@ void qlog(va_alist) ...@@ -95,7 +95,7 @@ void qlog(va_alist)
va_dcl va_dcl
{ {
char *fmt; char *fmt;
char *args; va_list args;
char filebuf[80]; char filebuf[80];
FILE* LOGFP = globals.qlogFP; FILE* LOGFP = globals.qlogFP;
......
...@@ -113,7 +113,7 @@ typedef struct GlobalValues_ ...@@ -113,7 +113,7 @@ typedef struct GlobalValues_
char disable_optimizer; char disable_optimizer;
char ksqo; char ksqo;
char unique_index; char unique_index;
char readonly; char onlyread; /* readonly is reserved on Digital C++ compiler */
char use_declarefetch; char use_declarefetch;
char text_as_longvarchar; char text_as_longvarchar;
char unknowns_as_longvarchar; char unknowns_as_longvarchar;
......
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