}
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
}
}
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(")");
/********** 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;
/********** 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)
{
/********** 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];