#include "wx/object.h"
#include "wx/list.h"
#include "wx/utils.h"
- #if wxUSE_GUI
- #include "wx/msgdlg.h"
- #endif
#include "wx/log.h"
#endif
#include "wx/filefn.h"
#include "wx/db.h"
-WXDLLEXPORT_DATA(wxDbList*) PtrBegDbList = 0;
+// DLL options compatibility check:
+#include "wx/app.h"
+WX_CHECK_BUILD_OPTIONS("wxODBC")
+
+WXDLLIMPEXP_DATA_ODBC(wxDbList*) PtrBegDbList = 0;
wxChar const *SQL_LOG_FILENAME = wxT("sqllog.txt");
UserID.Empty();
// dBase does not use user names, and some drivers fail if you try to pass one
- if (Dbms() == dbmsDBASE)
+ if ( Dbms() == dbmsDBASE
+ || Dbms() == dbmsXBASE_SEQUITER )
UserID.Empty();
// Oracle user names may only be in uppercase, so force
{
if (!getDataTypeInfo(SQL_DATE,typeInfDate))
{
- if (!getDataTypeInfo(SQL_DATETIME,typeInfDate))
+#ifdef SQL_DATETIME
+ if (getDataTypeInfo(SQL_DATETIME,typeInfDate))
+ {
+ typeInfDate.FsqlType = SQL_TIME;
+ }
+ else
+#endif // SQL_DATETIME defined
{
if (failOnDataTypeUnsupported)
return(FALSE);
}
- else
- typeInfDate.FsqlType = SQL_TIME;
}
else
typeInfDate.FsqlType = SQL_DATE;
GetData(7,SQL_C_SLONG, (UCHAR *)&precision, 0, &cb);
GetData(8,SQL_C_SLONG, (UCHAR *)&length, 0, &cb);
- outStr.Printf(wxT("%-32s %-32s (%04d)%-15s %9d %9d\n"),
+ outStr.Printf(wxT("%-32s %-32s (%04d)%-15s %9ld %9ld\n"),
tblName, colName, sqlDataType, typeName, precision, length);
if (fputs(outStr.c_str(), fp) == EOF)
{
if (!wxStricmp(baseName,wxT("DBASE")))
return((wxDBMS)(dbmsType = dbmsDBASE));
+ if (!wxStricmp(baseName,wxT("xBase")))
+ return((wxDBMS)(dbmsType = dbmsXBASE_SEQUITER));
+
if (!wxStricmp(baseName,wxT("MySQL")))
return((wxDBMS)(dbmsType = dbmsMY_SQL));
case dbmsPOSTGRES :
case dbmsACCESS :
case dbmsDBASE :
+ case dbmsXBASE_SEQUITER :
default :
alterSlashModify = "MODIFY";
break;
}
// create the SQL statement
- sqlStmt.Printf(wxT("ALTER TABLE \"%s\" \"%s\" \"%s\" %s"), tableName.c_str(), alterSlashModify.c_str(),
+ if ( Dbms() == dbmsMY_SQL )
+ {
+ sqlStmt.Printf(wxT("ALTER TABLE %s %s %s %s"), tableName.c_str(), alterSlashModify.c_str(),
columnName.c_str(), dataTypeName.c_str());
+ }
+ else
+ {
+ 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
if (dataType == DB_DATA_TYPE_VARCHAR &&
(Dbms() != dbmsMY_SQL || dataTypeName != "text"))
{
wxString s;
- s.Printf(wxT("(%d)"), columnLength);
+ s.Printf(wxT("(%lu)"), columnLength);
sqlStmt += s;
}
/********** wxDbGetConnection() **********/
-wxDb WXDLLEXPORT *wxDbGetConnection(wxDbConnectInf *pDbConfig, bool FwdOnlyCursors)
+wxDb WXDLLIMPEXP_ODBC *wxDbGetConnection(wxDbConnectInf *pDbConfig, bool FwdOnlyCursors)
{
wxDbList *pList;
/********** wxDbFreeConnection() **********/
-bool WXDLLEXPORT wxDbFreeConnection(wxDb *pDb)
+bool WXDLLIMPEXP_ODBC wxDbFreeConnection(wxDb *pDb)
{
wxDbList *pList;
/********** wxDbCloseConnections() **********/
-void WXDLLEXPORT wxDbCloseConnections(void)
+void WXDLLIMPEXP_ODBC wxDbCloseConnections(void)
{
wxDbList *pList, *pNext;
/********** wxDbConnectionsInUse() **********/
-int WXDLLEXPORT wxDbConnectionsInUse(void)
+int WXDLLIMPEXP_ODBC wxDbConnectionsInUse(void)
{
wxDbList *pList;
int cnt = 0;
/********** wxDbLogExtendedErrorMsg() **********/
// DEBUG ONLY function
-const wxChar WXDLLEXPORT *wxDbLogExtendedErrorMsg(const wxChar *userText,
+const wxChar* WXDLLIMPEXP_ODBC wxDbLogExtendedErrorMsg(const wxChar *userText,
wxDb *pDb,
const wxChar *ErrFile,
int ErrLine)
return wxDbGetDataSource(henv, Dsn, DsnMax, DsDesc, DsDescMax, direction);
}
/***** DEPRECATED: use wxDbGetConnection() *****/
-wxDb WXDLLEXPORT *GetDbConnection(DbStuff *pDbStuff, bool FwdOnlyCursors)
+wxDb WXDLLIMPEXP_ODBC *GetDbConnection(DbStuff *pDbStuff, bool FwdOnlyCursors)
{
return wxDbGetConnection((wxDbConnectInf *)pDbStuff, FwdOnlyCursors);
}
/***** DEPRECATED: use wxDbFreeConnection() *****/
-bool WXDLLEXPORT FreeDbConnection(wxDb *pDb)
+bool WXDLLIMPEXP_ODBC FreeDbConnection(wxDb *pDb)
{
return wxDbFreeConnection(pDb);
}
/***** DEPRECATED: use wxDbCloseConnections() *****/
-void WXDLLEXPORT CloseDbConnections(void)
+void WXDLLIMPEXP_ODBC CloseDbConnections(void)
{
wxDbCloseConnections();
}
/***** DEPRECATED: use wxDbConnectionsInUse() *****/
-int WXDLLEXPORT NumberDbConnectionsInUse(void)
+int WXDLLIMPEXP_ODBC NumberDbConnectionsInUse(void)
{
return wxDbConnectionsInUse();
}