Location: PHPKode > projects > Icecube > icecube/databases/postgresql.php
<?php

class icecube_postgresql extends icecube_database
{
	private $_conn_str;
	
	public function __construct($conn_str)
	{
		if(!function_exists("pg_connect"))
		{
			;
		}
		
		$this->_conn_str = $conn_str;
	}
	
	public function connect()
	{
		$return = false;
		
		if(!$this->_conn_str)
		{
			;
		}
		else if(!$this->_dbh = pg_connect($this->_conn_str))
		{
			;
		}
		else
		{
			$return = true;
		}
		
		return $return;
	}
	
	public function quick_connect()
	{
		return $this->connect();
	}
	
	public function close()
	{
		pg_close($this->_dbh);
	}
	
	public function select($db_name)
	{
		if($this->_dbh)
		{
			$this->close();
		}
		
		if(strstr($this->_conn_str, "dbname="))
		{
			$this->_conn_str = str_replace("/dbname=(.*)\s/", "dbname={$db_name}", $this->_conn_str);
		}
		else
		{
			$this->_conn_str .= " dbname={$db_name}";
		}
		
		return $this->connect();
	}
	
	public function escape($str)
	{
		return pg_escape_string(stripslashes($str));
	}
	
	public function query($query)
	{
		
	}
}

?>
Return current item: Icecube