[ Index ]

PHP Cross Reference of Web Application Component Toolkit

title

Body

[close]

/framework/db/drivers/ -> mdb.inc.php (summary)

(no description)

Version: $Id: mdb.inc.php,v 1.18 2004/11/20 18:09:47 jeffmoore Exp $
File Size: 610 lines (18 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 3 classes

mdbconnection:: (14 methods):
  mdbconnection()
  connect()
  raiseerror()
  makeliteral()
  newrecord()
  newrecordset()
  newpagedrecordset()
  findrecord()
  getonevalue()
  getonecolumnarray()
  gettwocolumnarray()
  execute()
  _execute()
  disconnect()

mdbrecord:: (6 methods):
  mdbrecord()
  buildassignmentlist()
  insertid()
  insert()
  update()
  getaffectedrowcount()

mdbrecordset:: (8 methods):
  mdbrecordset()
  query()
  paginate()
  freequery()
  reset()
  next()
  getrowcount()
  gettotalrowcount()


Class: mdbconnection  - X-Ref

Encapsulates a database connection.  Allows for lazy connections.
implements Connection interface

mdbconnection(&$config)   X-Ref
Create a PEAR::MDB database connection.

access: private
param: object Connection Configuration information

connect()   X-Ref
No description

raiseerror($sql = NULL, &$error)   X-Ref
Raises an error, passing it on to the framework level error mechanisms

access: private
param: string (optional) SQL statement
return: void

makeliteral($value, $type = NULL)   X-Ref
Convert a PHP value into an SQL literal.  The type to convert to is
based on the type of the PHP value passed, or the type string passed.

WARNING: while in MDB a boolean is mapped to CHAR(1) ['Y' | 'N'],
the WACT preferred way is an integer [1 | 0]

Use registerFieldConverter() if you are using an existing db

access: public
param: mixed value to convert
param: string (optional) type to convert to
return: string literal SQL fragment

newrecord($DataSpace = NULL)   X-Ref
Factory function to create a Record object

access: public
param: DataSpace or subclass (optional)
return: Record reference

newrecordset($query, $filter = NULL)   X-Ref
Factory function used to retrieve more than one row from a MDB database,
applying a filter to the data if supplied as an argument

access: public
param: string SQL statement
param: object filter class (optional)
return: RecordSet reference

newpagedrecordset($query, &$pager, $filter = NULL)   X-Ref
Factory function used to retrieve more than one row from a MDB database,
applying a filter to the data if supplied as an argument, and applying a
pager to the result set as well.

access: public
param: string SQL statement
param: object pager
param: object filter class (optional)
return: RecordSet reference

findrecord($query)   X-Ref
Retrieve a single record from the database based on a query.

access: public
param: string SQL Query
return: Record object or NULL if not found

getonevalue($query)   X-Ref
Get a single value from the first column of a single record from
a database query.

access: public
param: string SQL Query
return: Value or NULL if not found

getonecolumnarray($query)   X-Ref
Retrieve an array where each element of the array is the value from the
first column of a database query.

access: public
param: string SQL Query

gettwocolumnarray($query)   X-Ref
Retrieve an associative array where each element of the array is based
on the first column as a key and the second column as data.

access: public
param: string SQL Query

execute($sql)   X-Ref
Performs any query that does not return a cursor.

param: string SQL query
return: boolean TRUE if query is successful

_execute($sql)   X-Ref
For internal driver use only

access: public
param: string SQL query
return: object PEAR MDB_Result or DB_Error

disconnect()   X-Ref
Disconnect from database

access: public
return: void

Class: mdbrecord  - X-Ref

Encapsulates operations on a database via PEAR::DB. Generally this
class is only used for INSERT, UPDATE and DELETE operations
implements Record interface

mdbrecord(& $Connection)   X-Ref
Construct a record

param: PearConnection

buildassignmentlist($fields, $extrafields)   X-Ref
Build a list of values to assign to columns

access: protected
param: array associative of field_name => type
param: array associative (optional)  of field_name => value
return: array List of values to assign

insertid($table, $fields, $primary_key_field, $extrafields = NULL)   X-Ref
INSERT a record into a table with a primary key represented by a
auto_increment/serial column and return the primary key of the
inserted record.
the field list parameter allows expressions to defined in the sql
statements as well as field values defined in the record.

param: string table name
param: array associative of field_name => type
param: string Name of primary key field field
param: array associative (optional)  of field_name => value
return: integer Primary key of the newly inserted record or FALSE if no

insert($table, $fields, $extrafields = NULL)   X-Ref
INSERTs the values of this record into a single table
the field list parameter allows expressions to defined in the sql
statements as well as field values defined in the record.

param: string table name
param: array associative of field_name => type
param: string (default = null) Name of autoincrement field
param: array associative (optional)  of field_name => value
return: Boolean True on success.

update($table, $fields, $where = NULL, $extrafields = NULL)   X-Ref
Performs an UPDATE on a single table

access: public
param: string table name
param: array associative of field_name => type
param: string (optional) SQL where clause
param: array associative (optional)  of field_name => value
return: boolean true on success, false on failure

getaffectedrowcount()   X-Ref
Gets the number of rows changed by a query

access: public
return: int number of affected rows

Class: mdbrecordset  - X-Ref

Encapsulates the results of a SELECT, SHOW, DESCRIBE or EXPLAIN sql statement
Implements the Iterator interface defined in the DataSpace
implements RecordSet and PagedDataSet interfaces

mdbrecordset($Connection, $Query_String)   X-Ref
Construct a record set.

access: public
param: object PearConnection
param: string SQL SELECT, SHOW, DESCRIBE, or EXPLAIN statement

query($Query_String)   X-Ref
Stores the SQL statement and makes sure the result object is
empty

access: protected
param: string SQL statement
return: void

paginate(&$pager)   X-Ref
Assign a pager to this query for the purposes of breaking up the resulting
cursor into paged chucks.

access: public
param: interface Pager
return: void

freequery()   X-Ref
Frees up the Result object if one exists

access: private
return: void

reset()   X-Ref
Move the current pointer to the first position in the cursor.

access: public
return: void

next()   X-Ref
Iterator next method

access: public
return: boolean TRUE if there are more results to fetch

getrowcount()   X-Ref
Returns the number of rows in a query

access: public
return: int number of rows

gettotalrowcount()   X-Ref
Returns the total number of rows that a query would return, ignoring paging
restrictions.  Query re-writing based on _adodb_getcount.

access: public
return: int number of rows



Generated: Sun Nov 28 19:36:09 2004 Cross-referenced by PHPXref 0.5