コード例 #1
0
 public function result($type, $resource, $context)
 {
     if (!$resource instanceof \SQLite3Result) {
         return null;
     }
     switch ($type) {
         case 'next':
             $result = $resource->fetchArray(SQLITE3_ASSOC);
             break;
         case 'close':
             $resource->finalize();
             $result = null;
             break;
         default:
             $result = parent::result($type, $resource, $context);
             break;
     }
     return $result;
 }
コード例 #2
0
 /**
  *
  * @param string $type
  * @param object $mysqliResult
  * @param unknown_type $context
  * @return array|null
  */
 public function result($type, $mysqliResult, $context)
 {
     if (!$mysqliResult instanceof \mysqli_result) {
         return null;
     }
     switch ($type) {
         case 'next':
             $result = $mysqliResult->fetch_row();
             break;
         case 'close':
             $mysqliResult->close();
             $result = null;
             break;
         default:
             $result = parent::result($type, $mysqliResult, $context);
             break;
     }
     return $result;
 }
コード例 #3
0
ファイル: MySql.php プロジェクト: EHER/chegamos
 /**
  * Handle the result.
  *
  * @param string $type next|close The current step in the iteration.
  * @param mixed $resource The result resource returned from the database.
  * @param object $context The given query (an instance of `lithium\data\model\Query`).
  * @return mixed Result
  */
 public function result($type, $resource, $context)
 {
     if (!is_resource($resource)) {
         return null;
     }
     switch ($type) {
         case 'next':
             $result = mysql_fetch_row($resource);
             break;
         case 'close':
             mysql_free_result($resource);
             $result = null;
             break;
         default:
             $result = parent::result($type, $resource, $context);
             break;
     }
     return $result;
 }
コード例 #4
0
ファイル: Doctrine.php プロジェクト: ncud/sagalaya
 public function result($type, $resource, $context)
 {
     if (!is_object($resource)) {
         return null;
     }
     $result = null;
     switch ($type) {
         case 'next':
             if ($resource instanceof \Iterator) {
                 $row = $resource->next();
                 if ($row !== false) {
                     $result = $row[0];
                 }
             } else {
                 $result = $resource;
             }
             if ($result) {
                 $this->getEntityManager()->detach($result);
             }
             break;
         case 'close':
             unset($resource);
             break;
         default:
             $result = parent::result($type, $resource, $context);
             break;
     }
     return $result;
 }