|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.caucho.quercus.lib.db.JdbcResultResource
public class JdbcResultResource
Represents a JDBC Result value.
| Field Summary | |
|---|---|
protected java.sql.ResultSetMetaData |
_metaData
|
protected java.sql.ResultSet |
_rs
|
static java.lang.String |
BLOB
|
static java.lang.String |
DATE
|
static java.lang.String |
DATETIME
|
static int |
FETCH_ASSOC
|
static int |
FETCH_BOTH
|
static int |
FETCH_NUM
|
static java.lang.String |
INTEGER
|
static java.lang.String |
REAL
|
static java.lang.String |
STRING
|
static java.lang.String |
TIME
|
static java.lang.String |
TIMESTAMP
|
static java.lang.String |
UNKNOWN
|
static java.lang.String |
YEAR
|
| Constructor Summary | |
|---|---|
JdbcResultResource(Env env,
java.sql.ResultSetMetaData metaData,
JdbcConnectionResource conn)
Constructor for JdbcResultResource |
|
JdbcResultResource(Env env,
java.sql.Statement stmt,
java.sql.ResultSet rs,
JdbcConnectionResource conn)
Constructor for JdbcResultResource |
|
| Method Summary | |
|---|---|
void |
close()
Closes the result set. |
ArrayValue |
fetchArray(Env env,
int type)
Fetch the next line as an array. |
ArrayValue |
fetchAssoc(Env env)
Returns an associative array representing the row. |
Value |
fetchField(Env env,
int maxLength,
java.lang.String tableName,
java.lang.String type)
Returns an object with the following fields: name, table, max_length, not_null, primary_key, multiple_key, numeric, blob, type, unsigned, zerofill. |
Value |
fetchObject(Env env)
Returns an object with properties that correspond to the fetched row and moves the internal data pointer ahead. |
ArrayValue |
fetchRow(Env env)
Returns an array representing the row. |
int |
getAffectedRows()
Get the number of affected rows. |
protected Value |
getColumnDate(Env env,
java.sql.ResultSet rs,
int column)
|
protected int |
getColumnNumber(java.lang.String colName)
Gets the column number. |
protected int |
getColumnNumber(Value fieldNameOrNumber,
int base)
Gets the column number based on a generic Value. |
protected Value |
getColumnString(Env env,
java.sql.ResultSet rs,
java.sql.ResultSetMetaData md,
int column)
|
protected Value |
getColumnTime(Env env,
java.sql.ResultSet rs,
int column)
|
protected Value |
getColumnTimestamp(Env env,
java.sql.ResultSet rs,
int column)
|
Value |
getColumnValue(Env env,
java.sql.ResultSet rs,
java.sql.ResultSetMetaData metaData,
int column)
Get the column value in the specified result set. |
JdbcConnectionResource |
getConnection()
Get the connection corresponding to this result resource. |
Value |
getFieldCatalog(int fieldOffset)
Get the field catalog name. |
int |
getFieldCount()
Returns column count. |
Value |
getFieldLength(Env env,
int fieldOffset)
Get field length. |
Value |
getFieldName(Env env,
int fieldOffset)
Returns the column name. |
Value |
getFieldNameAlias(int fieldOffset)
Returns a StringValue containing the column Alias. |
Value |
getFieldNotNull(Env env,
int fieldOffset)
Returns the column name. |
int |
getFieldOffset()
Get field offset. |
Value |
getFieldScale(int fieldOffset)
Get field scale. |
Value |
getFieldSchema(Env env,
int fieldOffset)
Returns the table corresponding to the field. |
Value |
getFieldTable(Env env,
int fieldOffset)
Returns the table corresponding to the field. |
Value |
getFieldType(Env env,
int fieldOffset)
Get a StringValue with the column type. |
protected java.lang.String |
getFieldType(int fieldOffset,
int jdbcType)
Given the JDBC type of the field at the given offset, return a PHP type string. |
protected java.sql.Statement |
getJavaStatement()
Returns the underlying SQL statement associated to this result resource. |
protected Value |
getJdbcType(int fieldOffset)
Get type from Types enumeration |
Value |
getLengths()
Returns an ArrayValue column lengths in the most recently accessed row. |
java.sql.ResultSetMetaData |
getMetaData()
Get the result set meta data. |
Value |
getNumFields()
Returns the number of columns returned in query. |
int |
getNumRows()
Get the number of rows in this result set. |
static int |
getNumRows(java.sql.ResultSet rs)
Returns number of rows returned in query. |
Value |
getResultField(Env env,
int row,
Value field)
Returns the value at a particular row and column. |
java.sql.ResultSet |
getResultSet()
Get the underlying result set. |
java.sql.Statement |
getStatement()
Get the underlying statement. |
protected Value |
getUnicodeColumnString(Env env,
java.sql.ResultSet rs,
java.sql.ResultSetMetaData md,
int column)
|
protected boolean |
isInResultString(int columnIndex,
java.lang.String substring)
Return true if the String result at the given index of the ResultSet contains the substring. |
protected boolean |
isValidFieldOffset(int fieldOffset)
Return true is the field offset is valid, meaning it is larger than 0 and is less that the max number of fields in this result resource. |
boolean |
seek(Env env,
int rowNumber)
Seeks to an arbitrary result pointer specified by the offset in the result set represented by result. |
void |
setAffectedRows(int affectedRows)
Set the number of affected rows to the specified value. |
boolean |
setFieldOffset(int fieldOffset)
Set a value for field offset. |
boolean |
setRowNumber(int rowNumber)
Points to the row right before "rowNumber". |
static boolean |
setRowNumber(java.sql.ResultSet rs,
int rowNumber)
Points to the row right before "rowNumber". |
Value |
toKey()
Convert this JDBC result resource to a hash code. |
java.lang.String |
toString()
Returns a string representation for this object. |
JdbcResultResource |
validateResult()
Validate this result set and return it. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final int FETCH_ASSOC
public static final int FETCH_NUM
public static final int FETCH_BOTH
public static final java.lang.String INTEGER
public static final java.lang.String BLOB
public static final java.lang.String STRING
public static final java.lang.String DATE
public static final java.lang.String DATETIME
public static final java.lang.String REAL
public static final java.lang.String TIME
public static final java.lang.String TIMESTAMP
public static final java.lang.String UNKNOWN
public static final java.lang.String YEAR
protected java.sql.ResultSet _rs
protected java.sql.ResultSetMetaData _metaData
| Constructor Detail |
|---|
public JdbcResultResource(Env env,
java.sql.Statement stmt,
java.sql.ResultSet rs,
JdbcConnectionResource conn)
stmt - the corresponding statementrs - the corresponding result setconn - the corresponding connection
public JdbcResultResource(Env env,
java.sql.ResultSetMetaData metaData,
JdbcConnectionResource conn)
metaData - the corresponding result set meta dataconn - the corresponding connection| Method Detail |
|---|
public void close()
public ArrayValue fetchArray(Env env,
int type)
type - one of FETCH_ASSOC, FETCH_NUM, or FETCH_BOTH (default)
By using the FETCH_ASSOC constant this function will behave
identically to the mysqli_fetch_assoc(), while FETCH_NUM will
behave identically to the mysqli_fetch_row() function. The final
option FETCH_BOTH will create a single array with the attributes
of both.
public ArrayValue fetchAssoc(Env env)
public Value fetchField(Env env,
int maxLength,
java.lang.String tableName,
java.lang.String type)
env - the PHP executing environmentmaxLength - the field maximum lengthtableName - the field table nametype - the field type
public Value fetchObject(Env env)
env - the PHP executing environment
public ArrayValue fetchRow(Env env)
public int getAffectedRows()
protected int getColumnNumber(Value fieldNameOrNumber,
int base)
throws java.sql.SQLException
fieldNameOrNumber - the field index or it's namebase - the numbering base: 0 or 1 (usually zero).
java.sql.SQLException
protected int getColumnNumber(java.lang.String colName)
throws java.sql.SQLException
java.sql.SQLException
public Value getColumnValue(Env env,
java.sql.ResultSet rs,
java.sql.ResultSetMetaData metaData,
int column)
throws java.sql.SQLException
env - the PHP executing environmentrs - the result setmetaData - the result set meta datacolumn - the column number
java.sql.SQLException
protected Value getUnicodeColumnString(Env env,
java.sql.ResultSet rs,
java.sql.ResultSetMetaData md,
int column)
throws java.io.IOException,
java.sql.SQLException
java.io.IOException
java.sql.SQLException
protected Value getColumnString(Env env,
java.sql.ResultSet rs,
java.sql.ResultSetMetaData md,
int column)
throws java.sql.SQLException
java.sql.SQLException
protected Value getColumnTime(Env env,
java.sql.ResultSet rs,
int column)
throws java.sql.SQLException
java.sql.SQLException
protected Value getColumnDate(Env env,
java.sql.ResultSet rs,
int column)
throws java.sql.SQLException
java.sql.SQLException
protected Value getColumnTimestamp(Env env,
java.sql.ResultSet rs,
int column)
throws java.sql.SQLException
java.sql.SQLExceptionpublic JdbcConnectionResource getConnection()
public Value getFieldCatalog(int fieldOffset)
fieldOffset - the field number
public int getFieldCount()
protected boolean isValidFieldOffset(int fieldOffset)
protected boolean isInResultString(int columnIndex,
java.lang.String substring)
throws java.sql.SQLException
java.sql.SQLException
public Value getFieldLength(Env env,
int fieldOffset)
env - the PHP executing environmentfieldOffset - the field number (0-based)
public Value getFieldName(Env env,
int fieldOffset)
env - the PHP executing environmentfieldOffset - 0-based field offset
public Value getFieldNameAlias(int fieldOffset)
fieldOffset - 0-based field offset
public Value getFieldNotNull(Env env,
int fieldOffset)
env - the PHP executing environmentfieldOffset - 0-based field offset
public int getFieldOffset()
public Value getFieldScale(int fieldOffset)
fieldOffset - the field offset
public Value getFieldTable(Env env,
int fieldOffset)
env - the PHP executing environmentfieldOffset - the field number
public Value getFieldSchema(Env env,
int fieldOffset)
env - the PHP executing environmentfieldOffset - the field number
public Value getFieldType(Env env,
int fieldOffset)
env - the PHP executing environmentfieldOffset - need to add 1 because java
is 1 based index and quercus is 0 based
protected java.lang.String getFieldType(int fieldOffset,
int jdbcType)
protected java.sql.Statement getJavaStatement()
protected Value getJdbcType(int fieldOffset)
fieldOffset - the field number (0-based)
public Value getLengths()
public java.sql.ResultSetMetaData getMetaData()
throws java.sql.SQLException
java.sql.SQLExceptionpublic Value getNumFields()
public int getNumRows()
public static int getNumRows(java.sql.ResultSet rs)
rs - a result set
public Value getResultField(Env env,
int row,
Value field)
env - the PHP executing environmentrow - a particular row to get the field value fromfield - the field name or number
public java.sql.ResultSet getResultSet()
public java.sql.Statement getStatement()
public boolean seek(Env env,
int rowNumber)
env - the PHP executing environmentrowNumber - the row offset
public void setAffectedRows(int affectedRows)
affectedRows - the new number of affected rowspublic boolean setFieldOffset(int fieldOffset)
fieldOffset - PHP is 0-basedpublic boolean setRowNumber(int rowNumber)
rowNumber - the row offset
public static boolean setRowNumber(java.sql.ResultSet rs,
int rowNumber)
rs - the result set to move the row pointerrowNumber - the row offset
public Value toKey()
public java.lang.String toString()
toString in class java.lang.Objectpublic JdbcResultResource validateResult()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||