Exemplo n.º 1
0
 /**
  * Result - object
  *
  * Returns the result set as an object
  *
  * @access	private
  * @return	object
  */
 function _fetch_object()
 {
     return sasql_fetch_object($this->result_id);
 }
 /**
  * Return value of de Result in Onject
  * @return object Results
  */
 public function fetchObject()
 {
     return sasql_fetch_object($this->result);
 }
 /**
  * {@inheritdoc}
  *
  * @throws SQLAnywhereException
  */
 public function fetch($fetchMode = null)
 {
     if (!is_resource($this->result) || get_resource_type($this->result) !== 'SQLAnywhere result') {
         return false;
     }
     $fetchMode = $fetchMode ?: $this->defaultFetchMode;
     switch ($fetchMode) {
         case PDO::FETCH_ASSOC:
             return sasql_fetch_assoc($this->result);
         case PDO::FETCH_BOTH:
             return sasql_fetch_array($this->result, SASQL_BOTH);
         case PDO::FETCH_CLASS:
             $className = $this->defaultFetchClass;
             $ctorArgs = $this->defaultFetchClassCtorArgs;
             if (func_num_args() >= 2) {
                 $args = func_get_args();
                 $className = $args[1];
                 $ctorArgs = isset($args[2]) ? $args[2] : array();
             }
             $result = sasql_fetch_object($this->result);
             if ($result instanceof \stdClass) {
                 $result = $this->castObject($result, $className, $ctorArgs);
             }
             return $result;
         case PDO::FETCH_NUM:
             return sasql_fetch_row($this->result);
         case PDO::FETCH_OBJ:
             return sasql_fetch_object($this->result);
         default:
             throw new SQLAnywhereException('Fetch mode is not supported: ' . $fetchMode);
     }
 }
Exemplo n.º 4
0
 /**
  * Fetch a row and convert it into an object.
  */
 function db_fetch_object($qid = false)
 {
     if ($qid === false) {
         return false;
     }
     return sasql_fetch_object($qid);
 }