示例#1
0
 /**
  * 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
 /**
  * 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;
         }
     }
 }
 function _initrs()
 {
     global $ADODB_COUNTRECS;
     $this->_numOfRows = $ADODB_COUNTRECS ? @fbsql_num_rows($this->_queryID) : -1;
     $this->_numOfFields = @fbsql_num_fields($this->_queryID);
 }
示例#4
0
文件: fbsql.php 项目: roojs/pear
 /**
  * Gets the number of rows in a result set
  *
  * This method is not meant to be called directly.  Use
  * DB_result::numRows() instead.  It can't be declared "protected"
  * because DB_result is a separate object.
  *
  * @param resource $result  PHP's query result resource
  *
  * @return int  the number of rows.  A DB_Error object on failure.
  *
  * @see DB_result::numRows()
  */
 function numRows($result)
 {
     $rows = @fbsql_num_rows($result);
     if ($rows === null) {
         return $this->fbsqlRaiseError();
     }
     return $rows;
 }
示例#5
0
	function _initrs()
	{
	GLOBAL $ADODB_COUNTRECS;
		$this->_numOfRows = ($ADODB_COUNTRECS) ? @fbsql_num_rows($this->_queryID):-1;
		$this->_numOfFields = @fbsql_num_fields($this->_queryID);
	}
 /**
  * returns the number of rows in a result object
  *
  * @param ressource $result a valid result ressouce pointer
  * @return mixed MDB_Error or the number of rows
  * @access public
  */
 function numRows($result)
 {
     return @fbsql_num_rows($result);
 }
 public function numRows()
 {
     if (!empty($this->query)) {
         return fbsql_num_rows($this->query);
     } else {
         return 0;
     }
 }
示例#8
0
文件: fbsql.php 项目: Dulciane/jaws
 /**
  * Returns the number of rows in a result object
  *
  * @return mixed MDB2 Error Object or the number of rows
  * @access public
  */
 function numRows()
 {
     $rows = @fbsql_num_rows($this->result);
     if (null === $rows) {
         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 0;
         }
         return $this->db->raiseError(null, null, null, 'Could not get row count', __FUNCTION__);
     }
     return $rows;
 }
示例#9
0
 /**
  * returns the number of rows in a result object
  *
  * @return mixed MDB2 Error Object or the number of rows
  * @access public
  */
 function numRows()
 {
     $rows = @fbsql_num_rows($this->result);
     if (is_null($rows)) {
         if ($this->result === false) {
             return $this->db->raiseError(MDB2_ERROR_NEED_MORE_DATA, null, null, 'numRows: resultset has already been freed');
         } elseif (is_null($this->result)) {
             return 0;
         }
         return $this->db->raiseError();
     }
     return $rows;
 }