Vergleich inc/db_pgsql.php - 1.8.8 - 1.8.16

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 1093Zeile 1093

$primary_key = array();
$primary_key_name = '';


$primary_key = array();
$primary_key_name = '';

 

$unique_keys = array();


// We do this in two steps. It makes placing the comma easier
while($row = $this->fetch_array($query))
{
if($row['primary_key'] == 't')


// We do this in two steps. It makes placing the comma easier
while($row = $this->fetch_array($query))
{
if($row['primary_key'] == 't')

			{

			{

				$primary_key[] = $row['column_name'];
$primary_key_name = $row['index_name'];
}

				$primary_key[] = $row['column_name'];
$primary_key_name = $row['index_name'];
}

 

if($row['unique_key'] == 't')
{
$unique_keys[$row['index_name']][] = $row['column_name'];
}
}

if(!empty($primary_key))
{
$lines[] = " CONSTRAINT $primary_key_name PRIMARY KEY (".implode(', ', $primary_key).")";

		}


		}


		if(!empty($primary_key))

		foreach($unique_keys as $key_name => $key_columns)

		{

		{

			$lines[] = "  CONSTRAINT $primary_key_name PRIMARY KEY (".implode(', ', $primary_key).")";

			$lines[] = "  CONSTRAINT $key_name UNIQUE (".implode(', ', $key_columns).")";

		}

$table_lines .= implode(", \n", $lines);

		}

$table_lines .= implode(", \n", $lines);

Zeile 1153Zeile 1165
	 * @return boolean True or false if the table has a fulltext index or not.
*/
function is_fulltext($table, $index="")

	 * @return boolean True or false if the table has a fulltext index or not.
*/
function is_fulltext($table, $index="")

	{
return false;
}

	{
return false;
}


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


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

Zeile 1242Zeile 1254
	 * @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)
{
$table_prefix = "";
}
else
{

	{
if($table_prefix == false)
{
$table_prefix = "";
}
else
{

			$table_prefix = $this->table_prefix;
}


			$table_prefix = $this->table_prefix;
}


Zeile 1310Zeile 1322
		global $mybb;

if($default_field == "")

		global $mybb;

if($default_field == "")

		{

		{

			$query = $this->write_query("SELECT column_name FROM information_schema.constraint_column_usage WHERE table_name = '{$this->table_prefix}{$table}' and constraint_name = '{$this->table_prefix}{$table}_pkey' LIMIT 1");
$main_field = $this->fetch_field($query, 'column_name');

			$query = $this->write_query("SELECT column_name FROM information_schema.constraint_column_usage WHERE table_name = '{$this->table_prefix}{$table}' and constraint_name = '{$this->table_prefix}{$table}_pkey' LIMIT 1");
$main_field = $this->fetch_field($query, 'column_name');

		}

		}

		else
{
$main_field = $default_field;

		else
{
$main_field = $default_field;

Zeile 1321Zeile 1333

$update = false;
$search_bit = array();


$update = false;
$search_bit = array();

		if(is_array($main_field) && !empty($main_field))



if(!is_array($main_field))

		{

		{

			foreach($main_field as $field)
{
if(isset($mybb->binary_fields[$table][$field]) && $mybb->binary_fields[$table][$field])
{
$search_bit[] = "{$field} = ".$replacements[$field];
}
else
{
$search_bit[] = "{$field} = ".$this->quote_val($replacements[$field]);
}
}

$search_bit = implode(" AND ", $search_bit);
$query = $this->write_query("SELECT COUNT(".$main_field[0].") as count FROM {$this->table_prefix}{$table} WHERE {$search_bit} LIMIT 1");
if($this->fetch_field($query, "count") == 1)
{
$update = true;
}
}
else
{
$query = $this->write_query("SELECT {$main_field} FROM {$this->table_prefix}{$table}");

while($column = $this->fetch_array($query))
{
if($column[$main_field] == $replacements[$main_field])
{
$update = true;
break;
}
}

			$main_field = array($main_field);































		}


		}


		if($update === true)

		foreach($main_field as $field)

		{

		{

			if(is_array($main_field))
{
return $this->update_query($table, $replacements, $search_bit);

			if(isset($mybb->binary_fields[$table][$field]) && $mybb->binary_fields[$table][$field])
{
$search_bit[] = "{$field} = ".$replacements[$field];

			}
else
{

			}
else
{

				return $this->update_query($table, $replacements, "{$main_field}=".$this->quote_val($replacements[$main_field]));

				$search_bit[] = "{$field} = ".$this->quote_val($replacements[$field]);

			}

			}

 
		}
$search_bit = implode(" AND ", $search_bit);
$query = $this->write_query("SELECT COUNT(".$main_field[0].") as count FROM {$this->table_prefix}{$table} WHERE {$search_bit} LIMIT 1");
if($this->fetch_field($query, "count") == 1)
{
$update = true;
}

if($update === true)
{
return $this->update_query($table, $replacements, $search_bit);

		}
else
{

		}
else
{