KjwPgSql Class Reference
[Database (SQL) handling]

KjwPgSql is the postgresql implementation of the KjwSql abstract class. More...

Inheritance diagram for KjwPgSql:

Inheritance graph
[legend]

List of all members.

Public Member Functions

 KjwPgSql ($hostname, $portnum, $username, $password, $database)
 Construct a KjwPgSql object.
 destroy ()
 Destructor performing cleanup.
 connect ()
 Connect to the SQL server.
 disconnect ()
 Disconnect from the SQL server.
 beginWork ()
 Begin a transaction / atomic operation.
 execute ($query)
 Execute a query.
 safeQuote ($mixed)
 Makes sure that any variable is quoted like its correct type should be.
 nameQuote ($string)
 Quote a name for an object (column or table).
 affectedRows ()
 How many rows were affected (touched) by the last INSERT, UPDATE, REPLACE or DELETE query.
 insertId ()
 Returns the id of the last INSERT clause that uses an IDENTITY/SEQUENCE/AUTO_INCREMENT value.

Public Attributes

 $_dbconn
 Database resource.


Detailed Description

KjwPgSql is the postgresql implementation of the KjwSql abstract class.

Definition at line 29 of file KjwPgSql.php.


Member Function Documentation

KjwPgSql::affectedRows (  ) 

How many rows were affected (touched) by the last INSERT, UPDATE, REPLACE or DELETE query.

It's unspecified if an UPDATE count includes updates that weren't actual changes. I.e. either the WHERE-match-count is returned, or only the subset where the update was a change.

Returns:
The number of rows affected.
Note:
Don't try to be funny and do SELECT or whatever queries before calling this.

Reimplemented from KjwSql.

Definition at line 116 of file KjwPgSql.php.

KjwPgSql::connect (  ) 

Connect to the SQL server.

Returns:
True.
Todo:
Put timing on connect, so we don't have to wait 60secs on firewalled server.

Reimplemented from KjwSql.

Definition at line 53 of file KjwPgSql.php.

References KjwObject::croak().

Referenced by execute(), and safeQuote().

KjwPgSql::destroy (  ) 

Destructor performing cleanup.

Don't rely on this being called ever. The user must call it by hand.

Reimplemented from KjwSql.

Definition at line 47 of file KjwPgSql.php.

References disconnect().

KjwPgSql::disconnect (  ) 

Disconnect from the SQL server.

Returns:
Success boolean.

Reimplemented from KjwSql.

Definition at line 73 of file KjwPgSql.php.

Referenced by destroy().

KjwPgSql::execute ( query  ) 

Execute a query.

Parameters:
$query The query to execute.
Returns:
Returns a boolean specifying success or a KjwResult object on a select/show/describe/explain.

Reimplemented from KjwSql.

Definition at line 88 of file KjwPgSql.php.

References KjwSql::_setLastQuery(), connect(), and KjwObject::croak().

Referenced by beginWork().

KjwPgSql::insertId (  ) 

Returns the id of the last INSERT clause that uses an IDENTITY/SEQUENCE/AUTO_INCREMENT value.

Returns:
The new id.
Note:
Don't try to be funny and do SELECT or whatever queries before calling this.

Reimplemented from KjwSql.

Definition at line 121 of file KjwPgSql.php.

KjwPgSql::KjwPgSql ( hostname,
portnum,
username,
password,
database 
)

Construct a KjwPgSql object.

Parameters:
$hostname Server name or IP.
$portnum Port number of 0 if default.
$username User name.
$password Password.
$database Database name.

Definition at line 41 of file KjwPgSql.php.

References KjwSql::KjwSql().

KjwPgSql::nameQuote ( string  ) 

Quote a name for an object (column or table).

For MySQL this would be by surrounding the name with backticks.

Parameters:
$string An identifier (column or table name) to be quoted.
Returns:
The quoted identifier.

Reimplemented from KjwSql.

Definition at line 110 of file KjwPgSql.php.

KjwPgSql::safeQuote ( mixed  ) 

Makes sure that any variable is quoted like its correct type should be.

Integers and booleans are returned as integers. Strings are returned as quoted strings with all quotes escaped. If the escaping mechanism is not known, all <32 and >127 characters REMOVED, otherwise the escaping for the specific database make is used.

Parameters:
$mixed The variable that needs to be returned as a safe entity.
Returns:
A quoted/escaped entity.

Reimplemented from KjwSql.

Definition at line 100 of file KjwPgSql.php.

References connect().


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

Generated on Wed Apr 8 22:16:36 2009 for KjwLib-php45 by  doxygen 1.5.8