Ejemplo n.º 1
0
 /**
  * @return parser\SqlParser
  */
 public static function parser()
 {
     return parser\BaseParserFactory::singleton()->create();
 }
Ejemplo n.º 2
0
 public static function &parseSql($sStatement, $sParserName = 'statement', $bReturnFirstTree = false)
 {
     $aCache = Cache::highSpeed();
     $sSqlCacheKey = '/db/sql/raw/' . md5($sStatement);
     // 优先从缓存中查找
     if (!($arrTrees = $aCache->item($sSqlCacheKey))) {
         if (!($arrTrees =& BaseParserFactory::singleton()->create(true, null, $sParserName)->parse($sStatement, $bReturnFirstTree))) {
             $null = null;
             return $null;
         }
         // 写入缓存
         $aCache->setItem($sSqlCacheKey, $arrTrees);
     }
     return $arrTrees;
 }