BitDbAdodb Class Reference

Inheritance diagram for BitDbAdodb:

Inheritance graph
[legend]
List of all members.

Public Member Functions

 Affected_Rows ()
 BitDbAdodb ()
 CompleteTrans ()
 CreateSequence ($seqname='adodbseq', $startID=1)
 createTables ($pTables, $pOptions=array())
 debug ($pLevel=99)
 dropTables ($pTables)
 GenID ($pSequenceName, $pUseDbPrefix=true)
 getAll ($pQuery, $pValues=FALSE, $pCacheTime=BIT_QUERY_DEFAULT)
 getArray ($pQuery, $pValues=FALSE, $pForceArray=FALSE, $pFirst2Cols=FALSE, $pCacheTime=BIT_QUERY_DEFAULT)
 getAssoc ($pQuery, $pValues=FALSE, $pForceArray=FALSE, $pFirst2Cols=FALSE, $pCacheTime=BIT_QUERY_DEFAULT)
 getCol ($pQuery, $pValues=FALSE, $pTrim=FALSE, $pCacheTime=BIT_QUERY_DEFAULT)
 getDebugLevel ()
 getOne ($pQuery, $pValues=NULL, $pNumRows=NULL, $pOffset=NULL, $pCacheTime=BIT_QUERY_DEFAULT)
 getRow ($pQuery, $pValues=FALSE, $pCacheTime=BIT_QUERY_DEFAULT)
 ifNull ($pField, $pNullRepl)
 ls ($pDate)
 MetaColumns ($table, $normalize=true, $schema=false)
 MetaIndexes ($table, $primary=false, $owner=false)
 MetaTables ($ttype=false, $showSchema=false, $mask=false)
 OffsetDate ($pDays, $pColumn=NULL)
 qstr ($pStr)
 query ($query, $values=null, $numrows=BIT_QUERY_DEFAULT, $offset=BIT_QUERY_DEFAULT, $pCacheTime=BIT_QUERY_DEFAULT)
 queryError ($pQuery, &$pError, $pValues=NULL, $pNumRows=-1, $pOffset=-1)
 RollbackTrans ()
 SQLDate ($pDateFormat, $pBaseDate=false)
 StartTrans ()
 tableExists ($pTable)

Private Member Functions

 convertQuery (&$pQuery)

Detailed Description

Definition at line 47 of file BitDbAdodb.php.


Member Function Documentation

BitDbAdodb::Affected_Rows (  ) 

Returns:
# rows affected by UPDATE/DELETE

Reimplemented from BitDb.

Definition at line 618 of file BitDbAdodb.php.

References mDb.

BitDbAdodb::BitDbAdodb (  ) 

Definition at line 49 of file BitDbAdodb.php.

References $gBitDbHost, $gBitDbName, $gBitDbPassword, $gBitDbType, $gBitDbUser, debug(), die, getDebugLevel(), mDb, mType, BitDb::postDBConnection(), and BitDb::preDBConnection().

Here is the call graph for this function:

BitDbAdodb::CompleteTrans (  ) 

Used together with StartTrans() to end a transaction. Monitors connection for sql errors, and will commit or rollback as appropriate.

autoComplete if true, monitor sql errors and commit and rollback as appropriate, and if set to false force rollback even if no SQL error detected.

Returns:
true on commit, false on rollback.

Reimplemented from BitDb.

Definition at line 584 of file BitDbAdodb.php.

References mDb.

BitDbAdodb::convertQuery ( &$  pQuery  )  [private]

Converts backtick (`) quotes to the appropriate quote for the database.

Parameters:
pQuery the SQL query using backticks (`)
Returns:
the correctly quoted SQL statement
Todo:
investigate replacement by AdoDB NameQuote() function

Reimplemented from BitDb.

Definition at line 524 of file BitDbAdodb.php.

References $i, and mType.

Referenced by getAll(), getArray(), getAssoc(), getCol(), getRow(), query(), and queryError().

BitDbAdodb::CreateSequence ( seqname = 'adodbseq',
startID = 1 
)

A database portable Sequence management function.

Parameters:
pSequenceName Name of the sequence to be used It will be created if it does not already exist
pStartID Allows setting the initial value of the sequence
Returns:
0 if not supported, otherwise a sequence id
Todo:
To be combined with GenID

Reimplemented from BitDb.

Definition at line 460 of file BitDbAdodb.php.

References FALSE, and mDb.

BitDbAdodb::createTables ( pTables,
pOptions = array() 
)

Used to create tables - most commonly from package/schema_inc.php files

Todo:
remove references to BIT_DB_PREFIX, us a member function
Parameters:
pTables an array of tables and creation information in DataDict style
pOptions an array of options used while creating the tables
Returns:
true|false true if created with no errors | false if errors are stored in $this->mFailed

Reimplemented from BitDb.

Definition at line 101 of file BitDbAdodb.php.

References $completeTableName, $dict, $result, $sql, mDb, and mType.

BitDbAdodb::debug ( pLevel = 99  ) 

will activate ADODB's native debugging output

Parameters:
pLevel debugging level - FALSE is off, TRUE is on, 99 is verbose

Reimplemented from BitDb.

Definition at line 549 of file BitDbAdodb.php.

References mDb.

Referenced by BitDbAdodb().

BitDbAdodb::dropTables ( pTables  ) 

Used to drop tables

Todo:
remove references to BIT_DB_PREFIX, us a member function
Parameters:
pTables an array of table names to drop
Returns:
true | false true if dropped with no errors | false if errors are stored in $this->mFailed

Reimplemented from BitDb.

Definition at line 152 of file BitDbAdodb.php.

References $completeTableName, $dict, $sql, and mDb.

BitDbAdodb::GenID ( pSequenceName,
pUseDbPrefix = true 
)

A database portable Sequence management function.

Parameters:
pSequenceName Name of the sequence to be used It will be created if it does not already exist
Returns:
0 if not supported, otherwise a sequence id

Reimplemented from BitDb.

Definition at line 438 of file BitDbAdodb.php.

References $prefix, FALSE, and mDb.

BitDbAdodb::getAll ( pQuery,
pValues = FALSE,
pCacheTime = BIT_QUERY_DEFAULT 
)

Definition at line 291 of file BitDbAdodb.php.

References $result, convertQuery(), FALSE, BitDb::isCachingActive(), mDb, BitDb::queryComplete(), and BitDb::queryStart().

Here is the call graph for this function:

BitDbAdodb::getArray ( pQuery,
pValues = FALSE,
pForceArray = FALSE,
pFirst2Cols = FALSE,
pCacheTime = BIT_QUERY_DEFAULT 
)

Returns an associative array for the given query. See AdoDB GetAssoc() function for more detail.

Parameters:
pQuery the SQL query. Use backticks (`) to quote all table and attribute names for AdoDB to quote appropriately.
pValues an array of values used in a parameterised query
pForceArray if set to true, when an array is created for each value
pFirst2Cols if set to true, only returns the first two columns
Returns:
the associative array, or false if an error occurs

Reimplemented from BitDb.

Definition at line 345 of file BitDbAdodb.php.

References $result, convertQuery(), FALSE, BitDb::isCachingActive(), mDb, BitDb::queryComplete(), and BitDb::queryStart().

Here is the call graph for this function:

BitDbAdodb::getAssoc ( pQuery,
pValues = FALSE,
pForceArray = FALSE,
pFirst2Cols = FALSE,
pCacheTime = BIT_QUERY_DEFAULT 
)

Returns an associative array for the given query. See AdoDB GetAssoc() function for more detail.

Parameters:
pQuery the SQL query. Use backticks (`) to quote all table and attribute names for AdoDB to quote appropriately.
pValues an array of values used in a parameterised query
pForceArray if set to true, when an array is created for each value
pFirst2Cols if set to true, only returns the first two columns
Returns:
the associative array, or false if an error occurs

Reimplemented from BitDb.

Definition at line 370 of file BitDbAdodb.php.

References $result, convertQuery(), FALSE, BitDb::isCachingActive(), mDb, BitDb::queryComplete(), and BitDb::queryStart().

Here is the call graph for this function:

BitDbAdodb::getCol ( pQuery,
pValues = FALSE,
pTrim = FALSE,
pCacheTime = BIT_QUERY_DEFAULT 
)

Executes the SQL and returns all elements of the first column as a 1-dimensional array. The recordset is discarded for you automatically. If an error occurs, false is returned. See AdoDB GetCol() function for more detail.

Parameters:
pQuery the SQL query. Use backticks (`) to quote all table and attribute names for AdoDB to quote appropriately.
pValues an array of values used in a parameterised query
pForceArray if set to true, when an array is created for each value
pFirst2Cols if set to true, only returns the first two columns
Returns:
the associative array, or false if an error occurs
Todo:
not currently used anywhere

Definition at line 320 of file BitDbAdodb.php.

References $result, convertQuery(), FALSE, BitDb::isCachingActive(), mDb, BitDb::queryComplete(), and BitDb::queryStart().

Here is the call graph for this function:

BitDbAdodb::getDebugLevel (  ) 

returns the level of query debugging output

Returns:
pLevel debugging level - FALSE is off, TRUE is on, 99 is verbose

Reimplemented from BitDb.

Definition at line 558 of file BitDbAdodb.php.

Referenced by BitDbAdodb().

BitDbAdodb::getOne ( pQuery,
pValues = NULL,
pNumRows = NULL,
pOffset = NULL,
pCacheTime = BIT_QUERY_DEFAULT 
)

Returns a single column value from the database.

Parameters:
pQuery the SQL query. Use backticks (`) to quote all table and attribute names for AdoDB to quote appropriately.
pValues an array of values used in a parameterised query
pReportErrors report errors to STDOUT
pOffset the row number to begin returning rows from.
Returns:
the associative array, or false if an error occurs

Reimplemented from BitDb.

Definition at line 417 of file BitDbAdodb.php.

References $res, $result, and query().

Here is the call graph for this function:

BitDbAdodb::getRow ( pQuery,
pValues = FALSE,
pCacheTime = BIT_QUERY_DEFAULT 
)

Executes the SQL and returns the first row as an array. The recordset and remaining rows are discarded for you automatically. If an error occurs, false is returned. See AdoDB GetRow() function for more detail.

Parameters:
pQuery the SQL query. Use backticks (`) to quote all table and attribute names for AdoDB to quote appropriately.
pValues an array of values used in a parameterised query
Returns:
returns the first row as an array, or false if an error occurs

Reimplemented from BitDb.

Definition at line 393 of file BitDbAdodb.php.

References $result, convertQuery(), FALSE, BitDb::isCachingActive(), mDb, BitDb::queryComplete(), and BitDb::queryStart().

Here is the call graph for this function:

BitDbAdodb::ifNull ( pField,
pNullRepl 
)

A database portable IFNULL function.

Parameters:
pField argument to compare to NULL
pNullRepl the NULL replacement value
Returns:
a string that represents the function that checks whether $pField is NULL for the given database, and if NULL, change the value returned to $pNullRepl.

Reimplemented from BitDb.

Definition at line 475 of file BitDbAdodb.php.

References mDb.

BitDbAdodb::ls ( pDate  ) 

Format the timestamp in the format the database accepts.

Parameters:
pDate a Unix integer timestamp or an ISO format Y-m-d H:i:s
Returns:
the timestamp as a quoted string.
Todo:
could be used to later convert all int timestamps into db timestamps. Currently not used anywhere.

Reimplemented from BitDb.

Definition at line 486 of file BitDbAdodb.php.

References mDb.

BitDbAdodb::MetaColumns ( table,
normalize = true,
schema = false 
)

List columns in a database as an array of ADOFieldObjects. See top of file for definition of object.

Parameters:
table table name to query
upper uppercase table name (required by some databases)
schema is optional database schema to use - not supported by all databases.
Returns:
array of ADOFieldObjects for current table.

Reimplemented from BitDb.

Definition at line 273 of file BitDbAdodb.php.

References $schema, and mDb.

BitDbAdodb::MetaIndexes ( table,
primary = false,
owner = false 
)

List indexes in a database as an array of ADOFieldObjects. See top of file for definition of object.

Parameters:
table table name to query
primary list primary indexes
owner list owner of index
Returns:
array of ADOFieldObjects for current table.

Reimplemented from BitDb.

Definition at line 287 of file BitDbAdodb.php.

References mDb.

BitDbAdodb::MetaTables ( ttype = false,
showSchema = false,
mask = false 
)

Create a list of tables available in the current database

Parameters:
ttype can either be 'VIEW' or 'TABLE' or false. If false, both views and tables are returned. "VIEW" returns only views "TABLE" returns only tables
showSchema returns the schema/user with the table name, eg. USER.TABLE
mask is the input mask - only supported by oci8 and postgresql
Returns:
array of tables for current database.

Reimplemented from BitDb.

Definition at line 611 of file BitDbAdodb.php.

References mDb.

BitDbAdodb::OffsetDate ( pDays,
pColumn = NULL 
)

Calculate the offset of a date for a particular database and generate appropriate SQL. Useful for calculating future/past dates and storing in a database.

Parameters:
pDays Number of days to offset by If dayFraction=1.5 means 1.5 days from now, 1.0/24 for 1 hour.
pColumn Value to be offset If NULL an offset from the current time is supplied
Returns:
New number of days
Todo:
Not currently used - this is database specific and uses TIMESTAMP rather than unix seconds

Reimplemented from BitDb.

Definition at line 513 of file BitDbAdodb.php.

References mDb.

BitDbAdodb::qstr ( pStr  ) 

Quotes a string to be sent to the database which is passed to function on to AdoDB->qstr().

Todo:
not sure what its supposed to do
Parameters:
pStr string to be quotes
Returns:
quoted string using AdoDB->qstr()

Reimplemented from BitDb.

Definition at line 182 of file BitDbAdodb.php.

References mDb.

BitDbAdodb::query ( query,
values = null,
numrows = BIT_QUERY_DEFAULT,
offset = BIT_QUERY_DEFAULT,
pCacheTime = BIT_QUERY_DEFAULT 
)

Queries the database reporting an error if detected than exiting while printing the error. -rlpowell

Parameters:
pQuery the SQL query. Use backticks (`) to quote all table and attribute names for AdoDB to quote appropriately.
pValues an array of values used in a parameterised query
pNumRows the number of rows (LIMIT) to return in this query
pOffset the row number to begin returning rows from. Used in conjunction with $pNumRows
Returns:
an AdoDB RecordSet object

Reimplemented from BitDb.

Definition at line 228 of file BitDbAdodb.php.

References $offset, $query, $result, convertQuery(), FALSE, BitDb::isCachingActive(), mDb, BitDb::queryComplete(), and BitDb::queryStart().

Referenced by getOne().

Here is the call graph for this function:

BitDbAdodb::queryError ( pQuery,
&$  pError,
pValues = NULL,
pNumRows = -1,
pOffset = -1 
)

Queries the database, returning an error if one occurs, rather than exiting while printing the error. -rlpowell

Parameters:
pQuery the SQL query. Use backticks (`) to quote all table and attribute names for AdoDB to quote appropriately.
pError the error string to modify and return
pValues an array of values used in a parameterised query
pNumRows the number of rows (LIMIT) to return in this query
pOffset the row number to begin returning rows from. Used in
Returns:
an AdoDB RecordSet object conjunction with $pNumRows
Todo:
currently not used anywhere.

Reimplemented from BitDb.

Definition at line 199 of file BitDbAdodb.php.

References $result, convertQuery(), and mDb.

Here is the call graph for this function:

BitDbAdodb::RollbackTrans (  ) 

If database does not support transactions, rollbacks always fail, so return false otherwise returns true if the Rollback was successful

Returns:
true/false.

Reimplemented from BitDb.

Definition at line 594 of file BitDbAdodb.php.

References FALSE, and mDb.

BitDbAdodb::SQLDate ( pDateFormat,
pBaseDate = false 
)

Format date column in sql string given an input format that understands Y M D

Reimplemented from BitDb.

Definition at line 496 of file BitDbAdodb.php.

References mDb.

BitDbAdodb::StartTrans (  ) 

Improved method of initiating a transaction. Used together with CompleteTrans(). Advantages include:

a. StartTrans/CompleteTrans is nestable, unlike BeginTrans/CommitTrans/RollbackTrans. Only the outermost block is treated as a transaction.
b. CompleteTrans auto-detects SQL errors, and will rollback on errors, commit otherwise.
c. All BeginTrans/CommitTrans/RollbackTrans inside a StartTrans/CompleteTrans block are disabled, making it backward compatible.

Reimplemented from BitDb.

Definition at line 572 of file BitDbAdodb.php.

References mDb.

BitDbAdodb::tableExists ( pTable  ) 

Used to check if tables already exists.

Todo:
should be used to confirm tables are already created
Parameters:
pTable the table name
Returns:
true if table already exists

Reimplemented from BitDb.

Definition at line 137 of file BitDbAdodb.php.

References $dict, $tables, FALSE, and mDb.


The documentation for this class was generated from the following file:
Generated on Wed Aug 22 19:34:12 2007 for bitweaver by  doxygen 1.5.2