dBase fix on creating index
General cleanup of code in the sample git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@10161 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
ea24eeb2db
commit
5a226de062
@ -3221,30 +3221,35 @@ bool wxDb::TablePrivileges(const wxString &tableName, const wxString &priv, cons
|
|||||||
if ((retcode != SQL_SUCCESS) && (retcode != SQL_SUCCESS_WITH_INFO))
|
if ((retcode != SQL_SUCCESS) && (retcode != SQL_SUCCESS_WITH_INFO))
|
||||||
return(DispAllErrors(henv, hdbc, hstmt));
|
return(DispAllErrors(henv, hdbc, hstmt));
|
||||||
|
|
||||||
|
bool failed = FALSE;
|
||||||
retcode = SQLFetch(hstmt);
|
retcode = SQLFetch(hstmt);
|
||||||
while (retcode == SQL_SUCCESS || retcode == SQL_SUCCESS_WITH_INFO)
|
while (retcode == SQL_SUCCESS || retcode == SQL_SUCCESS_WITH_INFO)
|
||||||
{
|
{
|
||||||
if (SQLGetData(hstmt, 1, SQL_C_CHAR, (UCHAR*) result.tableQual, sizeof(result.tableQual), &cbRetVal) != SQL_SUCCESS)
|
if (SQLGetData(hstmt, 1, SQL_C_CHAR, (UCHAR*) result.tableQual, sizeof(result.tableQual), &cbRetVal) != SQL_SUCCESS)
|
||||||
return(DispAllErrors(henv, hdbc, hstmt));
|
failed = true;
|
||||||
|
|
||||||
if (SQLGetData(hstmt, 2, SQL_C_CHAR, (UCHAR*) result.tableOwner, sizeof(result.tableOwner), &cbRetVal) != SQL_SUCCESS)
|
if (!failed && SQLGetData(hstmt, 2, SQL_C_CHAR, (UCHAR*) result.tableOwner, sizeof(result.tableOwner), &cbRetVal) != SQL_SUCCESS)
|
||||||
return(DispAllErrors(henv, hdbc, hstmt));
|
failed = true;
|
||||||
|
|
||||||
if (SQLGetData(hstmt, 3, SQL_C_CHAR, (UCHAR*) result.tableName, sizeof(result.tableName), &cbRetVal) != SQL_SUCCESS)
|
if (!failed && SQLGetData(hstmt, 3, SQL_C_CHAR, (UCHAR*) result.tableName, sizeof(result.tableName), &cbRetVal) != SQL_SUCCESS)
|
||||||
return(DispAllErrors(henv, hdbc, hstmt));
|
failed = true;
|
||||||
|
|
||||||
if (SQLGetData(hstmt, 4, SQL_C_CHAR, (UCHAR*) result.grantor, sizeof(result.grantor), &cbRetVal) != SQL_SUCCESS)
|
if (!failed && SQLGetData(hstmt, 4, SQL_C_CHAR, (UCHAR*) result.grantor, sizeof(result.grantor), &cbRetVal) != SQL_SUCCESS)
|
||||||
return(DispAllErrors(henv, hdbc, hstmt));
|
failed = true;
|
||||||
|
|
||||||
if (SQLGetData(hstmt, 5, SQL_C_CHAR, (UCHAR*) result.grantee, sizeof(result.grantee), &cbRetVal) != SQL_SUCCESS)
|
if (!failed && SQLGetData(hstmt, 5, SQL_C_CHAR, (UCHAR*) result.grantee, sizeof(result.grantee), &cbRetVal) != SQL_SUCCESS)
|
||||||
return(DispAllErrors(henv, hdbc, hstmt));
|
failed = true;
|
||||||
|
|
||||||
if (SQLGetData(hstmt, 6, SQL_C_CHAR, (UCHAR*) result.privilege, sizeof(result.privilege), &cbRetVal) != SQL_SUCCESS)
|
if (!failed && SQLGetData(hstmt, 6, SQL_C_CHAR, (UCHAR*) result.privilege, sizeof(result.privilege), &cbRetVal) != SQL_SUCCESS)
|
||||||
return(DispAllErrors(henv, hdbc, hstmt));
|
failed = true;
|
||||||
|
|
||||||
if (SQLGetData(hstmt, 7, SQL_C_CHAR, (UCHAR*) result.grantable, sizeof(result.grantable), &cbRetVal) != SQL_SUCCESS)
|
if (!failed && SQLGetData(hstmt, 7, SQL_C_CHAR, (UCHAR*) result.grantable, sizeof(result.grantable), &cbRetVal) != SQL_SUCCESS)
|
||||||
return(DispAllErrors(henv, hdbc, hstmt));
|
failed = true;
|
||||||
|
|
||||||
|
if (failed)
|
||||||
|
{
|
||||||
|
return(DispAllErrors(henv, hdbc, hstmt));
|
||||||
|
}
|
||||||
#ifdef DBDEBUG_CONSOLE
|
#ifdef DBDEBUG_CONSOLE
|
||||||
fprintf(stderr,wxT("Scanning %s privilege on table %s.%s granted by %s to %s\n"),
|
fprintf(stderr,wxT("Scanning %s privilege on table %s.%s granted by %s to %s\n"),
|
||||||
result.privilege,result.tableOwner,result.tableName,
|
result.privilege,result.tableOwner,result.tableName,
|
||||||
|
@ -1512,6 +1512,9 @@ bool wxDbTable::DropTable()
|
|||||||
cout << endl << sqlStmt.c_str() << endl;
|
cout << endl << sqlStmt.c_str() << endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
RETCODE retcode = SQLExecDirect(hstmt, (UCHAR FAR *) sqlStmt.c_str(), SQL_NTS);
|
RETCODE retcode = SQLExecDirect(hstmt, (UCHAR FAR *) sqlStmt.c_str(), SQL_NTS);
|
||||||
if (retcode != SQL_SUCCESS)
|
if (retcode != SQL_SUCCESS)
|
||||||
{
|
{
|
||||||
@ -1529,7 +1532,7 @@ bool wxDbTable::DropTable()
|
|||||||
pDb->DispNextError();
|
pDb->DispNextError();
|
||||||
pDb->DispAllErrors(henv, hdbc, hstmt);
|
pDb->DispAllErrors(henv, hdbc, hstmt);
|
||||||
pDb->RollbackTrans();
|
pDb->RollbackTrans();
|
||||||
CloseCursor(hstmt);
|
// CloseCursor(hstmt);
|
||||||
return(FALSE);
|
return(FALSE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1680,7 +1683,8 @@ bool wxDbTable::DropIndex(const wxString &idxName)
|
|||||||
|
|
||||||
wxString sqlStmt;
|
wxString sqlStmt;
|
||||||
|
|
||||||
if (pDb->Dbms() == dbmsACCESS || pDb->Dbms() == dbmsMY_SQL)
|
if (pDb->Dbms() == dbmsACCESS || pDb->Dbms() == dbmsMY_SQL ||
|
||||||
|
pDb->Dbms() == dbmsDBASE /*|| Paradox needs this syntax too when we add support*/)
|
||||||
sqlStmt.Printf(wxT("DROP INDEX %s ON %s"),idxName.c_str(), tableName.c_str());
|
sqlStmt.Printf(wxT("DROP INDEX %s ON %s"),idxName.c_str(), tableName.c_str());
|
||||||
else if ((pDb->Dbms() == dbmsMS_SQL_SERVER) ||
|
else if ((pDb->Dbms() == dbmsMS_SQL_SERVER) ||
|
||||||
(pDb->Dbms() == dbmsSYBASE_ASE))
|
(pDb->Dbms() == dbmsSYBASE_ASE))
|
||||||
|
Loading…
Reference in New Issue
Block a user