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_import

Source Location: /tNG3/tNG_import.class.php

Class Overview

tNG
   |
   --tNG_fields
      |
      --tNG_multiple
         |
         --tNG_import

This class is the "import" implementation of the tNG_multiple class.


Author(s):

Variables

Methods


Child classes:

tNG_CSVImport
This class is the "CSV" implementation of the tNG_import class.
tNG_XMLImport
This class is the "XML" implementation of the tNG_import class.

Inherited Variables

Inherited Methods

Class: tNG_multiple

tNG_multiple::getErrorMsg()
Gets the error message
tNG_multiple::getFieldError()
Gets the error message for a specific field, if it exists.
tNG_multiple::getLocalRecordset()
Abstract method; must be implemented by the inherited classes;
tNG_multiple::getRecordset()
Get the recordset associated to this transaction
tNG_multiple::getSavedValue()
Wrapper for getSavedValue method of the executed transactions;
tNG_multiple::registerConditionalTrigger()
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.
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.

Class: tNG_fields

tNG_fields::addColumn()
Adds a column to the transaction
tNG_fields::afterUpdateField()
Updates a field after the actual transaction was executed
tNG_fields::compileColumnsValues()
Sets for each column the value correspondeing to the reference/method
tNG_fields::evaluateNumeric()
Evaluates a numeric expression
tNG_fields::executeTransaction()
Evaluates the columns values then executes the Transaction
tNG_fields::getColumnReference()
Gets the reference of a column
tNG_fields::getColumnType()
Gets the type of a column
tNG_fields::getColumnValue()
Gets the value of a column
tNG_fields::getFakeRecordset()
Creates a fake recordset from the given columns associative array This function is called on error or for the insert default values.
tNG_fields::getFakeRsArr()
Creates a fake recordset array from the current $columns
tNG_fields::getFieldError()
Gets the error message for a specific field, if it exists.
tNG_fields::getLocalRecordset()
Get the local recordset associated to this transaction
tNG_fields::getPrimaryKey()
Gets the primary key column
tNG_fields::getPrimaryKeyValue()
Gets the primary key value
tNG_fields::getRecordset()
Get the recordset associated to this transaction
tNG_fields::getSavedValue()
Gets the value saved for the given column name
tNG_fields::getTable()
Getter for the transaction SQL table
tNG_fields::parseSQLError()
Parses the SQL error Calls the parent function then sets the error to a specific column if possible.
tNG_fields::prepareSQL()
Prepares the SQL query to be executed
tNG_fields::saveData()
Retrieve and store the saved values from database;
tNG_fields::setColumnValue()
Sets a value for a given column
tNG_fields::setPrimaryKey()
Sets the primary key and its details
tNG_fields::setRawColumnValue()
Sets a value for a column directly
tNG_fields::setTable()
Setter for the transaction SQL table

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 10]
This class is the "import" implementation of the tNG_multiple class.



Tags:

access:  public


[ Top ]


Class Variables

$data =

[line 45]

Structure used to store the import data. Represented as a 2-dimensional array



Tags:

access:  protected

Type:   array


[ Top ]

$executeSubSets =

[line 24]

if is false will check set the error on each transaction and will reset the Number of transactions executed successfully



Tags:

access:  protected

Type:   mixed


[ Top ]

$handleDuplicates =

[line 31]

The way duplicate records are handled (skip, update database record, throw error)



Tags:

access:  protected

Type:   mixed


[ Top ]

$hasHeader =

[line 17]

Set to true if the import transaction uses headers to describe the data columns



Tags:

access:  protected
see:  tNG_import::$headers

Type:   boolean


[ Top ]

$headers =

[line 54]

List of headers (column names) used to map data to columns If the import transaction doesn't use headers, then this structure is empty.



Tags:

access:  protected
see:  tNG_import::$hasHeader

Type:   array


[ Top ]

$importReference =

[line 77]

The current imported row values reference

Stores the data corresponding to the currently imported row for use in Common functions




Tags:

access:  public

Type:   array


[ Top ]

$importType =

[line 69]

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



Tags:

access:  protected

Type:   string


[ Top ]

$lineStart =

[line 84]

The data start row value



Tags:

access:  protected

Type:   integer


[ Top ]

$source =

[line 38]

Structure storing the type and the reference of the source



Tags:

access:  protected

Type:   mixed


[ Top ]

$uniqueKey =

[line 61]

Unique key field used to identofy duplicates



Tags:

access:  protected

Type:   mixed


[ Top ]



Class Methods


constructor tNG_import [line 92]

tNG_import tNG_import( object KT_Connection &$connection)

Constructor. Sets the connection, the database name and other default values.

Also sets the transaction type.




Tags:

access:  public


Parameters:

object KT_Connection   &$connection   the connection object

[ Top ]

method addColumn [line 367]

void addColumn( string $colName, string $type, string $method, string $reference, [string $defaultValue = ''])

Adds a column to the transaction Calls the parent addColumn method then sets the default value.



Tags:

access:  public


Overrides tNG_fields::addColumn() (Adds a column to the transaction)

Parameters:

string   $colName   The column name
string   $type   The column type (NUMERYC_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'])
string   $defaultValue   The default value for the current column

[ Top ]

method getErrorMsg [line 385]

string getErrorMsg( )

Gets the error message Adds the import specific messages, then calls the parent getErrorMsg method.



Tags:

return:  transaction error message (formatted)
access:  public


Overrides tNG_multiple::getErrorMsg() (Gets the error message)

[ Top ]

method prepareData [line 145]

nothing prepareData( )

Abstract method; must be implemented by the inherited classes;



Overridden in child classes as:

tNG_CSVImport::prepareData()
Set the headers and data structures associated to this transaction
tNG_XMLImport::prepareData()
Set the headers and data structures associated to this transaction

[ Top ]

method prepareSQL [line 153]

void prepareSQL( )

Executes all sub-transactions



Tags:

access:  protected


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

[ Top ]

method saveData [line 403]

nothing saveData( none 0)

No data needs to be saved on insert.



Tags:

access:  public


Overrides tNG_fields::saveData() (Retrieve and store the saved values from database;)

Parameters:

none   0  

[ Top ]

method setHandleDuplicates [line 135]

void setHandleDuplicates( string $handleDuplicates)

Sets the way duplicates are handled



Tags:

access:  public


Parameters:

string   $handleDuplicates   Handle duplicates type

[ Top ]

method setSource [line 111]

void setSource( string $type, string $reference)

Sets the source of the import data



Tags:

access:  public


Overridden in child classes as:

tNG_CSVImport::setSource()
Sets the source of the CSV data Calls the parent setSource method and also registers an upload file STARTER trigger.
tNG_XMLImport::setSource()
Sets the source of the XML data Calls the parent setSource method and also registers an upload file STARTER trigger.

Parameters:

string   $type   The type of the source (GET, POST, FILES)
string   $reference   The submitted variable name (if type=FILES and reference=test, value=$_FILES['test'])

[ Top ]

method setUniqueKey [line 121]

void setUniqueKey( string $uniqueKey)

Sets the unique key column



Tags:

access:  public


Parameters:

string   $uniqueKey   The name of the unique key column

[ Top ]



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