/** * 合成查询语句 * * @access public * @param array $sql 查询对象词法数组 * @return string */ public function parseSelect(array $sql) { if (!empty($sql['join'])) { foreach ($sql['join'] as $val) { list($table, $condition, $op) = $val; $sql['table'] = "{$sql['table']} {$op} JOIN {$table} ON {$condition}"; } } $sql['limit'] = 0 == strlen($sql['limit']) ? NULL : ' LIMIT ' . $sql['limit']; $sql['offset'] = 0 == strlen($sql['offset']) ? NULL : ' OFFSET ' . $sql['offset']; return Typecho_Common::filterSQLite2CountQuery('SELECT ' . $sql['fields'] . ' FROM ' . $sql['table'] . $sql['where'] . $sql['group'] . $sql['having'] . $sql['order'] . $sql['limit'] . $sql['offset']); }