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

Source Location: /tNG3/tNG.class.php

Class Overview


This class contains the tNG core (triggers, transactions, errors, etc) but does not handle field-based transactions.


Author(s):

Variables

Methods


Child classes:

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

Class Details

[line 11]
This class contains the tNG core (triggers, transactions, errors, etc) but does not handle field-based transactions.



Tags:

access:  public


[ Top ]


Class Variables

$connection =  null

[line 17]

The connection that will execute the transaction



Tags:

access:  public



[ Top ]

$dispatcher =  null

[line 75]

The tNG_dispatcher object



Tags:

access:  public



[ Top ]

$exportRecordset =  false

[line 54]

Wether the current implementation exports a recordset



Tags:

access:  protected

Type:   boolean


[ Top ]

$transactionType =  "UNKNOWN"

[line 47]

The transaction type Depending on the class that extends the base class, this changes.



Tags:

access:  protected

Type:   string


[ Top ]

$triggers = array()

[line 32]

Registered triggers

First dimension is the type of the trigger (STARTER, AFTER, BEFORE, ERROR or END), second dimension is an associative array with (key = callBackFunction,value = priority)




Tags:

access:  protected

Type:   array


[ Top ]



Class Methods


constructor tNG [line 83]

tNG tNG( object KT_Connection &$connection)

Constructor. Sets the connection.



Tags:

access:  public


Parameters:

object KT_Connection   &$connection   the connection object

[ Top ]

method doTransaction [line 352]

void doTransaction( )

executing the transaction (triggers, prepare SQL)



Tags:

access:  protected


Overridden in child classes as:

tNG_insert::doTransaction()
Overwrites tNG method in order to register some triggers specific to Register Transaction
tNG_update::doTransaction()
Overwrites tNG method in order to register some triggers specific to Update Users Transaction

[ Top ]

method executeTransaction [line 167]

void 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.



Tags:

access:  public


Overridden in child classes as:

tNG_fields::executeTransaction()
Evaluates the columns values then executes the Transaction

[ Top ]

method executeTriggers [line 199]

void executeTriggers( string $triggerType)

Executes the registered triggers that matches the specified type



Tags:

access:  protected


Parameters:

string   $triggerType   (STARTER, AFTER, BEFORE, ERROR and END)

[ Top ]

method exportsRecordset [line 113]

boolean exportsRecordset( )

Getter for the exportsRecordset property



Tags:

return:  true if the current implementation exports a recordset false otherwise
access:  public


[ Top ]

method getDispatcher [line 102]

tNG_dispatcher &getDispatcher( )

Gets the transaction dispatcher



Tags:

return:  type
access:  public


[ Top ]

method getError [line 323]

object tNG_error &getError( )

Getter for the transaction error object



Tags:

return:  the error object
access:  public


[ Top ]

method getErrorMsg [line 336]

string getErrorMsg( )

Gets the error message



Tags:

return:  transaction error message (formatted)
access:  public


Overridden in child classes as:

tNG_multiple::getErrorMsg()
Gets the error message
tNG_import::getErrorMsg()
Gets the error message Adds the import specific messages, then calls the parent getErrorMsg method.

[ Top ]

method getTransactionType [line 255]

string getTransactionType( )

Gets the transaction type



Tags:

return:  transaction type
access:  public


[ Top ]

method isStarted [line 266]

boolean isStarted( )

Gets the started property



Tags:

return:  true if the transaction was started false otherwise
access:  public


[ Top ]

method parseSQLError [line 303]

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

Parses the SQL error

Called when the transaction SQL throws an error. It sets the error object message




Tags:

access:  protected


Overridden in child classes as:

tNG_fields::parseSQLError()
Parses the SQL error Calls the parent function then sets the error to a specific column if possible.

Parameters:

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

[ Top ]

method postExecuteSql [line 292]

void postExecuteSql( )

This function is called once the transaction SQL was actually executed

And only if the execution was succesffully




Overridden in child classes as:

tNG_insert::postExecuteSql()
This function is called once the transaction SQL was actually executed And only if the execution was succesffully. On insert, it sets the primary key value if it is not set.

[ Top ]

method prepareSQL [line 159]

void prepareSQL( )

Prepares the SQL query to be executed

To be implemented in derived class




Tags:

access:  protected


Overridden in child classes as:

tNG_fields::prepareSQL()
Prepares the SQL query to be executed
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

[ Top ]

method registerTrigger [line 148]

nothing registerTrigger( string $triggerType, string $callBackFunction, integer $priority)

Register the trigger to transaction;

In case of error, the error object is setted;




Tags:

access:  public


Overridden in child classes as:

tNG_multiple::registerTrigger()
Register a trigger to the current transaction Or to the multiple transactions. The STARTER and the END triggers are registered to self, and the other triggers are sent to the multiple transactions.

Parameters:

string   $triggerType   trigger type
string   $callBackFunction   callback function name
integer   $priority   priority of the trigger

[ Top ]

method rollBackTransaction [line 454]

void rollBackTransaction( object &$errorObj)

Executes the error triggers and set the error object;



Tags:

access:  protected


Parameters:

object   $errorObj   error object

[ Top ]

method setDispatcher [line 93]

void setDispatcher( object tNG_dispatcher &$dispatcher)

Set dispatcher object for the transaction.



Tags:

access:  public


Parameters:

object tNG_dispatcher   &$dispatcher   the dispatcher object

[ Top ]

method setError [line 314]

void setError( object tNG_error $errorObj)

Setter for the transaction error object



Tags:

access:  public


Parameters:

object tNG_error   $errorObj   the error object

[ Top ]

method setSQL [line 284]

void setSQL( string $sql)

Sets the transaction SQL statement



Tags:

access:  public


Parameters:

string   $sql  

[ Top ]

method setStarted [line 275]

void setStarted( boolean $started)

Sets the started property (the starter triggers are the ones that call this function)



Tags:

access:  public


Parameters:

boolean   $started  

[ Top ]

Bernd  Matzner

In order to set an error in a custom trigger, the correct syntax for setting an error is:

return new tNG_error('Error Message', array(), array());


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