Page 1 of 1

Broken Backup (Column length too big)

Posted: Wed Nov 30, 2011 9:30 am
by Drache
The built-in backup button made some invalid CREATE TABLE statements.

The original table looks like

Code: Select all

mysql> desc ___nu14eccea0f3ffc7___;
+-----------------------------------+--------------+------+-----+---------+-------+
| Field                             | Type         | Null | Key | Default | Extra |
+-----------------------------------+--------------+------+-----+---------+-------+
| zzsys_object_id                   | varchar(15)  | NO   |     | NULL    |       |
| sob_zzsys_form_id                 | varchar(15)  | NO   |     |         |       |
| sob_all_access_key                | char(1)      | YES  |     | NULL    |       |
| sob_all_admin_only                | char(1)      | YES  |     | NULL    |       |
| sob_all_class                     | varchar(50)  | YES  |     | NULL    |       |
| sob_all_clone                     | char(1)      | YES  |     | NULL    |       |
| sob_all_column_number             | int(11)      | YES  | MUL | NULL    |       |
| sob_all_display_condition         | varchar(255) | YES  |     | NULL    |       |
...
while the backup-SQL turns varchar(x) into char(3*x):

Code: Select all

create table ___nu14eccea0f3ffc7___
(
    zzsys_object_id char(45),
    sob_zzsys_form_id char(45),
    sob_all_access_key char(3),
    sob_all_admin_only char(3),
    sob_all_class char(150),
    sob_all_clone char(3),
    sob_all_column_number int,
    sob_all_display_condition char(765),
...
Restoring the backup with:

Code: Select all

mysql -u root -p < backup.sql
fails with
ERROR 1074 (42000) at line XXX: Column length too big for column 'sob_all_display_condition' (max = 255); use BLOB or TEXT instead

I guess there is some conversion playing wrong with UTF-8 but why ??
Ruben

Re: Broken Backup (Column length too big)

Posted: Tue Dec 06, 2011 4:27 am
by admin
Ruben,

Try replacing sqlbackup.php in the attached zip file.
sqlbackup.zip
Steven

Re: Broken Backup (Column length too big)

Posted: Fri Dec 09, 2011 3:02 pm
by Drache
Thank you very much, Steven, that works without errors. But I still have these triple sizes.
The above looks like that now:

Code: Select all

create table ___nu14eda8135d2a1a___
(
    `zzsys_object_id` varchar(45),
    `sob_zzsys_form_id` varchar(45),
    `sob_all_access_key` varchar(3),
    `sob_all_admin_only` varchar(3),
    `sob_all_class` varchar(150),
    `sob_all_clone` varchar(3),
    `sob_all_column_number` int,
    `sob_all_display_condition` varchar(765),
There is a legal but ugly encoding mix. Both my test database and the ___nu***___ tables have a charset of "latin-1" (while the zzsys_* tables were created with charset=utf8).
This will be converted soon and I'll see whether this fixes something.

I'm generally somewhat confused about the Backup feature. I guess the built-in Backup will be a cross-database alternative to mysqldump. But has it some advantage above the latter for MySQL users ?
Ruben

Re: Broken Backup (Column length too big)

Posted: Fri Jan 06, 2012 3:49 am
by admin
Drache,

We have a new (better) version for backup now.

We build and host nuBuilder applications for other companies.

The backup button is for those customers who want to take their own backups.

Steven