@@ -11,7 +11,6 @@ class tabledef{
1111 public $ pdodsn = null ;
1212 public $ sql = array ();
1313 public $ key = false ;
14- public $ extra = false ;
1514
1615 function setTables (){
1716
@@ -264,13 +263,13 @@ function generateCollation($collation){
264263 return '' ;
265264 }
266265
267- function generateDefaultCommand ($ definitions ){
268-
269- if ($ this ->extra ){
270- if ($ definitions ['Extra ' ] == 'auto_increment ' ){
271- return "AUTO_INCREMENT " ;
272- }
266+ function generateDefault ($ definitions ){
267+ if ($ definitions ['Extra ' ] != 'auto_increment ' ){
268+ return $ definitions ['Extra ' ];
273269 }
270+ }
271+
272+ function generateDefaultCommand ($ definitions ){
274273
275274 if (in_array ($ definitions ['Default ' ], array ('CURRENT_TIMESTAMP ' , 'CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ' ))) {
276275 return "DEFAULT {$ definitions ['Default ' ]}" ;
@@ -314,9 +313,8 @@ function create_table($ctable){
314313 $ entries = array ();
315314 $ primaryKey = array ();
316315 $ keys = array ();
317- //$this->extra = true;
318316 foreach (db::get ($ ctable ) as $ columnName => $ definitions ) {
319- $ entries [] = '` ' . $ columnName . '` ' . $ definitions ['Type ' ] . ' ' . $ this ->generateCollation ($ definitions ['Collation ' ]) .' ' . $ this ->generateNullCommand ($ definitions ['Null ' ]) . ' ' . $ this ->generateDefaultCommand ($ definitions ) . ' ' . $ this ->generateDefaultComment ($ definitions );
317+ $ entries [] = '` ' . $ columnName . '` ' . $ definitions ['Type ' ] . ' ' . $ this ->generateCollation ($ definitions ['Collation ' ]) .' ' . $ this ->generateNullCommand ($ definitions ['Null ' ]) . ' ' . $ this ->generateDefaultCommand ($ definitions ) . ' ' . $ this -> generateDefault ( $ definitions ) . ' ' . $ this ->generateDefaultComment ($ definitions );
320318
321319 if ($ definitions ['Key ' ] == 'PRI ' ) {
322320 $ primaryKey [] = $ columnName ;
@@ -326,7 +324,7 @@ function create_table($ctable){
326324 $ keys [] = $ columnName ;
327325 }
328326 }
329- //$this->extra = false;
327+
330328 /*
331329 if (count($primaryKey) > 0) {
332330 $entries[] = 'PRIMARY KEY (`' . implode('`,`', $primaryKey) . '`)';
0 commit comments