public class JdbcResultResource
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected java.sql.ResultSetMetaData |
_metaData |
protected java.sql.ResultSet |
_rs |
static java.lang.String |
BLOB |
protected static int |
COLUMN_CASE_LOWER |
protected static int |
COLUMN_CASE_NATURAL |
protected static int |
COLUMN_CASE_UPPER |
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 and Description |
---|
JdbcResultResource(java.sql.ResultSet rs)
Constructor for JdbcResultResource
|
JdbcResultResource(java.sql.ResultSet rs,
int columnCase) |
JdbcResultResource(java.sql.ResultSetMetaData metaData)
Constructor for JdbcResultResource
|
JdbcResultResource(java.sql.ResultSetMetaData metaData,
int columnCase) |
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes the result set.
|
protected Value |
fetchArray(Env env,
int type)
Fetch the next line as an array.
|
protected Value |
fetchArray(Env env,
int type,
boolean isOrderIndexBeforeName) |
Value |
fetchAssoc(Env env)
Returns an associative array representing the row.
|
Value |
fetchBoth(Env env,
boolean isOrderIndexBeforeName) |
protected Value |
fetchBound(Env env,
Value[] vars)
Fetch results from a prepared statement into bound variables.
|
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 |
fetchNum(Env env) |
protected Value |
fetchObject(Env env,
java.lang.String className,
Value[] args)
Returns an object with properties that correspond to the fetched row and
moves the internal data pointer ahead.
|
protected Value |
fetchRow(Env env)
Returns an array representing the row.
|
int |
getAffectedRows()
Get the number of affected rows.
|
protected Value |
getBlobValue(Env env,
java.sql.ResultSet rs,
java.sql.ResultSetMetaData metaData,
int column) |
protected Value |
getClobValue(Env env,
java.sql.ResultSet rs,
java.sql.ResultSetMetaData metaData,
int column) |
protected Value |
getColumnDate(Env env,
java.sql.ResultSet rs,
int column) |
protected java.lang.String |
getColumnLabel(int index) |
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) |
protected Value |
getColumnValue(Env env,
int column) |
protected Value |
getColumnValue(Env env,
int column,
int type)
Get the column value in the specified result set.
|
Value |
getFieldCatalog(Env env,
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(Env env,
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 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()
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.
|
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.
|
protected boolean |
next() |
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".
|
java.lang.String |
toString()
Returns a string representation for this object.
|
JdbcResultResource |
validateResult()
Validate this result set and return it.
|
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 static final int COLUMN_CASE_NATURAL
protected static final int COLUMN_CASE_UPPER
protected static final int COLUMN_CASE_LOWER
protected java.sql.ResultSet _rs
protected java.sql.ResultSetMetaData _metaData
public JdbcResultResource(java.sql.ResultSet rs)
stmt
- the corresponding statementrs
- the corresponding result setconn
- the corresponding connectionpublic JdbcResultResource(java.sql.ResultSet rs, int columnCase)
public JdbcResultResource(java.sql.ResultSetMetaData metaData)
metaData
- the corresponding result set meta dataconn
- the corresponding connectionpublic JdbcResultResource(java.sql.ResultSetMetaData metaData, int columnCase)
public void close()
protected Value 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 Value 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 typeprotected Value fetchObject(Env env, java.lang.String className, Value[] args)
env
- the PHP executing environmentprotected Value fetchRow(Env env)
protected Value fetchBound(Env env, Value[] vars)
public int getAffectedRows()
protected boolean next() throws java.sql.SQLException
java.sql.SQLException
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
protected Value getColumnValue(Env env, int column) throws java.sql.SQLException
java.sql.SQLException
protected Value getColumnValue(Env env, int column, int type) throws java.sql.SQLException
env
- the PHP executing environmentrs
- the result setmetaData
- the result set meta datacolumn
- the column numberjava.sql.SQLException
protected Value getBlobValue(Env env, java.sql.ResultSet rs, java.sql.ResultSetMetaData metaData, int column) throws java.sql.SQLException
java.sql.SQLException
protected Value getClobValue(Env env, java.sql.ResultSet rs, java.sql.ResultSetMetaData metaData, int column) throws java.sql.SQLException
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.SQLException
public Value getFieldCatalog(Env env, int fieldOffset)
fieldOffset
- the field numberpublic 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 offsetpublic Value getFieldNameAlias(Env env, int fieldOffset)
fieldOffset
- 0-based field offsetpublic Value getFieldNotNull(Env env, int fieldOffset)
env
- the PHP executing environmentfieldOffset
- 0-based field offsetpublic int getFieldOffset()
public Value getFieldScale(int fieldOffset)
fieldOffset
- the field offsetpublic Value getFieldTable(Env env, int fieldOffset)
env
- the PHP executing environmentfieldOffset
- the field numberpublic Value getFieldSchema(Env env, int fieldOffset)
env
- the PHP executing environmentfieldOffset
- the field numberpublic 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 basedprotected java.lang.String getFieldType(int fieldOffset, int jdbcType)
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.SQLException
public Value getNumFields()
public int getNumRows()
rs
- a result setpublic 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 numberprotected java.lang.String getColumnLabel(int index) throws java.sql.SQLException
java.sql.SQLException
public java.sql.ResultSet getResultSet()
public boolean seek(Env env, int rowNumber)
env
- the PHP executing environmentrowNumber
- the row offsetpublic 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 offsetpublic java.lang.String toString()
toString
in class java.lang.Object
public JdbcResultResource validateResult()