com.caucho.quercus.lib.db
Class MysqliResult

java.lang.Object
  extended by com.caucho.quercus.lib.db.JdbcResultResource
      extended by com.caucho.quercus.lib.db.MysqliResult

public class MysqliResult
extends JdbcResultResource

mysqli object oriented API facade


Field Summary
 
Fields inherited from class com.caucho.quercus.lib.db.JdbcResultResource
_metaData, _rs, BLOB, DATE, DATETIME, FETCH_ASSOC, FETCH_BOTH, FETCH_NUM, INTEGER, REAL, STRING, TIME, TIMESTAMP, UNKNOWN, YEAR
 
Constructor Summary
MysqliResult(Env env, java.sql.ResultSetMetaData metaData, Mysqli conn)
          Constructor for MysqliResult
MysqliResult(Env env, java.sql.Statement stmt, java.sql.ResultSet rs, Mysqli conn)
          Constructor for MysqliResult
 
Method Summary
 boolean data_seek(Env env, int rowNumber)
          Seeks to an arbitrary result pointer specified by the offset in the result set represented by result.
 ArrayValue fetch_array(Env env, int type)
          Fetch a result row as an associative, a numeric array, or both.
 ArrayValue fetch_assoc(Env env)
          Returns an associative array representing the row.
 Value fetch_field_direct(Env env, int offset)
          Returns field metadata for a single field.
 Value fetch_field(Env env)
          Returns the next field in the result set.
 Value fetch_fields(Env env)
          Returns metadata for all fields in the result set.
 Value fetch_lengths()
          Returns the lengths of the columns of the current row in the result set.
 Value fetch_object(Env env)
          Returns an object representing the current row.
 ArrayValue fetch_row(Env env)
          Returns a numerical array representing the current row.
protected  Value fetchFieldDirect(Env env, int fieldOffset)
          returns an object containing the following field information: name: The name of the column orgname: The original name if an alias was specified table: The name of the table orgtable: The original name if an alias was specified def: default value for this field, represented as a string max_length: The maximum width of the field for the result set flags: An integer representing the bit-flags for the field (see _constMap).
protected  Value fetchFieldImproved(Env env, int fieldLength, java.lang.String name, java.lang.String originalName, java.lang.String table, int jdbcType, java.lang.String mysqlType, int scale)
          Returns an object with the following fields: name: The name of the column orgname: The original name if an alias was specified table: The name of the table orgtable: The original name if an alias was specified def: default value for this field, represented as a string max_length: The maximum width of the field for the result set flags: An integer representing the bit-flags for the field type: An integer respresenting the data type used for this field decimals: The number of decimals used (for integer fields)
protected  Value fetchFieldImproved(Env env, java.sql.ResultSetMetaData md, int offset)
           
protected  Value fetchNextField(Env env)
           
 int field_count(Env env)
          Returns the number of fields in the result set.
 boolean field_seek(Env env, int offset)
          Sets the field metadata cursor to the given offset.
 int field_tell(Env env)
          Get current field offset of a result pointer.
 void free_result()
          Closes the result
 void free()
          Closes the result.
protected  Value getColumnString(Env env, java.sql.ResultSet rs, java.sql.ResultSetMetaData md, int column)
           
 Value getFieldDirectArray(Env env)
           
 Value getFieldFlagsImproved(Env env, int jdbcType, java.lang.String mysqlType)
          Returns the following field flags: not_null, primary_key, multiple_key, blob, unsigned zerofill, binary, enum, auto_increment and timestamp

it does not return the MySQL / PHP flag unique_key

MysqlModule generates a special result set with the appropriate values

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  Mysqli getMysqli()
           
protected  java.lang.String getMysqlType(int fieldOffset)
          Get Mysql type string
 java.lang.String getResourceType()
           
 boolean isLastSqlDescribe()
           
 int num_fields()
          Get the number of fields in the result set.
 int num_rows()
          Get the number of rows in the result set.
 
Methods inherited from class com.caucho.quercus.lib.db.JdbcResultResource
close, fetchArray, fetchAssoc, fetchField, fetchObject, fetchRow, getAffectedRows, getColumnDate, getColumnNumber, getColumnNumber, getColumnTime, getColumnTimestamp, getColumnValue, getConnection, getFieldCatalog, getFieldCount, getFieldLength, getFieldName, getFieldNameAlias, getFieldNotNull, getFieldOffset, getFieldScale, getFieldSchema, getFieldTable, getFieldType, getJavaStatement, getJdbcType, getLengths, getMetaData, getNumFields, getNumRows, getNumRows, getResultField, getResultSet, getStatement, getUnicodeColumnString, isInResultString, isValidFieldOffset, seek, setAffectedRows, setFieldOffset, setRowNumber, setRowNumber, toKey, toString, validateResult
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MysqliResult

public MysqliResult(Env env,
                    java.sql.Statement stmt,
                    java.sql.ResultSet rs,
                    Mysqli conn)
Constructor for MysqliResult

Parameters:
stmt - the corresponding statement
rs - the corresponding result set
conn - the corresponding connection

MysqliResult

public MysqliResult(Env env,
                    java.sql.ResultSetMetaData metaData,
                    Mysqli conn)
Constructor for MysqliResult

Parameters:
metaData - the corresponding result set meta data
conn - the corresponding connection
Method Detail

getResourceType

public java.lang.String getResourceType()

isLastSqlDescribe

public boolean isLastSqlDescribe()

data_seek

public boolean data_seek(Env env,
                         int rowNumber)
Seeks to an arbitrary result pointer specified by the offset in the result set represented by result.

Parameters:
env - the PHP executing environment
rowNumber - the row offset
Returns:
true on success or false on failure

fetch_array

public ArrayValue fetch_array(Env env,
                              int type)
Fetch a result row as an associative, a numeric array, or both.

Parameters:
type - one of MYSQLI_ASSOC, MYSQLI_NUM, or MYSQLI_BOTH (default) By using the MYSQLI_ASSOC constant this function will behave identically to the mysqli_fetch_assoc(), while MYSQLI_NUM will behave identically to the mysqli_fetch_row() function. The final option MYSQLI_BOTH will create a single array with the attributes of both.
Returns:
a result row as an associative, a numeric array, or both or null if there are no more rows in the result set

fetch_assoc

public ArrayValue fetch_assoc(Env env)
Returns an associative array representing the row.

Returns:
an associative array representing the row or null if there are no more rows in the result set

fetch_field_direct

public Value fetch_field_direct(Env env,
                                int offset)
Returns field metadata for a single field.

Parameters:
env - the PHP executing environment
offset - the field number
Returns:
the field metadata or false if no field information for specified offset is available

fetch_field

public Value fetch_field(Env env)
Returns the next field in the result set.

Parameters:
env - the PHP executing environment
Returns:
the next field in the result set or false if no information is available

fetch_fields

public Value fetch_fields(Env env)
Returns metadata for all fields in the result set.

Parameters:
env - the PHP executing environment
Returns:
an array of objects which contains field definition information or FALSE if no field information is available

fetch_lengths

public Value fetch_lengths()
Returns the lengths of the columns of the current row in the result set.

Returns:
an array with the lengths of the columns of the current row in the result set or false if you call it before calling mysqli_fetch_row/array/object or after retrieving all rows in the result set

fetch_object

public Value fetch_object(Env env)
Returns an object representing the current row.

Parameters:
env - the PHP executing environment
Returns:
an object that corresponds to the fetched row or NULL if there are no more rows in resultset

fetch_row

public ArrayValue fetch_row(Env env)
Returns a numerical array representing the current row.

Returns:
an array that corresponds to the fetched row or NULL if there are no more rows in result set

field_count

public int field_count(Env env)
Returns the number of fields in the result set.

Parameters:
env - the PHP executing environment
Returns:
the number of fields in the result set

fetchFieldDirect

protected Value fetchFieldDirect(Env env,
                                 int fieldOffset)
returns an object containing the following field information: name: The name of the column orgname: The original name if an alias was specified table: The name of the table orgtable: The original name if an alias was specified def: default value for this field, represented as a string max_length: The maximum width of the field for the result set flags: An integer representing the bit-flags for the field (see _constMap). type: The data type used for this field (an integer... also see _constMap) decimals: The number of decimals used (for integer fields)

Parameters:
env - the PHP executing environment
fieldOffset - 0 <= fieldOffset < number of fields
Returns:
an object or BooleanValue.FALSE

fetchFieldImproved

protected Value fetchFieldImproved(Env env,
                                   java.sql.ResultSetMetaData md,
                                   int offset)

fetchFieldImproved

protected Value fetchFieldImproved(Env env,
                                   int fieldLength,
                                   java.lang.String name,
                                   java.lang.String originalName,
                                   java.lang.String table,
                                   int jdbcType,
                                   java.lang.String mysqlType,
                                   int scale)
Returns an object with the following fields: name: The name of the column orgname: The original name if an alias was specified table: The name of the table orgtable: The original name if an alias was specified def: default value for this field, represented as a string max_length: The maximum width of the field for the result set flags: An integer representing the bit-flags for the field type: An integer respresenting the data type used for this field decimals: The number of decimals used (for integer fields)

Parameters:
env - the PHP executing environment
fieldLength - the field length as defined in the table declaration.
name - the field name
originalName - the field original name
table - the field table name
type - the field type
scale - the field scale
Returns:
an object containing field metadata

getFieldFlagsImproved

public Value getFieldFlagsImproved(Env env,
                                   int jdbcType,
                                   java.lang.String mysqlType)
Returns the following field flags: not_null, primary_key, multiple_key, blob, unsigned zerofill, binary, enum, auto_increment and timestamp

it does not return the MySQL / PHP flag unique_key

MysqlModule generates a special result set with the appropriate values

Returns:
the field flags

getMysqlType

protected java.lang.String getMysqlType(int fieldOffset)
Get Mysql type string

Parameters:
fieldOffset - the field number (0-based)
Returns:
the Mysql type

getFieldType

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.

Overrides:
getFieldType in class JdbcResultResource

fetchNextField

protected Value fetchNextField(Env env)
Parameters:
env - the PHP executing environment
Returns:
See Also:
fetchFieldDirect increments the fieldOffset counter by one;

field_seek

public boolean field_seek(Env env,
                          int offset)
Sets the field metadata cursor to the given offset. The next call to mysqli_fetch_field() will retrieve the field definition of the column associated with that offset.

Parameters:
env - the PHP executing environment
Returns:
previous value of field cursor

field_tell

public int field_tell(Env env)
Get current field offset of a result pointer.

Parameters:
env - the PHP executing environment
Returns:
current offset of field cursor

free

public void free()
Closes the result.


free_result

public void free_result()
Closes the result


getFieldDirectArray

public Value getFieldDirectArray(Env env)
Parameters:
env - the PHP executing environment
Returns:
array of fieldDirect objects

num_fields

public int num_fields()
Get the number of fields in the result set.

Returns:
the number of columns in the result set

num_rows

public int num_rows()
Get the number of rows in the result set.

Returns:
the number of rows in the result set

getColumnString

protected Value getColumnString(Env env,
                                java.sql.ResultSet rs,
                                java.sql.ResultSetMetaData md,
                                int column)
                         throws java.sql.SQLException
Overrides:
getColumnString in class JdbcResultResource
Throws:
java.sql.SQLException

getMysqli

protected Mysqli getMysqli()