You are here

function _eloqua_select_query in Eloqua 6

Performs a select query returning the result If the option ('data') is set, then will unserialize the data column

Parameters

$sql string:

$params array:

$options array:

Return value

object|FALSE

2 calls to _eloqua_select_query()
_eloqua_post_load in ./eloqua.inc
Loads the post object from the database
_eloqua_webform_load in ./eloqua.inc
Loads the webform object from the database

File

./eloqua.inc, line 693

Code

function _eloqua_select_query($sql, $params, $options = array()) {
  $result = db_query($sql, $params);
  if ($result !== FALSE) {
    $row = db_fetch_object($result);
    if (!empty($row)) {

      // Capture any unserialization errors, and validate the result
      if (!empty($options[ELOQUA_QUERY_OPTION_UNSERIALIZE_DATA])) {
        $row->data = unserialize($row->data);
        if ($row->data === FALSE) {
          $row->data = new stdClass();
        }
      }
    }
    else {
      $row = FALSE;
    }
  }
  return $row;
}