- s.sprintf(wxT("Error opening '%s'.\n"), tableName);
- if (!pDb->TableExists(tableName,NULL,tablePath))
- s += wxT("Table/view does not exist in the database.\n");
+ s += ".\n";
+ }
+ 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,"SELECT",NULL,pDb->GetUsername(),tablePath))
+ s = "Current logged in user does not have sufficient privileges to access this table.\n";
+ }
+
+ if (!s.IsEmpty())
+ {
+ wxString p;
+
+ if (wxStrcmp(tablePath,""))
+ p.sprintf("Error opening '%s/%s'.\n",tablePath,tableName);