@@ 170-182 (lines=13) @@ | ||
167 | * @return string SQL query |
|
168 | * @access private |
|
169 | */ |
|
170 | public function _selectQuery($criteria = null) |
|
171 | { |
|
172 | $sql = sprintf('SELECT * FROM %s', $this->_db->prefix($this->_dbtable)); |
|
173 | if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) { |
|
174 | $sql .= ' ' . $criteria->renderWhere(); |
|
175 | if ($criteria->getSort() != '') { |
|
176 | $sql .= ' ORDER BY ' . $criteria->getSort() . ' |
|
177 | ' . $criteria->getOrder(); |
|
178 | } |
|
179 | } |
|
180 | ||
181 | return $sql; |
|
182 | } |
|
183 | ||
184 | /** |
|
185 | * count objects matching a criteria |
@@ 222-238 (lines=17) @@ | ||
219 | * @return string SQL query |
|
220 | * @access private |
|
221 | */ |
|
222 | public function _selectQuery($criteria = null, $join = false) |
|
223 | { |
|
224 | if (!$join) { |
|
225 | $sql = sprintf('SELECT * FROM %s', $this->_db->prefix($this->_dbtable)); |
|
226 | } else { |
|
227 | echo 'no need for join...'; |
|
228 | exit; |
|
229 | } |
|
230 | if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) { |
|
231 | $sql .= ' ' . $criteria->renderWhere(); |
|
232 | if ($criteria->getSort() != '') { |
|
233 | $sql .= ' ORDER BY ' . $criteria->getSort() . ' ' . $criteria->getOrder(); |
|
234 | } |
|
235 | } |
|
236 | ||
237 | return $sql; |
|
238 | } |
|
239 | ||
240 | /** |
|
241 | * @param $obj |