<?php
/*
Copyright 2008 Josh Heidenreich
This file is part of Pelzini.
Pelzini is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Pelzini is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Pelzini. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* The PostgreSQL wrapper functions
* @package Viewer
* @author Josh Heidenreich
* @since 0.2
**/
/**
* Connects to the PostgreSQL database
**/
function db_connect($settings)
{
global $db_connection, $settings;
$connect = '';
if (isset($settings['server'])) $connect .= "host='{$settings['server']}' "; if (isset($settings['username'])) $connect .= "user='{$settings['username']}' "; if (isset($settings['password'])) $connect .= "password='{$settings['password']}' "; if (isset($settings['name'])) $connect .= "dbname='{$settings['name']}' ";
}
/**
* Makes a query to the PostgreSQL database
**/
function db_query($q)
{
//echo "<pre>{$q}</pre>";
}
/**
* Escapses a string for use by the PostgreSQL database
**/
function db_escape($str)
{
}
/**
* Quotes a string as nessasary for use by hte PostgreSQL database
* The result will be different depending on the type of the input.
* - a number will be left as is
* - a string will be quoted
* - a null value will be returned as NULL
**/
function db_quote($str)
{
if ($str === null) {
return 'NULL';
return $str;
} else {
}
}
/**
* Fetches a PostgreSQL result set as an associative array
**/
function db_fetch_assoc($res)
{
}
/**
* Returns the number of rows in a PostgreSQL result set
**/
function db_num_rows($res)
{
}
/**
* Returns the number of rows affected by the last PostgreSQL query that was executed
**/
function db_affected_rows($res)
{
}
/**
* Returns the last unique ID generated by a query
**/
function db_insert_id()
{
$res = $this->query ('SELECT LASTVAL()');
$row = $this->fetch_row ($res);
return $row[0];
}
?>