You are here

public function QPDrupalDB::queryInto in QueryPath 7.2

Same name and namespace in other branches
  1. 6 querypath.classes.inc \QPDrupalDB::queryInto()
  2. 7.3 querypath.classes.inc \QPDrupalDB::queryInto()

This needs some fixing up to be as grand as QPDB's version.

File

./querypath.classes.inc, line 56
Classes that are part of the QueryPath module.

Class

QPDrupalDB
Add Drupal database support to QueryPath.

Code

public function queryInto($sql) {
  $args = func_get_args();
  array_shift($args);

  // If first item is an array, set args to that array.
  if (!empty($args) && is_array($args[0])) {
    $args = $args[0];
  }
  $results = db_query($sql, $args);
  foreach ($result as $row) {
    $rows[] = $row;
    foreach ($rows as $datum) {
      $this->qp
        ->append($datum);
    }
  }
  return $this->qp;
}