In-Portal Issue Tracker

Welcome to the In-Portal Open Source CMS Issue Tracker! This is a central management / tracking tool for all types of tasks / issues / bugs for the In-Portal Project. Before reporting any issues, please make sure to read the Guide into Issue Tracker and How to Properly Test and Report Bugs!

Dependency Graph View Issue ] Relation Graph ] Vertical ]
related to child of duplicate of

Viewing Issue Simple Details
ID Category Type Reproducibility Date Submitted Last Update
0000707 [In-Portal CMS] Database bug report always 2010-04-25 08:34 2010-11-30 12:48
Reporter alex View Status public  
Assigned To alex
Priority normal Resolution fixed  
Status closed      
Summary 0000707: SQL Error during usage of "Re-build Multilanguage Fields" functionality
Description In MySQL 5.x versions output format of "DESCRIBE" sql statement has changed. In particular it returns "NULL" instead of default column value even for "NOT NULL" fields, that were added to table without specifying actual default value.

That have raised a problem in 3 system places:
1. unit config "Fields" array validator (enable "DBG_VALIDATE_CONFIGS" in "debug.php" and press "Reset Configs Cache" in "System Tools" section.
2. unit config "Fields" array builder (enter table name into "Table Structure" input in "System Tools" section and press "Run" near it)
3. "Re-build Multilanguage Fields" functionality (button in "System Tools" section).

In all mentioned above places NOT NULL fields can have NULL as default value and this can lead to SQL fatal error.

For items "1." and "2." I propose to guess default value using following rule:
 * NULL for fields, that can be NULL
 * empty string for textual fields
 * 0 for numeric fields

For "3." item I propose to omit "DEFAULT ..." statement from "ALTER TABLE ..." database query when we have retrieved "NULL" as default value for "NOT NULL" field.
Additional Information In global scale phpMyAdmin displays "None", when "DEFAULT ..." statement was omitted during table creation/column adding. When we have default value, then it is used. When we don't have default value, then default value will be:

    * NULL for fields, that can be NULL
    * empty string for textual fields
    * 0 for numeric fields

We need to updated following places to reflect that:

    * remove "DEFAULT ..." statement from "install_schema.sql" file, when it matches default value auto-assigned from previous list
    * update unit config validator to support ommited "DEFAULT ..." statements
    * update translatable field auto-creator (partially what Sergey posted) to skip "DEFAULT ..." in ALTER TABLE statements, when field's default value matches the one, that MySQL will use automatically

This all can be successfully done based on DESCRIBE results. Omitted "DEFAULT ..." statement is shown differently on DESCRIBE sql only since 5.x version of MySQL. Although omitted "DEFAULT ..." statement was allowed in 4.x version of MySQL too, but DESCRIBE showed actual default value, what MySQL will use for NOT NULL fields and not NULL as 5.x MySQL does.

Web Development by Intechnic
In-Portal Open Source CMS
In-Portal Open Source CMS
Copyright © 2000 - 2009 MantisBT Group

Powered by Mantis Bugtracker