Vergleich inc/db_mysqli.php - 1.8.17 - 1.8.30

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 190Zeile 190
			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
			$this->data_seek($query, $row);
}
$array = $this->fetch_array($query);

			$this->data_seek($query, $row);
}
$array = $this->fetch_array($query);

		return $array[$field];





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

	}

/**

	}

/**

Zeile 498Zeile 502
	function data_seek($query, $row)
{
return mysqli_data_seek($query, $row);

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

	}


	}


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

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

Zeile 513Zeile 517

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


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

	 *

	 *

	 * @return int The id number.

	 * @return int The id number.

	 */

	 */

	function insert_id()
{
$id = mysqli_insert_id($this->current_link);

	function insert_id()
{
$id = mysqli_insert_id($this->current_link);

Zeile 527Zeile 531
	 *
*/
function close()

	 *
*/
function close()

	{

	{

		@mysqli_close($this->read_link);
if($this->write_link)
{

		@mysqli_close($this->read_link);
if($this->write_link)
{

Zeile 541Zeile 545
	 * @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)
{
return mysqli_errno($this->current_link);

		if($this->current_link)
{
return mysqli_errno($this->current_link);

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

Zeile 624Zeile 628
	 *
* @param mysqli_result $query The query data.
* @return int The number of fields.

	 *
* @param mysqli_result $query The query data.
* @return int The number of fields.

	 */

	 */

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

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

Zeile 638Zeile 642
	 * @return array The table list.
*/
function list_tables($database, $prefix='')

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

	{

	{

		if($prefix)

		if($prefix)

		{

		{

			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' AND `Tables_in_$database` LIKE '".$this->escape_string($prefix)."%'");

				$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
{
$query = $this->query("SHOW TABLES FROM `$database` LIKE '".$this->escape_string($prefix)."%'");

			}
}
else
{

			}
}
else
{

			if(version_compare($this->get_version(), '5.0.2', '>='))
{
$query = $this->query("SHOW FULL TABLES FROM `$database` WHERE table_type = 'BASE TABLE'");

			if(version_compare($this->get_version(), '5.0.2', '>='))
{
$query = $this->query("SHOW FULL TABLES FROM `$database` WHERE table_type = 'BASE TABLE'");

Zeile 693Zeile 697
		if($exists > 0)
{
return true;

		if($exists > 0)
{
return true;

		}

		}

		else
{
return false;

		else
{
return false;

Zeile 706Zeile 710
	 * @param string $field The field name.
* @param string $table The table name.
* @return boolean True when exists, false if not.

	 * @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)
{
$query = $this->write_query("

	function field_exists($field, $table)
{
$query = $this->write_query("

Zeile 719Zeile 723
		if($exists > 0)
{
return true;

		if($exists > 0)
{
return true;

		}

		}

		else
{
return false;

		else
{
return false;

Zeile 733Zeile 737
	 * @param string $name An optional name for the query.
*/
function shutdown_query($query, $name="")

	 * @param string $name An optional name for the query.
*/
function shutdown_query($query, $name="")

	{

	{

		global $shutdown_queries;
if($name)
{

		global $shutdown_queries;
if($name)
{

Zeile 774Zeile 778
			if(isset($options['order_dir']))
{
$query .= " ".my_strtoupper($options['order_dir']);

			if(isset($options['order_dir']))
{
$query .= " ".my_strtoupper($options['order_dir']);

			}

			}

		}

if(isset($options['limit_start']) && isset($options['limit']))

		}

if(isset($options['limit_start']) && isset($options['limit']))

Zeile 801Zeile 805
		global $mybb;

if(!is_array($array))

		global $mybb;

if(!is_array($array))

		{

		{

			return false;
}


			return false;
}


Zeile 815Zeile 819
				}

$array[$field] = $value;

				}

$array[$field] = $value;

			}
else

			}
else

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

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

Zeile 1034Zeile 1038
	 * @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));
}

/**

	 * Gets the current version of MySQL.
*
* @return string Version of MySQL.

	 * Gets the current version of MySQL.
*
* @return string Version of MySQL.

Zeile 1258Zeile 1262
		else
{
$this->write_query('DROP TABLE '.$table_prefix.$table);

		else
{
$this->write_query('DROP TABLE '.$table_prefix.$table);

		}

		}

	}

/**

	}

/**

Zeile 1272Zeile 1276
	function rename_table($old_table, $new_table, $table_prefix=true)
{
if($table_prefix == false)

	function rename_table($old_table, $new_table, $table_prefix=true)
{
if($table_prefix == false)

		{

		{

			$table_prefix = "";
}
else

			$table_prefix = "";
}
else

Zeile 1285Zeile 1289

/**
* Replace contents of table with values


/**
* Replace contents of table with values

	 *
* @param string $table The table

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

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

Zeile 1312Zeile 1316
			else
{
$values .= $comma."`".$column."`=".$this->quote_val($value);

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

			}


			}


			$comma = ',';

			$comma = ',';

		}

		}


if(empty($replacements))
{


if(empty($replacements))
{

Zeile 1327Zeile 1331

/**
* Drops a column


/**
* Drops a column

	 *

	 *

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

	 * @param string $table The table
* @param string $column The column name
* @return mysqli_result
*/
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}`");

	}

/**

	}

/**

Zeile 1347Zeile 1353
	 */
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}");

	}

/**

	}

/**

Zeile 1355Zeile 1363
	 *
* @param string $table The table
* @param string $column The column name

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



	 * @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 1370Zeile 1407
	 * @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 mysqli_result



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

	}

/**

	}

/**