Exemple #1
0
 function getNewParserOutput($xml_file)
 {
     $newXmlQueryParser = new XmlQueryParser();
     $xml_obj = $newXmlQueryParser->getXmlFileContent($xml_file);
     $parser = new QueryParser($xml_obj->query);
     return $parser->toString();
 }
Exemple #2
0
 /**
  * Look for query cache file
  * @param string $query_id query id for finding
  * @param string $xml_file original xml query file
  * @return string cache file
  */
 function checkQueryCacheFile($query_id, $xml_file)
 {
     // first try finding cache file
     $cache_file = sprintf('%s%s%s.%s.%s.cache.php', _XE_PATH_, $this->cache_file, $query_id, __ZBXE_VERSION__, $this->db_type);
     $cache_time = -1;
     if (file_exists($cache_file)) {
         $cache_time = filemtime($cache_file);
     }
     // if there is no cache file or is not new, find original xml query file and parse it
     if ($cache_time < filemtime($xml_file) || $cache_time < filemtime(_XE_PATH_ . 'classes/db/DB.class.php') || $cache_time < filemtime(_XE_PATH_ . 'classes/xml/XmlQueryParser.class.php')) {
         $oParser = new XmlQueryParser();
         $oParser->parse($query_id, $xml_file, $cache_file);
     }
     return $cache_file;
 }
Exemple #3
0
 /**
  * @brief 캐쉬파일을 찾아 본다
  *
  **/
 function checkQueryCacheFile($query_id, $xml_file)
 {
     // 일단 cache 파일을 찾아본다
     $cache_file = sprintf('%s%s%s.cache.php', _XE_PATH_, $this->cache_file, $query_id);
     if (file_exists($cache_file)) {
         $cache_time = filemtime($cache_file);
     } else {
         $cache_time = -1;
     }
     // 캐시 파일이 없거나 시간 비교하여 최근것이 아니면 원본 쿼리 xml파일을 찾아서 파싱을 한다
     if ($cache_time < filemtime($xml_file) || $cache_time < filemtime(_XE_PATH_ . 'classes/db/DB.class.php')) {
         require_once _XE_PATH_ . 'classes/xml/XmlQueryParser.class.php';
         $oParser = new XmlQueryParser();
         $oParser->parse($query_id, $xml_file, $cache_file);
     }
     return $cache_file;
 }
Exemple #4
0
 $set_db_info_methods = array('mysql' => 'setMysqlDBInfo', 'mysqli' => 'setMysqliDBInfo', 'cubrid' => 'setCubridDBInfo', 'mssql' => 'setMssqlDBInfo');
 foreach ($set_db_info_methods as $db_type => $set_info_method) {
     Context::$set_info_method();
     // calls setMysqlDBInfo()/setCubridDBInfo()/...
     if ($use_schema_language) {
         $GLOBALS['__DB__'][$db_type]->queries = '';
         $GLOBALS['__DB__'][$db_type]->createTableByXmlFile($argv[$i]);
         print "\n";
         print pathinfo($argv[$i], PATHINFO_FILENAME);
         print " {$db_type} query:\n";
         print $GLOBALS['__DB__'][$db_type]->queries;
         print "\n";
     } else {
         $unlink_tmpfile = new UnlinkFile(tempnam($tmpdir, 'xe_'));
         // copied from classes/db/DB.class.php
         $oParser = new XmlQueryParser();
         $args_array = $oParser->parse_xml_query(pathinfo($argv[$i], PATHINFO_FILENAME), $argv[$i], $unlink_tmpfile->file_name);
         $args_array = $args_array->queryTag->getArguments();
         $GLOBALS['__DB__'][$db_type]->queries = '';
         $k = 1;
         foreach ($args_array as $arg) {
             if (isset($arg->variable_name) && !array_key_exists($arg->variable_name, $query_user_args)) {
                 if (isset($arg->argument_validator)) {
                     if (FALSE && isset($arg->argument_validator->default_value) && isset($arg->argument_validator->default_value->value)) {
                         $query_user_args[$arg->variable_name] = eval('return ' . $arg->argument_validator->default_value->toString() . ';');
                     } else {
                         if ($arg->argument_validator->filter) {
                             switch ($arg->argument_validator->filter) {
                                 case 'email':
                                 case 'email_address':
                                     $query_user_args[$arg->variable_name] = '*****@*****.**';
Exemple #5
0
 static function getXmlObject($xml_file)
 {
     $xmlParser = XmlQueryParser::getInstance();
     return $xmlParser->getXmlFileContent($xml_file);
 }