WACT_DB
[ class tree: WACT_DB ] [ index: WACT_DB ] [ all elements ]

Class: MySqlRecord

Source Location: /framework/db/drivers/mysql.inc.php

http://wact.sourceforge.net/index.php/Record

Record

Class Overview

DataSpace
   |
   --MySqlRecord

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

Variables

Methods


Child classes:

MySqlRecordSet
Encapsulates the cursor result of a SELECT, SHOW, DESCRIBE or EXPLAIN sql statement.

Inherited Variables

Inherited Methods

Class: DataSpace

DataSpace::export()
Returns a reference to the complete array of properties stored
DataSpace::get()
Gets a copy of a stored property by name
DataSpace::getPath()
Gets a property value by navagating a dot separated path that dereferences elements within the dataspace.
DataSpace::getPropertyList()
Return a unique list of available properties This method is probably going to have capitalization problems.
DataSpace::hasProperty()
Has a value been assigned under this name for this dataspace?
DataSpace::import()
replaces the current properties of this dataspace with the proprties and values passed as a parameter
DataSpace::isDataSource()
Any class that implements the DataSource interface should implement this method This is a PHP4 way of detecting which objects implement the interface.
DataSpace::makeDataSpace()
Static method to convert a variable into a dataspace.
DataSpace::merge()
Append a new list of values to the DataSpace.
DataSpace::prepare()
Prepares the dataspace, executing the doFilter() method of the registered filter, if one exists
DataSpace::registerFilter()
Registers a filter with the dataspace.
DataSpace::remove()
removes stored property value
DataSpace::removeAll()
removes all property values
DataSpace::set()
Stores a copy of value into a Property
DataSpace::setPath()
Stores a copy of value into a Property based on a dot separated path.

Class Details

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

implements Record interface

access:  public
see:  http://wact.sourceforge.net/index.php/Record
see:  Record

Class Variables


$Connection =

Connection to MySQL
access:  private
Type:   resource

Class Methods


constructor MySqlRecord

Conecruct a record

MySqlRecord MySqlRecord( object $Connection)

Parameters:

object   $Connection   Connection

method buildAssignmentSQL

Build SQL fragment to assign values to columns

string buildAssignmentSQL( array $fields, array $extrafields)

API Tags:

return:  SQL fragment
access:  protected

Parameters:

array   $fields   associative of field_name => type
array   $extrafields   associative (optional) of field_name => value

method getAffectedRowCount

Gets the number of rows changed by an insert, delete or update query.

int getAffectedRowCount( )

API Tags:

return:  number of affected rows
access:  public

method insert

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.

Boolean insert( string $table, array $fields, [string $extrafields = NULL], array 3)

API Tags:

return:  True on success.

Parameters:

array   3   associative (optional) of field_name => value
string   $table   table name
array   $fields   associative of field_name => type
string   $extrafields   (default = null) Name of autoincrement field

method insertId

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.



integer insertId( string $table, array $fields, string $primary_key_field, [array $extrafields = NULL])

API Tags:

return:  Primary key of the newly inserted record or FALSE if no record was inserted.

Parameters:

string   $table   table name
array   $fields   associative of field_name => type
string   $primary_key_field   Name of primary key field field
array   $extrafields   associative (optional) of field_name => value

method update

Performs an UPDATE on a single table

boolean update( string $table, array $fields, [string $where = NULL], [array $extrafields = NULL])

API Tags:

return:  true on success, false on failure
access:  public

Parameters:

string   $table   table name
array   $fields   associative of field_name => type
string   $where   (optional) SQL where clause
array   $extrafields   associative (optional) of field_name => value
WACT: Copyright 2003 Procata, Inc. Released under the LGPL license (http://www.gnu.org/copyleft/lesser.html)
Documentation generated on Sun, 28 Nov 2004 19:48:31 -0800 by phpDocumentor 1.2.3