From 3c49574fa3d3a946f975da4a8574dc67d37c8c2c Mon Sep 17 00:00:00 2001 From: Urban Müller Date: Mon, 23 Jul 2007 14:01:18 +0000 Subject: _defaults are needed for autoloader --- dbi.class | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/dbi.class b/dbi.class index 9426971..5666d28 100644 --- a/dbi.class +++ b/dbi.class @@ -67,6 +67,11 @@ function it_dbi($config = array(), $query = null) $this->_dbid = "$this->_db/$this->_server/$this->_user"; + $this->_defaults = ""; + foreach($config as $key => $value) + if ($key != 'createclasses') + $this->_defaults .= "'$key' => '".strtr($value, array('\'' => '\\\'', '$' => '\\$'))."', "; + if ($this->_createclasses) { $this->_connect(); @@ -74,16 +79,11 @@ function it_dbi($config = array(), $query = null) if (!($tables = mysql_list_tables($this->_db, $this->_link))) $this->_fatal("it_dbi(): can't list on tables \"$this->_db\": " . mysql_error($this->_link)); - $this->_defaults = ""; - foreach($config as $key => $value) - if ($key != 'createclasses') - $this->_defaults .= "'$key' => '".strtr($value, array('\'' => '\\\'', '$' => '\\$'))."', "; - for ($i = 0; $i < mysql_num_rows($tables); $i++) $this->createclass(mysql_tablename($tables, $i)); } - if (!$GLOBALS['it_dbi']) + if (!$GLOBALS['it_dbi'] && !$config['table']) $GLOBALS['it_dbi'] =& $this; if (isset($query)) -- cgit v1.2.3