Applied patch [ 649284 ] Fix wxODBC to work with MySQL 2.x
The current sample/db fails to build indexes with MyODBC v2.50.39 This is due to two problems: (1) wxDb::ModifyColumn() created a SQL statement that was not correctly formed for MySQL. This problem caused wxDbTable::CreateIndex() to fail to set the columns that are going to indexes to be NOT NULL. I fixed this by added a special case for MySQL. (2) When creating an Index on a VARCHAR column, MySQL requires a key length to be specified. wxDbTable::CreateIndex() current does not do this. I fixed this problem by adding code to do this. The attached patch file patches dbtable.cpp and db.cpp on the 2.5 branch. gor Mikolic-Torreira git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@18145 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -3576,8 +3576,16 @@ bool wxDb::ModifyColumn(const wxString &tableName, const wxString &columnName,
|
||||
}
|
||||
|
||||
// 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 &&
|
||||
|
Reference in New Issue
Block a user