mysql — This class implements a MySQL specific DBAPI
mysql is part of the DBAPI package.
class mysql extends DBAPI { private resource $link private string $query public mysql __construct ( string $dsn, string $username, string $password, string $options ); public int affectedrows ( void ); public void close ( void ); public int errno ( void ); public string error ( void ); public mixed escape ( mixed $var ); protected resource execute_query ( string $query ); public array fetchrow ( resource $result ); public array fetchrowset ( resource $result ); public void freeresult ( resource $result ); public int lastid ( void ); protected string limit_query ( string $query, int $length, int $start ); }
DBAPI +----mysql
This class implements a MySQL specific DBAPI
private resource $link
The database connection resource
Default value: empty string
private string $query
A copy of the query. Used for reporting errors
Default value: empty string
public mysql __construct ( string $dsn, string $username, string $password, string $options );
Create a database connection
This function is identical to PHP's PDO() constructor.
public int affectedrows ( void );
Get the number of rows affected by the last query
public void close ( void );
Close the connection
public int errno ( void );
Return the last SQL error number
public string error ( void );
Return the last SQL error message
public mixed escape ( mixed $var );
Escape a variable to safely use in in SQL
protected resource execute_query ( string $query );
Execute a single SQL query
public array fetchrow ( resource $result );
Fetch a single row from the SQL result set. If no result is specified, it uses the last returned result
public array fetchrowset ( resource $result );
Fetch an array of rows from the SQL result set. If no result is specified, it uses the last returned result
public void freeresult ( resource $result );
Free an SQL result resource. If no result is specified, it uses the last returned result
public int lastid ( void );
Get the unique ID of the last row that was insterted in the database
protected string limit_query ( string $query, int $length, int $start );
Modify a query to limit the size of the returned result set