summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--it_dbi.class12
1 files changed, 12 insertions, 0 deletions
diff --git a/it_dbi.class b/it_dbi.class
index df79f0e..4e033b4 100644
--- a/it_dbi.class
+++ b/it_dbi.class
@@ -438,6 +438,12 @@ function query($query, $p = array())
if (!$result)
$this->_fatal("query(\"$query\") failed");
}
+ else if (preg_match('/^(CREATE|ALTER|DROP) /i', $query))
+ {
+ # Purge cache for schema changes (after modifying table)
+ $dbid = "{$p['user']}@{$p['server']}:{$p['db']}";
+ it_dbi::_state_purgeshared($dbid);
+ }
if ($GLOBALS['debug_sqllog'])
@@ -728,6 +734,12 @@ function _state_put($dbid, $state)
it_cache::put("dbi:$dbid", array('link' => null) + (array)$state); # link is not transferable
}
+function _state_purgeshared($dbid)
+{
+ #var_dump("purgeshared", $dbid);
+ it_cache::put("dbi:$dbid", array()); # Nuke shared cache
+}
+
#
# Implement PHP 5 Iterator interface to make foreach work
# Example: foreach (new T_User('firstname' => "foo") as $foouser) { ... }