X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/6b3f4fb87535df6514c256dc89c6a1abf12c59b4..942bef71b0d8ff9375c08ac5082c6a45686644fb:/src/common/dbtable.cpp diff --git a/src/common/dbtable.cpp b/src/common/dbtable.cpp index 524fb96e8e..a9cd88abb1 100644 --- a/src/common/dbtable.cpp +++ b/src/common/dbtable.cpp @@ -1399,16 +1399,23 @@ bool wxDbTable::CreateTable(bool attemptDrop) } if (j && pDb->Dbms() != dbmsDBASE) // Found a keyfield { - if (pDb->Dbms() != dbmsMY_SQL) + switch (pDb->Dbms()) { - sqlStmt += wxT(",CONSTRAINT "); - sqlStmt += tableName; - sqlStmt += wxT("_PIDX PRIMARY KEY ("); - } - else - { - /* MySQL goes out on this one. We also declare the relevant key NON NULL above */ - sqlStmt += wxT(", PRIMARY KEY ("); + case dbmsSYBASE_ASA: + case dbmsSYBASE_ASE: + case dbmsMY_SQL: + { + /* MySQL goes out on this one. We also declare the relevant key NON NULL above */ + sqlStmt += wxT(",PRIMARY KEY ("); + break; + } + default: + { + sqlStmt += wxT(",CONSTRAINT "); + sqlStmt += tableName; + sqlStmt += wxT("_PIDX PRIMARY KEY ("); + break; + } } // List column name(s) of column(s) comprising the primary key @@ -1422,6 +1429,14 @@ bool wxDbTable::CreateTable(bool attemptDrop) } } sqlStmt += wxT(")"); + + if (pDb->Dbms() == dbmsSYBASE_ASA || + pDb->Dbms() == dbmsSYBASE_ASE) + { + sqlStmt += wxT(" CONSTRAINT "); + sqlStmt += tableName; + sqlStmt += wxT("_PIDX"); + } } // Append the closing parentheses for the create table statement sqlStmt += wxT(")"); @@ -1504,7 +1519,8 @@ bool wxDbTable::DropTable() /********** wxDbTable::CreateIndex() **********/ -bool wxDbTable::CreateIndex(const wxString &idxName, bool unique, int noIdxCols, wxDbIdxDef *pIdxDefs, bool attemptDrop) +bool wxDbTable::CreateIndex(const wxString &idxName, bool unique, UWORD noIdxCols, + wxDbIdxDef *pIdxDefs, bool attemptDrop) { wxString sqlStmt; @@ -1686,9 +1702,9 @@ bool wxDbTable::DropIndex(const wxString &idxName) /********** wxDbTable::SetOrderByColNums() **********/ -bool wxDbTable::SetOrderByColNums(int first, ... ) +bool wxDbTable::SetOrderByColNums(UWORD first, ... ) { - int colNo = first; + int colNo = first; // using 'int' to be able to look for wxDB_NO_MORE_COLUN_NUMBERS va_list argptr; bool abort = FALSE; @@ -1879,7 +1895,7 @@ bool wxDbTable::DeleteMatching(void) /********** wxDbTable::IsColNull() **********/ -bool wxDbTable::IsColNull(int colNo) +bool wxDbTable::IsColNull(UWORD colNo) { /* This logic is just not right. It would indicate TRUE @@ -1964,7 +1980,7 @@ bool wxDbTable::IsCursorClosedOnCommit(void) /********** wxDbTable::ClearMemberVar() **********/ -void wxDbTable::ClearMemberVar(int colNo, bool setToNull) +void wxDbTable::ClearMemberVar(UWORD colNo, bool setToNull) { wxASSERT(colNo < noCols); @@ -2040,7 +2056,7 @@ bool wxDbTable::SetQueryTimeout(UDWORD nSeconds) /********** wxDbTable::SetColDefs() **********/ -void wxDbTable::SetColDefs(int index, const wxString &fieldName, int dataType, void *pData, +void wxDbTable::SetColDefs(UWORD index, const wxString &fieldName, int dataType, void *pData, SWORD cType, int size, bool keyField, bool upd, bool insAllow, bool derivedCol) { @@ -2079,14 +2095,14 @@ void wxDbTable::SetColDefs(int index, const wxString &fieldName, int dataType, v /********** wxDbTable::SetColDefs() **********/ -wxDbColDataPtr* wxDbTable::SetColDefs(wxDbColInf *pColInfs, ULONG numCols) +wxDbColDataPtr* wxDbTable::SetColDefs(wxDbColInf *pColInfs, UWORD numCols) { wxASSERT(pColInfs); wxDbColDataPtr *pColDataPtrs = NULL; if (pColInfs) { - ULONG index; + UWORD index; pColDataPtrs = new wxDbColDataPtr[numCols+1]; @@ -2313,8 +2329,8 @@ bool wxDbTable::Refresh(void) } // wxDbTable::Refresh() -/********** wxDbTable::SetColNull(int colNo, bool set) **********/ -bool wxDbTable::SetColNull(int colNo, bool set) +/********** wxDbTable::SetColNull() **********/ +bool wxDbTable::SetColNull(UWORD colNo, bool set) { if (colNo < noCols) { @@ -2329,7 +2345,7 @@ bool wxDbTable::SetColNull(int colNo, bool set) } // wxDbTable::SetColNull() -/********** wxDbTable::SetColNull(const wxString &colName, bool set) **********/ +/********** wxDbTable::SetColNull() **********/ bool wxDbTable::SetColNull(const wxString &colName, bool set) { int i;