To reproduce:
DROP TABLE IF EXISTS buggy;
CREATE TABLE buggy (col1 TEXT, col2 TEXT);
What happens:
When trying to save with the Edit Table window, the SHOW CREATE statement will be parsed
with the comma in with the type - so f->Type becomes "text,". What the end user sees
is that a) it's a TINYINT (since it didn't match anything, so the listbox chooses the
first entry) and b) Editing the table simply won't work, since MyCC will try and put in
something like:
CHANGE `col2` `col2` text, AFTER `col1`,
which is missing a comma.
Solution:
My messy little hack is below.
WARNING: I suck at C++, and this is not well tested, but it seemed to work for me - use at
own risk :).
Anyway, hope this helps. Stay tuned for ENUM difficulties and an equally pitiful hack to
fix them!
---------------
Adam Hooper
adamh@stripped
[adam@hera src]$ diff -C 3 ../../mycc/src/CTableWindow.cpp CTableWindow.cpp
*** ../../mycc/src/CTableWindow.cpp Mon Jun 10 06:54:02 2002
--- CTableWindow.cpp Mon Jun 10 18:40:19 2002
***************
*** 1532,1537 ****
--- 1532,1539 ----
p = line.find(' ');
f->Type = line.left(p);
+ if (f->Type.right(1) == ",")
+ f->Type = f->Type.left(f->Type.length() - 1);
line = line.mid(p + 1).stripWhiteSpace();
p = f->Type.find('(');
***************
*** 1958,1963 ****
--- 1960,1966 ----
else
if (t != tableName)
sql += ", RENAME " + mysql->Quote(t);
+ qDebug(sql);
if (ok = exec(sql))
tableName = t;
}