Vergleich inc/db_mysql.php - 1.8.8 - 1.8.24

  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 1042Zeile 1042
	 */
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 1057Zeile 1057
			return $this->version;
}


			return $this->version;
}


		$version = @mysql_get_server_info();
if(!$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)
{


if($version)
{

Zeile 1142Zeile 1138
			else
{
return false;

			else
{
return false;

			}
}

			}
}

		if(preg_match('#FULLTEXT KEY#i', $structure))

		if(preg_match('#FULLTEXT KEY#i', $structure))

		{
return true;
}
return false;
}

		{
return true;
}
return false;
}


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


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

Zeile 1164Zeile 1160
		$query = $this->write_query("SHOW TABLE STATUS LIKE '{$this->table_prefix}$table'");
$status = $this->fetch_array($query);
if($status['Engine'])

		$query = $this->write_query("SHOW TABLE STATUS LIKE '{$this->table_prefix}$table'");
$status = $this->fetch_array($query);
if($status['Engine'])

		{

		{

			$table_type = my_strtoupper($status['Engine']);
}
else

			$table_type = my_strtoupper($status['Engine']);
}
else

Zeile 1172Zeile 1168
			$table_type = my_strtoupper($status['Type']);
}
if(version_compare($version, '3.23.23', '>=') && ($table_type == 'MYISAM' || $table_type == 'ARIA'))

			$table_type = my_strtoupper($status['Type']);
}
if(version_compare($version, '3.23.23', '>=') && ($table_type == 'MYISAM' || $table_type == 'ARIA'))

		{
return true;
}

		{
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 1184Zeile 1180

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


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

	 *

	 *

	 * @param string $table The name of the table.
* @param string $index The name of the index.
* @return bool Whether or not the index exists in that table
*/
function index_exists($table, $index)

	 * @param string $table The name of the table.
* @param string $index The name of the index.
* @return bool Whether or not the index exists in that table
*/
function index_exists($table, $index)

	{

	{

		$index_exists = false;
$query = $this->write_query("SHOW INDEX FROM {$this->table_prefix}{$table}");
while($ukey = $this->fetch_array($query))

		$index_exists = false;
$query = $this->write_query("SHOW INDEX FROM {$this->table_prefix}{$table}");
while($ukey = $this->fetch_array($query))

Zeile 1200Zeile 1196
				$index_exists = true;
break;
}

				$index_exists = true;
break;
}

		}

		}


if($index_exists)


if($index_exists)

		{
return true;
}

		{
return true;
}


return false;
}


return false;
}

Zeile 1225Zeile 1221
			return true;
}
return false;

			return true;
}
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 $table The name of the table.
* @param string $column Name of the column to be indexed.
* @param string $name 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.

Zeile 1239Zeile 1235
		$this->write_query("
ALTER TABLE {$this->table_prefix}$table
ADD FULLTEXT $name ($column)

		$this->write_query("
ALTER TABLE {$this->table_prefix}$table
ADD FULLTEXT $name ($column)

		");

		");

	}

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

	}

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

	 *

	 *

	 * @param string $table The name of the table.
* @param string $name The name of the index.
*/
function drop_index($table, $name)

	 * @param string $table The name of the table.
* @param string $name The name of the index.
*/
function drop_index($table, $name)

	{

	{

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

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

Zeile 1264Zeile 1260
	 * @param boolean $table_prefix use table prefix
*/
function drop_table($table, $hard=false, $table_prefix=true)

	 * @param boolean $table_prefix use table prefix
*/
function drop_table($table, $hard=false, $table_prefix=true)

	{
if($table_prefix == false)
{

	{
if($table_prefix == false)
{

			$table_prefix = "";
}
else

			$table_prefix = "";
}
else

Zeile 1311Zeile 1307
	 *
* @param string $table The table
* @param array $replacements The replacements

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

 
	 * @param string|array $default_field The default field(s)
* @param boolean $insert_id Whether or not to return an insert id. True by default

	 * @return resource|bool
*/

	 * @return resource|bool
*/

	function replace_query($table, $replacements=array())

	function replace_query($table, $replacements=array(), $default_field="", $insert_id=true)

	{
global $mybb;


	{
global $mybb;


Zeile 1348Zeile 1346

/**
* Drops a column


/**
* Drops a column

	 *
* @param string $table The table

	 *
* @param string $table The table

	 * @param string $column The column name
* @return resource
*/
function drop_column($table, $column)

	 * @param string $column The column name
* @return resource
*/
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

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

	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
*
* @param string $table The table
* @param string $column The column name

	 * Modifies a column
*
* @param string $table The table
* @param string $column The column name

	 * @param string $new_definition the new column definition
* @return resource



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

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


/**
* Renames a column


/**
* Renames a column

Zeile 1391Zeile 1422
	 * @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}");

	}

/**

	}

/**

Zeile 1477Zeile 1538
			'cp1251' => 'Windows Cyrillic',
'cp1256' => 'Windows Arabic',
'cp1257' => 'Windows Baltic',

			'cp1251' => 'Windows Cyrillic',
'cp1256' => 'Windows Arabic',
'cp1257' => 'Windows Baltic',

			'binary' => 'Binary pseudo charset',

 
			'geostd8' => 'GEOSTD8 Georgian',
'cp932' => 'SJIS for Windows Japanese',
'eucjpms' => 'UJIS for Windows Japanese',

			'geostd8' => 'GEOSTD8 Georgian',
'cp932' => 'SJIS for Windows Japanese',
'eucjpms' => 'UJIS for Windows Japanese',

Zeile 1526Zeile 1586
			'cp1251' => 'cp1251_general_ci',
'cp1256' => 'cp1256_general_ci',
'cp1257' => 'cp1257_general_ci',

			'cp1251' => 'cp1251_general_ci',
'cp1256' => 'cp1256_general_ci',
'cp1257' => 'cp1257_general_ci',

			'binary' => 'binary',

 
			'geostd8' => 'geostd8_general_ci',
'cp932' => 'cp932_japanese_ci',
'eucjpms' => 'eucjpms_japanese_ci',

			'geostd8' => 'geostd8_general_ci',
'cp932' => 'cp932_japanese_ci',
'eucjpms' => 'eucjpms_japanese_ci',