remove unused
This commit is contained in:
parent
e4bf3fd342
commit
351cc5c6a2
@ -3,7 +3,7 @@
|
||||
* Make mysql_connect work like mysqli_connect for future php versions.
|
||||
*
|
||||
* @author Ivor Barhansky
|
||||
* @version 0.1
|
||||
* @version 0.2
|
||||
*/
|
||||
|
||||
// Make sure the MySQL extension is not loaded and there is no other drop in replacement active
|
||||
@ -64,23 +64,6 @@ if (!extension_loaded('mysql') && !function_exists('mysql_connect')) {
|
||||
return $link;
|
||||
}
|
||||
|
||||
/**
|
||||
* Open a persistent connection to a MySQL server
|
||||
*
|
||||
* @param $server
|
||||
* @param $username
|
||||
* @param $password
|
||||
* @return mysqli|null
|
||||
* @deprecated
|
||||
*/
|
||||
function mysql_pconnect($server, $username, $password, $new_link = false, $client_flags = 0)
|
||||
{
|
||||
global $link;
|
||||
|
||||
$link = mysqli_connect('p:' . $server, $username, $password);
|
||||
return $link;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $databaseName
|
||||
* @return bool
|
||||
@ -130,20 +113,6 @@ if (!extension_loaded('mysql') && !function_exists('mysql_connect')) {
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mysqli_result $result
|
||||
* @return object|stdClass
|
||||
*/
|
||||
function mysql_fetch_object(mysqli_result $result)
|
||||
{
|
||||
$result = $result->fetch_object();
|
||||
if ($result === null) {
|
||||
$result = false;
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mysqli_result $result
|
||||
* @return bool|int
|
||||
@ -173,76 +142,6 @@ if (!extension_loaded('mysql') && !function_exists('mysql_connect')) {
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mysqli $mysqli
|
||||
* @return int
|
||||
* @deprecated
|
||||
*/
|
||||
function mysql_affected_rows(mysqli $mysqli = null)
|
||||
{
|
||||
return mysqli_affected_rows(getLinkIdentifier($mysqli));
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
function mysql_client_encoding(mysqli $mysqli = null)
|
||||
{
|
||||
return mysqli_character_set_name(getLinkIdentifier($mysqli));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mysqli $mysqli
|
||||
* @return bool
|
||||
* @deprecated
|
||||
*/
|
||||
function mysql_close(mysqli $mysqli = null)
|
||||
{
|
||||
return mysqli_close(getLinkIdentifier($mysqli));
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
function mysql_create_db($database_name, mysqli $mysqli = null)
|
||||
{
|
||||
trigger_error('This function was deprecated in PHP 4.3.0 and is therefor not supported', E_USER_DEPRECATED);
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mysqli $mysqli
|
||||
* @return int
|
||||
* @deprecated
|
||||
*/
|
||||
function mysql_errno(mysqli $mysqli = null)
|
||||
{
|
||||
return mysqli_errno(getLinkIdentifier($mysqli));
|
||||
}
|
||||
|
||||
/**
|
||||
* Not implemented
|
||||
*
|
||||
* @return null
|
||||
* @todo implement
|
||||
*
|
||||
*/
|
||||
function mysql_db_name()
|
||||
{
|
||||
trigger_error('The function mysql_db_name() is not implemented', E_USER_WARNING);
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mysqli $mysqli
|
||||
* @return string
|
||||
* @deprecated
|
||||
*/
|
||||
function mysql_error(mysqli $mysqli = null)
|
||||
{
|
||||
return mysqli_error(getLinkIdentifier($mysqli));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mysqli_result $result
|
||||
* @param $result_type
|
||||
@ -254,174 +153,6 @@ if (!extension_loaded('mysql') && !function_exists('mysql_connect')) {
|
||||
return mysqli_fetch_array($result, $result_type);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mysqli $mysqli
|
||||
* @return bool
|
||||
*/
|
||||
function mysql_ping(mysqli $mysqli = null)
|
||||
{
|
||||
return mysqli_ping(getLinkIdentifier($mysqli));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $query
|
||||
* @param mysqli $mysqli
|
||||
* @deprecated
|
||||
*/
|
||||
function mysql_unbuffered_query($query, mysqli $mysqli = null)
|
||||
{
|
||||
return mysqli_query(getLinkIdentifier($mysqli), $query, MYSQLI_USE_RESULT);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
* @deprecated
|
||||
*/
|
||||
function mysql_get_client_info()
|
||||
{
|
||||
return mysqli_get_client_info();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mysqli_result $result
|
||||
* @return void
|
||||
* @deprecated
|
||||
*/
|
||||
function mysql_free_result(mysqli_result $result)
|
||||
{
|
||||
return mysqli_free_result($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mysqli $mysqli
|
||||
* @return bool|mysqli_result
|
||||
*/
|
||||
function mysql_list_dbs(mysqli $mysqli = null)
|
||||
{
|
||||
trigger_error('This function is deprecated. It is preferable to use mysql_query() to issue an SQL Query: SHOW DATABASES statement instead.', E_USER_DEPRECATED);
|
||||
|
||||
return mysqli_query(getLinkIdentifier($mysqli), 'SHOW DATABASES');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $database_name
|
||||
* @param $table_name
|
||||
* @param null $mysqli
|
||||
* @return bool|mysqli_result
|
||||
*/
|
||||
function mysql_list_fields($database_name, $table_name, mysqli $mysqli = null)
|
||||
{
|
||||
trigger_error('This function is deprecated. It is preferable to use mysql_query() to issue an SQL SHOW COLUMNS FROM table [LIKE \'name\'] statement instead.', E_USER_DEPRECATED);
|
||||
|
||||
$mysqli = getLinkIdentifier($mysqli);
|
||||
$db = mysqli_escape_string($mysqli, $database_name);
|
||||
$table = mysqli_escape_string($mysqli, $table_name);
|
||||
|
||||
return mysqli_query($mysqli, sprintf('SHOW COLUMNS FROM %s.%s', $db, $table));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mysqli $mysqli
|
||||
* @return bool|mysqli_result
|
||||
*/
|
||||
function mysql_list_processes(mysqli $mysqli = null)
|
||||
{
|
||||
return mysqli_query(getLinkIdentifier($mysqli), 'SHOW PROCESSLIST');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $charset
|
||||
* @param null $mysqli
|
||||
* @return bool
|
||||
*/
|
||||
function mysql_set_charset($charset, mysqli $mysqli = null)
|
||||
{
|
||||
return mysqli_set_charset(getLinkIdentifier($mysqli), $charset);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param null $mysqli
|
||||
* @return bool|string
|
||||
*/
|
||||
function mysql_info(mysqli $mysqli = null)
|
||||
{
|
||||
$result = mysqli_info(getLinkIdentifier($mysqli));
|
||||
if ($result === null) {
|
||||
$result = false;
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get current system status
|
||||
*
|
||||
* @param null $mysqli
|
||||
* @return bool|string
|
||||
*/
|
||||
function mysql_stat(mysqli $mysqli = null)
|
||||
{
|
||||
return mysqli_stat(getLinkIdentifier($mysqli));
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the current thread ID
|
||||
*
|
||||
* @param null $mysqli
|
||||
* @return bool|string
|
||||
*/
|
||||
function mysql_thread_id(mysqli $mysqli = null)
|
||||
{
|
||||
return mysqli_thread_id(getLinkIdentifier($mysqli));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get MySQL host info
|
||||
*
|
||||
* @param null $mysqli
|
||||
* @return bool|string
|
||||
*/
|
||||
function mysql_get_host_info(mysqli $mysqli = null)
|
||||
{
|
||||
return mysqli_get_host_info(getLinkIdentifier($mysqli));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get MySQL protocol info
|
||||
*
|
||||
* @param null $mysqli
|
||||
* @return bool|string
|
||||
* @deprecated
|
||||
*/
|
||||
function mysql_get_proto_info(mysqli $mysqli = null)
|
||||
{
|
||||
return mysqli_get_proto_info(getLinkIdentifier($mysqli));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get MySQL server info
|
||||
*
|
||||
* @param null $mysqli
|
||||
* @return bool|string
|
||||
*/
|
||||
function mysql_get_server_info(mysqli $mysqli = null)
|
||||
{
|
||||
return mysqli_get_server_info(getLinkIdentifier($mysqli));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get table name of field
|
||||
*
|
||||
* @param $result
|
||||
* @param $i
|
||||
* @return bool
|
||||
*/
|
||||
function mysql_tablename($result, $i)
|
||||
{
|
||||
trigger_error('Not implemented', E_USER_WARNING);
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the ID generated in the last query
|
||||
*
|
||||
@ -454,243 +185,4 @@ if (!extension_loaded('mysql') && !function_exists('mysql_connect')) {
|
||||
return $row[$field];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get number of fields in result
|
||||
*
|
||||
* @param mysqli_result $result
|
||||
* @return int
|
||||
* @deprecated
|
||||
*/
|
||||
function mysql_num_fields(mysqli_result $result)
|
||||
{
|
||||
return mysqli_num_fields($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* List tables in a MySQL database
|
||||
*
|
||||
* @param null $mysqli
|
||||
* @return bool|string
|
||||
*/
|
||||
function mysql_list_tables($database_name, mysqli $mysqli = null)
|
||||
{
|
||||
trigger_error('This function is deprecated. It is preferable to use mysql_query() to issue an SQL SHOW TABLES [FROM db_name] [LIKE \'pattern\'] statement instead.', E_USER_DEPRECATED);
|
||||
|
||||
$mysqli = getLinkIdentifier($mysqli);
|
||||
$db = mysqli_escape_string($mysqli, $database_name);
|
||||
|
||||
return mysqli_query($mysqli, sprintf('SHOW TABLES FROM %s', $db));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get column information from a result and return as an object
|
||||
*
|
||||
* @param mysqli_result $result
|
||||
* @param int $field_offset
|
||||
* @return bool|object
|
||||
* @deprecated
|
||||
*/
|
||||
function mysql_fetch_field(mysqli_result $result, $field_offset = 0)
|
||||
{
|
||||
if ($field_offset) {
|
||||
mysqli_field_seek($result, $field_offset);
|
||||
}
|
||||
|
||||
return mysqli_fetch_field($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the length of the specified field
|
||||
*
|
||||
* @param mysqli_result $result
|
||||
* @param int $field_offset
|
||||
* @return bool
|
||||
* @deprecated
|
||||
*/
|
||||
function mysql_field_len(mysqli_result $result, $field_offset = 0)
|
||||
{
|
||||
trigger_error('This function is not implemented', E_USER_WARNING);
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
function mysql_drop_db()
|
||||
{
|
||||
trigger_error('This function is deprecated since PHP 4.3.0 and therefore not implemented', E_USER_DEPRECATED);
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Move internal result pointer
|
||||
*
|
||||
* @param mysqli_result $result
|
||||
* @param int $row_number
|
||||
* @return void
|
||||
*/
|
||||
function mysql_data_seek(mysqli_result $result, $row_number = 0)
|
||||
{
|
||||
return mysqli_data_seek($result, $row_number);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the name of the specified field in a result
|
||||
*
|
||||
* @param $result
|
||||
* @param $field_offset
|
||||
* @return bool
|
||||
*/
|
||||
function mysql_field_name($result, $field_offset = 0)
|
||||
{
|
||||
$props = mysqli_fetch_field_direct($result, $field_offset);
|
||||
return is_object($props) ? $props->name : false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the length of each output in a result
|
||||
*
|
||||
* @param mysqli_result $result
|
||||
* @return array|bool
|
||||
*/
|
||||
function mysql_fetch_lengths(mysqli_result $result)
|
||||
{
|
||||
return mysqli_fetch_lengths($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the type of the specified field in a result
|
||||
* @param mysqli_result $result
|
||||
* @param $field_offset
|
||||
* @return string
|
||||
*/
|
||||
function mysql_field_type(mysqli_result $result, $field_offset = 0)
|
||||
{
|
||||
$unknown = 'unknown';
|
||||
$info = mysqli_fetch_field_direct($result, $field_offset);
|
||||
if (empty($info->type)) {
|
||||
return $unknown;
|
||||
}
|
||||
|
||||
switch ($info->type) {
|
||||
case MYSQLI_TYPE_FLOAT:
|
||||
case MYSQLI_TYPE_DOUBLE:
|
||||
case MYSQLI_TYPE_DECIMAL:
|
||||
case MYSQLI_TYPE_NEWDECIMAL:
|
||||
return 'real';
|
||||
|
||||
case MYSQLI_TYPE_BIT:
|
||||
return 'bit';
|
||||
|
||||
case MYSQLI_TYPE_TINY:
|
||||
return 'tinyint';
|
||||
|
||||
case MYSQLI_TYPE_TIME:
|
||||
return 'time';
|
||||
|
||||
case MYSQLI_TYPE_DATE:
|
||||
return 'date';
|
||||
|
||||
case MYSQLI_TYPE_DATETIME:
|
||||
return 'datetime';
|
||||
|
||||
case MYSQLI_TYPE_TIMESTAMP:
|
||||
return 'timestamp';
|
||||
|
||||
case MYSQLI_TYPE_YEAR:
|
||||
return 'year';
|
||||
|
||||
case MYSQLI_TYPE_STRING:
|
||||
case MYSQLI_TYPE_VAR_STRING:
|
||||
return 'string';
|
||||
|
||||
case MYSQLI_TYPE_SHORT:
|
||||
case MYSQLI_TYPE_LONG:
|
||||
case MYSQLI_TYPE_LONGLONG:
|
||||
case MYSQLI_TYPE_INT24:
|
||||
return 'int';
|
||||
|
||||
case MYSQLI_TYPE_CHAR:
|
||||
return 'char';
|
||||
|
||||
case MYSQLI_TYPE_ENUM:
|
||||
return 'enum';
|
||||
|
||||
case MYSQLI_TYPE_TINY_BLOB:
|
||||
case MYSQLI_TYPE_MEDIUM_BLOB:
|
||||
case MYSQLI_TYPE_LONG_BLOB:
|
||||
case MYSQLI_TYPE_BLOB:
|
||||
return 'blob';
|
||||
|
||||
case MYSQLI_TYPE_NULL:
|
||||
return 'null';
|
||||
|
||||
case MYSQLI_TYPE_NEWDATE:
|
||||
case MYSQLI_TYPE_INTERVAL:
|
||||
case MYSQLI_TYPE_SET:
|
||||
case MYSQLI_TYPE_GEOMETRY:
|
||||
default:
|
||||
return $unknown;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get name of the table the specified field is in
|
||||
*
|
||||
* @param mysqli_result $result
|
||||
* @param $field_offset
|
||||
* @return bool
|
||||
*/
|
||||
function mysql_field_table(mysqli_result $result, $field_offset = 0)
|
||||
{
|
||||
$info = mysqli_fetch_field_direct($result, $field_offset);
|
||||
if (empty($info->table)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return $info->table;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the flags associated with the specified field in a result
|
||||
*
|
||||
* @param mysqli_result $result
|
||||
* @param int $field_offset
|
||||
* @return bool
|
||||
* @todo implement
|
||||
*
|
||||
*/
|
||||
function mysql_field_flags(mysqli_result $result, $field_offset = 0)
|
||||
{
|
||||
trigger_error('This function is not implemented', E_USER_WARNING);
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set result pointer to a specified field offset
|
||||
*
|
||||
* @param mysqli_result $result
|
||||
* @param int $field_offset
|
||||
* @return bool
|
||||
*/
|
||||
function mysql_field_seek(mysqli_result $result, $field_offset = 0)
|
||||
{
|
||||
return mysqli_field_seek($result, $field_offset);
|
||||
}
|
||||
|
||||
/**
|
||||
* Selects a database and executes a query on it
|
||||
*
|
||||
* @param $database
|
||||
* @param $query
|
||||
* @param mysqli $mysqli
|
||||
* @return bool
|
||||
* @todo implement
|
||||
*
|
||||
*/
|
||||
function mysql_db_query($database, $query, mysqli $mysqli = null)
|
||||
{
|
||||
trigger_error('This function is deprecated since PHP 5.3.0 and therefore not implemented', E_USER_DEPRECATED);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user