summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUrban Müller2008-10-22 17:27:34 +0000
committerUrban Müller2008-10-22 17:27:34 +0000
commit206fc6778cb586d7ac21543707e49ec4c2b49aee (patch)
tree4c543ac327a3bed3e48e3dd8c5bc3a3423669412
parent3c524c5306085ebdbf112937e11d2751fca51d4d (diff)
downloaditools-206fc6778cb586d7ac21543707e49ec4c2b49aee.tar.gz
itools-206fc6778cb586d7ac21543707e49ec4c2b49aee.tar.bz2
itools-206fc6778cb586d7ac21543707e49ec4c2b49aee.zip
support safety=0 in construktor
-rw-r--r--it_dbi.class4
1 files changed, 2 insertions, 2 deletions
diff --git a/it_dbi.class b/it_dbi.class
index 6ce5808..018d7db 100644
--- a/it_dbi.class
+++ b/it_dbi.class
@@ -658,7 +658,7 @@ function _get_field_info()
if (!($this->_fields = $GLOBALS['it_dbi']->_state[$dbid]['fields'][$this->_p['table']]))
{
debug("it_dbi(): no fields for {$dbid}.{$this->_p['table']}, calculating.", 5);
- for ($res = $this->query('SHOW COLUMNS FROM ' . $this->_p['table']); $field = mysql_fetch_assoc($res);)
+ for ($res = $this->query('SHOW COLUMNS FROM ' . $this->_p['table']); ($res || $this->p['safety'] > 0) && ($field = mysql_fetch_assoc($res));)
{
$this->_fields[$field['Field']] = $field + array('Length' => preg_match('/date|time/', $field['Type']) ? 20 : intval(it::match('\d+', $field['Type'])));
$this->_isint[$field['Field']] = $field['Type'] == "int(11)";
@@ -670,7 +670,7 @@ function _get_field_info()
else # Existing _fields, copy other info too
$this->_isint = $GLOBALS['it_dbi']->_state[$dbid]['isint'][$this->_p['table']];
- foreach($this->_fields as $field)
+ foreach((array)$this->_fields as $field)
{
if ($field['Key'] == 'PRI')
{