Vergleich inc/db_pgsql.php - 1.4.4 - 1.4.8

  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 4274 2008-11-19 03:22:50Z Tikitiki $

 * $Id: db_pgsql.php 4340 2009-04-05 17:10:22Z Tikitiki $

 */

class DB_PgSQL

 */

class DB_PgSQL

Zeile 217Zeile 217

if($single_connection['port'])
{


if($single_connection['port'])
{

					$this->connect_string .= "port={$single_connection['port']} ";

					$this->connect_string .= " port={$single_connection['port']}";

				}

if($single_connection['hostname'] != "localhost")
{

				}

if($single_connection['hostname'] != "localhost")
{

					$this->connect_string .= "host={$single_connection['hostname']} ";

					$this->connect_string .= " host={$single_connection['hostname']}";

				}

if($single_connection['password'])

				}

if($single_connection['password'])

Zeile 1002Zeile 1002
		");

$lines = array();

		");

$lines = array();

		$lines[] = "CREATE TABLE {$this->table_prefix}{$table} (\n";

		$table_lines = "CREATE TABLE {$this->table_prefix}{$table} (\n";

		
while($row = $this->fetch_array($query))
{

		
while($row = $this->fetch_array($query))
{

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


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


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

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

		

		

		return $table;

		return $table_lines;

	}

/**

	}

/**

Zeile 1180Zeile 1180
			ALTER TABLE {$this->table_prefix}$table 
DROP INDEX $name
");

			ALTER TABLE {$this->table_prefix}$table 
DROP INDEX $name
");

 
	}

/**
* Checks to see if an index exists on a specified table
*
* @param string The name of the table.
* @param string The name of the index.
*/
function index_exists($table, $index)
{
$err = $this->error_reporting;
$this->error_reporting = 0;

$query = $this->write_query("SELECT * FROM pg_indexes WHERE tablename='".$this->escape_string($this->table_prefix.$table)."'");

$exists = $this->fetch_field($query, $index);
$this->error_reporting = $err;

if($exists)
{
return true;
}
else
{
return false;
}

	}

/**

	}

/**

Zeile 1194Zeile 1220
		if($table_prefix == false)
{
$table_prefix = "";

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

		}
else
{

		}
else
{

			$table_prefix = $this->table_prefix;

			$table_prefix = $this->table_prefix;

		}

		}

		
if($hard == false)
{
if($this->table_exists($table))
{
$this->write_query('DROP TABLE '.$table_prefix.$table);

		
if($hard == false)
{
if($this->table_exists($table))
{
$this->write_query('DROP TABLE '.$table_prefix.$table);

			}
}
else

			}
}
else

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

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

Zeile 1224Zeile 1250
	function replace_query($table, $replacements=array(), $default_field="", $insert_id=true)
{
$i = 0;

	function replace_query($table, $replacements=array(), $default_field="", $insert_id=true)
{
$i = 0;

		
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');
}
else
{
$main_field = $default_field;
}

$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])
{
++$i;
}
}

if($i > 0)



		
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');
}
else
{
$main_field = $default_field;
}

$update = false;
$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;
}
}

if($update === true)

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

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

Zeile 1260Zeile 1288
	 *
* @param string The table
* @param array The replacements

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

	 * @param string The default field

 
	 */
function build_replace_query($table, $replacements=array(), $default_field="")

	 */
function build_replace_query($table, $replacements=array(), $default_field="")

	{
$i = 0;

	{	


		
if($default_field == "")
{

		
if($default_field == "")
{

Zeile 1276Zeile 1302
			$main_field = $default_field;
}


			$main_field = $default_field;
}


 
		$update = false;

		$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])
{

		$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])
{

				++$i;


				$update = true;
break;

			}
}


			}
}


		if($i > 0)

		if($update === true)

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

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