Vergleich inc/db_mysql.php - 1.4.0 - 1.4.14

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 6Zeile 6
 * Website: http://www.mybboard.net
* License: http://www.mybboard.net/about/license
*

 * Website: http://www.mybboard.net
* License: http://www.mybboard.net/about/license
*

 * $Id: db_mysql.php 3902 2008-06-11 02:21:37Z Tikitiki $

 * $Id: db_mysql.php 4304 2009-01-02 01:11:56Z chris $

 */

class DB_MySQL

 */

class DB_MySQL

Zeile 143Zeile 143
		{
$connections['read'][] = $config;
}

		{
$connections['read'][] = $config;
}

 
		else

		// Connecting to more than one server
{
// Specified multiple servers, but no specific read/write servers

		// Connecting to more than one server
{
// Specified multiple servers, but no specific read/write servers

Zeile 164Zeile 165

// 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(!is_array($connections[$type]))

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

			{

			{

				break;
}


				break;
}


Zeile 175Zeile 176
				$details = $connections[$type];
unset($connections);
$connections[$type][] = $details;

				$details = $connections[$type];
unset($connections);
$connections[$type][] = $details;

			}

			}


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


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

Zeile 185Zeile 186
			{
$connect_function = "mysql_connect";
if($single_connection['pconnect'])

			{
$connect_function = "mysql_connect";
if($single_connection['pconnect'])

				{

				{

					$connect_function = "mysql_pconnect";
}


					$connect_function = "mysql_pconnect";
}


Zeile 229Zeile 230
		}

// Select databases

		}

// Select databases

		$this->select_db($config['database']);




		if(!$this->select_db($config['database']))
{
return false;
}


$this->current_link = &$this->read_link;
return $this->read_link;


$this->current_link = &$this->read_link;
return $this->read_link;

Zeile 427Zeile 431
		{
$array = $this->fetch_array($query);
return $array[$field];

		{
$array = $this->fetch_array($query);
return $array[$field];

		}
else
{

		}
else
{

			return mysql_result($query, $row, $field);
}
}

			return mysql_result($query, $row, $field);
}
}

Zeile 443Zeile 447
	function data_seek($query, $row)
{
return mysql_data_seek($query, $row);

	function data_seek($query, $row)
{
return mysql_data_seek($query, $row);

	}


	}


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

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

Zeile 458Zeile 462

/**
* Return the last id number of inserted data.


/**
* Return the last id number of inserted data.

	 *

	 *

	 * @return int The id number.
*/
function insert_id()

	 * @return int The id number.
*/
function insert_id()

Zeile 485Zeile 489
	 * @return int The error number of the current error.
*/
function error_number()

	 * @return int The error number of the current error.
*/
function error_number()

	{
if($this->current_link)

	{
if($this->current_link)

		{
return @mysql_errno($this->current_link);
}

		{
return @mysql_errno($this->current_link);
}

Zeile 500Zeile 504
	 * Return an error string.
*
* @return string The explanation for the current error.

	 * Return an error string.
*
* @return string The explanation for the current error.

	 */

	 */

	function error_string()
{
if($this->current_link)

	function error_string()
{
if($this->current_link)

Zeile 543Zeile 547
			{
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);
}

 
		}
else
{
return false;

		}
}


		}
}


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

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

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

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

		}
$fields = "`".implode("`,`", array_keys($array))."`";
$values = implode("','", $array);

		}
$fields = "`".implode("`,`", array_keys($array))."`";
$values = implode("','", $array);

Zeile 732Zeile 740
	 * @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 The table name to perform the query on.
* @param array An array of inserts.
* @return int The insert ID if available

	 */

	 */

	function insert_query_multiple($table, $array)
{
if(!is_array($array))

	function insert_query_multiple($table, $array)
{
if(!is_array($array))

Zeile 786Zeile 794
		{
$query .= $comma."`".$field."`={$quote}{$value}{$quote}";
$comma = ", ";

		{
$query .= $comma."`".$field."`={$quote}{$value}{$quote}";
$comma = ", ";

		}


		}


		if(!empty($where))

		if(!empty($where))

		{

		{

			$query .= " WHERE $where";

			$query .= " WHERE $where";

		}

		}

		
if(!empty($limit))
{

		
if(!empty($limit))
{

Zeile 801Zeile 809
		return $this->write_query("
UPDATE {$this->table_prefix}$table
SET $query

		return $this->write_query("
UPDATE {$this->table_prefix}$table
SET $query

		");
}

/**

		");
}

/**

	 * Build a delete query.
*
* @param string The table name to perform the query on.

	 * Build a delete query.
*
* @param string The table name to perform the query on.

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

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

	 */

	 */

	function free_result($query)
{
return mysql_free_result($query);

	function free_result($query)
{
return mysql_free_result($query);

Zeile 1015Zeile 1023
		}
return false;
}

		}
return false;
}



	

	/**
* 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 The name of the table.
* @param string Name of the column to be indexed.
* @param string The index name, optional.

Zeile 1027Zeile 1035
	{
$this->write_query("
ALTER TABLE {$this->table_prefix}$table

	{
$this->write_query("
ALTER TABLE {$this->table_prefix}$table

			ADD FULLTEXT $name ($column)















			ADD FULLTEXT $name ($column)
");
}

/**
* 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.
*/
function drop_index($table, $name)
{
$this->write_query("
ALTER TABLE {$this->table_prefix}$table
DROP INDEX $name

		");
}

		");
}



	

	/**

	/**

	 * Drop an index with the specified name from the 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 The name of the table.
* @param string The name of the index.
*/

	function drop_index($table, $name)

	function index_exists($table, $index)

	{

	{

		$this->write_query("
ALTER TABLE {$this->table_prefix}$table
DROP INDEX $name
");














		$index_exists = false;
$query = $this->write_query("SHOW INDEX FROM {$this->table_prefix}{$table}");
while($ukey = $this->fetch_array($query))
{
if($ukey['Key_name'] == $index)
{
$index_exists = true;
break;
}
}

if($index_exists)
{
return true;
}

return false;

	}

/**

	}

/**

Zeile 1138Zeile 1173
	 */
function fetch_db_charsets()
{

	 */
function fetch_db_charsets()
{

		if($this_link && $this->get_version() < 4.1)

		if($this->link && version_compare($this->get_version(), "4.1", "<"))

		{
return false;
}

		{
return false;
}

Zeile 1284Zeile 1319
	}
}


	}
}


if(!class_exists('databaseEngine'))
{
class databaseEngine extends DB_MySQL {
}
}

 
?>

?>