Vergleich inc/db_pgsql.php - 1.6.2 - 1.6.5

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 6Zeile 6
 * Website: http://www.mybboard.com
* License: http://www.mybboard.com/license.php
*

 * Website: http://www.mybboard.com
* License: http://www.mybboard.com/license.php
*

 * $Id: db_pgsql.php 5028 2010-06-16 05:50:39Z RyanGordon $

 * $Id: db_pgsql.php 5332 2011-01-14 12:07:07Z Tomm $

 */

class DB_PgSQL

 */

class DB_PgSQL

Zeile 1295Zeile 1295
	 * @param string The table
* @param string The column name
* @param string the new column definition

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

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

	 */

	 */

	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} ALTER COLUMN {$column} TYPE {$new_definition}");





























		$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_not_null !== false)
{
$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");
}

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;

	}

/**

	}

/**

Zeile 1308Zeile 1338
	 * @param string The old column name
* @param string the new column name
* @param string the new column definition

	 * @param string The old column name
* @param string the new column name
* @param string the new column definition

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

	 */

	 */

	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)

	{
$result1 = $this->write_query("ALTER TABLE {$this->table_prefix}{$table} RENAME COLUMN {$old_column} TO {$new_column}");

	{
$result1 = $this->write_query("ALTER TABLE {$this->table_prefix}{$table} RENAME COLUMN {$old_column} TO {$new_column}");

		$result2 = $this->modify_column($table, $new_column, $new_definition);

		$result2 = $this->modify_column($table, $new_column, $new_definition, $new_not_null, $new_default_value);

		return ($result1 && $result2);
}


		return ($result1 && $result2);
}