Reverting back to 1.35 as 1.36 does not work with all data sources
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@6257 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -547,9 +547,6 @@ bool wxDB::getDbInfo(void)
|
|||||||
if (SQLGetInfo(hdbc, SQL_PROCEDURES, (UCHAR*) dbInf.procedureSupport, 2, &cb) != SQL_SUCCESS)
|
if (SQLGetInfo(hdbc, SQL_PROCEDURES, (UCHAR*) dbInf.procedureSupport, 2, &cb) != SQL_SUCCESS)
|
||||||
return(DispAllErrors(henv, hdbc));
|
return(DispAllErrors(henv, hdbc));
|
||||||
|
|
||||||
if (SQLGetInfo(hdbc, SQL_ACCESSIBLE_TABLES, (UCHAR*) dbInf.accessibleTables, 2, &cb) != SQL_SUCCESS)
|
|
||||||
return(DispAllErrors(henv, hdbc));
|
|
||||||
|
|
||||||
if (SQLGetInfo(hdbc, SQL_CURSOR_COMMIT_BEHAVIOR, (UCHAR*) &dbInf.cursorCommitBehavior, sizeof(dbInf.cursorCommitBehavior), &cb) != SQL_SUCCESS)
|
if (SQLGetInfo(hdbc, SQL_CURSOR_COMMIT_BEHAVIOR, (UCHAR*) &dbInf.cursorCommitBehavior, sizeof(dbInf.cursorCommitBehavior), &cb) != SQL_SUCCESS)
|
||||||
return(DispAllErrors(henv, hdbc));
|
return(DispAllErrors(henv, hdbc));
|
||||||
|
|
||||||
@@ -630,7 +627,6 @@ bool wxDB::getDbInfo(void)
|
|||||||
cout << "Max. Connections: " << dbInf.maxConnections << endl;
|
cout << "Max. Connections: " << dbInf.maxConnections << endl;
|
||||||
cout << "Outer Joins: " << dbInf.outerJoins << endl;
|
cout << "Outer Joins: " << dbInf.outerJoins << endl;
|
||||||
cout << "Support for Procedures: " << dbInf.procedureSupport << endl;
|
cout << "Support for Procedures: " << dbInf.procedureSupport << endl;
|
||||||
cout << "All tables accessible : " << dbInf.accessibleTables << endl;
|
|
||||||
|
|
||||||
cout << "Cursor COMMIT Behavior: ";
|
cout << "Cursor COMMIT Behavior: ";
|
||||||
switch(dbInf.cursorCommitBehavior)
|
switch(dbInf.cursorCommitBehavior)
|
||||||
@@ -1563,6 +1559,9 @@ wxColInf *wxDB::GetColumns(char *tableName[], const char *userID)
|
|||||||
* userID == "" ... UserID set equal to 'this->uid'
|
* userID == "" ... UserID set equal to 'this->uid'
|
||||||
* userID != "" ... UserID set equal to 'userID'
|
* userID != "" ... UserID set equal to 'userID'
|
||||||
*
|
*
|
||||||
|
* NOTE: ALL column bindings associated with this wxDB instance are unbound
|
||||||
|
* by this function. This function should use its own wxDB instance
|
||||||
|
* to avoid undesired unbinding of columns.
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
int noCols = 0;
|
int noCols = 0;
|
||||||
@@ -2346,108 +2345,6 @@ bool wxDB::TableExists(const char *tableName, const char *userID, const char *ta
|
|||||||
} // wxDB::TableExists()
|
} // wxDB::TableExists()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/********** wxDB::TablePrivileges() **********/
|
|
||||||
bool wxDB::TablePrivileges(const char* privilege, const char *tableName,
|
|
||||||
const char *userID, const char *tablePath)
|
|
||||||
{
|
|
||||||
SqlPrivilegesInfo result;
|
|
||||||
SDWORD cbRetVal;
|
|
||||||
RETCODE retcode;
|
|
||||||
|
|
||||||
//We probably need to be able to dynamically set this based on
|
|
||||||
//the driver type, and state. - roger gammans
|
|
||||||
char curRole[]="public";
|
|
||||||
|
|
||||||
wxString UserID;
|
|
||||||
wxString TableName;
|
|
||||||
|
|
||||||
assert(tableName && wxStrlen(tableName));
|
|
||||||
|
|
||||||
if (userID)
|
|
||||||
{
|
|
||||||
if (!wxStrlen(userID))
|
|
||||||
UserID = uid;
|
|
||||||
else
|
|
||||||
UserID = userID;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
UserID = "";
|
|
||||||
|
|
||||||
// Oracle user names may only be in uppercase, so force
|
|
||||||
// the name to uppercase
|
|
||||||
// if (Dbms() == dbmsORACLE)
|
|
||||||
// UserID = UserID.Upper();
|
|
||||||
//
|
|
||||||
// However we fors case-insentive compare so it shouldn't matter.
|
|
||||||
|
|
||||||
|
|
||||||
TableName = tableName;
|
|
||||||
// Oracle table names are uppercase only, so force
|
|
||||||
// the name to uppercase just in case programmer forgot to do this
|
|
||||||
if (Dbms() == dbmsORACLE)
|
|
||||||
TableName = TableName.Upper();
|
|
||||||
|
|
||||||
SQLFreeStmt(hstmt, SQL_CLOSE);
|
|
||||||
|
|
||||||
retcode = SQLTablePrivileges(hstmt,
|
|
||||||
NULL, 0, // All qualifiers
|
|
||||||
NULL, 0, // All owners
|
|
||||||
(UCHAR FAR *)TableName.GetData(), SQL_NTS);
|
|
||||||
|
|
||||||
#ifdef DBDEBUG_CONSOLE
|
|
||||||
fprintf(stderr ,"SQLTablePrivileges() returned %i \n",retcode);
|
|
||||||
#endif
|
|
||||||
/*
|
|
||||||
retcode = SQLBindCol (hstmt, 1, SQL_C_CHAR, &result.TableQualifier, 128, &cbRetVal);
|
|
||||||
retcode = SQLBindCol (hstmt, 2, SQL_C_CHAR, &result.TableOwner, 128, &cbRetVal);
|
|
||||||
retcode = SQLBindCol (hstmt, 3, SQL_C_CHAR, &result.TableName, 128, &cbRetVal);
|
|
||||||
retcode = SQLBindCol (hstmt, 4, SQL_C_CHAR, &result.Grantor, 128, &cbRetVal);
|
|
||||||
retcode = SQLBindCol (hstmt, 5, SQL_C_CHAR, &result.Grantee, 128, &cbRetVal);
|
|
||||||
retcode = SQLBindCol (hstmt, 6, SQL_C_CHAR, &result.Privilege, 128, &cbRetVal);
|
|
||||||
retcode = SQLBindCol (hstmt, 7, SQL_C_CHAR, &result.Grantable, 3, &cbRetVal);
|
|
||||||
*/
|
|
||||||
retcode = SQLFetch(hstmt);
|
|
||||||
while (retcode == SQL_SUCCESS || retcode == SQL_SUCCESS_WITH_INFO)
|
|
||||||
{
|
|
||||||
GetData(1, SQL_C_CHAR, &result.TableQualifier, 128, &cbRetVal);
|
|
||||||
GetData(2, SQL_C_CHAR, &result.TableOwner, 128, &cbRetVal);
|
|
||||||
GetData(3, SQL_C_CHAR, &result.TableName, 128, &cbRetVal);
|
|
||||||
GetData(4, SQL_C_CHAR, &result.Grantor, 128, &cbRetVal);
|
|
||||||
GetData(5, SQL_C_CHAR, &result.Grantee, 128, &cbRetVal);
|
|
||||||
GetData(6, SQL_C_CHAR, &result.Privilege, 128, &cbRetVal);
|
|
||||||
GetData(7, SQL_C_CHAR, &result.Grantable, 3, &cbRetVal);
|
|
||||||
|
|
||||||
#ifdef DBDEBUG_CONSOLE
|
|
||||||
fprintf(stderr,"Scanning %s privilege on table %s.%s granted by %s to %s\n",
|
|
||||||
result.Privilege,result.TableOwner,result.TableName,
|
|
||||||
result.Grantor, result.Grantee);
|
|
||||||
#endif
|
|
||||||
if (UserID.IsSameAs(result.TableOwner,false))
|
|
||||||
{
|
|
||||||
SQLFreeStmt(hstmt, SQL_CLOSE);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (UserID.IsSameAs(result.Grantee,false) &&
|
|
||||||
!strcmp(result.Privilege, privilege))
|
|
||||||
{
|
|
||||||
SQLFreeStmt(hstmt, SQL_CLOSE);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (!strcmp(result.Grantee,curRole) &&
|
|
||||||
!strcmp(result.Privilege, privilege))
|
|
||||||
{
|
|
||||||
SQLFreeStmt(hstmt, SQL_CLOSE);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
retcode = SQLFetch(hstmt);
|
|
||||||
}
|
|
||||||
|
|
||||||
SQLFreeStmt(hstmt, SQL_CLOSE);
|
|
||||||
return false;
|
|
||||||
} // wxDB::TablePrivileges()
|
|
||||||
|
|
||||||
|
|
||||||
/********** wxDB::SqlLog() **********/
|
/********** wxDB::SqlLog() **********/
|
||||||
bool wxDB::SqlLog(enum sqlLog state, const char *filename, bool append)
|
bool wxDB::SqlLog(enum sqlLog state, const char *filename, bool append)
|
||||||
{
|
{
|
||||||
@@ -2738,4 +2635,3 @@ bool GetDataSource(HENV henv, char *Dsn, SWORD DsnMax, char *DsDesc, SWORD DsDes
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
// wxUSE_ODBC
|
// wxUSE_ODBC
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user