db_type = $db_type; } function parse($query_id, $xml_file, $cache_file) { // Read xml file $xml_obj = $this->getXmlFileContent($xml_file); // insert, update, delete, select action $action = strtolower($xml_obj->query->attrs->action); if(!$action) return; $parser = new QueryParser($xml_obj->query); FileHandler::writeFile($cache_file, $parser->toString()); } // singleton function &getDBParser(){ static $dbParser; if(!$dbParser){ if(isset($this->db_type)) $oDB = &DB::getInstance($this->db_type); else $oDB = &DB::getInstance(); $dbParser = $oDB->getParser(); } return $dbParser; } function getXmlFileContent($xml_file){ $buff = FileHandler::readFile($xml_file); $xml_obj = parent::parse($buff); if(!$xml_obj) return; unset($buff); return $xml_obj; } } ?>