summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--it_dbi.class7
1 files changed, 4 insertions, 3 deletions
diff --git a/it_dbi.class b/it_dbi.class
index 7425275..1b749eb 100644
--- a/it_dbi.class
+++ b/it_dbi.class
@@ -42,6 +42,7 @@ class it_dbi
var $_fields; # Array of name => array(Field,Type,Null,Key,Default,Extra,Length) of fields (public readonly)
var $_convertfunc; # Array of name => convert function (currently intval and floatval) for this field's values
var $_link; # DB link identifier (private)
+ var $_dbid; # string identifying db connection. used for _state_purgeshared from outside
/**
@@ -143,7 +144,7 @@ function createclass($p)
# Make sure singleton exists
$dbi = $GLOBALS['it_dbi'] ? $GLOBALS['it_dbi'] : new it_dbi(array('table' => null) + $p);
$p += $dbi->_p; # FIXME: (has to be checked for side effects!)
- $dbid = "{$p['user']}@{$p['server']}:{$p['db']}";
+ $dbid = $dbi->_dbid = "{$p['user']}@{$p['server']}:{$p['db']}";
if (!isset($dbi->_tables[$dbid]))
{
@@ -833,10 +834,10 @@ function _state_put($dbid, $state, $shared = true)
it_cache::put("dbi:$dbid", array('link' => null) + (array)$state); # link is not transferable
}
-function _state_purgeshared($dbid)
+function _state_purgeshared($dbid = null)
{
#var_dump("purgeshared", $dbid);
- it_cache::put("dbi:$dbid", array()); # Nuke shared cache
+ it_cache::put("dbi:" . ($dbid ? $dbid : $GLOBALS['it_dbi']->_dbid), array()); # Nuke shared cache
}
#