Geeklog
[ class tree: Geeklog ] [ index: Geeklog ] [ all elements ]

Class: DataBase

Source Location: /system/databases/pgsql.class.php

Class Overview


This file is the pgsql implementation of the Geeklog abstraction layer.


Methods



Class Details

[line 40]
This file is the pgsql implementation of the Geeklog abstraction layer.

Unfortunately the Geeklog abstraction layer isn't 100% abstract because a few key functions use MySQL's REPLACE INTO syntax which is not a SQL standard. This issue will need to be resolved some time ...




[ Top ]


Class Methods


method buildString [line 106]

void buildString( )

Creates a connection string for pg_connect

Doesn't show the port because it isnt being provided in class default assumed




[ Top ]

method database [line 180]

void database( string $dbhost, string $dbname, sring $dbuser, $dbpass, [string $errorlogfn = ''], [string $charset = ''], string $pass)

constructor for database

This initializes an instance of the database object




Parameters:

string   $dbhost   Database host
string   $dbname   Name of database
sring   $dbuser   User to make connection as
string   $pass   Password for dbuser
string   $errorlogfn   Name of the errorlog function
string   $charset   character set to use
   $dbpass  

[ Top ]

method dbAffectedRows [line 203]

int dbAffectedRows( object $recordset)

Retrieves returns the number of effected rows for last query

Retrieves returns the number of effected rows for last query




Tags:

return:  Number of rows affected by last query


Parameters:

object   $recordset   The recordset to operate on

[ Top ]

method dbChange [line 584]

boolean dbChange( string $table, string $item_to_set, string $value_to_set, array|string $id, array|string $value, [boolean $supress_quotes = false])

Changes records in a table

This will change the data in the given table that meet the given criteria and will redirect user to another page if told to do so




Tags:

return:  Returns true on success otherwise false


Parameters:

string   $table   Table to perform change on
string   $item_to_set   field name of unique ID field for table
string   $value_to_set   Value for id
array|string   $id   additional field name used in where clause
array|string   $value   additional values used in where clause
boolean   $supress_quotes   if false it will not use '<value>' in where clause

[ Top ]

method dbCopy [line 286]

boolean dbCopy( string $table, string $fields, string $values, string $tablefrom, array|string $id, array|string $value)

Copies a record from one table to another (can be the same table)

This will use a REPLACE INTO...SELECT FROM to copy a record from one table to another table. They can be the same table.




Tags:

return:  Returns true on success otherwise false


Parameters:

string   $table   Table to insert record into
string   $fields   Comma delmited list of fields to copy over
string   $values   Values to store in database fields
string   $tablefrom   Table to get record from
array|string   $id   field name(s) to use in where clause
array|string   $value   Value(s) to use in where clause

[ Top ]

method dbCount [line 680]

boolean dbCount( string $table, [array|string $id = ''], [array|string $value = ''])

Returns the number of records for a query that meets the given criteria

This will build a SELECT count(*) statement with the given criteria and return the result




Tags:

return:  returns count on success otherwise false


Parameters:

string   $table   Table to perform count on
array|string   $id   field name(s) of fields to use in where clause
array|string   $value   Value(s) to use in where clause

[ Top ]

method dbDelete [line 521]

boolean dbDelete( string $table, array|string $id, array|string $value)

Deletes data from the database

This will delete some data from the given table where id = value. If id and value are arrays then it will traverse the arrays setting $id[curval] = $value[curval].




Tags:

return:  Returns true on success otherwise false


Parameters:

string   $table   Table to delete data from
array|string   $id   field name(s) to include in where clause
array|string   $value   field value(s) corresponding to field names

[ Top ]

method dbError [line 838]

string dbError( [string $sql = ''])

Returns an database error message



Tags:

return:  Text for error message


Parameters:

string   $sql   SQL that may have caused the error

[ Top ]

method dbFetchArray [line 245]

array dbFetchArray( object $recordset, [boolean $both = false])

Retrieves record from a recordset

Gets the next record in a recordset and returns in array




Tags:

return:  Returns data array of current row from recordset


Parameters:

object   $recordset   The recordset to operate on
boolean   $both   get both assoc and numeric indices

[ Top ]

method dbFieldName [line 266]

string dbFieldName( object $recordset, int $fnumber)

Retrieves returns the field name for a field

Returns the field name for a given field number




Tags:

return:  Returns name of specified field


Parameters:

object   $recordset   The recordset to operate on
int   $fnumber   field number to return the name of

[ Top ]

method dbInsertId [line 737]

int dbInsertId( [resource $link_identifier = ''], [ $sequence = ''])

Returns the last ID inserted

Returns the last auto_increment ID generated




Tags:

return:  Returns last auto-generated ID


Parameters:

resource   $link_identifier   identifier for opened link $param sequence name $sequence the sequence to get the value last insert ID from
   $sequence  

[ Top ]

method dbLockTable [line 763]

void dbLockTable( string $table)

Lock a table

Locks a table for write operations




Tags:



Parameters:

string   $table   Table to lock

[ Top ]

method dbNumRows [line 644]

int dbNumRows( object $recordset)

Retrieves the number of rows in a recordset

This returns the number of rows in a recordset




Tags:

return:  Returns number of rows otherwise false (0)


Parameters:

object   $recordset   The recordset to operate one

[ Top ]

method dbQuery [line 337]

object Returns dbQuery( string $sql, [ $ignore_errors = 0], boolean $ignore_error)

Executes a query on the pgSQL server

This executes the passed SQL and returns the recordset or errors out




Tags:

return:  results of query


Parameters:

string   $sql   SQL to be executed
boolean   $ignore_error   If 1 this function supresses any error messages
   $ignore_errors  

[ Top ]

method dbResult [line 221]

(depends dbResult( object $recordset, int $row, [string $field = 0])

Returns the contents of one cell from a MySQL result set



Tags:

return:  on field content)


Parameters:

object   $recordset   The recordset to operate on
int   $row   row to get data from
string   $field   field to return

[ Top ]

method dbSave [line 386]

void dbSave( string $table, string $fields, string $values)

Saves information to the database

This will use a REPLACE INTO to save a record into the database




Parameters:

string   $table   The table to save to
string   $fields   string Comma demlimited list of fields to save
string   $values   Values to save to the database table

[ Top ]

method dbUnlockTable [line 788]

void dbUnlockTable( string $table)

Unlock a table

Unlocks a table after a dbLockTable (actually, unlocks all tables)




Tags:



Parameters:

string   $table   Table to unlock (ignored)

[ Top ]

method isVerbose [line 867]

boolean isVerbose( )

Checks to see if debug mode is on Returns value of $_verbose



Tags:

return:  true if in verbose mode otherwise false


[ Top ]

method setDisplayError [line 827]

void setDisplayError( boolean $flag)

Turns detailed error reporting on

If set to true, this will display detailed error messages on the site. Otherwise, it will only that state an error occurred without going into details. The complete error message (including the offending SQL request) is always available from error.log.




Parameters:

boolean   $flag   true or false

[ Top ]

method setVerbose [line 811]

void setVerbose( boolean $flag)

Turns debug mode on

Set this to true to see debug messages




Parameters:

boolean   $flag   true or false

[ Top ]

method _connect [line 125]

object Returns _connect( )

Connects to the pgSQL database server

This function connects to the MySQL server and returns the connection object




Tags:

return:  connection object


[ Top ]

method _errorlog [line 93]

void _errorlog( string $msg)

Logs messages

Logs messages by calling the function held in $_errorlog_fn




Parameters:

string   $msg   Message to log

[ Top ]


Documentation generated on Sun, 20 Feb 2011 02:08:53 -0500 by phpDocumentor 1.4.3