public function free() { $this->disconnect(); $n = sizeof($this->wheresCreated); if ($n > 1) { foreach ($this->wheresCreated as $i => $o) { if ($i) { $o->end(); } } if (sooh_trace::needsWrite(__CLASS__)) { sooh_trace::str(__CLASS__ . ':' . $n . ' Where(s) created but not end.better check you code'); } } else { if (sooh_trace::needsWrite(__CLASS__)) { sooh_trace::str(__CLASS__ . ':all cleared'); } } }
public static function free($arrConf_or_strModName = null, $subid = null) { if ($arrConf_or_strModName == null) { $ks = array_keys(self::$_instances); } elseif (is_array($arrConf_or_strModName)) { $ks = array(self::idOfConnection($arrConf_or_strModName)); } else { $ini = sooh_ini::getInstance(); $dbid = $ini->get('dbByObj.' . $arrConf_or_strModName); if ($dbid === null) { $dbid = $ini->get('dbByObj.default'); } if (is_array($dbid)) { if ($subid === null) { $ks = array(); foreach ($dbid as $subid) { $ks[] = self::idOfConnection(self::confOfMod($arrConf_or_strModName, $subid)); } } else { $ks = array(self::idOfConnection(self::confOfMod($arrConf_or_strModName, $subid))); } } else { $ks = array(self::idOfConnection(self::confOfMod($arrConf_or_strModName, null))); } } if (sooh_trace::needsWrite(__CLASS__)) { sooh_trace::obj('final free these db(s):', $ks); } foreach ($ks as $id) { if (isset(self::$_instances[$id])) { self::$_instances[$id]->free(); unset(self::$_instances[$id]); } } }