summaryrefslogtreecommitdiff
path: root/it_dbi.class
diff options
context:
space:
mode:
authorChristian Schneider2011-01-27 15:06:39 +0000
committerChristian Schneider2011-01-27 15:06:39 +0000
commitc2f2909d99845f2757cc50e2d8e1432276b3b5fd (patch)
tree719679f31e79483aa4016258007c439dd7b05dcc /it_dbi.class
parent0716fc1ddaff47bdd7a944d109215f3bcb64103f (diff)
downloaditools-c2f2909d99845f2757cc50e2d8e1432276b3b5fd.tar.gz
itools-c2f2909d99845f2757cc50e2d8e1432276b3b5fd.tar.bz2
itools-c2f2909d99845f2757cc50e2d8e1432276b3b5fd.zip
Fix bug with double connections caused by overwriting link cache when putting table info into cache as well
Diffstat (limited to 'it_dbi.class')
-rw-r--r--it_dbi.class4
1 files changed, 4 insertions, 0 deletions
diff --git a/it_dbi.class b/it_dbi.class
index 68ba6a0..413ca8d 100644
--- a/it_dbi.class
+++ b/it_dbi.class
@@ -117,6 +117,7 @@ function createclasses($p = array())
for ($tables = array(), $res = $dbi->query('SHOW TABLES', $p); $row = mysql_fetch_row($res);)
$tables[] = $row[0];
+ $state = it_dbi::_state_get($dbid); # State could have been modified by query above
$state['tables'] = $tables;
it_dbi::_state_put($dbid, $state);
}
@@ -154,6 +155,7 @@ function createclass($p)
for ($tables = array(), $res = $dbi->query('SHOW TABLES', $p); $row = mysql_fetch_row($res);)
$tables[] = $row[0];
+ $state = it_dbi::_state_get($dbid); # State could have been modified by query above
$state['tables'] = $tables;
it_dbi::_state_put($dbid, $state);
}
@@ -225,6 +227,7 @@ function _connect($p = array())
if ($p['charset'])
mysql_set_charset($p['charset'], $this->_link);
+ # NOTE: This overwrites old state but that is on purpose. New link means we should refetch all info about connection
$state['link'] = $this->_link;
it_dbi::_state_put($dbid, $state, false); # Store only locally as link is not shared anyway
}
@@ -738,6 +741,7 @@ function _get_field_info()
$this->_isint[$field['Field']] = preg_match('/^(tiny|small|medium|)int/', $field['Type']);
}
+ $state = it_dbi::_state_get($dbid); # State could have been modified by query above
$state['fields'][$this->_p['table']] = $this->_fields;
$state['isint'][$this->_p['table']] = $this->_isint;
it_dbi::_state_put($dbid, $state);