DB_OP Class Reference

A wrapper class of normally used PostgreSQL operations. More...

List of all members.

Public Member Functions

 __construct ($params)
 reconnect ()
 affected_rows ()
 select ($table, $select=array('*'))
 simple_query ($sql)
 query ($sql, $return_object=FALSE)
 load_rdriver ()
 close ()
 display_error ($error= '', $swap= '', $native=FALSE)

Private Member Functions

 initialize ()
 _connect_string ()
 db_connect ()
 db_pconnect ()
 _error_message ()

Detailed Description

This class is used to construct database connection to a PostgreSQL database. It also includes some basic operation to database. This can be a template for future development of connecting to other databases


Constructor & Destructor Documentation

DB_OP::__construct ( params  ) 

Constructor. Accepts one parameter containing the database connection settings.

Parameters:
array 

Member Function Documentation

DB_OP::initialize (  )  [private]

Initialize Database Settings. Called by the constructor.

Parameters:
void 
Returns:
boolean. TRUE for successful initialisation. FALSE otherwise.
DB_OP::_connect_string (  )  [private]

Construct connection string

Returns:
string
DB_OP::db_connect (  )  [private]

Non-persistent database connection

Returns:
resource
DB_OP::db_pconnect (  )  [private]

Persistent database connection

Returns:
resource
DB_OP::reconnect (  ) 

Reconnect

Keep / reestablish the db connection if no queries have been sent for a length of time exceeding the server's idle timeout

Returns:
void
DB_OP::affected_rows (  ) 

Affected Rows

Returns:
integer
DB_OP::select ( table,
select = array('*') 
)

Generates the SELECT portion of the query when multiple fileds are needed

Parameters:
$table Type: string.
$select Type: array.
Returns:
string
DB_OP::simple_query ( sql  ) 

Simple Query This function is used for client script will process result. Or running transaction commands since they do not require all the features of the main query() function.

Parameters:
string the sql query
Returns:
resource
DB_OP::query ( sql,
return_object = FALSE 
)

Execute the query

Accepts an SQL string as input and returns a result object upon successful execution of a "read" type query. Returns boolean TRUE upon successful execution of a "write" type query. Returns boolean FALSE upon failure.

Parameters:
string An SQL query string
array An array of binding data
Returns:
mixed
DB_OP::load_rdriver (  ) 

Load the result drivers

Returns:
string the name of the result class
DB_OP::close (  ) 

Close database connection

Returns:
void
DB_OP::_error_message (  )  [private]

The error message string

Returns:
string
DB_OP::display_error ( error = '',
swap = '',
native = FALSE 
)

Display an error message in some format

Parameters:
string the error message
string any "swap" values
boolean whether to localize the message
Returns:
string sends the application/error_db.php template

The documentation for this class was generated from the following file:
 All Classes Files Functions
Generated on Fri May 27 09:42:03 2011 for Data Centre by  doxygen 1.6.3