Merge branch 'master' of git@github.com:k4ml/drupal-qb
[drupal-qb.git] / DrupalQBuilder.class.php
blobc3ef1b948921a46c3146aac09160286c45ab014a
1 <?php
3 class DrupalQBuilder extends QBuilder {
4 public function fetch($as_array = FALSE) {
5 $db_fetch = 'db_fetch_object';
6 if ($as_array) {
7 $db_fetch = 'db_fetch_array';
10 $result = db_query($this->sql(), $this->getArguments());
11 $rows = array();
12 while ($row = $db_fetch($result)) {
13 $rows[] = $row;
15 return $rows;
18 public function fetchArray() {
19 return $this->fetch($as_array = TRUE);
22 public function fetchRow($as_array = FALSE) {
23 $db_fetch = 'db_fetch_object';
24 if ($as_array) {
25 $db_fetch = 'db_fetch_array';
27 $result = db_query($this->sql(), $this->getArguments());
28 if ($result) {
29 return $db_fetch($result);
31 return FALSE;