Removed TABs that had gotten in to the source
Added more INTERBASE support fixes git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@10292 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -366,9 +366,9 @@ int wxDbColFor::Format(int Nation, int dbDataType, SWORD sqlDataType,
|
|||||||
s_Field = wxT("%02d/%02d/%04d %02d:%02d:%02d.%03d");
|
s_Field = wxT("%02d/%02d/%04d %02d:%02d:%02d.%03d");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case DB_DATA_TYPE_BLOB:
|
case DB_DATA_TYPE_BLOB:
|
||||||
s_Field.Printf(wxT("Unable to format(%d)-SQL(%d)"),dbDataType,sqlDataType); //
|
s_Field.Printf(wxT("Unable to format(%d)-SQL(%d)"),dbDataType,sqlDataType); //
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
s_Field.Printf(wxT("Unknown Format(%d)-SQL(%d)"),dbDataType,sqlDataType); //
|
s_Field.Printf(wxT("Unknown Format(%d)-SQL(%d)"),dbDataType,sqlDataType); //
|
||||||
break;
|
break;
|
||||||
@@ -619,12 +619,12 @@ bool wxDb::Open(const wxString &Dsn, const wxString &Uid, const wxString &AuthSt
|
|||||||
else if (retcode != SQL_SUCCESS)
|
else if (retcode != SQL_SUCCESS)
|
||||||
return(DispAllErrors(henv, hdbc));
|
return(DispAllErrors(henv, hdbc));
|
||||||
|
|
||||||
if (retcode == SQL_ERROR)
|
if (retcode == SQL_ERROR)
|
||||||
return(DispAllErrors(henv, hdbc));
|
return(DispAllErrors(henv, hdbc));
|
||||||
*/
|
*/
|
||||||
if ((retcode != SQL_SUCCESS) &&
|
if ((retcode != SQL_SUCCESS) &&
|
||||||
(retcode != SQL_SUCCESS_WITH_INFO))
|
(retcode != SQL_SUCCESS_WITH_INFO))
|
||||||
return(DispAllErrors(henv, hdbc));
|
return(DispAllErrors(henv, hdbc));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
If using Intersolv branded ODBC drivers, this is the place where you would substitute
|
If using Intersolv branded ODBC drivers, this is the place where you would substitute
|
||||||
@@ -807,8 +807,8 @@ bool wxDb::Open(wxDb *copyDb)
|
|||||||
(UCHAR FAR *) uid.c_str(), SQL_NTS,
|
(UCHAR FAR *) uid.c_str(), SQL_NTS,
|
||||||
(UCHAR FAR *) authStr.c_str(), SQL_NTS);
|
(UCHAR FAR *) authStr.c_str(), SQL_NTS);
|
||||||
|
|
||||||
if (retcode == SQL_ERROR)
|
if (retcode == SQL_ERROR)
|
||||||
return(DispAllErrors(henv, hdbc));
|
return(DispAllErrors(henv, hdbc));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
If using Intersolv branded ODBC drivers, this is the place where you would substitute
|
If using Intersolv branded ODBC drivers, this is the place where you would substitute
|
||||||
@@ -927,7 +927,7 @@ bool wxDb::setConnectionOptions(void)
|
|||||||
|
|
||||||
SQLSetConnectOption(hdbc, SQL_AUTOCOMMIT, SQL_AUTOCOMMIT_OFF);
|
SQLSetConnectOption(hdbc, SQL_AUTOCOMMIT, SQL_AUTOCOMMIT_OFF);
|
||||||
SQLSetConnectOption(hdbc, SQL_OPT_TRACE, SQL_OPT_TRACE_OFF);
|
SQLSetConnectOption(hdbc, SQL_OPT_TRACE, SQL_OPT_TRACE_OFF);
|
||||||
// SQLSetConnectOption(hdbc, SQL_TXN_ISOLATION, SQL_TXN_READ_COMMITTED); // No dirty reads
|
// SQLSetConnectOption(hdbc, SQL_TXN_ISOLATION, SQL_TXN_READ_COMMITTED); // No dirty reads
|
||||||
|
|
||||||
// By default, MS Sql Server closes cursors on commit and rollback. The following
|
// By default, MS Sql Server closes cursors on commit and rollback. The following
|
||||||
// call to SQLSetConnectOption() is needed to force SQL Server to preserve cursors
|
// call to SQLSetConnectOption() is needed to force SQL Server to preserve cursors
|
||||||
@@ -1426,7 +1426,7 @@ void wxDb::Close(void)
|
|||||||
for (i = 0; i < DB_MAX_ERROR_HISTORY; i++)
|
for (i = 0; i < DB_MAX_ERROR_HISTORY; i++)
|
||||||
wxStrcpy(DBerrorList[i], errorList[i]);
|
wxStrcpy(DBerrorList[i], errorList[i]);
|
||||||
|
|
||||||
dbmsType = dbmsUNIDENTIFIED;
|
dbmsType = dbmsUNIDENTIFIED;
|
||||||
dbIsOpen = FALSE;
|
dbIsOpen = FALSE;
|
||||||
|
|
||||||
} // wxDb::Close()
|
} // wxDb::Close()
|
||||||
@@ -2111,8 +2111,8 @@ wxDbColInf *wxDb::GetColumns(wxChar *tableName[], const wxChar *userID)
|
|||||||
* to avoid undesired unbinding of columns.
|
* to avoid undesired unbinding of columns.
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
UWORD noCols = 0;
|
UWORD noCols = 0;
|
||||||
UWORD colNo = 0;
|
UWORD colNo = 0;
|
||||||
wxDbColInf *colInf = 0;
|
wxDbColInf *colInf = 0;
|
||||||
|
|
||||||
RETCODE retcode;
|
RETCODE retcode;
|
||||||
@@ -3004,6 +3004,7 @@ bool wxDb::Catalog(const wxChar *userID, const wxString &fileName)
|
|||||||
if (!UserID.IsEmpty() &&
|
if (!UserID.IsEmpty() &&
|
||||||
Dbms() != dbmsMY_SQL &&
|
Dbms() != dbmsMY_SQL &&
|
||||||
Dbms() != dbmsACCESS &&
|
Dbms() != dbmsACCESS &&
|
||||||
|
Dbms() != dbmsINTERBASE &&
|
||||||
Dbms() != dbmsMS_SQL_SERVER)
|
Dbms() != dbmsMS_SQL_SERVER)
|
||||||
{
|
{
|
||||||
retcode = SQLColumns(hstmt,
|
retcode = SQLColumns(hstmt,
|
||||||
@@ -3132,6 +3133,7 @@ bool wxDb::TableExists(const wxString &tableName, const wxChar *userID, const wx
|
|||||||
Dbms() != dbmsACCESS &&
|
Dbms() != dbmsACCESS &&
|
||||||
Dbms() != dbmsMS_SQL_SERVER &&
|
Dbms() != dbmsMS_SQL_SERVER &&
|
||||||
Dbms() != dbmsDB2 &&
|
Dbms() != dbmsDB2 &&
|
||||||
|
Dbms() != dbmsINTERBASE &&
|
||||||
Dbms() != dbmsPERVASIVE_SQL)
|
Dbms() != dbmsPERVASIVE_SQL)
|
||||||
{
|
{
|
||||||
retcode = SQLTables(hstmt,
|
retcode = SQLTables(hstmt,
|
||||||
@@ -3393,6 +3395,10 @@ wxDBMS wxDb::Dbms(void)
|
|||||||
*
|
*
|
||||||
* PERVASIVE SQL
|
* PERVASIVE SQL
|
||||||
*
|
*
|
||||||
|
* INTERBASE
|
||||||
|
* - Columns that are part of primary keys must be defined as being NOT NULL
|
||||||
|
* when they are created. Some code is added in ::CreateIndex to try to adjust the
|
||||||
|
* column definition if it is not defined correctly, but it is experimental
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
// Should only need to do this once for each new database connection
|
// Should only need to do this once for each new database connection
|
||||||
@@ -3425,9 +3431,9 @@ wxDBMS wxDb::Dbms(void)
|
|||||||
{
|
{
|
||||||
if (!wxStrncmp(dbInf.driverName, wxT("oplodbc"), 7) ||
|
if (!wxStrncmp(dbInf.driverName, wxT("oplodbc"), 7) ||
|
||||||
!wxStrncmp(dbInf.driverName, wxT("OLOD"), 4))
|
!wxStrncmp(dbInf.driverName, wxT("OLOD"), 4))
|
||||||
return ((wxDBMS)(dbmsMS_SQL_SERVER));
|
return ((wxDBMS)(dbmsMS_SQL_SERVER));
|
||||||
else
|
else
|
||||||
return ((wxDBMS)(dbmsType = dbmsSYBASE_ASE));
|
return ((wxDBMS)(dbmsType = dbmsSYBASE_ASE));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!wxStricmp(dbInf.dbmsName,wxT("Microsoft SQL Server")))
|
if (!wxStricmp(dbInf.dbmsName,wxT("Microsoft SQL Server")))
|
||||||
@@ -3438,8 +3444,8 @@ wxDBMS wxDb::Dbms(void)
|
|||||||
return((wxDBMS)(dbmsType = dbmsPOSTGRES));
|
return((wxDBMS)(dbmsType = dbmsPOSTGRES));
|
||||||
|
|
||||||
baseName[9] = 0;
|
baseName[9] = 0;
|
||||||
if (!wxStricmp(dbInf.dbmsName,wxT("Pervasive")))
|
if (!wxStricmp(dbInf.dbmsName,wxT("Pervasive")))
|
||||||
return((wxDBMS)(dbmsType = dbmsPERVASIVE_SQL));
|
return((wxDBMS)(dbmsType = dbmsPERVASIVE_SQL));
|
||||||
|
|
||||||
baseName[8] = 0;
|
baseName[8] = 0;
|
||||||
if (!wxStricmp(baseName,wxT("Informix")))
|
if (!wxStricmp(baseName,wxT("Informix")))
|
||||||
@@ -3482,55 +3488,55 @@ bool wxDb::ModifyColumn(const wxString &tableName, const wxString &columnName,
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
wxString dataTypeName;
|
wxString dataTypeName;
|
||||||
wxString sqlStmt;
|
wxString sqlStmt;
|
||||||
wxString alterSlashModify;
|
wxString alterSlashModify;
|
||||||
|
|
||||||
switch(dataType)
|
switch(dataType)
|
||||||
{
|
{
|
||||||
case DB_DATA_TYPE_VARCHAR :
|
case DB_DATA_TYPE_VARCHAR :
|
||||||
dataTypeName = typeInfVarchar.TypeName;
|
dataTypeName = typeInfVarchar.TypeName;
|
||||||
break;
|
break;
|
||||||
case DB_DATA_TYPE_INTEGER :
|
case DB_DATA_TYPE_INTEGER :
|
||||||
dataTypeName = typeInfInteger.TypeName;
|
dataTypeName = typeInfInteger.TypeName;
|
||||||
break;
|
break;
|
||||||
case DB_DATA_TYPE_FLOAT :
|
case DB_DATA_TYPE_FLOAT :
|
||||||
dataTypeName = typeInfFloat.TypeName;
|
dataTypeName = typeInfFloat.TypeName;
|
||||||
break;
|
break;
|
||||||
case DB_DATA_TYPE_DATE :
|
case DB_DATA_TYPE_DATE :
|
||||||
dataTypeName = typeInfDate.TypeName;
|
dataTypeName = typeInfDate.TypeName;
|
||||||
break;
|
break;
|
||||||
case DB_DATA_TYPE_BLOB :
|
case DB_DATA_TYPE_BLOB :
|
||||||
dataTypeName = typeInfBlob.TypeName;
|
dataTypeName = typeInfBlob.TypeName;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set the modify or alter syntax depending on the type of database connected to
|
|
||||||
switch (Dbms())
|
|
||||||
{
|
|
||||||
case dbmsORACLE :
|
|
||||||
alterSlashModify = "MODIFY";
|
|
||||||
break;
|
|
||||||
case dbmsMS_SQL_SERVER :
|
|
||||||
alterSlashModify = "ALTER COLUMN";
|
|
||||||
break;
|
|
||||||
case dbmsUNIDENTIFIED :
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
case dbmsSYBASE_ASA :
|
}
|
||||||
case dbmsSYBASE_ASE :
|
|
||||||
case dbmsMY_SQL :
|
|
||||||
case dbmsPOSTGRES :
|
|
||||||
case dbmsACCESS :
|
|
||||||
case dbmsDBASE :
|
|
||||||
default :
|
|
||||||
alterSlashModify = "MODIFY";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
// create the SQL statement
|
// Set the modify or alter syntax depending on the type of database connected to
|
||||||
sqlStmt.Printf(wxT("ALTER TABLE %s %s %s %s"), tableName.c_str(), alterSlashModify.c_str(),
|
switch (Dbms())
|
||||||
columnName.c_str(), dataTypeName.c_str());
|
{
|
||||||
|
case dbmsORACLE :
|
||||||
|
alterSlashModify = "MODIFY";
|
||||||
|
break;
|
||||||
|
case dbmsMS_SQL_SERVER :
|
||||||
|
alterSlashModify = "ALTER COLUMN";
|
||||||
|
break;
|
||||||
|
case dbmsUNIDENTIFIED :
|
||||||
|
return FALSE;
|
||||||
|
case dbmsSYBASE_ASA :
|
||||||
|
case dbmsSYBASE_ASE :
|
||||||
|
case dbmsMY_SQL :
|
||||||
|
case dbmsPOSTGRES :
|
||||||
|
case dbmsACCESS :
|
||||||
|
case dbmsDBASE :
|
||||||
|
default :
|
||||||
|
alterSlashModify = "MODIFY";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// create the SQL statement
|
||||||
|
sqlStmt.Printf(wxT("ALTER TABLE %s %s %s %s"), tableName.c_str(), alterSlashModify.c_str(),
|
||||||
|
columnName.c_str(), dataTypeName.c_str());
|
||||||
|
|
||||||
// For varchars only, append the size of the column
|
// For varchars only, append the size of the column
|
||||||
if (dataType == DB_DATA_TYPE_VARCHAR)
|
if (dataType == DB_DATA_TYPE_VARCHAR)
|
||||||
@@ -3547,7 +3553,7 @@ bool wxDb::ModifyColumn(const wxString &tableName, const wxString &columnName,
|
|||||||
sqlStmt += optionalParam;
|
sqlStmt += optionalParam;
|
||||||
}
|
}
|
||||||
|
|
||||||
return ExecSql(sqlStmt);
|
return ExecSql(sqlStmt);
|
||||||
|
|
||||||
} // wxDb::ModifyColumn()
|
} // wxDb::ModifyColumn()
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user