Vergleich inc/db_mysql.php - 1.8.16 - 1.8.33

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 72Zeile 72
	 * @var resource
*/
public $current_link;

	 * @var resource
*/
public $current_link;

 

/**
* @var array
*/
public $connections = array();


/**
* The database name.


/**
* The database name.

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

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

				unset($connections);

				unset($connections[$type]);

				$connections[$type][] = $details;
}


				$connections[$type][] = $details;
}


Zeile 485Zeile 490
		if($row === false)
{
$array = $this->fetch_array($query);

		if($row === false)
{
$array = $this->fetch_array($query);

			return $array[$field];





			if($array !== null)
{
return $array[$field];
}
return null;

		}
else
{

		}
else
{

Zeile 495Zeile 504

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


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

	 *
* @param resource $query The query ID.

	 *
* @param resource $query The query ID.

	 * @param int $row The pointer to move the row to.
* @return bool
*/

	 * @param int $row The pointer to move the row to.
* @return bool
*/

Zeile 514Zeile 523
	function num_rows($query)
{
return mysql_num_rows($query);

	function num_rows($query)
{
return mysql_num_rows($query);

	}

/**

	}

/**

	 * Return the last id number of inserted data.
*
* @return int The id number.

	 * Return the last id number of inserted data.
*
* @return int The id number.

Zeile 524Zeile 533
	function insert_id()
{
return mysql_insert_id($this->current_link);

	function insert_id()
{
return mysql_insert_id($this->current_link);

	}

/**

	}

/**

	 * Close the connection with the DBMS.
*
*/

	 * Close the connection with the DBMS.
*
*/

Zeile 536Zeile 545
		if($this->write_link)
{
@mysql_close($this->write_link);

		if($this->write_link)
{
@mysql_close($this->write_link);

		}
}

		}
}


/**
* Return an error number.


/**
* Return an error number.

Zeile 545Zeile 554
	 * @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);
}
else

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

Zeile 566Zeile 575
		if($this->current_link)
{
return @mysql_error($this->current_link);

		if($this->current_link)
{
return @mysql_error($this->current_link);

		}
else

		}
else

		{
return @mysql_error();
}

		{
return @mysql_error();
}

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

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

			}

return true;
}
else
{

			}

return true;
}
else
{

			return false;
}
}

			return false;
}
}

Zeile 648Zeile 657
			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)."%'");

			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

			}
else

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

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

			}

			}

		}
else

		}
else

		{

		{

			if(version_compare($this->get_version(), '5.0.2', '>='))

			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 FULL TABLES FROM `$database` WHERE table_type = 'BASE TABLE'");
}
else

Zeile 670Zeile 679
		while(list($table) = mysql_fetch_array($query))
{
$tables[] = $table;

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

		}

		}


return $tables;
}


return $tables;
}

Zeile 731Zeile 740

/**
* Add a shutdown query.


/**
* Add a shutdown query.

	 *

	 *

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

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

Zeile 792Zeile 801

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


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

	 *

	 *

	 * @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

	 * @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

Zeile 831Zeile 840
			VALUES (".$values.")
");
return $this->insert_id();

			VALUES (".$values.")
");
return $this->insert_id();

	}


	}


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

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

Zeile 894Zeile 903
	 * @return resource The query data.
*/
function update_query($table, $array, $where="", $limit="", $no_quote=false)

	 * @return resource The query data.
*/
function update_query($table, $array, $where="", $limit="", $no_quote=false)

	{
global $mybb;

	{
global $mybb;


if(!is_array($array))
{


if(!is_array($array))
{

Zeile 929Zeile 938
				$query .= $comma."`".$field."`={$quoted_val}";
}
$comma = ', ';

				$query .= $comma."`".$field."`={$quoted_val}";
}
$comma = ', ';

		}

if(!empty($where))
{
$query .= " WHERE $where";
}

if(!empty($limit))

		}

if(!empty($where))
{
$query .= " WHERE $where";
}

if(!empty($limit))

		{
$query .= " LIMIT $limit";
}

		{
$query .= " LIMIT $limit";
}

Zeile 997Zeile 1006

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


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

	 *
* @param string $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 1039Zeile 1048
	 *
* @param string $string The string to be escaped.
* @return string The escaped string.

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

	 */

	 */

	function escape_string_like($string)
{

	function escape_string_like($string)
{

		return $this->escape_string(str_replace(array('%', '_') , array('\\%' , '\\_') , $string));

		return $this->escape_string(str_replace(array('\\', '%', '_') , array('\\\\', '\\%' , '\\_') , $string));

	}

/**

	}

/**

Zeile 1060Zeile 1069
		$query = $this->query("SELECT VERSION() as version");
$ver = $this->fetch_array($query);
$version = $ver['version'];

		$query = $this->query("SELECT VERSION() as version");
$ver = $this->fetch_array($query);
$version = $ver['version'];





		if($version)
{
$version = explode(".", $version, 3);

		if($version)
{
$version = explode(".", $version, 3);

Zeile 1353Zeile 1362
	 */
function drop_column($table, $column)
{

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

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



		$column = trim($column, '`');

return $this->write_query("ALTER TABLE {$this->table_prefix}{$table} DROP `{$column}`");

	}

/**
* Adds a column

	}

/**
* Adds a column

	 *

	 *

	 * @param string $table The table
* @param string $column The column name
* @param string $definition the new column definition
* @return resource
*/
function add_column($table, $column, $definition)

	 * @param string $table The table
* @param string $column The column name
* @param string $definition the new column definition
* @return resource
*/
function add_column($table, $column, $definition)

	{
return $this->write_query("ALTER TABLE {$this->table_prefix}{$table} ADD {$column} {$definition}");
}




	{
$column = trim($column, '`');

return $this->write_query("ALTER TABLE {$this->table_prefix}{$table} ADD `{$column}` {$definition}");
}


	/**
* Modifies a column

	/**
* Modifies a column

	 *
* @param string $table The table

	 *
* @param string $table The table

	 * @param string $column The column name

	 * @param string $column The column name

	 * @param string $new_definition the new column definition
* @return resource
*/
function modify_column($table, $column, $new_definition)



	 * @param string $new_definition the new column definition
* @param boolean|string $new_not_null Whether to "drop" or "set" the NOT NULL attribute (no change if false)
* @param boolean|string $new_default_value The new default value, or false to drop the attribute
* @return bool Returns true if all queries are executed successfully or false if one of them failed
*/
function modify_column($table, $column, $new_definition, $new_not_null=false, $new_default_value=false)

	{

	{

		return $this->write_query("ALTER TABLE {$this->table_prefix}{$table} MODIFY {$column} {$new_definition}");




























		$column = trim($column, '`');

if($new_not_null !== false)
{
if(strtolower($new_not_null) == "set")
{
$not_null = "NOT NULL";
}
else
{
$not_null = "NULL";
}
}
else
{
$not_null = '';
}

if($new_default_value !== false)
{
$default = "DEFAULT ".$new_default_value;
}
else
{
$default = '';
}

return (bool)$this->write_query("ALTER TABLE {$this->table_prefix}{$table} MODIFY `{$column}` {$new_definition} {$not_null} {$default}");

	}

/**

	}

/**

Zeile 1389Zeile 1431
	 * @param string $old_column The old column name
* @param string $new_column the new column name
* @param string $new_definition the new column definition

	 * @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 resource



	 * @param boolean|string $new_not_null Whether to "drop" or "set" the NOT NULL attribute (no change if false)
* @param boolean|string $new_default_value The new default value, or false to drop the attribute
* @return bool Returns true if all queries are executed successfully

	 */

	 */

	function rename_column($table, $old_column, $new_column, $new_definition)

	function rename_column($table, $old_column, $new_column, $new_definition, $new_not_null=false, $new_default_value=false)

	{

	{

		return $this->write_query("ALTER TABLE {$this->table_prefix}{$table} CHANGE {$old_column} {$new_column} {$new_definition}");





























		$old_column = trim($old_column, '`');
$new_column = trim($new_column, '`');

if($new_not_null !== false)
{
if(strtolower($new_not_null) == "set")
{
$not_null = "NOT NULL";
}
else
{
$not_null = "NULL";
}
}
else
{
$not_null = '';
}

if($new_default_value !== false)
{
$default = "DEFAULT ".$new_default_value;
}
else
{
$default = '';
}

return (bool)$this->write_query("ALTER TABLE {$this->table_prefix}{$table} CHANGE `{$old_column}` `{$new_column}` {$new_definition} {$not_null} {$default}");

	}

/**

	}

/**