Vergleich inc/db_mysqli.php - 1.8.3 - 1.8.7

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 8Zeile 8
 *
*/


 *
*/


class DB_MySQLi

class DB_MySQLi implements DB_Base

{
/**
* The title of this layer.

{
/**
* The title of this layer.

Zeile 55Zeile 55
	/**
* The read database connection resource.
*

	/**
* The read database connection resource.
*

	 * @var resource

	 * @var mysqli

	 */
public $read_link;

/**
* The write database connection resource
*

	 */
public $read_link;

/**
* The write database connection resource
*

	 * @var resource

	 * @var mysqli

	 */
public $write_link;

/**
* Reference to the last database connection resource used.
*

	 */
public $write_link;

/**
* Reference to the last database connection resource used.
*

	 * @var resource

	 * @var mysqli

	 */
public $current_link;

/**

	 */
public $current_link;

/**

	 * Explanation of a query.

	 * The database name.

	 *

	 *

	 * @var string
*/








	 * @var string
*/
public $database;

/**
* Explanation of a query.
*
* @var string
*/

	public $explain;

/**

	public $explain;

/**

Zeile 86Zeile 93
	 * @var string
*/
public $version;

	 * @var string
*/
public $version;


/**


/**

	 * The current table type in use (myisam/innodb)

	 * The current table type in use (myisam/innodb)

	 *
* @var string

	 *
* @var string

	 */
public $table_type = "myisam";

/**
* The table prefix used for simple select, update, insert and delete queries

	 */
public $table_type = "myisam";

/**
* The table prefix used for simple select, update, insert and delete queries

	 *
* @var string
*/

	 *
* @var string
*/

	public $table_prefix;

/**

	public $table_prefix;

/**

Zeile 135Zeile 142
	 * @var int
*/
protected $last_query_type = 0;

	 * @var int
*/
protected $last_query_type = 0;





	/**
* Connect to the database server.
*

	/**
* Connect to the database server.
*

	 * @param array Array of DBMS connection details.
* @return resource The DB connection resource. Returns false on fail or -1 on a db connect failure.

	 * @param array $config Array of DBMS connection details.
* @return mysqli The DB connection resource. Returns false on fail or -1 on a db connect failure.

	 */
function connect($config)
{

	 */
function connect($config)
{

Zeile 162Zeile 169
						$connections['read'][] = $settings;
}
}

						$connections['read'][] = $settings;
}
}

			}

			}

			// Specified both read & write servers
else
{

			// Specified both read & write servers
else
{

Zeile 174Zeile 181

// Actually connect to the specified servers
foreach(array('read', 'write') as $type)


// Actually connect to the specified servers
foreach(array('read', 'write') as $type)

		{

		{

			if(!isset($connections[$type]) || !is_array($connections[$type]))

			if(!isset($connections[$type]) || !is_array($connections[$type]))

			{

			{

				break;

				break;

			}


			}


			if(array_key_exists('hostname', $connections[$type]))
{
$details = $connections[$type];
unset($connections);
$connections[$type][] = $details;

			if(array_key_exists('hostname', $connections[$type]))
{
$details = $connections[$type];
unset($connections);
$connections[$type][] = $details;

			}


			}


			// Shuffle the connections
shuffle($connections[$type]);


			// Shuffle the connections
shuffle($connections[$type]);


Zeile 198Zeile 205
				if(!empty($single_connection['pconnect']) && version_compare(PHP_VERSION, '5.3.0', '>='))
{
$persist = 'p:';

				if(!empty($single_connection['pconnect']) && version_compare(PHP_VERSION, '5.3.0', '>='))
{
$persist = 'p:';

				}

$link = "{$type}_link";

				}

$link = "{$type}_link";


get_execution_time();


get_execution_time();





				// Specified a custom port for this connection?
$port = 0;
if(strstr($single_connection['hostname'],':'))
{
list($hostname, $port) = explode(":", $single_connection['hostname'], 2);

				// Specified a custom port for this connection?
$port = 0;
if(strstr($single_connection['hostname'],':'))
{
list($hostname, $port) = explode(":", $single_connection['hostname'], 2);

				}


				}


				if($port)
{
$this->$link = @$connect_function($persist.$hostname, $single_connection['username'], $single_connection['password'], "", $port);

				if($port)
{
$this->$link = @$connect_function($persist.$hostname, $single_connection['username'], $single_connection['password'], "", $port);

				}

				}

				else
{
$this->$link = @$connect_function($persist.$single_connection['hostname'], $single_connection['username'], $single_connection['password']);
}

				else
{
$this->$link = @$connect_function($persist.$single_connection['hostname'], $single_connection['username'], $single_connection['password']);
}





				$time_spent = get_execution_time();

				$time_spent = get_execution_time();

				$this->query_time += $time_spent;


				$this->query_time += $time_spent;


				// Successful connection? break down brother!
if($this->$link)

				// Successful connection? break down brother!
if($this->$link)

				{

				{

					$this->connections[] = "[".strtoupper($type)."] {$single_connection['username']}@{$single_connection['hostname']} (Connected in ".format_time_duration($time_spent).")";
break;

					$this->connections[] = "[".strtoupper($type)."] {$single_connection['username']}@{$single_connection['hostname']} (Connected in ".format_time_duration($time_spent).")";
break;

				}

				}

				else
{
$this->connections[] = "<span style=\"color: red\">[FAILED] [".strtoupper($type)."] {$single_connection['username']}@{$single_connection['hostname']}</span>";
}
}

				else
{
$this->connections[] = "<span style=\"color: red\">[FAILED] [".strtoupper($type)."] {$single_connection['username']}@{$single_connection['hostname']}</span>";
}
}

		}


		}


		// No write server was specified (simple connection or just multiple servers) - mirror write link
if(!array_key_exists('write', $connections))

		// No write server was specified (simple connection or just multiple servers) - mirror write link
if(!array_key_exists('write', $connections))

		{

		{

			$this->write_link = &$this->read_link;
}


			$this->write_link = &$this->read_link;
}


Zeile 246Zeile 253
		if(!$this->read_link)
{
$this->error("[READ] Unable to connect to MySQL server");

		if(!$this->read_link)
{
$this->error("[READ] Unable to connect to MySQL server");

			return false;

			return false;

		}
// No write?
else if(!$this->write_link)

		}
// No write?
else if(!$this->write_link)

Zeile 268Zeile 275
	/**
* Selects the database to use.
*

	/**
* Selects the database to use.
*

	 * @param string The database name.

	 * @param string $database The database name.

	 * @return boolean True when successfully connected, false if not.
*/
function select_db($database)

	 * @return boolean True when successfully connected, false if not.
*/
function select_db($database)

	{
global $mybb;


	{
$this->database = $database;


		$master_success = @mysqli_select_db($this->read_link, $database) or $this->error("[READ] Unable to select database", $this->read_link);
if($this->write_link)

		$master_success = @mysqli_select_db($this->read_link, $database) or $this->error("[READ] Unable to select database", $this->read_link);
if($this->write_link)

		{

		{

			$slave_success = @mysqli_select_db($this->write_link, $database) or $this->error("[WRITE] Unable to select slave database", $this->write_link);

$success = ($master_success && $slave_success ? true : false);

			$slave_success = @mysqli_select_db($this->write_link, $database) or $this->error("[WRITE] Unable to select slave database", $this->write_link);

$success = ($master_success && $slave_success ? true : false);

		}

		}

		else
{
$success = $master_success;

		else
{
$success = $master_success;

		}


		}


		if($success && $this->db_encoding)
{
@mysqli_set_charset($this->read_link, $this->db_encoding);

		if($success && $this->db_encoding)
{
@mysqli_set_charset($this->read_link, $this->db_encoding);

Zeile 297Zeile 304
			}
}
return $success;

			}
}
return $success;

	}


	}


	/**
* Query the database.
*

	/**
* Query the database.
*

	 * @param string The query SQL.
* @param boolean 1 if hide errors, 0 if not.
* @param integer 1 if executes on master database, 0 if not.
* @return resource The query data.

	 * @param string $string The query SQL.
* @param boolean|int $hide_errors 1 if hide errors, 0 if not.
* @param integer $write_query 1 if executes on master database, 0 if not.
* @return mysqli_result The query data.

	 */
function query($string, $hide_errors=0, $write_query=0)
{

	 */
function query($string, $hide_errors=0, $write_query=0)
{

		global $pagestarttime, $db, $mybb;

		global $mybb;


get_execution_time();



get_execution_time();


Zeile 353Zeile 360

/**
* Execute a write query on the master database


/**
* Execute a write query on the master database

	 *
* @param string The query SQL.
* @param boolean 1 if hide errors, 0 if not.
* @return resource The query data.

	 *
* @param string $query The query SQL.
* @param boolean|int $hide_errors 1 if hide errors, 0 if not.
* @return mysqli_result The query data.

	 */
function write_query($query, $hide_errors=0)
{

	 */
function write_query($query, $hide_errors=0)
{

Zeile 366Zeile 373
	/**
* Explain a query on the database.
*

	/**
* Explain a query on the database.
*

	 * @param string The query SQL.
* @param string The time it took to perform the query.

	 * @param string $string The query SQL.
* @param string $qtime The time it took to perform the query.

	 */
function explain_query($string, $qtime)
{

	 */
function explain_query($string, $qtime)
{

Zeile 381Zeile 388
		if(preg_match("#^\s*select#i", $string))
{
$query = mysqli_query($this->current_link, "EXPLAIN $string");

		if(preg_match("#^\s*select#i", $string))
{
$query = mysqli_query($this->current_link, "EXPLAIN $string");

			$this->explain .= "<table style=\"background-color: #666;\" width=\"95%\" cellpadding=\"4\" cellspacing=\"1\" align=\"center\">\n".
"<tr>\n".

			$this->explain .= "<table style=\"background-color: #666;\" width=\"95%\" cellpadding=\"4\" cellspacing=\"1\" align=\"center\">\n".
"<tr>\n".

				"<td colspan=\"8\" style=\"background-color: #ccc;\">{$debug_extra}<div><strong>#".$this->query_count." - Select Query</strong></div></td>\n".
"</tr>\n".
"<tr>\n".

				"<td colspan=\"8\" style=\"background-color: #ccc;\">{$debug_extra}<div><strong>#".$this->query_count." - Select Query</strong></div></td>\n".
"</tr>\n".
"<tr>\n".

Zeile 443Zeile 450
	/**
* Return a result array for a query.
*

	/**
* Return a result array for a query.
*

	 * @param resource The query data.
* @param constant The type of array to return.

	 * @param mysqli_result $query The query data.
* @param int $resulttype The type of array to return. Either MYSQLI_NUM, MYSQLI_BOTH or MYSQLI_ASSOC

	 * @return array The array of results.
*/
function fetch_array($query, $resulttype=MYSQLI_ASSOC)

	 * @return array The array of results.
*/
function fetch_array($query, $resulttype=MYSQLI_ASSOC)

Zeile 467Zeile 474
	/**
* Return a specific field from a query.
*

	/**
* Return a specific field from a query.
*

	 * @param resource The query ID.
* @param string The name of the field to return.
* @param int The number of the row to fetch it from.

	 * @param mysqli_result $query The query ID.
* @param string $field The name of the field to return.
* @param int|bool $row The number of the row to fetch it from.

	 */
function fetch_field($query, $field, $row=false)
{

	 */
function fetch_field($query, $field, $row=false)
{

Zeile 484Zeile 491
	/**
* Moves internal row pointer to the next row
*

	/**
* Moves internal row pointer to the next row
*

	 * @param resource The query ID.
* @param int The pointer to move the row to.


	 * @param mysqli_result $query The query ID.
* @param int $row The pointer to move the row to.
* @return bool

	 */
function data_seek($query, $row)
{

	 */
function data_seek($query, $row)
{

Zeile 495Zeile 503
	/**
* Return the number of rows resulting from a query.
*

	/**
* Return the number of rows resulting from a query.
*

	 * @param resource The query data.

	 * @param mysqli_result $query The query data.

	 * @return int The number of rows in the result.
*/
function num_rows($query)

	 * @return int The number of rows in the result.
*/
function num_rows($query)

Zeile 564Zeile 572
	/**
* Output a database error.
*

	/**
* Output a database error.
*

	 * @param string The string to present as an error.


	 * @param string $string The string to present as an error.
* @return bool Whether error reporting is enabled or not

	 */
function error($string="")
{

	 */
function error($string="")
{

Zeile 586Zeile 595
					"query" => $string
);
$error_handler->error(MYBB_SQL, $error);

					"query" => $string
);
$error_handler->error(MYBB_SQL, $error);

			}
else
{

			}
else
{

				trigger_error("<strong>[SQL] [".$this->error_number()."] ".$this->error_string()."</strong><br />{$string}", E_USER_ERROR);
}

				trigger_error("<strong>[SQL] [".$this->error_number()."] ".$this->error_string()."</strong><br />{$string}", E_USER_ERROR);
}

 

return true;

		}
else
{
return false;

		}
else
{
return false;

		}
}

		}
}


/**
* Returns the number of affected rows in a query.


/**
* Returns the number of affected rows in a query.

Zeile 604Zeile 615
	 * @return int The number of affected rows.
*/
function affected_rows()

	 * @return int The number of affected rows.
*/
function affected_rows()

	{

	{

		return mysqli_affected_rows($this->current_link);
}

/**
* Return the number of fields.
*

		return mysqli_affected_rows($this->current_link);
}

/**
* Return the number of fields.
*

	 * @param resource The query data.

	 * @param mysqli_result $query The query data.

	 * @return int The number of fields.

	 * @return int The number of fields.

	 */

	 */

	function num_fields($query)
{
return mysqli_num_fields($query);

	function num_fields($query)
{
return mysqli_num_fields($query);

	}

/**
* Lists all functions in the database.
*
* @param string The database name.
* @param string Prefix of the table (optional)

	}

/**
* Lists all tables in the database.
*
* @param string $database The database name.
* @param string $prefix Prefix of the table (optional)

	 * @return array The table list.
*/
function list_tables($database, $prefix='')
{
if($prefix)
{

	 * @return array The table list.
*/
function list_tables($database, $prefix='')
{
if($prefix)
{

			$query = $this->query("SHOW TABLES FROM `$database` LIKE '".$this->escape_string($prefix)."%'");
}
else
{
$query = $this->query("SHOW TABLES FROM `$database`");















			if(version_compare($this->get_version(), '5.0.2', '>='))
{
$query = $this->query("SHOW FULL TABLES FROM `$database` WHERE table_type = 'BASE TABLE' AND `Tables_in_$database` LIKE '".$this->escape_string($prefix)."%'");
}
else
{
$query = $this->query("SHOW TABLES FROM `$database` LIKE '".$this->escape_string($prefix)."%'");
}
}
else
{
if(version_compare($this->get_version(), '5.0.2', '>='))
{
$query = $this->query("SHOW FULL TABLES FROM `$database` WHERE table_type = 'BASE TABLE'");
}
else
{
$query = $this->query("SHOW TABLES FROM `$database`");
}

		}

$tables = array();

		}

$tables = array();

		while(list($table) = mysqli_fetch_array($query))
{
$tables[] = $table;
}


		while(list($table) = mysqli_fetch_array($query))
{
$tables[] = $table;
}


		return $tables;
}

/**
* Check if a table exists in a database.
*

		return $tables;
}

/**
* Check if a table exists in a database.
*

	 * @param string The table name.

	 * @param string $table The table name.

	 * @return boolean True when exists, false if not.
*/
function table_exists($table)
{
// Execute on master server to ensure if we've just created a table that we get the correct result

	 * @return boolean True when exists, false if not.
*/
function table_exists($table)
{
// Execute on master server to ensure if we've just created a table that we get the correct result

		$query = $this->write_query("
SHOW TABLES
LIKE '{$this->table_prefix}$table'
");
$exists = $this->num_rows($query);




		if(version_compare($this->get_version(), '5.0.2', '>='))
{
$query = $this->query("SHOW FULL TABLES FROM `".$this->database."` WHERE table_type = 'BASE TABLE' AND `Tables_in_".$this->database."` = '{$this->table_prefix}$table'");
}
else
{
$query = $this->query("SHOW TABLES LIKE '{$this->table_prefix}$table'");
}





 
		$exists = $this->num_rows($query);

		if($exists > 0)
{
return true;

		if($exists > 0)
{
return true;

Zeile 673Zeile 703
	/**
* Check if a field exists in a database.
*

	/**
* Check if a field exists in a database.
*

	 * @param string The field name.
* @param string The table name.

	 * @param string $field The field name.
* @param string $table The table name.

	 * @return boolean True when exists, false if not.
*/
function field_exists($field, $table)

	 * @return boolean True when exists, false if not.
*/
function field_exists($field, $table)

Zeile 699Zeile 729
	/**
* Add a shutdown query.
*

	/**
* Add a shutdown query.
*

	 * @param resource The query data.
* @param string An optional name for the query.

	 * @param mysqli_result $query The query data.
* @param string $name An optional name for the query.

	 */

	 */

	function shutdown_query($query, $name=0)

	function shutdown_query($query, $name="")

	{
global $shutdown_queries;
if($name)

	{
global $shutdown_queries;
if($name)

Zeile 718Zeile 748
	/**
* Performs a simple select query.
*

	/**
* Performs a simple select query.
*

	 * @param string The table name to be queried.
* @param string Comma delimetered list of fields to be selected.
* @param string SQL formatted list of conditions to be matched.
* @param array List of options: group by, order by, order direction, limit, limit start.
* @return resource The query data.

	 * @param string $table The table name to be queried.
* @param string $fields Comma delimetered list of fields to be selected.
* @param string $conditions SQL formatted list of conditions to be matched.
* @param array $options List of options: group by, order by, order direction, limit, limit start.
* @return mysqli_result The query data.

	 */
function simple_select($table, $fields="*", $conditions="", $options=array())
{

	 */
function simple_select($table, $fields="*", $conditions="", $options=array())
{

Zeile 762Zeile 792
	/**
* Build an insert query from an array.
*

	/**
* Build an insert query from an array.
*

	 * @param string The table name to perform the query on.
* @param array An array of fields and their values.

	 * @param string $table The table name to perform the query on.
* @param array $array An array of fields and their values.

	 * @return int The insert ID if available
*/
function insert_query($table, $array)

	 * @return int The insert ID if available
*/
function insert_query($table, $array)

Zeile 788Zeile 818
			}
else
{

			}
else
{

				$array[$field] = "'{$value}'";

				$array[$field] = $this->quote_val($value);

			}
}


			}
}


Zeile 805Zeile 835
	/**
* Build one query for multiple inserts from a multidimensional array.
*

	/**
* Build one query for multiple inserts from a multidimensional array.
*

	 * @param string The table name to perform the query on.
* @param array An array of inserts.
* @return int The insert ID if available

	 * @param string $table The table name to perform the query on.
* @param array $array An array of inserts.
* @return void

	 */
function insert_query_multiple($table, $array)
{

	 */
function insert_query_multiple($table, $array)
{

Zeile 815Zeile 845

if(!is_array($array))
{


if(!is_array($array))
{

			return false;

			return;

		}
// Field names
$fields = array_keys($array[0]);

		}
// Field names
$fields = array_keys($array[0]);

Zeile 836Zeile 866
					$values[$field] = $value;
}
else

					$values[$field] = $value;
}
else

				{
$values[$field] = "'{$value}'";
}
}

				{
$values[$field] = $this->quote_val($value);
}
}

			$insert_rows[] = "(".implode(",", $values).")";
}
$insert_rows = implode(", ", $insert_rows);

			$insert_rows[] = "(".implode(",", $values).")";
}
$insert_rows = implode(", ", $insert_rows);

Zeile 848Zeile 878
			INSERT
INTO {$this->table_prefix}{$table} ({$fields})
VALUES {$insert_rows}

			INSERT
INTO {$this->table_prefix}{$table} ({$fields})
VALUES {$insert_rows}

		");
}


		");
}


	/**
* Build an update query from an array.
*

	/**
* Build an update query from an array.
*

	 * @param string The table name to perform the query on.
* @param array An array of fields and their values.
* @param string An optional where clause for the query.
* @param string An optional limit clause for the query.
* @param boolean An option to quote incoming values of the array.
* @return resource The query data.

	 * @param string $table The table name to perform the query on.
* @param array $array An array of fields and their values.
* @param string $where An optional where clause for the query.
* @param string $limit An optional limit clause for the query.
* @param boolean $no_quote An option to quote incoming values of the array.
* @return mysqli_result The query data.

	 */
function update_query($table, $array, $where="", $limit="", $no_quote=false)
{

	 */
function update_query($table, $array, $where="", $limit="", $no_quote=false)
{

Zeile 868Zeile 898
		if(!is_array($array))
{
return false;

		if(!is_array($array))
{
return false;

		}

		}


$comma = "";
$query = "";
$quote = "'";


$comma = "";
$query = "";
$quote = "'";





		if($no_quote == true)
{
$quote = "";
}

foreach($array as $field => $value)

		if($no_quote == true)
{
$quote = "";
}

foreach($array as $field => $value)

		{

		{

			if(isset($mybb->binary_fields[$table][$field]) && $mybb->binary_fields[$table][$field])
{
if($value[0] != 'X') // Not escaped?

			if(isset($mybb->binary_fields[$table][$field]) && $mybb->binary_fields[$table][$field])
{
if($value[0] != 'X') // Not escaped?

Zeile 892Zeile 922
			}
else
{

			}
else
{

				if(is_numeric($value))
{
$query .= $comma."`".$field."`={$value}";
}
else
{
$query .= $comma."`".$field."`={$quote}{$value}{$quote}";
}

				$quoted_value = $this->quote_val($value, $quote);

$query .= $comma."`".$field."`={$quoted_value}";






			}
$comma = ', ';
}

			}
$comma = ', ';
}

Zeile 918Zeile 943
			UPDATE {$this->table_prefix}$table
SET $query
");

			UPDATE {$this->table_prefix}$table
SET $query
");

 
	}

/**
* @param int|string $value
* @param string $quote
*
* @return int|string
*/
private function quote_val($value, $quote="'")
{
if(is_int($value))
{
$quoted = $value;
}
else
{
$quoted = $quote . $value . $quote;
}

return $quoted;

	}

/**
* Build a delete query.
*

	}

/**
* Build a delete query.
*

	 * @param string The table name to perform the query on.
* @param string An optional where clause for the query.
* @param string An optional limit clause for the query.
* @return resource The query data.

	 * @param string $table The table name to perform the query on.
* @param string $where An optional where clause for the query.
* @param string $limit An optional limit clause for the query.
* @return mysqli_result The query data.

	 */
function delete_query($table, $where="", $limit="")
{

	 */
function delete_query($table, $where="", $limit="")
{

Zeile 945Zeile 990
	/**
* Escape a string according to the MySQL escape format.
*

	/**
* Escape a string according to the MySQL escape format.
*

	 * @param string The string to be escaped.

	 * @param string $string The string to be escaped.

	 * @return string The escaped string.
*/
function escape_string($string)

	 * @return string The escaped string.
*/
function escape_string($string)

Zeile 973Zeile 1018
	/**
* Frees the resources of a MySQLi query.
*

	/**
* Frees the resources of a MySQLi query.
*

	 * @param object The query to destroy.
* @return boolean Returns true on success, false on faliure

	 * @param mysqli_result $query The query to destroy.
* @return boolean Returns true

	 */
function free_result($query)
{

	 */
function free_result($query)
{

		return mysqli_free_result($query);


		mysqli_free_result($query);
return true; // Kept for compatibility reasons

	}

/**
* Escape a string used within a like command.
*

	}

/**
* Escape a string used within a like command.
*

	 * @param string The string to be escaped.

	 * @param string $string The string to be escaped.

	 * @return string The escaped string.
*/
function escape_string_like($string)

	 * @return string The escaped string.
*/
function escape_string_like($string)

Zeile 1023Zeile 1069
	/**
* Optimizes a specific table.
*

	/**
* Optimizes a specific table.
*

	 * @param string The name of the table to be optimized.

	 * @param string $table The name of the table to be optimized.

	 */
function optimize_table($table)
{

	 */
function optimize_table($table)
{

Zeile 1033Zeile 1079
	/**
* Analyzes a specific table.
*

	/**
* Analyzes a specific table.
*

	 * @param string The name of the table to be analyzed.

	 * @param string $table The name of the table to be analyzed.

	 */
function analyze_table($table)
{

	 */
function analyze_table($table)
{

Zeile 1043Zeile 1089
	/**
* Show the "create table" command for a specific table.
*

	/**
* Show the "create table" command for a specific table.
*

	 * @param string The name of the table.

	 * @param string $table The name of the table.

	 * @return string The MySQL command to create the specified table.
*/
function show_create_table($table)

	 * @return string The MySQL command to create the specified table.
*/
function show_create_table($table)

Zeile 1057Zeile 1103
	/**
* Show the "show fields from" command for a specific table.
*

	/**
* Show the "show fields from" command for a specific table.
*

	 * @param string The name of the table.
* @return string Field info for that table

	 * @param string $table The name of the table.
* @return array Field info for that table

	 */
function show_fields_from($table)
{
$query = $this->write_query("SHOW FIELDS FROM ".$this->table_prefix.$table."");

	 */
function show_fields_from($table)
{
$query = $this->write_query("SHOW FIELDS FROM ".$this->table_prefix.$table."");

 
		$field_info = array();

		while($field = $this->fetch_array($query))
{
$field_info[] = $field;

		while($field = $this->fetch_array($query))
{
$field_info[] = $field;

Zeile 1073Zeile 1120
	/**
* Returns whether or not the table contains a fulltext index.
*

	/**
* Returns whether or not the table contains a fulltext index.
*

	 * @param string The name of the table.
* @param string Optionally specify the name of the index.

	 * @param string $table The name of the table.
* @param string $index Optionally specify the name of the index.

	 * @return boolean True or false if the table has a fulltext index or not.
*/
function is_fulltext($table, $index="")

	 * @return boolean True or false if the table has a fulltext index or not.
*/
function is_fulltext($table, $index="")

Zeile 1101Zeile 1148
	/**
* Returns whether or not this database engine supports fulltext indexing.
*

	/**
* Returns whether or not this database engine supports fulltext indexing.
*

	 * @param string The table to be checked.

	 * @param string $table The table to be checked.

	 * @return boolean True or false if supported or not.
*/


	 * @return boolean True or false if supported or not.
*/


Zeile 1125Zeile 1172
	/**
* Returns whether or not this database engine supports boolean fulltext matching.
*

	/**
* Returns whether or not this database engine supports boolean fulltext matching.
*

	 * @param string The table to be checked.

	 * @param string $table The table to be checked.

	 * @return boolean True or false if supported or not.
*/
function supports_fulltext_boolean($table)

	 * @return boolean True or false if supported or not.
*/
function supports_fulltext_boolean($table)

Zeile 1142Zeile 1189
	/**
* Checks to see if an index exists on a specified table
*

	/**
* Checks to see if an index exists on a specified table
*

	 * @param string The name of the table.
* @param string The name of the index.


	 * @param string $table The name of the table.
* @param string $index The name of the index.
* @return bool Returns whether index exists

	 */
function index_exists($table, $index)
{

	 */
function index_exists($table, $index)
{

Zeile 1169Zeile 1217
	/**
* Creates a fulltext index on the specified column in the specified table with optional index name.
*

	/**
* Creates a fulltext index on the specified column in the specified table with optional index name.
*

	 * @param string The name of the table.
* @param string Name of the column to be indexed.
* @param string The index name, optional.

	 * @param string $table The name of the table.
* @param string $column Name of the column to be indexed.
* @param string $name The index name, optional.

	 */
function create_fulltext_index($table, $column, $name="")
{

	 */
function create_fulltext_index($table, $column, $name="")
{

Zeile 1181Zeile 1229
	/**
* Drop an index with the specified name from the specified table
*

	/**
* Drop an index with the specified name from the specified table
*

	 * @param string The name of the table.
* @param string The name of the index.

	 * @param string $table The name of the table.
* @param string $name The name of the index.

	 */
function drop_index($table, $name)
{

	 */
function drop_index($table, $name)
{

Zeile 1192Zeile 1240
	/**
* Drop an table with the specified table
*

	/**
* Drop an table with the specified table
*

	 * @param boolean hard drop - no checking
* @param boolean use table prefix


	 * @param string $table The table to drop
* @param boolean $hard hard drop - no checking
* @param boolean $table_prefix use table prefix

	 */
function drop_table($table, $hard=false, $table_prefix=true)
{

	 */
function drop_table($table, $hard=false, $table_prefix=true)
{

Zeile 1219Zeile 1268
	/**
* Renames a table
*

	/**
* Renames a table
*

	 * @param string The old table name
* @param string the new table name
* @param boolean use table prefix


	 * @param string $old_table The old table name
* @param string $new_table the new table name
* @param boolean $table_prefix use table prefix
* @return mysqli_result

	 */
function rename_table($old_table, $new_table, $table_prefix=true)
{

	 */
function rename_table($old_table, $new_table, $table_prefix=true)
{

Zeile 1240Zeile 1290
	/**
* Replace contents of table with values
*

	/**
* Replace contents of table with values
*

	 * @param string The table
* @param array The replacements


	 * @param string $table The table
* @param array $replacements The replacements
* @return mysqli_result|bool

	 */
function replace_query($table, $replacements=array())
{

	 */
function replace_query($table, $replacements=array())
{

Zeile 1262Zeile 1313
			}
else
{

			}
else
{

				$values .= $comma."`".$column."`='".$value."'";

				$values .= $comma."`".$column."`=".$this->quote_val($value);

			}

$comma = ',';

			}

$comma = ',';

Zeile 1279Zeile 1330
	/**
* Drops a column
*

	/**
* Drops a column
*

	 * @param string The table
* @param string The column name


	 * @param string $table The table
* @param string $column The column name
* @return mysqli_result

	 */
function drop_column($table, $column)
{

	 */
function drop_column($table, $column)
{

Zeile 1290Zeile 1342
	/**
* Adds a column
*

	/**
* Adds a column
*

	 * @param string The table
* @param string The column name
* @param string the new column definition


	 * @param string $table The table
* @param string $column The column name
* @param string $definition the new column definition
* @return mysqli_result

	 */
function add_column($table, $column, $definition)
{

	 */
function add_column($table, $column, $definition)
{

Zeile 1302Zeile 1355
	/**
* Modifies a column
*

	/**
* Modifies a column
*

	 * @param string The table
* @param string The column name
* @param string the new column definition


	 * @param string $table The table
* @param string $column The column name
* @param string $new_definition the new column definition
* @return mysqli_result

	 */
function modify_column($table, $column, $new_definition)
{

	 */
function modify_column($table, $column, $new_definition)
{

Zeile 1314Zeile 1368
	/**
* Renames a column
*

	/**
* Renames a column
*

	 * @param string The table
* @param string The old column name
* @param string the new column name
* @param string the new column definition


	 * @param string $table The table
* @param string $old_column The old column name
* @param string $new_column the new column name
* @param string $new_definition the new column definition
* @return mysqli_result

	 */
function rename_column($table, $old_column, $new_column, $new_definition)
{

	 */
function rename_column($table, $old_column, $new_column, $new_definition)
{

Zeile 1327Zeile 1382
	/**
* Sets the table prefix used by the simple select, insert, update and delete functions
*

	/**
* Sets the table prefix used by the simple select, insert, update and delete functions
*

	 * @param string The new table prefix

	 * @param string $prefix The new table prefix

	 */
function set_table_prefix($prefix)
{

	 */
function set_table_prefix($prefix)
{

Zeile 1337Zeile 1392
	/**
* Fetched the total size of all mysql tables or a specific table
*

	/**
* Fetched the total size of all mysql tables or a specific table
*

	 * @param string The table (optional)

	 * @param string $table The table (optional)

	 * @return integer the total size of all mysql tables or a specific table
*/
function fetch_size($table='')

	 * @return integer the total size of all mysql tables or a specific table
*/
function fetch_size($table='')

Zeile 1361Zeile 1416
	/**
* Fetch a list of database character sets this DBMS supports
*

	/**
* Fetch a list of database character sets this DBMS supports
*

	 * @return array Array of supported character sets with array key being the name, array value being display name. False if unsupported

	 * @return array|bool Array of supported character sets with array key being the name, array value being display name. False if unsupported

	 */
function fetch_db_charsets()
{

	 */
function fetch_db_charsets()
{

Zeile 1375Zeile 1430
			'cp850' => 'DOS West European',
'hp8' => 'HP West European',
'koi8r' => 'KOI8-R Relcom Russian',

			'cp850' => 'DOS West European',
'hp8' => 'HP West European',
'koi8r' => 'KOI8-R Relcom Russian',

			'latin1' => 'cp1252 West European',

			'latin1' => 'ISO 8859-1 Latin 1',

			'latin2' => 'ISO 8859-2 Central European',
'swe7' => '7bit Swedish',
'ascii' => 'US ASCII',

			'latin2' => 'ISO 8859-2 Central European',
'swe7' => '7bit Swedish',
'ascii' => 'US ASCII',

Zeile 1413Zeile 1468
	/**
* Fetch a database collation for a particular database character set
*

	/**
* Fetch a database collation for a particular database character set
*

	 * @param string The database character set
* @return string The matching database collation, false if unsupported

	 * @param string $charset The database character set
* @return string|bool The matching database collation, false if unsupported

	 */
function fetch_charset_collation($charset)
{

	 */
function fetch_charset_collation($charset)
{

Zeile 1497Zeile 1552
	/**
* Binary database fields require special attention.
*

	/**
* Binary database fields require special attention.
*

	 * @param string Binary value

	 * @param string $string Binary value

	 * @return string Encoded binary value
*/
function escape_binary($string)

	 * @return string Encoded binary value
*/
function escape_binary($string)

Zeile 1508Zeile 1563
	/**
* Unescape binary data.
*

	/**
* Unescape binary data.
*

	 * @param string Binary value

	 * @param string $string Binary value

	 * @return string Encoded binary value
*/
function unescape_binary($string)

	 * @return string Encoded binary value
*/
function unescape_binary($string)