Lines Matching defs:query

131         // prepare query
132 $query = $this->_db->prepare($sql);
133 if($query == false) return;
135 // execute query
136 $res = $query->execute($values);
138 $error = $query->errorInfo();
142 $query->closeCursor();
179 $query = $this->_db->prepare($sql);
180 if($query == false) return;
182 // execute query
183 $res = $query->execute($values);
186 $error = $query->errorInfo();
191 $result = $query->fetchAll(PDO::FETCH_ASSOC);
192 $query->closeCursor();
216 // prepare insertion query
218 $query = $this->_db->prepare($sql);
219 if($query == false) return false;
226 $res = $query->execute($values);
230 $error = $query->errorInfo();
235 $query->closeCursor();
243 * Executes the given abstract query tree as a query on the store.
245 * @param query array an abstract query tree
249 // create the SQL generator, and generate the SQL query
253 // prepare the query
254 $query = $this->_db->prepare($sql);
255 if($query === false) {
259 // execute the query
260 $res = $query->execute($literals);
262 $error = $query->errorInfo();
273 return new strata_relations_iterator($query, $projected);
275 return new strata_aggregating_iterator($query, $projected, $grouped);
280 * Executes the abstract query tree, and returns all properties of the matching subjects.
283 * @param query array the abstract query tree
286 function queryResources($query) {
287 // We transform the given query into a resource-centric query as follows:
292 // The query is ready for execution. Result set can be transformed into a
297 $query['group'] = array(
299 'lhs'=>$query['group'],
302 'subject'=>array('type'=>'variable','text'=>$query['projection'][0]),
309 $query['projection'] = array(
310 $query['projection'][0],
316 $query['ordering'][] = array(
317 'variable'=>$query['projection'][0],
322 $query['grouping'] = false;
324 // execute query
325 $result = $this->queryRelations($query);
332 return new strata_resource_iterator($result,$query['projection']);
559 function _trans_opt($query) {
560 $gp1 = $this->_dispatch($query['lhs']);
561 $gp2 = $this->_dispatch($query['rhs']);
568 function _trans_and($query) {
569 $gp1 = $this->_dispatch($query['lhs']);
570 $gp2 = $this->_dispatch($query['rhs']);
577 function _trans_filter($query) {
578 $gp = $this->_dispatch($query['lhs']);
579 $fs = $query['rhs'];
653 function _trans_minus($query) {
654 $gp1 = $this->_dispatch($query['lhs']);
655 $gp2 = $this->_dispatch($query['rhs']);
681 function _trans_union($query) {
683 $gp1 = $this->_dispatch($query['lhs']);
684 $gp2 = $this->_dispatch($query['rhs']);
688 $gp1x = $this->_dispatch($query['lhs']);
689 $gp2x = $this->_dispatch($query['rhs']);
723 function _trans_select($query) {
724 $gp = $this->_dispatch($query['group']);
725 $vars = $query['projection'];
726 $order = $query['ordering'];
727 $group = $query['grouping'];
728 $consider = $query['considering'];
830 function _dispatch($query) {
831 switch($query['type']) {
833 return $this->_trans_select($query);
835 return $this->_trans_union($query);
837 return $this->_trans_minus($query);
839 return $this->_trans_opt($query);
841 return $this->_trans_filter($query);
843 return $this->_trans_tp($query);
845 return $this->_trans_and($query);
847 msg(sprintf($this->getLang('error_triples_node'),hsc($query['type'])),-1);
853 * Translates an abstract query tree to SQL.
855 function translate($query) {
856 $q = $this->_dispatch($query);
863 * relations query result.
936 * resources query result.