コード例 #1
0
ファイル: fbsqlAdapter.php プロジェクト: ksecor/civicrm
 /**
  * Constructor method for the adapter.  This constructor implements the setting of the
  * 3 required properties for the object.
  * 
  * @param resource $d The datasource resource
  */
 function pgsqlAdapter($d)
 {
     parent::RecordSetAdapter($d);
     $fieldcount = fbsql_num_fields($d);
     $ob = "";
     $be = $this->isBigEndian;
     $fc = pack('N', $fieldcount);
     if (fbsql_num_rows($d) > 0) {
         fbsql_data_seek($d, 0);
         while ($line = fbsql_fetch_row($d)) {
             // write all of the array elements
             $ob .= "\n" . $fc;
             foreach ($line as $value) {
                 // write all of the array elements
                 if (is_string($value)) {
                     // type as string
                     $os = $this->_directCharsetHandler->transliterate($value);
                     //string flag, string length, and string
                     $len = strlen($os);
                     if ($len < 65536) {
                         $ob .= "" . pack('n', $len) . $os;
                     } else {
                         $ob .= "\f" . pack('N', $len) . $os;
                     }
                 } elseif (is_float($value) || is_int($value)) {
                     // type as double
                     $b = pack('d', $value);
                     // pack the bytes
                     if ($be) {
                         // if we are a big-endian processor
                         $r = strrev($b);
                     } else {
                         // add the bytes to the output
                         $r = $b;
                     }
                     $ob .= "" . $r;
                 } elseif (is_bool($value)) {
                     //type as bool
                     $ob .= "";
                     $ob .= pack('c', $value);
                 } elseif (is_null($value)) {
                     // null
                     $ob .= "";
                 }
             }
         }
     }
     $this->serializedData = $ob;
     $this->numRows = fbsql_num_rows($d);
     for ($i = 0; $i < $fieldcount; $i++) {
         $this->columnNames[$i] = $this->_charsetHandler->transliterate(fbsql_field_name($d, $i));
     }
 }
コード例 #2
0
ファイル: fbsqlAdapter.php プロジェクト: FalconGT/DrEvony
 /**
  * Constructor method for the adapter.  This constructor implements the setting of the
  * 3 required properties for the object.
  * 
  * @param resource $d The datasource resource
  */
 function fbsqlAdapter($d)
 {
     parent::RecordSetAdapter($d);
     $fieldcount = fbsql_num_fields($d);
     for ($i = 0; $i < $fieldcount; $i++) {
         $this->columns[] = fbsql_field_name($d, $i);
     }
     if (fbsql_num_rows($d) > 0) {
         fbsql_data_seek($d, 0);
         while ($line = fbsql_fetch_row($d)) {
             $this->rows[] = $line;
         }
     }
 }
コード例 #3
0
 function _seek($row)
 {
     return @fbsql_data_seek($this->_queryID, $row);
 }
コード例 #4
0
ファイル: fbsql.php プロジェクト: roojs/pear
 /**
  * Places a row from the result set into the given array
  *
  * Formating of the array and the data therein are configurable.
  * See DB_result::fetchInto() for more information.
  *
  * This method is not meant to be called directly.  Use
  * DB_result::fetchInto() instead.  It can't be declared "protected"
  * because DB_result is a separate object.
  *
  * @param resource $result    the query result resource
  * @param array    $arr       the referenced array to put the data in
  * @param int      $fetchmode how the resulting array should be indexed
  * @param int      $rownum    the row number to fetch (0 = first row)
  *
  * @return mixed  DB_OK on success, NULL when the end of a result set is
  *                 reached or on failure
  *
  * @see DB_result::fetchInto()
  */
 function fetchInto($result, &$arr, $fetchmode, $rownum = null)
 {
     if ($rownum !== null) {
         if (!@fbsql_data_seek($result, $rownum)) {
             return null;
         }
     }
     if ($fetchmode & DB_FETCHMODE_ASSOC) {
         $arr = @fbsql_fetch_array($result, FBSQL_ASSOC);
         if ($this->options['portability'] & DB_PORTABILITY_LOWERCASE && $arr) {
             $arr = array_change_key_case($arr, CASE_LOWER);
         }
     } else {
         $arr = @fbsql_fetch_row($result);
     }
     if (!$arr) {
         return null;
     }
     if ($this->options['portability'] & DB_PORTABILITY_RTRIM) {
         $this->_rtrimArrayValues($arr);
     }
     if ($this->options['portability'] & DB_PORTABILITY_NULL_TO_EMPTY) {
         $this->_convertNullArrayValuesToEmpty($arr);
     }
     return DB_OK;
 }
コード例 #5
0
ファイル: fbsql.php プロジェクト: BackupTheBerlios/e-maku-svn
 /**
  * Fetch a row and insert the data into an existing array.
  *
  * @param $result fbsql result identifier
  * @param $arr (reference) array where data from the row is stored
  * @param $fetchmode how the array data should be indexed
  * @param   $rownum the row number to fetch
  * @access public
  *
  * @return int DB_OK on success, a DB error on failure
  */
 function fetchInto($result, &$arr, $fetchmode, $rownum = null)
 {
     if ($rownum !== null) {
         if (!@fbsql_data_seek($result, $rownum)) {
             return null;
         }
     }
     if ($fetchmode & DB_FETCHMODE_ASSOC) {
         $arr = @fbsql_fetch_array($result, FBSQL_ASSOC);
     } else {
         $arr = @fbsql_fetch_row($result);
     }
     if (!$arr) {
         $errno = @fbsql_errno($this->connection);
         if (!$errno) {
             return NULL;
         }
         return $this->fbsqlRaiseError($errno);
     }
     return DB_OK;
 }
コード例 #6
0
 /**
  * Fetch a row and return data in an array.
  *
  * @param resource $result result identifier
  * @param int $fetchmode ignored
  * @param int $rownum the row number to fetch
  * @return mixed data array or NULL on success, a MDB error on failure
  * @access public
  */
 function fetchInto($result, $fetchmode = MDB_FETCHMODE_DEFAULT, $rownum = NULL)
 {
     $result_value = intval($result);
     if ($rownum == NULL) {
         ++$this->highest_fetched_row[$result_value];
     } else {
         if (!@fbsql_data_seek($result, $rownum)) {
             return NULL;
         }
         $this->highest_fetched_row[$result_value] = max($this->highest_fetched_row[$result_value], $rownum);
     }
     if ($fetchmode == MDB_FETCHMODE_DEFAULT) {
         $fetchmode = $this->fetchmode;
     }
     if ($fetchmode & MDB_FETCHMODE_ASSOC) {
         $row = @fbsql_fetch_assoc($result);
         if (is_array($row) && $this->options['optimize'] == 'portability') {
             $row = array_change_key_case($row, CASE_LOWER);
         }
     } else {
         $row = @fbsql_fetch_row($result);
     }
     if (!$row) {
         if ($this->options['autofree']) {
             $this->freeResult($result);
         }
         return NULL;
     }
     if (isset($this->result_types[$result_value])) {
         $row = $this->convertResultRow($result, $row);
     }
     return $row;
 }
コード例 #7
0
ファイル: fbsql.php プロジェクト: Dulciane/jaws
 /**
  * Seek to a specific row in a result set
  *
  * @param int    $rownum    number of the row where the data can be found
  * @return mixed MDB2_OK on success, a MDB2 error on failure
  * @access public
  */
 function seek($rownum = 0)
 {
     if ($this->rownum != $rownum - 1 && !@fbsql_data_seek($this->result, $rownum)) {
         if (false === $this->result) {
             return $this->db->raiseError(MDB2_ERROR_NEED_MORE_DATA, null, null, 'resultset has already been freed', __FUNCTION__);
         }
         if (null === $this->result) {
             return MDB2_OK;
         }
         return $this->db->raiseError(MDB2_ERROR_INVALID, null, null, 'tried to seek to an invalid row number (' . $rownum . ')', __FUNCTION__);
     }
     $this->rownum = $rownum - 1;
     return MDB2_OK;
 }
コード例 #8
0
ファイル: fbsql.php プロジェクト: ajisantoso/kateglo
 /**
  * seek to a specific row in a result set
  *
  * @param int    $rownum    number of the row where the data can be found
  * @return mixed MDB2_OK on success, a MDB2 error on failure
  * @access public
  */
 function seek($rownum = 0)
 {
     if ($this->rownum != $rownum - 1 && !@fbsql_data_seek($this->result, $rownum)) {
         if ($this->result === false) {
             return $this->db->raiseError(MDB2_ERROR_NEED_MORE_DATA, null, null, 'seek: resultset has already been freed');
         } elseif (is_null($this->result)) {
             return MDB2_OK;
         }
         return $this->db->raiseError(MDB2_ERROR_INVALID, null, null, 'seek: tried to seek to an invalid row number (' . $rownum . ')');
     }
     $this->rownum = $rownum - 1;
     return MDB2_OK;
 }