Public Member Functions | Protected Member Functions | Protected Attributes

PGsqlEngine Class Reference

Inheritance diagram for PGsqlEngine:
DbEngine

List of all members.

Public Member Functions

 __construct ($connstring)
 __destruct ()
 setPrefix ($pre)
 setCharacterSet ($c)
 tryConnect ()
 hasTable ($tnm)
 beginTransaction ()
 commitTransaction ()
 rollbackTransaction ()
 sqlBeginTransaction ()
 sqlCommitTransaction ()
 sqlRollbackTransaction ()
 select ($table, $cols, $where="", $orderby="")
 insert ($table, array $values)
 update ($table, array $values, $where)
 deleteRows ($table, $where)
 lastError ()
 escapeString ($s)
 escapeBlob ($s)
 syncSequence ($table)
 setDebugMode ($b=true, $a=false)

Protected Member Functions

 lockDB ($wl)
 createTable ($tn, $t)
 sqlCreateTable ($tn, $t)
 tableName ($tn)
 dataType ($type)
 columnFlag ($flag, $col, $table)
 unescapeBool ($b)

Protected Attributes

 $prefix = ""

Detailed Description

MySQL adaptation of DB-Engine


Constructor & Destructor Documentation

PGsqlEngine::__construct ( connstring  ) 

initialize driver

PGsqlEngine::__destruct (  ) 

make sure it shuts down


Member Function Documentation

PGsqlEngine::beginTransaction (  ) 

begins a transaction; must be implemented by driver; use sqlBeginTransaction to create the SQL statement!

Reimplemented from DbEngine.

PGsqlEngine::columnFlag ( flag,
col,
table 
) [protected]

returns the correct name/coding of a flag: primarykey, notnull, unique (implies notnull), foreignkey:$table:$col, defaultint:$val, defaultstr:$val, index

Reimplemented from DbEngine.

PGsqlEngine::commitTransaction (  ) 

ends a transaction successfully; must be implemented by driver; returns true on success; use sqlCommitTransaction to create the SQL statement!

Reimplemented from DbEngine.

PGsqlEngine::createTable ( tablename,
table 
) [protected]

creates a table; the argument is an array of the form "col-name" => array("col-type", "flags"...); use sqlCreateTable() etc. to create the actual statement

Reimplemented from DbEngine.

PGsqlEngine::dataType ( type  )  [protected]

returns the correct type name for the required abstract data type; types that must be understood are: int32 (INTEGER), int64 (LONG INTEGER), seq32 (auto-incrementing int), seq64, bool (boolean), string:$length (text up to 255 chars, length is optional, default is 255; VARCHAR($length)), text (unlimited text)

Reimplemented from DbEngine.

PGsqlEngine::deleteRows ( table,
where 
)

delete database values; returns the amount of rows deleted or false if an error occurred; use sqlDelete to create the SQL statement!

Reimplemented from DbEngine.

PGsqlEngine::escapeBlob ( s  ) 

escapes blobs; it uses mysqli_escape_string and encloses the value in '' - blobs are binary strings in MySQL

Reimplemented from DbEngine.

PGsqlEngine::escapeString ( s  ) 

escapes strings; it uses mysqli_escape_string and encloses the value in ''

Reimplemented from DbEngine.

PGsqlEngine::hasTable ( tablename  ) 

returns whether the table exists; must be implemented by driver

Reimplemented from DbEngine.

PGsqlEngine::insert ( table,
array $  values 
)

insert values into a table; returns false on failure, the new primary key if a sequence was set, true otherwise; use sqlInsert to create the SQL statement!

Reimplemented from DbEngine.

PGsqlEngine::lastError (  ) 

returns the error string of the last operation

Reimplemented from DbEngine.

PGsqlEngine::lockDB ( writelock  )  [protected]

locks the database - only used by the backup functions; if necessary should also start a transaction; default just starts a transaction

Reimplemented from DbEngine.

PGsqlEngine::rollbackTransaction (  ) 

ends a transaction with a rollback; must be implemented by driver; returns true on success; use sqlRollbackTransaction to create the SQL statement!

Reimplemented from DbEngine.

PGsqlEngine::select ( table,
cols,
where = "",
orderby = "" 
)

gets some data from the database; $table is the name of the table, $cols is the list of columns to return or "*" for all, $where is the where clause of the SQL-statement, $orderby may contain additional ORDER BY or GROUP BY clauses; returns array of rows, which are in *_fetch_array format; returns false on error; use sqlSelect to create the SQL statement!; make sure that NULL values are returned as PHP value null (most DB drivers already do this)

Reimplemented from DbEngine.

PGsqlEngine::setCharacterSet ( c  ) 

set the default charset for tables and connections

PGsqlEngine::setDebugMode ( b = true,
a = false 
)

development helper: activate debug mode

PGsqlEngine::setPrefix ( pre  ) 

set a table-name prefix for the database

PGsqlEngine::sqlBeginTransaction (  ) 

returns the SQL92 statement for beginning a transaction; overwrite this to implement DB specific syntax

Reimplemented from DbEngine.

PGsqlEngine::sqlCommitTransaction (  ) 

returns the SQL92 statement for committing a transaction; overwrite this to implement DB specific syntax

Reimplemented from DbEngine.

PGsqlEngine::sqlCreateTable ( tablename,
table 
) [protected]

creates a SQL92 statement for creating a table; overwrite this to implement DB specific syntax

Reimplemented from DbEngine.

PGsqlEngine::sqlRollbackTransaction (  ) 

returns the SQL92 statement for rolling a transaction back; overwrite this to implement DB specific syntax

Reimplemented from DbEngine.

PGsqlEngine::syncSequence ( table  ) 

synchronize the sequence of one database table

Reimplemented from DbEngine.

PGsqlEngine::tableName ( tname  )  [protected]

transform an internally used table name to the actual table name in the DB; the default implementation returns exactly what it gets

Reimplemented from DbEngine.

PGsqlEngine::tryConnect (  ) 

connect to the database, must be overwritten by DB driver

Reimplemented from DbEngine.

PGsqlEngine::unescapeBool ( b  )  [protected]

internal: unescape a postgres bool towards PHP bool

PGsqlEngine::update ( table,
array $  values,
where 
)

update database values; returns how many rows have been changed or false for failure; use sqlUpdate to create the SQL statement!

Reimplemented from DbEngine.


Member Data Documentation

PGsqlEngine::$prefix = "" [protected]

prefix for table names


The documentation for this class was generated from the following file: