summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
362a97b)
Blind postgres fixes for calls to TableExists() and TablePrivileges() inside the Open() function to not pass the user name when postgres is expecting the schema. We REALLY need to add schema support...wish I had the time
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@31184
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
+
+ bool exists = true;
+ if (checkTableExists)
+ {
+ if (pDb->Dbms() == dbmsPOSTGRES)
+ exists = pDb->TableExists(tableName, NULL, tablePath);
+ else
+ exists = pDb->TableExists(tableName, pDb->GetUsername(), tablePath);
+ }
+
// Verify that the table exists in the database
// Verify that the table exists in the database
- if (checkTableExists && !pDb->TableExists(tableName, pDb->GetUsername(), tablePath))
{
s = wxT("Table/view does not exist in the database");
if ( *(pDb->dbInf.accessibleTables) == wxT('Y'))
{
s = wxT("Table/view does not exist in the database");
if ( *(pDb->dbInf.accessibleTables) == wxT('Y'))
else if (checkPrivileges)
{
// Verify the user has rights to access the table.
else if (checkPrivileges)
{
// Verify the user has rights to access the table.
- // Shortcut boolean evaluation to optimize out call to
- // TablePrivileges
- //
- // Unfortunately this optimization doesn't seem to be
- // reliable!
- if (// *(pDb->dbInf.accessibleTables) == 'N' &&
- !pDb->TablePrivileges(tableName, wxT("SELECT"), pDb->GetUsername(), pDb->GetUsername(), tablePath))
+ bool hasPrivs = true;
+ if (pDb->Dbms() == dbmsPOSTGRES)
+ hasPrivs = pDb->TablePrivileges(tableName, wxT("SELECT"), pDb->GetUsername(), NULL, tablePath);
+ else
+ hasPrivs = pDb->TablePrivileges(tableName, wxT("SELECT"), pDb->GetUsername(), pDb->GetUsername(), tablePath);
+
+ if (!hasPrivs)
s = wxT("Connecting user does not have sufficient privileges to access this table.\n");
}
s = wxT("Connecting user does not have sufficient privileges to access this table.\n");
}
{
switch (colDefs[colNumber].SqlCtype)
{
{
switch (colDefs[colNumber].SqlCtype)
{
+ case SQL_WCHAR:
+ case SQL_WVARCHAR:
case SQL_CHAR:
case SQL_VARCHAR:
val = (wxChar *)(colDefs[colNumber].PtrDataObj);
case SQL_CHAR:
case SQL_VARCHAR:
val = (wxChar *)(colDefs[colNumber].PtrDataObj);
switch (colDefs[colNumber].SqlCtype)
{
switch (colDefs[colNumber].SqlCtype)
{
+ case SQL_WCHAR:
+ case SQL_WVARCHAR:
case SQL_CHAR:
case SQL_VARCHAR:
csstrncpyt((wxChar *)(colDefs[colNumber].PtrDataObj),
case SQL_CHAR:
case SQL_VARCHAR:
csstrncpyt((wxChar *)(colDefs[colNumber].PtrDataObj),