Public Member Functions | |
__construct (Connection $conn, $result, $fetchmode=null) | |
close () | |
_setOffset ($offset) | |
This function exists to set offset after ResultSet is instantiated. | |
_setLimit ($limit) | |
This function exists to set limit after ResultSet is instantiated. | |
getFieldNum ($colname) | |
If fetchmode is FETCHMODE_ASSOC, returns the 1-based field index number for the specified column name. | |
Protected Member Functions | |
readLobData ($column, $binmode, $curdata=null) | |
Reads in any unread LOB data. | |
checkFetchMode (&$row) | |
Converts row fields to names if FETCHMODE_ASSOC is set. | |
Protected Attributes | |
$offset = 0 | |
$limit = 0 |
Definition at line 32 of file ODBCResultSetCommon.php.
ODBCResultSetCommon::__construct | ( | Connection $ | conn, | |
$ | result, | |||
$ | fetchmode = null | |||
) |
Reimplemented from ResultSetCommon.
Reimplemented in ODBCResultSet.
Definition at line 49 of file ODBCResultSetCommon.php.
References ResultSetCommon::$fetchmode, and ResultSetCommon::$result.
00050 { 00051 parent::__construct($conn, $result, $fetchmode); 00052 }
ODBCResultSetCommon::_setLimit | ( | $ | limit | ) |
This function exists to set limit after ResultSet is instantiated.
This function should be "protected" in Java sense: only available to classes in package. THIS METHOD SHOULD NOT BE CALLED BY ANYTHING EXCEPTION DRIVER CLASSES.
int | $limit New limit. protected |
Definition at line 88 of file ODBCResultSetCommon.php.
References $limit.
00089 { 00090 $this->limit = $limit; 00091 }
ODBCResultSetCommon::_setOffset | ( | $ | offset | ) |
This function exists to set offset after ResultSet is instantiated.
This function should be "protected" in Java sense: only available to classes in package. THIS METHOD SHOULD NOT BE CALLED BY ANYTHING EXCEPTION DRIVER CLASSES.
int | $offset New offset. protected |
Definition at line 76 of file ODBCResultSetCommon.php.
References $offset.
00077 { 00078 $this->offset = $offset; 00079 }
ODBCResultSetCommon::checkFetchMode | ( | &$ | row | ) | [protected] |
Converts row fields to names if FETCHMODE_ASSOC is set.
array& | Row to convert. |
Definition at line 165 of file ODBCResultSetCommon.php.
References ResultSet::FETCHMODE_ASSOC.
Referenced by ODBCResultSet::next(), and ODBCCachedResultSet::next().
00166 { 00167 if ($this->fetchmode == ResultSet::FETCHMODE_ASSOC) 00168 { 00169 $newrow = array(); 00170 00171 for ($i = 0, $n = count($row); $i < $n; $i++) 00172 { 00173 $colname = @odbc_field_name($this->result->getHandle(), $i+1); 00174 00175 if ($this->lowerAssocCase) { 00176 $colname = strtolower($colname); 00177 } 00178 00179 $newrow[$colname] = $row[$i]; 00180 } 00181 00182 $row =& $newrow; 00183 } 00184 00185 return $row; 00186 }
ODBCResultSetCommon::close | ( | ) |
Reimplemented in ODBCCachedResultSet, and ODBCResultSet.
Definition at line 57 of file ODBCResultSetCommon.php.
00058 { 00059 $this->result = null; 00060 $this->conn = null; 00061 $this->fetchmode = null; 00062 $this->cursorPos = 0; 00063 $this->fields = null; 00064 $this->lowerAssocCase = false; 00065 $this->limit = 0; 00066 $this->offset = 0; 00067 }
ODBCResultSetCommon::getFieldNum | ( | $ | colname | ) |
If fetchmode is FETCHMODE_ASSOC, returns the 1-based field index number for the specified column name.
Otherwise returns 0 (false).
Definition at line 98 of file ODBCResultSetCommon.php.
References ResultSet::FETCHMODE_ASSOC.
Referenced by readLobData().
00099 { 00100 $fieldnum = 0; 00101 00102 if ($this->fetchmode == ResultSet::FETCHMODE_ASSOC) 00103 { 00104 $keys = array_keys($this->fields); 00105 $fieldnum = array_search($colname, $keys); 00106 } 00107 00108 return $fieldnum; 00109 }
ODBCResultSetCommon::readLobData | ( | $ | column, | |
$ | binmode, | |||
$ | curdata = null | |||
) | [protected] |
Reads in any unread LOB data.
For long char fields, we may already have up to odbc_longreadlen() bytes in the buffer. These are passed in via the $curdata parm. For long binary fields, no data is read initially since odbc_binmode() is set to ODBC_BINMODE_PASSTHRU. This method adjusts the binmode and longreadlen to finish reading these datatypes into the buffer. Returns a string with the complete contents.
int|string | $column Column index or name to read data from. | |
int | $binmode ODBC_BINMODE_RETURN for binary data, ODBC_BINMODE_CONVERT for char data. | |
string | $curdata Existing LOB data already in buffer. |
Definition at line 125 of file ODBCResultSetCommon.php.
References getFieldNum().
Referenced by ODBCResultSet::getBlob(), ODBCResultSet::getClob(), and ODBCCachedResultSet::loadCache().
00126 { 00127 // Retrieve field num 00128 $fldNum = (is_int($column) ? $column : getFieldNum($column)); 00129 00130 $data = $curdata; 00131 $newdata = null; 00132 00133 // Adjust binmode and longreadlen 00134 odbc_binmode($this->result->getHandle(), $binmode); 00135 odbc_longreadlen($this->result->getHandle(), 4096); 00136 00137 while (1) 00138 { 00139 $newdata = odbc_result($this->result->getHandle(), $fldNum); 00140 00141 if ($newdata === false) 00142 break; 00143 else 00144 $data .= $newdata; 00145 } 00146 00147 // Restore the default binmode and longreadlen 00148 odbc_binmode($this->result->getHandle(), ODBC_BINMODE_PASSTHRU); 00149 odbc_longreadlen($this->result->getHandle(), ini_get('odbc.defaultlrl')); 00150 00151 // The ODBC driver I use seems to return a string with an escaped 00152 // null char at the end for clob data. 00153 $data = rtrim($data, "\x0"); 00154 00155 return $data; 00156 }
ODBCResultSetCommon::$limit = 0 [protected] |
ODBCResultSetCommon::$offset = 0 [protected] |