diff options
-rw-r--r-- | dbi.class | 50 |
1 files changed, 25 insertions, 25 deletions
@@ -107,38 +107,38 @@ function it_dbi($config, $query = null) $table = mysql_tablename($tables, $i); $classname = "$this->_classprefix$table"; - if (!($result = @mysql_list_fields($this->_db, $table, $this->_link))) - $this->_fatal("it_dbi(): can't list fields \"$this->_db\": " . mysql_error($this->_link)); - - for ($fields=array(), $j=0; $j < mysql_num_fields($result); $j++) + if ($result = @mysql_list_fields($this->_db, $table, $this->_link)) { - $fields[mysql_field_name($result, $j)] = mysql_field_len($result, $j); - $flags = mysql_field_flags($result, $j); - - if (strstr($flags, "primary_key")) + for ($fields=array(), $j=0; $j < mysql_num_fields($result); $j++) { - $keyfield = mysql_field_name($result, $j); - $autoincrement = (bool)strstr($flags, "auto_increment"); - $randomid = (mysql_field_type($result, $j) == "string"); + $fields[mysql_field_name($result, $j)] = mysql_field_len($result, $j); + $flags = mysql_field_flags($result, $j); + + if (strstr($flags, "primary_key")) + { + $keyfield = mysql_field_name($result, $j); + $autoincrement = (bool)strstr($flags, "auto_increment"); + $randomid = (mysql_field_type($result, $j) == "string"); + } } - } - $fields = var_export($fields, true); + $fields = var_export($fields, true); - if ($this->_createclasses && (substr($classname, 0, 4) != 'PMA_') && !class_exists($classname)) - { - debug("it_dbi: creating class $classname", 5); - eval(" - class $classname extends it_dbi - { - function $classname(\$query = null, \$config = array()) + if ($this->_createclasses && (substr($classname, 0, 4) != 'PMA_') && !class_exists($classname)) + { + debug("it_dbi: creating class $classname", 5); + eval(" + class $classname extends it_dbi { - \$config += array($defaults'table' => '$table', 'keyfield' => '$keyfield', 'autoincrement' => '$autoincrement', 'randomid' => '$randomid'); - \$this->_fields = $fields; - \$this->it_dbi(\$config, \$query); + function $classname(\$query = null, \$config = array()) + { + \$config += array($defaults'table' => '$table', 'keyfield' => '$keyfield', 'autoincrement' => '$autoincrement', 'randomid' => '$randomid'); + \$this->_fields = $fields; + \$this->it_dbi(\$config, \$query); + } } - } - "); + "); + } } } } |