From c2f2909d99845f2757cc50e2d8e1432276b3b5fd Mon Sep 17 00:00:00 2001 From: Christian Schneider Date: Thu, 27 Jan 2011 15:06:39 +0000 Subject: Fix bug with double connections caused by overwriting link cache when putting table info into cache as well --- it_dbi.class | 4 ++++ 1 file changed, 4 insertions(+) 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); -- cgit v1.2.3