CMS MADE SIMPLE FORGE

CMS Made Simple Core

 

[#10574] Can't set string 'default' for default value in method.install.php.

avatar
Created By: Karelin (guro)
Date Submitted: Thu Jul 02 22:49:40 -0400 2015

Assigned To:
Version: 1.12
CMSMS Version: 1.12
Severity: Minor
Resolution: Accepted
State: Open
Summary:
Can't set string 'default' for default value in method.install.php.
Detailed Description:
When I do this (in method.install.php in module):
  $flds = "
      obj_id I KEY AUTOINCREMENT,
      sort_fix I(1),
      sort_type C(10) DEFAULT 'default',
      sort_field C(150),
      sort_dir C(5),
      sort_field_type C(7) DEFAULT 'default',
      active I(1),
      obj_tpl I(1)
 	";

  $sqlarray = $dict->CreateTableSQL(GR_TABLE_OBJECTTYPES, $flds, $taboptarray);
  $dict->ExecuteSQLArray($sqlarray);

debug show me this:

(mysql): CREATE TABLE cms_module_grealty_object_types (
obj_id                  INTEGER NOT NULL AUTO_INCREMENT,
sort_fix         INTEGER(1),
sort_type        VARCHAR(10),
C                        150 DEFAULT 'sort_field',
sort_dir         VARCHAR(5),
sort_field_type  VARCHAR(7),
I                        1 DEFAULT 'active',
obj_tpl              INTEGER(1),
         PRIMARY KEY (obj_id)
)ENGINE=MyISAM
Error (1064): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near '150
DEFAULT 'sort_field',....


I solved this like this
in file /lib/adodb_lite/adodb-datadict.inc.php in function _GenFields in string
515 ( after "foreach($f0 as $token) {" ) I insert strings:

  if ($hasparam) {
    $f1[$hasparam] = $token;
    $hasparam = false;
    continue;
  }

Now i can set string 'default' for default value in database field.


History

Comments
avatar
Date: 2015-07-02 23:26
Posted By: Robert Campbell (calguy1000)

This is very minor issue (first time it has come up in 10 years). 
      
Updates

Updated: 2015-07-02 23:26
resolution_id: => 6
severity_id: 2 => 3