Transaction Engine 3 Application Programming Interface
[ class tree: Transaction Engine 3 Application Programming Interface ] [ index: Transaction Engine 3 Application Programming Interface ] [ all elements ]

Class: tNG_fields

Source Location: /tNG3/tNG_fields.class.php

Class Overview

tNG
   |
   --tNG_fields

This class adds the "field" concept to the tNG base class.


Author(s):

Variables

Methods


Child classes:

tNG_custom
This class is the "custom" implementation of the tNG_fields class.
tNG_delete
This class is the "delete" implementation of the tNG_fields class.
tNG_insert
This class is the "insert" implementation of the tNG_fields class.
tNG_multiple
This class adds a "multiple" layer to the tNG_fields class.
tNG_update
This class is the "update" implementation of the tNG_fields class.

Inherited Variables

Inherited Methods

Class: tNG

tNG::tNG()
Constructor. Sets the connection.
tNG::doTransaction()
executing the transaction (triggers, prepare SQL)
tNG::executeTransaction()
Executes the Transaction Tests the STARTER triggers, executes the BEFORE triggers, the transaction SQL, the AFTER triggers and the END triggers. If error occurs, it executes the ERROR triggers and exits.
tNG::executeTriggers()
Executes the registered triggers that matches the specified type
tNG::exportsRecordset()
Getter for the exportsRecordset property
tNG::getDispatcher()
Gets the transaction dispatcher
tNG::getError()
Getter for the transaction error object
tNG::getErrorMsg()
Gets the error message
tNG::getTransactionType()
Gets the transaction type
tNG::isStarted()
Gets the started property
tNG::parseSQLError()
Parses the SQL error
tNG::postExecuteSql()
This function is called once the transaction SQL was actually executed
tNG::prepareSQL()
Prepares the SQL query to be executed
tNG::registerTrigger()
Register the trigger to transaction;
tNG::rollBackTransaction()
Executes the error triggers and set the error object;
tNG::setDispatcher()
Set dispatcher object for the transaction.
tNG::setError()
Setter for the transaction error object
tNG::setSQL()
Sets the transaction SQL statement
tNG::setStarted()
Sets the started property (the starter triggers are the ones that call this function)

Class Details

[line 12]
This class adds the "field" concept to the tNG base class.

Thus, the SQL query will be dinamically-built.




Tags:

access:  public
abstract:  


[ Top ]


Class Variables

$columns = array()

[line 19]

List of columns to use when generating the transaction SQL query



Tags:

access:  protected
see:  tNG_fields::addColumn()

Type:   array


[ Top ]

$pkName =  'kt_pk'

[line 41]

The Primary Key value that is submitted on update



Tags:

access:  protected

Type:   string


[ Top ]

$primaryKey =  ''

[line 26]

Primary Key field



Tags:

access:  protected

Type:   string


[ Top ]

$primaryKeyColumn = array()

[line 34]

Primary Key details

Value, Type, etc




Tags:

access:  protected

Type:   array


[ Top ]

$savedData = array()

[line 46]

The transaction saved data (before the actual execution)


Type:   mixed


[ Top ]

$table =  ''

[line 53]

Table to use when generating the transaction SQL query



Tags:

access:  protected

Type:   string


[ Top ]



Class Methods


method addColumn [line 73]

void addColumn( string $colName, string $type, string $method, string $reference)

Adds a column to the transaction



Tags:

access:  public
see:  tNG_fields::$columns


Overridden in child classes as:

tNG_custom::addColumn()
Adds a column to the transaction Calls the parent addColumn method then sets the default value.
tNG_insert::addColumn()
Adds a column to the transaction Calls the parent addColumn method then sets the default value.
tNG_import::addColumn()
Adds a column to the transaction Calls the parent addColumn method then sets the default value.
tNG_multipleInsert::addColumn()
Adds a column to the transaction Calls the parent addColumn method then sets the default value.

Parameters:

string   $colName   The column name
string   $type   The column type (NUMERIC_TYPE, STRING_TYPE, etc)
string   $method   The request method (GET, POST, FILE, COOKIE, SESSION)
string   $reference   The submitted variable name (if method=GET and reference=test, value=$_GET['test'])

[ Top ]

method afterUpdateField [line 407]

boolean afterUpdateField( string $fieldName, string $fieldValue)

Updates a field after the actual transaction was executed



Tags:

return:  true on success false on error
access:  public


Parameters:

string   $fieldName   The field name
string   $fieldValue   The field value

[ Top ]

method compileColumnsValues [line 268]

void compileColumnsValues( )

Sets for each column the value correspondeing to the reference/method



Tags:

access:  public


[ Top ]

method evaluateNumeric [line 105]

float evaluateNumeric( string $expr)

Evaluates a numeric expression



Tags:

return:  - the result of the evaluated expresison.
access:  public


Parameters:

string   $expr   - the expression to be evaluated (must contain only: numbers (0 to 9) and the follwing characters: + - * / . ( )

[ Top ]

method executeTransaction [line 59]

void executeTransaction( )

Evaluates the columns values then executes the Transaction



Tags:

access:  public


Overrides tNG::executeTransaction() (Executes the Transaction Tests the STARTER triggers, executes the BEFORE triggers, the transaction SQL, the AFTER triggers and the END triggers. If error occurs, it executes the ERROR triggers and exits.)

[ Top ]

method getColumnReference [line 174]

string getColumnReference( string $colName)

Gets the reference of a column



Tags:

access:  public


Parameters:

string   $colName  

[ Top ]

method getColumnType [line 189]

string getColumnType( string $colName)

Gets the type of a column



Tags:

return:  The column type
access:  public


Parameters:

string   $colName  

[ Top ]

method getColumnValue [line 158]

object unknown getColumnValue( string $colName)

Gets the value of a column



Tags:

access:  public


Parameters:

string   $colName  

[ Top ]

method getFakeRecordset [line 300]

object resource getFakeRecordset( array $fakeArr)

Creates a fake recordset from the given columns associative array This function is called on error or for the insert default values.



Tags:

return:  Recordset resource
access:  protected


Parameters:

array   $fakeArr   The associative array

[ Top ]

method getFakeRsArr [line 348]

array getFakeRsArr( )

Creates a fake recordset array from the current $columns

This function is called ONLY on error




Tags:

return:  associative array with the current values.
access:  protected


[ Top ]

method getFieldError [line 425]

string getFieldError( string $fName)

Gets the error message for a specific field, if it exists.



Tags:

return:  error message
access:  public


Overridden in child classes as:

tNG_multiple::getFieldError()
Gets the error message for a specific field, if it exists.

Parameters:

string   $fName   the field name

[ Top ]

method getLocalRecordset [line 289]

object resource getLocalRecordset( )

Get the local recordset associated to this transaction

This function is to be implemented in subclasses




Tags:

return:  Recordset resource
abstract:  


Overridden in child classes as:

tNG_custom::getLocalRecordset()
Get the local recordset associated to this transaction
tNG_login::getLocalRecordset()
Get the local recordset associated to this transaction
tNG_delete::getLocalRecordset()
This function exits because the current class does not export a recordset.
tNG_insert::getLocalRecordset()
Get the local recordset associated to this transaction
tNG_multiple::getLocalRecordset()
Abstract method; must be implemented by the inherited classes;
tNG_multipleDelete::getLocalRecordset()
No recordset is created when multiple delete is executed; thus the calling of this method set an error;
tNG_multipleInsert::getLocalRecordset()
Get the local recordset associated to this transaction
tNG_multipleUpdate::getLocalRecordset()
Get the local recordset associated to this transaction
tNG_update::getLocalRecordset()
Get the local recordset associated to this transaction

[ Top ]

method getPrimaryKey [line 247]

string getPrimaryKey( )

Gets the primary key column



Tags:

access:  public


[ Top ]

method getPrimaryKeyValue [line 256]

object unknown getPrimaryKeyValue( )

Gets the primary key value



Tags:

access:  public


[ Top ]

method getRecordset [line 321]

object resource getRecordset( )

Get the recordset associated to this transaction



Tags:

return:  Recordset resource The fake recordset on error or the local recordset
access:  public


Overridden in child classes as:

tNG_multiple::getRecordset()
Get the recordset associated to this transaction

[ Top ]

method getSavedValue [line 438]

string getSavedValue( string $colName)

Gets the value saved for the given column name



Tags:

access:  public


Overridden in child classes as:

tNG_multiple::getSavedValue()
Wrapper for getSavedValue method of the executed transactions;

Parameters:

string   $colName   the name of the column

[ Top ]

method getTable [line 222]

string getTable( )

Getter for the transaction SQL table



Tags:

return:  The table name
access:  public
see:  tNG_fields::$table


[ Top ]

method parseSQLError [line 385]

void &parseSQLError( string $sql, mixed $error, string $errorMsg)

Parses the SQL error Calls the parent function then sets the error to a specific column if possible.



Tags:

access:  protected


Overrides tNG::parseSQLError() (Parses the SQL error)

Parameters:

string   $sql   the SQL statement that throwed the error message
string   $errorMsg   the error text message

[ Top ]

method prepareSQL [line 336]

void prepareSQL( )

Prepares the SQL query to be executed

To be implemented in derived class




Tags:

access:  protected


Overridden in child classes as:

tNG_custom::prepareSQL()
Prepares the custom SQL query to be executed
tNG_login::prepareSQL()
Prepares the custom SQL query to be executed
tNG_delete::prepareSQL()
Prepares the delete SQL query to be executed
tNG_insert::prepareSQL()
Prepares the insert SQL query to be executed
tNG_import::prepareSQL()
Executes all sub-transactions
tNG_multipleDelete::prepareSQL()
Executes all sub-transactions
tNG_multipleInsert::prepareSQL()
Executes all sub-transactions
tNG_multipleUpdate::prepareSQL()
Executes all sub-transactions
tNG_update::prepareSQL()
Prepares the update SQL query to be executed

Overrides tNG::prepareSQL() (Prepares the SQL query to be executed)

[ Top ]

method saveData [line 450]

string saveData( )

Retrieve and store the saved values from database;



Tags:

access:  public


Overridden in child classes as:

tNG_import::saveData()
No data needs to be saved on insert.
tNG_multipleInsert::saveData()
No data needs to be saved on insert.

[ Top ]

method setColumnValue [line 128]

void setColumnValue( string $colName, object unknown $colValue)

Sets a value for a given column



Tags:

access:  public


Parameters:

string   $colName   - the column to alter
object unknown   $colValue   - the new value

[ Top ]

method setPrimaryKey [line 235]

void setPrimaryKey( string $colName, string $type, [string $method = 'VALUE'], [string $reference = NULL])

Sets the primary key and its details



Tags:



Parameters:

string   $colName   The column name
string   $type   The column type (NUMERIC_TYPE, STRING_TYPE, etc)
string   $method   The request method (GET, POST, FILE, COOKIE, SESSION)
string   $reference   The submitted variable name (if method=GET and reference=test, value=$_GET['test'])

[ Top ]

method setRawColumnValue [line 144]

void setRawColumnValue( string $colName, object unknown $colValue)

Sets a value for a column directly



Tags:

access:  public


Parameters:

string   $colName   - the column to alter
object unknown   $colValue   - the new value

[ Top ]

method setTable [line 206]

void setTable( string $tableName)

Setter for the transaction SQL table



Tags:

access:  public
see:  tNG_fields::$table


Parameters:

string   $tableName   The table name

[ Top ]



Documentation generated on Tue, 6 Dec 2005 15:11:42 +0200 by phpDocumentor 1.3.0RC3