[ Index ]

PHP Cross Reference of Web Application Component Toolkit

title

Body

[close]

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

(no description)

Version: $Id: mysql.inc.php,v 1.34 2004/11/12 21:25:05 jeffmoore Exp $
File Size: 563 lines (15 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 3 classes

mysqlconnection:: (15 methods):
  mysqlconnection()
  getconnectionid()
  connect()
  raiseerror()
  makeliteral()
  newrecord()
  newrecordset()
  newpagedrecordset()
  findrecord()
  getonevalue()
  getonecolumnarray()
  gettwocolumnarray()
  execute()
  _execute()
  disconnect()

mysqlrecord:: (6 methods):
  mysqlrecord()
  buildassignmentsql()
  insertid()
  insert()
  update()
  getaffectedrowcount()

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


Class: mysqlconnection  - X-Ref

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

mysqlconnection(&$config)   X-Ref
Create a MySQL database connection.

access: private
param: object Connection Configuration information

getconnectionid()   X-Ref
Return connectionId for a mysql database.  Allow a lazy connection.

access: protected
return: resource

connect()   X-Ref
Connect to the the database

access: protected
return: void

raiseerror($sql = NULL)   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.

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 MySQL 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 MySQL 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
Retreive 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
Retreive 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
Retreive 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
No description

disconnect()   X-Ref
Disconnect from database

access: public
return: void

Class: mysqlrecord  - X-Ref

Encapsulates INSERT, UPDATE, or DELETE operations on a MySQL database.
implements Record interface

mysqlrecord($Connection)   X-Ref
Conecruct a record

param: object Connection

buildassignmentsql($fields, $extrafields)   X-Ref
Build SQL fragment to assign values to columns

access: protected
param: array associative of field_name => type
param: array associative (optional)  of field_name => value
return: string SQL fragment

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.
requires MySQL Version 3.22.10 or better.

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 an insert, delete or update query.

access: public
return: int number of affected rows

Class: mysqlrecordset  - X-Ref

Encapsulates the cursor result of a SELECT, SHOW, DESCRIBE or EXPLAIN
sql statement.  Implements the Iterator interface.
implements RecordSet and PagedDataSet interfaces

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

access: public
param: object MySQL Connection
param: string SQL SELECT, SHOW, DESCRIBE, or EXPLAIN statement
return: void

query($Query_String)   X-Ref
Assign a query for this object to process.

access: public
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 Query resource.  can be called even if no
resource is set or if has already been freed.

access: private
return: void

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

access: public
return: boolean TRUE if the query is valid.

next()   X-Ref
Iterator next method.  Load the data values from the next record
in the query into the current data values.

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