Vergleich inc/db_pgsql.php - 1.8.10 - 1.8.21

  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 1176Zeile 1188
	 * @return boolean True or false if supported or not.
*/
function supports_fulltext_boolean($table)

	 * @return boolean True or false if supported or not.
*/
function supports_fulltext_boolean($table)

	{
return false;
}

	{
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.

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

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

		}


		}


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


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


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

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

		}

		}

		else
{
return $this->insert_query($table, $replacements, $insert_id);

		else
{
return $this->insert_query($table, $replacements, $insert_id);

		}
}

		}
}


/**
* @param string $table
* @param string $append


/**
* @param string $table
* @param string $append

	 *

	 *

	 * @return string
*/
function build_fields_string($table, $append="")

	 * @return string
*/
function build_fields_string($table, $append="")

Zeile 1373Zeile 1385
		}

return $fieldstring;

		}

return $fieldstring;

	}

	}


/**
* Drops a column


/**
* Drops a column

	 *
* @param string $table The table

	 *
* @param string $table The table

	 * @param string $column The column name
* @return resource
*/

	 * @param string $column The column name
* @return resource
*/

Zeile 1389Zeile 1401

/**
* Adds a column


/**
* Adds a column

	 *
* @param string $table The table

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


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


Zeile 1406Zeile 1418
	 * @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

	 * @param boolean $new_not_null Whether to drop or set a column
* @param boolean $new_default_value The new default value (if one is to be set)

	 * @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)
{
$result1 = $result2 = $result3 = true;

	 * @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)
{
$result1 = $result2 = $result3 = true;





		if($new_definition !== false)
{
$result1 = $this->write_query("ALTER TABLE {$this->table_prefix}{$table} ALTER COLUMN {$column} TYPE {$new_definition}");

		if($new_definition !== false)
{
$result1 = $this->write_query("ALTER TABLE {$this->table_prefix}{$table} ALTER COLUMN {$column} TYPE {$new_definition}");

Zeile 1424Zeile 1436
			$set_drop = "DROP";

if(strtolower($new_not_null) == "set")

			$set_drop = "DROP";

if(strtolower($new_not_null) == "set")

			{

			{

				$set_drop = "SET";
}

$result2 = $this->write_query("ALTER TABLE {$this->table_prefix}{$table} ALTER COLUMN {$column} {$set_drop} NOT NULL");
}


				$set_drop = "SET";
}

$result2 = $this->write_query("ALTER TABLE {$this->table_prefix}{$table} ALTER COLUMN {$column} {$set_drop} NOT NULL");
}


		if($new_default_value !== false)

		if($new_default_value !== null)

		{

		{

			$result3 = $this->write_query("ALTER TABLE {$this->table_prefix}{$table} ALTER COLUMN {$column} SET DEFAULT {$new_default_value}");
}
else
{
$result3 = $this->write_query("ALTER TABLE {$this->table_prefix}{$table} ALTER COLUMN {$column} DROP DEFAULT");




			if($new_default_value !== false)
{
$result3 = $this->write_query("ALTER TABLE {$this->table_prefix}{$table} ALTER COLUMN {$column} SET DEFAULT {$new_default_value}");
}
else
{
$result3 = $this->write_query("ALTER TABLE {$this->table_prefix}{$table} ALTER COLUMN {$column} DROP DEFAULT");
}

		}

return $result1 && $result2 && $result3;

		}

return $result1 && $result2 && $result3;

Zeile 1450Zeile 1465
	 * @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

	 * @param boolean $new_not_null Whether to drop or set a column
* @param boolean $new_default_value The new default value (if one is to be set)

	 * @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, $new_not_null=false, $new_default_value=false)

	 * @return bool Returns true if all queries are executed successfully
*/
function rename_column($table, $old_column, $new_column, $new_definition, $new_not_null=false, $new_default_value=false)