com.caucho.quercus.lib.db
Class MysqlModule

java.lang.Object
  extended by com.caucho.quercus.module.AbstractQuercusModule
      extended by com.caucho.quercus.lib.db.MysqlModule
All Implemented Interfaces:
QuercusModule

public class MysqlModule
extends AbstractQuercusModule

PHP mysql routines.


Field Summary
static int MYSQL_ASSOC
           
static int MYSQL_BOTH
           
static int MYSQL_NUM
           
static int MYSQL_STORE_RESULT
           
static int MYSQL_USE_RESULT
           
 
Fields inherited from class com.caucho.quercus.module.AbstractQuercusModule
PHP_INI_ALL, PHP_INI_PERDIR, PHP_INI_SYSTEM, PHP_INI_USER
 
Constructor Summary
MysqlModule()
           
 
Method Summary
 java.lang.String[] getLoadedExtensions()
          Returns true for the mysql extension.
static int mysql_affected_rows(Env env, Mysqli conn)
          Returns the number of affected rows.
static boolean mysql_change_user(Env env, StringValue user, StringValue pass, StringValue database, Mysqli conn)
          Change the logged in user of the current active connection.
static StringValue mysql_client_encoding(Env env, Mysqli conn)
          Returns the client encoding
static boolean mysql_close(Env env, Mysqli conn)
          Closes a mysql connection.
static Value mysql_connect(Env env, StringValue host, StringValue userName, StringValue password, boolean isNewLink, int flags)
          Returns a new mysql connection.
static boolean mysql_create_db(Env env, StringValue name, Mysqli conn)
          Creates a database.
static boolean mysql_data_seek(Env env, MysqliResult result, int rowNumber)
          Moves the intenal row pointer of the MySQL result to the specified row number, 0 based.
static Value mysql_db_name(Env env, MysqliResult result, int row, Value field)
          Retrieves the database name after a call to mysql_list_dbs()
static Value mysql_db_query(Env env, java.lang.String databaseName, StringValue query, Mysqli conn)
          Returns result set or false on error
static Value mysql_dbname(Env env, MysqliResult result, int row)
          Deprecated alias for mysql_db_name
static boolean mysql_drop_db(Env env, StringValue databaseName, Mysqli conn)
          Drops a database.
static boolean mysql_dropdb(Env env, StringValue databaseName, Mysqli conn)
          Deprecated alias for mysql_drop_db.
static int mysql_errno(Env env, Mysqli conn)
          Returns the error number of the most recent error
static StringValue mysql_error(Env env, Mysqli conn)
          Returns the most recent error.
static StringValue mysql_escape_string(Env env, Value val)
          Deprecated, mysql_real_escape_string() should be used instead.
static Value mysql_fetch_array(Env env, MysqliResult result, int type)
          Returns a row from the connection
static ArrayValue mysql_fetch_assoc(Env env, MysqliResult result)
          Returns a row from the connection
static Value mysql_fetch_field(Env env, MysqliResult result, int fieldOffset)
          Returns an object containing field information.
static Value mysql_fetch_lengths(Env env, MysqliResult result)
          Returns an array of lengths.
static Value mysql_fetch_object(Env env, MysqliResult result)
          Returns an object with properties that correspond to the fetched row and moves the data pointer ahead.
static ArrayValue mysql_fetch_row(Env env, MysqliResult result)
          Returns a numerical row from the result, FALSE if no more rows.
static Value mysql_field_flags(Env env, MysqliResult result, int fieldOffset)
          Returns the field flags of the specified field.
static Value mysql_field_len(Env env, MysqliResult result, int fieldOffset)
          Returns the length of the specified field
static Value mysql_field_name(Env env, MysqliResult result, int fieldOffset)
          Returns field name at given offset.
static boolean mysql_field_seek(Env env, MysqliResult result, int fieldOffset)
          Seeks to the specified field offset, the field offset is is used as the default for the next call to mysql_fetch_field(com.caucho.quercus.env.Env, com.caucho.quercus.lib.db.MysqliResult, int).
static Value mysql_field_table(Env env, MysqliResult result, int fieldOffset)
          Returns the table corresponding to the field.
static Value mysql_field_type(Env env, MysqliResult result, Value fieldOffset)
          Returns the field type.
static Value mysql_fieldname(Env env, MysqliResult result, int fieldOffset)
          Deprecated alias for mysql_field_name.
static Value mysql_fieldtable(Env env, MysqliResult result, int fieldOffset)
          Deprecated alias for mysql_field_table.
static Value mysql_fieldtype(Env env, MysqliResult result, Value fieldOffset)
          Deprecated alias for mysql_field_type.
static boolean mysql_free_result(MysqliResult result)
          Frees a mysql result.
static boolean mysql_freeresult(MysqliResult result)
          Alias for mysql_free_result.
static StringValue mysql_get_client_info(Env env)
          Returns the MySQL client version.
static StringValue mysql_get_host_info(Env env, Mysqli conn)
          Returns a string describing the host.
static int mysql_get_proto_info(Env env, Mysqli conn)
          Returns an integer respresenting the MySQL protocol version.
static Value mysql_get_server_info(Env env, Mysqli conn)
          Returns the MySQL server version.
static Value mysql_info(Env env, Mysqli conn)
          Get information about the most recent query.
static Value mysql_insert_id(Env env, Mysqli conn)
          returns ID generated for an AUTO_INCREMENT column by the previous INSERT query on success, 0 if the previous query does not generate an AUTO_INCREMENT value, or FALSE if no MySQL connection was established
static Value mysql_list_dbs(Env env, Mysqli conn)
          Returns a result pointer containing the databases available from the current mysql daemon.
static Value mysql_list_fields(Env env, java.lang.String database, StringValue tableName, Mysqli conn)
          Retrieves information about the given table name.
static java.lang.Object mysql_list_tables(Env env, StringValue databaseName, Mysqli conn)
          Retrieves a list of table names from a MySQL database.
static Value mysql_listfields(Env env, java.lang.String databaseName, StringValue tableName, Mysqli conn)
          Deprecated alias for mysql_list_fields
static Value mysql_num_fields(Env env, MysqliResult result)
          Get number of fields in result
static Value mysql_num_rows(Env env, MysqliResult result)
          Retrieves the number of rows in a result set.
static Value mysql_numfields(Env env, MysqliResult result)
          Deprecated alias for mysql_num_fields
static Value mysql_numrows(Env env, MysqliResult result)
          Undocumented alias for {#link #mysql_num_rows}.
static Value mysql_pconnect(Env env, StringValue server, StringValue user, StringValue password, boolean newLink, int flags)
          Returns a new persistent mysql connection.
static boolean mysql_ping(Env env, Mysqli conn)
          Checks if the connection is still valid.
static Value mysql_query(Env env, StringValue sql, Mysqli conn)
          Executes a query and returns a result set.
static StringValue mysql_real_escape_string(Env env, Value val, Mysqli conn)
          Escapes special characters.
static Value mysql_result(Env env, MysqliResult result, int row, Value field)
          Returns the value of one field in the result set.
static boolean mysql_select_db(Env env, java.lang.String dbName, Mysqli conn)
          Selects the database
static Value mysql_stat(Env env, Mysqli conn)
          Returns a string with the status of the connection or NULL if error.
static Value mysql_tablename(Env env, MysqliResult result, int i)
          Retrieves the table name corresponding to a field, using a result return by mysql_list_tables(com.caucho.quercus.env.Env, com.caucho.quercus.env.StringValue, com.caucho.quercus.lib.db.Mysqli).
static Value mysql_thread_id(Env env, Mysqli conn)
          Query an identifier that corresponds to this specific connection.
static java.lang.Object mysql_unbuffered_query(Env env, StringValue name, Mysqli conn)
          Queries the database.
 
Methods inherited from class com.caucho.quercus.module.AbstractQuercusModule
addConstant, addConstant, addConstant, getConstMap, getIniDefinitions
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MYSQL_ASSOC

public static final int MYSQL_ASSOC
See Also:
Constant Field Values

MYSQL_NUM

public static final int MYSQL_NUM
See Also:
Constant Field Values

MYSQL_BOTH

public static final int MYSQL_BOTH
See Also:
Constant Field Values

MYSQL_USE_RESULT

public static final int MYSQL_USE_RESULT
See Also:
Constant Field Values

MYSQL_STORE_RESULT

public static final int MYSQL_STORE_RESULT
See Also:
Constant Field Values
Constructor Detail

MysqlModule

public MysqlModule()
Method Detail

getLoadedExtensions

public java.lang.String[] getLoadedExtensions()
Returns true for the mysql extension.

Specified by:
getLoadedExtensions in interface QuercusModule
Overrides:
getLoadedExtensions in class AbstractQuercusModule

mysql_affected_rows

public static int mysql_affected_rows(Env env,
                                      Mysqli conn)
Returns the number of affected rows.


mysql_info

public static Value mysql_info(Env env,
                               Mysqli conn)
Get information about the most recent query.


mysql_change_user

public static boolean mysql_change_user(Env env,
                                        StringValue user,
                                        StringValue pass,
                                        StringValue database,
                                        Mysqli conn)
Change the logged in user of the current active connection. This function is deprecated and was removed from PHP in PHP 3.0.14.


mysql_client_encoding

public static StringValue mysql_client_encoding(Env env,
                                                Mysqli conn)
Returns the client encoding


mysql_close

public static boolean mysql_close(Env env,
                                  Mysqli conn)
Closes a mysql connection.


mysql_create_db

public static boolean mysql_create_db(Env env,
                                      StringValue name,
                                      Mysqli conn)
Creates a database.


mysql_data_seek

public static boolean mysql_data_seek(Env env,
                                      MysqliResult result,
                                      int rowNumber)
Moves the intenal row pointer of the MySQL result to the specified row number, 0 based.


mysql_db_name

public static Value mysql_db_name(Env env,
                                  MysqliResult result,
                                  int row,
                                  Value field)
Retrieves the database name after a call to mysql_list_dbs()


mysql_dbname

public static Value mysql_dbname(Env env,
                                 MysqliResult result,
                                 int row)
Deprecated alias for mysql_db_name


mysql_result

public static Value mysql_result(Env env,
                                 MysqliResult result,
                                 int row,
                                 Value field)
Returns the value of one field in the result set. FALSE on failure.


mysql_drop_db

public static boolean mysql_drop_db(Env env,
                                    StringValue databaseName,
                                    Mysqli conn)
Drops a database.


mysql_dropdb

public static boolean mysql_dropdb(Env env,
                                   StringValue databaseName,
                                   Mysqli conn)
Deprecated alias for mysql_drop_db.


mysql_errno

public static int mysql_errno(Env env,
                              Mysqli conn)
Returns the error number of the most recent error


mysql_error

public static StringValue mysql_error(Env env,
                                      Mysqli conn)
Returns the most recent error.


mysql_escape_string

public static StringValue mysql_escape_string(Env env,
                                              Value val)
Deprecated, mysql_real_escape_string() should be used instead.

Returns:
the escaped string
See Also:
MysqlModule.mysql_real_escape_string(String, Mysqli)

mysql_real_escape_string

public static StringValue mysql_real_escape_string(Env env,
                                                   Value val,
                                                   Mysqli conn)
Escapes special characters.

Returns:
the escaped string
See Also:
MysqliModule.mysqli_real_escape_string( JdbcConnectionResource, String)

mysql_fetch_array

public static Value mysql_fetch_array(Env env,
                                      MysqliResult result,
                                      int type)
Returns a row from the connection


mysql_fetch_assoc

public static ArrayValue mysql_fetch_assoc(Env env,
                                           MysqliResult result)
Returns a row from the connection


mysql_fetch_field

public static Value mysql_fetch_field(Env env,
                                      MysqliResult result,
                                      int fieldOffset)
Returns an object containing field information. On success, this method increments the field offset (see mysql_field_seek(com.caucho.quercus.env.Env, com.caucho.quercus.lib.db.MysqliResult, int)).

ERRATA


mysql_query

public static Value mysql_query(Env env,
                                StringValue sql,
                                Mysqli conn)
Executes a query and returns a result set. Returns true on update success, false on failure, and a result set for a successful select


mysql_fetch_lengths

public static Value mysql_fetch_lengths(Env env,
                                        MysqliResult result)
Returns an array of lengths.


mysql_fetch_object

public static Value mysql_fetch_object(Env env,
                                       MysqliResult result)
Returns an object with properties that correspond to the fetched row and moves the data pointer ahead.


mysql_fetch_row

public static ArrayValue mysql_fetch_row(Env env,
                                         MysqliResult result)
Returns a numerical row from the result, FALSE if no more rows.


mysql_field_flags

public static Value mysql_field_flags(Env env,
                                      MysqliResult result,
                                      int fieldOffset)
Returns the field flags of the specified field. The flags are reported as a space separated list of words, the returned value can be split using explode(). The following flages are reported, older version of MySQL may not report all flags:


mysql_field_name

public static Value mysql_field_name(Env env,
                                     MysqliResult result,
                                     int fieldOffset)
Returns field name at given offset.


mysql_fieldname

public static Value mysql_fieldname(Env env,
                                    MysqliResult result,
                                    int fieldOffset)
Deprecated alias for mysql_field_name.


mysql_field_seek

public static boolean mysql_field_seek(Env env,
                                       MysqliResult result,
                                       int fieldOffset)
Seeks to the specified field offset, the field offset is is used as the default for the next call to mysql_fetch_field(com.caucho.quercus.env.Env, com.caucho.quercus.lib.db.MysqliResult, int).


mysql_field_table

public static Value mysql_field_table(Env env,
                                      MysqliResult result,
                                      int fieldOffset)
Returns the table corresponding to the field.


mysql_fieldtable

public static Value mysql_fieldtable(Env env,
                                     MysqliResult result,
                                     int fieldOffset)
Deprecated alias for mysql_field_table.


mysql_field_type

public static Value mysql_field_type(Env env,
                                     MysqliResult result,
                                     Value fieldOffset)
Returns the field type.


mysql_fieldtype

public static Value mysql_fieldtype(Env env,
                                    MysqliResult result,
                                    Value fieldOffset)
Deprecated alias for mysql_field_type.


mysql_field_len

public static Value mysql_field_len(Env env,
                                    MysqliResult result,
                                    int fieldOffset)
Returns the length of the specified field


mysql_free_result

public static boolean mysql_free_result(MysqliResult result)
Frees a mysql result.


mysql_freeresult

public static boolean mysql_freeresult(MysqliResult result)
Alias for mysql_free_result.


mysql_get_client_info

public static StringValue mysql_get_client_info(Env env)
Returns the MySQL client version.


mysql_get_host_info

public static StringValue mysql_get_host_info(Env env,
                                              Mysqli conn)
Returns a string describing the host.


mysql_get_proto_info

public static int mysql_get_proto_info(Env env,
                                       Mysqli conn)
Returns an integer respresenting the MySQL protocol version.


mysql_get_server_info

public static Value mysql_get_server_info(Env env,
                                          Mysqli conn)
Returns the MySQL server version.


mysql_insert_id

public static Value mysql_insert_id(Env env,
                                    Mysqli conn)
returns ID generated for an AUTO_INCREMENT column by the previous INSERT query on success, 0 if the previous query does not generate an AUTO_INCREMENT value, or FALSE if no MySQL connection was established


mysql_list_dbs

public static Value mysql_list_dbs(Env env,
                                   Mysqli conn)
Returns a result pointer containing the databases available from the current mysql daemon.


mysql_list_fields

public static Value mysql_list_fields(Env env,
                                      java.lang.String database,
                                      StringValue tableName,
                                      Mysqli conn)
Retrieves information about the given table name. A Result on success, FALSE on failure.


mysql_listfields

public static Value mysql_listfields(Env env,
                                     java.lang.String databaseName,
                                     StringValue tableName,
                                     Mysqli conn)
Deprecated alias for mysql_list_fields


mysql_db_query

public static Value mysql_db_query(Env env,
                                   java.lang.String databaseName,
                                   StringValue query,
                                   Mysqli conn)
Returns result set or false on error


mysql_select_db

public static boolean mysql_select_db(Env env,
                                      java.lang.String dbName,
                                      Mysqli conn)
Selects the database


mysql_list_tables

public static java.lang.Object mysql_list_tables(Env env,
                                                 StringValue databaseName,
                                                 Mysqli conn)
Retrieves a list of table names from a MySQL database.


mysql_num_fields

public static Value mysql_num_fields(Env env,
                                     MysqliResult result)
Get number of fields in result


mysql_numfields

public static Value mysql_numfields(Env env,
                                    MysqliResult result)
Deprecated alias for mysql_num_fields


mysql_num_rows

public static Value mysql_num_rows(Env env,
                                   MysqliResult result)
Retrieves the number of rows in a result set.


mysql_numrows

public static Value mysql_numrows(Env env,
                                  MysqliResult result)
Undocumented alias for {#link #mysql_num_rows}.


mysql_pconnect

public static Value mysql_pconnect(Env env,
                                   StringValue server,
                                   StringValue user,
                                   StringValue password,
                                   boolean newLink,
                                   int flags)
Returns a new persistent mysql connection. JDBC has its own pooling so don't need to do anything different from regular mysql_connect().


mysql_connect

public static Value mysql_connect(Env env,
                                  StringValue host,
                                  StringValue userName,
                                  StringValue password,
                                  boolean isNewLink,
                                  int flags)
Returns a new mysql connection.


mysql_ping

public static boolean mysql_ping(Env env,
                                 Mysqli conn)
Checks if the connection is still valid.


mysql_stat

public static Value mysql_stat(Env env,
                               Mysqli conn)
Returns a string with the status of the connection or NULL if error.


mysql_tablename

public static Value mysql_tablename(Env env,
                                    MysqliResult result,
                                    int i)
Retrieves the table name corresponding to a field, using a result return by mysql_list_tables(com.caucho.quercus.env.Env, com.caucho.quercus.env.StringValue, com.caucho.quercus.lib.db.Mysqli).


mysql_unbuffered_query

public static java.lang.Object mysql_unbuffered_query(Env env,
                                                      StringValue name,
                                                      Mysqli conn)
Queries the database.


mysql_thread_id

public static Value mysql_thread_id(Env env,
                                    Mysqli conn)
Query an identifier that corresponds to this specific connection. Mysql calls this integer identifier a thread, but it is really a connection identifier.