DBWrapper Class Reference

Inheritance diagram for DBWrapper:

MySQLDBWrapper PostgreDBWrapper

List of all members.

Public Member Functions

 __construct ($db, $logger)
 query ($sql, $result=false)
 escape ($str)
 get_data_array ($res)
 get_data_named ($res)
 get_id ()
 count ($res)

Protected Attributes

 $db
 db connection resource
 $logger
 LogMaster object.

Private Member Functions

 virtual_error ($method)


Detailed Description

Wrapper around database

Pure virtual class. Functionality must be defined in child classes.


Constructor & Destructor Documentation

__construct ( db,
logger 
)

constructor

Parameters:
db db resource
logger LogMaster object


Member Function Documentation

count ( res  ) 

return count of records affected by previou operation

Parameters:
res sql result resource
Returns:
count of records affected by previou operation

Reimplemented in MySQLDBWrapper, and PostgreDBWrapper.

escape ( str  ) 

escapes data according DB rules

Parameters:
str string of data
Returns:
escaped string of data

Reimplemented in MySQLDBWrapper, and PostgreDBWrapper.

get_data_array ( res  ) 

return array of data from dataset

Parameters:
res sql result resource
Returns:
array of data

Reimplemented in MySQLDBWrapper, and PostgreDBWrapper.

get_data_named ( res  ) 

return hash of data from dataset

Parameters:
res sql result resource
Returns:
hash of data

Reimplemented in MySQLDBWrapper, and PostgreDBWrapper.

get_id (  ) 

return id of previously inserted record

Returns:
string with ID value

Reimplemented in MySQLDBWrapper, and PostgreDBWrapper.

query ( sql,
result = false 
)

exec sql query

if result specified, function takes data from specified column of first row in dataset and returns it

Parameters:
sql sql string
result optional, index of column, from which data need to be returned
Returns:
return sql result resource or data based on second parameter

Reimplemented in MySQLDBWrapper, and PostgreDBWrapper.

virtual_error ( method  )  [private]

check that class method correctly re-defined

probably there are better ways to implement the same use-case

Parameters:
method name of method


Member Data Documentation

$db [protected]

db connection resource

$logger [protected]

LogMaster object.


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

Generated on Tue Mar 3 20:06:24 2009 for dhxmlXConnector by  doxygen 1.5.8