Changeset 2864
- Timestamp:
- 01/20/07 15:10:13 (2 years ago)
- Location:
- sandbox/lib
- Files:
-
- 2 modified
-
model/plugin.php (modified) (2 diffs)
-
plugins.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
sandbox/lib/model/plugin.php
r2777 r2864 81 81 } else { 82 82 $query = "CREATE TABLE {$database['prefix']}{$name} (owner int(11) NOT NULL default '0',"; 83 83 $isaiExists = false; 84 84 foreach($fields as $field) { 85 $ai = ''; 86 if( strtolower($field['attribute']) == 'int' || strtolower($field['attribute']) == 'mediumint' ){ 87 if( true == $field['autoincrement'] && ! $isaiExists){ 88 $ai = ' AUTO_INCREMENT '; 89 $isaiExists = true; 90 } 91 } 85 92 $isNull = ($field['isnull'] == 0) ? ' NOT NULL ' : ' NULL '; 86 93 $defaultValue = is_null($field['default']) ? '' : " DEFAULT '" . mysql_tt_escape_string($field['default']) . "' "; 87 94 $fieldLength = ($field['length'] >= 0) ? "(".$field['length'].")" : ''; 88 $sentence = $field['name'] . " " . $field['attribute'] . $fieldLength . $isNull . $defaultValue . ",";95 $sentence = $field['name'] . " " . $field['attribute'] . $fieldLength . $isNull . $defaultValue . $ai . ","; 89 96 $query .= $sentence; 90 97 } … … 94 101 $query .= ") TYPE=MyISAM "; 95 102 $query .= ($database['utf8'] == true) ? 'DEFAULT CHARSET=utf8' : ''; 96 97 103 if (DBQuery::execute($query)) { 98 104 $keyname = mysql_tt_escape_string(mysql_lessen('Database_' . $name, 32)); -
sandbox/lib/plugins.php
r2777 r2864 49 49 $fieldIsNull = isset($field['isnull']) ? $field['isnull'][0]['.value'] : 1; 50 50 $fieldDefault = isset($field['default']) ? $field['default'][0]['.value'] : null; 51 $ai = isset($field['autoincrement']) ? $field['autoincrement'][0]['.value'] == '1' : false; 51 52 52 array_push($storageMappings, array('name' => $fieldName, 'attribute' => $fieldAttribute, 'length' => $fieldLength, 'isnull' => $fieldIsNull, 'default' => $fieldDefault ));53 array_push($storageMappings, array('name' => $fieldName, 'attribute' => $fieldAttribute, 'length' => $fieldLength, 'isnull' => $fieldIsNull, 'default' => $fieldDefault , 'autoincrement' => $ai)); 53 54 } 54 55 }
