Vergleich inc/db_mysql.php - 1.8.20 - 1.8.28

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 191Zeile 191
			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 485
		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 514Zeile 518
	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 528Zeile 532

/**
* Close the connection with the DBMS.


/**
* Close the connection with the DBMS.

	 *

	 *

	 */
function close()
{

	 */
function close()
{

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

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

			}

			}

			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);

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

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

		}

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

if(!empty($limit))
{
$query .= " LIMIT $limit";
}

return $this->write_query("

		}

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

if(!empty($limit))
{
$query .= " LIMIT $limit";
}

return $this->write_query("

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

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

Zeile 956Zeile 960
	private function quote_val($value, $quote="'")
{
if(is_int($value))

	private function quote_val($value, $quote="'")
{
if(is_int($value))

		{

		{

			$quoted = $value;
}
else

			$quoted = $value;
}
else

Zeile 984Zeile 988
		}

if(!empty($limit))

		}

if(!empty($limit))

		{

		{

			$query .= " LIMIT $limit";
}

			$query .= " LIMIT $limit";
}





		return $this->write_query("
DELETE
FROM {$this->table_prefix}$table

		return $this->write_query("
DELETE
FROM {$this->table_prefix}$table

Zeile 997Zeile 1001

/**
* 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)
{
if($this->db_encoding == 'utf8')

	 * @return string The escaped string.
*/
function escape_string($string)
{
if($this->db_encoding == 'utf8')

		{

		{

			$string = validate_utf8_string($string, false);

			$string = validate_utf8_string($string, false);

		}

		}

		elseif($this->db_encoding == 'utf8mb4')
{
$string = validate_utf8_string($string);
}

if(function_exists("mysql_real_escape_string") && $this->read_link)

		elseif($this->db_encoding == 'utf8mb4')
{
$string = validate_utf8_string($string);
}

if(function_exists("mysql_real_escape_string") && $this->read_link)

		{

		{

			$string = mysql_real_escape_string($string, $this->read_link);
}
else

			$string = mysql_real_escape_string($string, $this->read_link);
}
else

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

	 * @return string The escaped 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 1055Zeile 1059
		if($this->version)
{
return $this->version;

		if($this->version)
{
return $this->version;

		}


		}


		$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);
$this->version = (int)$version[0].".".(int)$version[1].".".(int)$version[2];
}
return $this->version;

		if($version)
{
$version = explode(".", $version, 3);
$this->version = (int)$version[0].".".(int)$version[1].".".(int)$version[2];
}
return $this->version;

	}


	}


	/**
* Optimizes a specific table.
*

	/**
* Optimizes a specific table.
*

Zeile 1096Zeile 1100
	 * @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)

	{

	{

		$query = $this->write_query("SHOW CREATE TABLE {$this->table_prefix}{$table}");
$structure = $this->fetch_array($query);
return $structure['Create Table'];

		$query = $this->write_query("SHOW CREATE TABLE {$this->table_prefix}{$table}");
$structure = $this->fetch_array($query);
return $structure['Create Table'];

Zeile 1166Zeile 1170
		else
{
$table_type = my_strtoupper($status['Type']);

		else
{
$table_type = my_strtoupper($status['Type']);

		}
if(version_compare($version, '3.23.23', '>=') && ($table_type == 'MYISAM' || $table_type == 'ARIA'))
{
return true;
}

		}
if(version_compare($version, '3.23.23', '>=') && ($table_type == 'MYISAM' || $table_type == 'ARIA'))
{
return true;
}

		elseif(version_compare($version, '5.6', '>=') && $table_type == 'INNODB')
{
return true;

		elseif(version_compare($version, '5.6', '>=') && $table_type == 'INNODB')
{
return true;

Zeile 1379Zeile 1383
	 * @param string $table The table
* @param string $column The column name
* @param string $new_definition the new column definition

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

	 * @return resource
*/
function modify_column($table, $column, $new_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)
{

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

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


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



























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 1395Zeile 1426
	 * @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)

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


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


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


























		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}");

	}

/**

	}

/**