Changeset: dd0ba89f8a16 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/dd0ba89f8a16
Modified Files:
clients/odbc/driver/ODBCDbc.c
clients/odbc/driver/ODBCDbc.h
clients/odbc/driver/ODBCUtil.c
clients/odbc/driver/SQLColumnPrivileges.c
clients/odbc/driver/SQLColumns.c
clients/odbc/driver/SQLConnect.c
clients/odbc/driver/SQLDisconnect.c
clients/odbc/driver/SQLForeignKeys.c
clients/odbc/driver/SQLGetInfo.c
clients/odbc/driver/SQLPrimaryKeys.c
clients/odbc/driver/SQLProcedureColumns.c
clients/odbc/driver/SQLProcedures.c
clients/odbc/driver/SQLSpecialColumns.c
clients/odbc/driver/SQLStatistics.c
clients/odbc/driver/SQLTablePrivileges.c
clients/odbc/driver/SQLTables.c
Branch: odbc-tls
Log Message:
Remove uid, pwd, host, port, dbname from ODBCDbc
diffs (256 lines):
diff --git a/clients/odbc/driver/ODBCDbc.c b/clients/odbc/driver/ODBCDbc.c
--- a/clients/odbc/driver/ODBCDbc.c
+++ b/clients/odbc/driver/ODBCDbc.c
@@ -187,10 +187,6 @@ destroyODBCDbc(ODBCDbc *dbc)
deleteODBCErrorList(&dbc->Error);
msettings_destroy(dbc->settings);
free(dbc->dsn);
- free(dbc->uid);
- free(dbc->pwd);
- free(dbc->host);
- free(dbc->dbname);
free(dbc);
}
diff --git a/clients/odbc/driver/ODBCDbc.h b/clients/odbc/driver/ODBCDbc.h
--- a/clients/odbc/driver/ODBCDbc.h
+++ b/clients/odbc/driver/ODBCDbc.h
@@ -54,11 +54,6 @@ typedef struct tODBCDRIVERDBC {
/* connection information */
msettings *settings; /* All connection parameters */
char *dsn; /* Data source name or NULL */
- char *uid; /* User ID or NULL */
- char *pwd; /* Password for User ID or NULL */
- char *host; /* Server host */
- int port; /* Server port */
- char *dbname; /* Database Name or NULL */
bool Connected; /* whether we are connecte to a server */
bool has_comment; /* whether the server has sys.comments */
bool allow_hugeint; /* whether the application deals with HUGEINT */
diff --git a/clients/odbc/driver/ODBCUtil.c b/clients/odbc/driver/ODBCUtil.c
--- a/clients/odbc/driver/ODBCUtil.c
+++ b/clients/odbc/driver/ODBCUtil.c
@@ -1203,11 +1203,11 @@ ODBCTranslateSQL(ODBCDbc *dbc, const SQL
size_t repl3len
= 0;
if (repl ==
NULL) {
if
(strcmp(func->name, "user") == 0) {
-
repl = dbc->uid;
+
repl = msetting_string(dbc->settings, MP_USER);
p1 = p2 = "";
quote = "'";
} else
if (strcmp(func->name, "database") == 0) {
-
repl = dbc->dbname;
+
repl = msetting_string(dbc->settings, MP_DATABASE);
p1 = p2 = "";
quote = "'";
} else
if (strcmp(func->name, "convert") == 0) {
diff --git a/clients/odbc/driver/SQLColumnPrivileges.c
b/clients/odbc/driver/SQLColumnPrivileges.c
--- a/clients/odbc/driver/SQLColumnPrivileges.c
+++ b/clients/odbc/driver/SQLColumnPrivileges.c
@@ -185,7 +185,7 @@ MNDBColumnPrivileges(ODBCStmt *stmt,
/* Construct the selection condition query part */
if (NameLength1 > 0 && CatalogName != NULL) {
/* filtering requested on catalog name */
- if (strcmp((char *) CatalogName, stmt->Dbc->dbname) != 0) {
+ if (strcmp((char *) CatalogName,
msetting_string(stmt->Dbc->settings, MP_DATABASE)) != 0) {
/* catalog name does not match the database name, so
return no rows */
pos += snprintf(query + pos, querylen - pos, " and
1=2");
}
diff --git a/clients/odbc/driver/SQLColumns.c b/clients/odbc/driver/SQLColumns.c
--- a/clients/odbc/driver/SQLColumns.c
+++ b/clients/odbc/driver/SQLColumns.c
@@ -226,7 +226,7 @@ MNDBColumns(ODBCStmt *stmt,
/* Construct the selection condition query part */
if (NameLength1 > 0 && CatalogName != NULL) {
/* filtering requested on catalog name */
- if (strcmp((char *) CatalogName, stmt->Dbc->dbname) != 0) {
+ if (strcmp((char *) CatalogName,
msetting_string(stmt->Dbc->settings, MP_DATABASE)) != 0) {
/* catalog name does not match the database name, so
return no rows */
pos += snprintf(query + pos, querylen - pos, " and
1=2");
}
diff --git a/clients/odbc/driver/SQLConnect.c b/clients/odbc/driver/SQLConnect.c
--- a/clients/odbc/driver/SQLConnect.c
+++ b/clients/odbc/driver/SQLConnect.c
@@ -104,11 +104,7 @@ get_serverinfo(ODBCDbc *dbc)
dbc->raw_strings = strcmp(v, "true") == 0;
} else {
assert(strcmp(n, "gdk_dbname") == 0);
- assert(dbc->dbname == NULL ||
- strcmp(dbc->dbname, v) == 0);
- if (dbc->dbname)
- free(dbc->dbname);
- dbc->dbname = strdup(v);
+ msetting_set_string(dbc->settings, MP_DATABASE, v);
}
}
mapi_close_handle(hdl);
diff --git a/clients/odbc/driver/SQLDisconnect.c
b/clients/odbc/driver/SQLDisconnect.c
--- a/clients/odbc/driver/SQLDisconnect.c
+++ b/clients/odbc/driver/SQLDisconnect.c
@@ -72,22 +72,5 @@ SQLDisconnect(SQLHDBC ConnectionHandle)
free(dbc->dsn);
dbc->dsn = NULL;
- if (dbc->uid) {
- free(dbc->uid);
- dbc->uid = NULL;
- }
- if (dbc->pwd) {
- free(dbc->pwd);
- dbc->pwd = NULL;
- }
- if (dbc->host) {
- free(dbc->host);
- dbc->host = NULL;
- }
- if (dbc->dbname) {
- free(dbc->dbname);
- dbc->dbname = NULL;
- }
-
return SQL_SUCCESS;
}
diff --git a/clients/odbc/driver/SQLForeignKeys.c
b/clients/odbc/driver/SQLForeignKeys.c
--- a/clients/odbc/driver/SQLForeignKeys.c
+++ b/clients/odbc/driver/SQLForeignKeys.c
@@ -211,7 +211,7 @@ MNDBForeignKeys(ODBCStmt *stmt,
/* Construct the selection condition query part */
if (NameLength1 > 0 && PKCatalogName != NULL) {
/* filtering requested on catalog name */
- if (strcmp((char *) PKCatalogName, stmt->Dbc->dbname) != 0) {
+ if (strcmp((char *) PKCatalogName,
msetting_string(stmt->Dbc->settings, MP_DATABASE)) != 0) {
/* catalog name does not match the database name, so
return no rows */
pos += snprintf(query + pos, querylen - pos, " and
1=2");
}
@@ -228,7 +228,7 @@ MNDBForeignKeys(ODBCStmt *stmt,
}
if (NameLength4 > 0 && FKCatalogName != NULL) {
/* filtering requested on catalog name */
- if (strcmp((char *) FKCatalogName, stmt->Dbc->dbname) != 0) {
+ if (strcmp((char *) FKCatalogName,
msetting_string(stmt->Dbc->settings, MP_DATABASE)) != 0) {
/* catalog name does not match the database name, so
return no rows */
pos += snprintf(query + pos, querylen - pos, " and
1=2");
}
diff --git a/clients/odbc/driver/SQLGetInfo.c b/clients/odbc/driver/SQLGetInfo.c
--- a/clients/odbc/driver/SQLGetInfo.c
+++ b/clients/odbc/driver/SQLGetInfo.c
@@ -395,7 +395,7 @@ MNDBGetInfo(ODBCDbc *dbc,
sValue = "N"; /* "Y" */
break;
case SQL_DATABASE_NAME:
- sValue = dbc->dbname ? dbc->dbname : "";
+ sValue = msetting_string(dbc->settings, MP_DATABASE);
break;
case SQL_DATETIME_LITERALS:
nValue = SQL_DL_SQL92_DATE |
@@ -1121,7 +1121,7 @@ MNDBGetInfo(ODBCDbc *dbc,
nValue = SQL_U_UNION | SQL_U_UNION_ALL;
break;
case SQL_USER_NAME:
- sValue = dbc->uid ? dbc->uid : "";
+ sValue = msetting_string(dbc->settings, MP_USER);
break;
case SQL_XOPEN_CLI_YEAR: /* ? */
sValue = "";
diff --git a/clients/odbc/driver/SQLPrimaryKeys.c
b/clients/odbc/driver/SQLPrimaryKeys.c
--- a/clients/odbc/driver/SQLPrimaryKeys.c
+++ b/clients/odbc/driver/SQLPrimaryKeys.c
@@ -150,7 +150,7 @@ MNDBPrimaryKeys(ODBCStmt *stmt,
/* Construct the selection condition query part */
if (NameLength1 > 0 && CatalogName != NULL) {
/* filtering requested on catalog name */
- if (strcmp((char *) CatalogName, stmt->Dbc->dbname) != 0) {
+ if (strcmp((char *) CatalogName,
msetting_string(stmt->Dbc->settings, MP_DATABASE)) != 0) {
/* catalog name does not match the database name, so
return no rows */
pos += snprintf(query + pos, querylen - pos, " and
1=2");
}
@@ -184,7 +184,7 @@ MNDBPrimaryKeys(ODBCStmt *stmt,
/* Construct the selection condition query part */
if (NameLength1 > 0 && CatalogName != NULL) {
/* filtering requested on catalog name */
- if (strcmp((char *) CatalogName, stmt->Dbc->dbname) !=
0) {
+ if (strcmp((char *) CatalogName,
msetting_string(stmt->Dbc->settings, MP_DATABASE)) != 0) {
/* catalog name does not match the database
name, so return no rows */
pos += snprintf(query + pos, querylen - pos, "
and 1=2");
}
diff --git a/clients/odbc/driver/SQLProcedureColumns.c
b/clients/odbc/driver/SQLProcedureColumns.c
--- a/clients/odbc/driver/SQLProcedureColumns.c
+++ b/clients/odbc/driver/SQLProcedureColumns.c
@@ -237,7 +237,7 @@ MNDBProcedureColumns(ODBCStmt *stmt,
/* Construct the selection condition query part */
if (NameLength1 > 0 && CatalogName != NULL) {
/* filtering requested on catalog name */
- if (strcmp((char *) CatalogName, stmt->Dbc->dbname) != 0) {
+ if (strcmp((char *) CatalogName,
msetting_string(stmt->Dbc->settings, MP_DATABASE)) != 0) {
/* catalog name does not match the database name, so
return no rows */
pos += snprintf(query + pos, querylen - pos, " and
1=2");
}
diff --git a/clients/odbc/driver/SQLProcedures.c
b/clients/odbc/driver/SQLProcedures.c
--- a/clients/odbc/driver/SQLProcedures.c
+++ b/clients/odbc/driver/SQLProcedures.c
@@ -150,7 +150,7 @@ MNDBProcedures(ODBCStmt *stmt,
/* Construct the selection condition query part */
if (NameLength1 > 0 && CatalogName != NULL) {
/* filtering requested on catalog name */
- if (strcmp((char *) CatalogName, stmt->Dbc->dbname) != 0) {
+ if (strcmp((char *) CatalogName,
msetting_string(stmt->Dbc->settings, MP_DATABASE)) != 0) {
/* catalog name does not match the database name, so
return no rows */
pos += snprintf(query + pos, querylen - pos, " and
1=2");
}
diff --git a/clients/odbc/driver/SQLSpecialColumns.c
b/clients/odbc/driver/SQLSpecialColumns.c
--- a/clients/odbc/driver/SQLSpecialColumns.c
+++ b/clients/odbc/driver/SQLSpecialColumns.c
@@ -262,7 +262,7 @@ MNDBSpecialColumns(ODBCStmt *stmt,
/* add the selection condition */
if (NameLength1 > 0 && CatalogName != NULL) {
/* filtering requested on catalog name */
- if (strcmp((char *) CatalogName, stmt->Dbc->dbname) !=
0) {
+ if (strcmp((char *) CatalogName,
msetting_string(stmt->Dbc->settings, MP_DATABASE)) != 0) {
/* catalog name does not match the database
name, so return no rows */
pos += strcpy_len(query + pos, " and 1=2",
querylen - pos);
}
diff --git a/clients/odbc/driver/SQLStatistics.c
b/clients/odbc/driver/SQLStatistics.c
--- a/clients/odbc/driver/SQLStatistics.c
+++ b/clients/odbc/driver/SQLStatistics.c
@@ -224,7 +224,7 @@ MNDBStatistics(ODBCStmt *stmt,
/* Construct the selection condition query part */
if (NameLength1 > 0 && CatalogName != NULL) {
/* filtering requested on catalog name */
- if (strcmp((char *) CatalogName, stmt->Dbc->dbname) != 0) {
+ if (strcmp((char *) CatalogName,
msetting_string(stmt->Dbc->settings, MP_DATABASE)) != 0) {
/* catalog name does not match the database name, so
return no rows */
pos += snprintf(query + pos, querylen - pos, " and
1=2");
}
@@ -270,7 +270,7 @@ MNDBStatistics(ODBCStmt *stmt,
/* Construct the selection condition query part */
if (NameLength1 > 0 && CatalogName != NULL) {
/* filtering requested on catalog name */
- if (strcmp((char *) CatalogName, stmt->Dbc->dbname) !=
0) {
+ if (strcmp((char *) CatalogName,
msetting_string(stmt->Dbc->settings, MP_DATABASE)) != 0) {
/* catalog name does not match the database
name, so return no rows */
pos += snprintf(query + pos, querylen - pos, "
and 1=2");
}
diff --git a/clients/odbc/driver/SQLTablePrivileges.c
b/clients/odbc/driver/SQLTablePrivileges.c
--- a/clients/odbc/driver/SQLTablePrivileges.c
+++ b/clients/odbc/driver/SQLTablePrivileges.c
@@ -163,7 +163,7 @@ MNDBTablePrivileges(ODBCStmt *stmt,
/* Construct the selection condition query part */
if (NameLength1 > 0 && CatalogName != NULL) {
/* filtering requested on catalog name */
- if (strcmp((char *) CatalogName, stmt->Dbc->dbname) != 0) {
+ if (strcmp((char *) CatalogName,
msetting_string(stmt->Dbc->settings, MP_DATABASE)) != 0) {
/* catalog name does not match the database name, so
return no rows */
pos += snprintf(query + pos, querylen - pos, " and
1=2");
}
diff --git a/clients/odbc/driver/SQLTables.c b/clients/odbc/driver/SQLTables.c
--- a/clients/odbc/driver/SQLTables.c
+++ b/clients/odbc/driver/SQLTables.c
@@ -188,7 +188,7 @@ MNDBTables(ODBCStmt *stmt,
/* Construct the selection condition query part */
if (NameLength1 > 0 && CatalogName != NULL) {
/* filtering requested on catalog name */
- if (strcmp((char *) CatalogName, stmt->Dbc->dbname) !=
0) {
+ if (strcmp((char *) CatalogName,
msetting_string(stmt->Dbc->settings, MP_DATABASE)) != 0) {
/* catalog name does not match the database
name, so return no rows */
pos += snprintf(query + pos, querylen - pos, "
and 1=2");
}
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]