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

Class: DTableShell

Source Location: /DataBase/Shells/DTableShell.php

Class Overview

DObject
   |
   --DDataBase
      |
      --DTableShell

Base class for handling tables


Variables

Constants

Methods


Child classes:

DTableSQLExporter
SQL exporter functionality

Inherited Constants

Inherited Variables

Inherited Methods

Class: DDataBase

DDataBase::__construct()
Constructor
DDataBase::getDBInstance()
Gets IDSQLBase instance
DDataBase::getInstance()
Gets database instance
DDataBase::initializeSQLBase()
Initializes the DB Layber
DDataBase::query()
Execute a SQL Query and returns the data
DDataBase::setCurrentDB()
Sets the current db

Class: DObject

DObject::__construct()
Constructor
DObject::debug()
Debig
DObject::getClassMembers()
Gets member variables of the instance
DObject::getClassMemberType()
Gets class member type
DObject::getClassMethods()
Gets classes of the class
DObject::getClassName()
Gets class name
DObject::PHPSerialize()
Gets serialized string of the class
DObject::trace()
Trace
DObject::__destruct()
Descructor
DObject::__toString()
Returns String equivalent of the object.

Class Details

[line 63]
Base class for handling tables



[ Top ]


Class Variables

static $SHELL_CONFIG =  null

[line 225]

Shell config name



Tags:

staticvar:   0:
access:  public

Type:   string


[ Top ]

$configurationVersion =  null

[line 204]

XML Configuration File version



Tags:

access:  public

Type:   string


[ Top ]

$extraParameterDefaultValuesDelimiter =  PHP_DTABLESHELL_EXTRA_PARAMETER_DEFAULT_VALUES_DELIMITER

[line 185]

Extra paramter default values delimiter



Tags:

access:  public

Type:   string


[ Top ]

$extraParameterDefaultValuesEquals =  PHP_DTABLESHELL_EXTRA_PARAMETER_DEFAULT_VALUES_EQUALS

[line 192]

Extra parameter default values equals



Tags:

access:  public

Type:   string


[ Top ]

$extraParameterPrefixSuffix =  PHP_DTABLESHELL_EXTRA_PARAMETER_PREFIX_SUFFIX

[line 178]

Extra parameter prefix and suffix



Tags:

access:  public

Type:   string


[ Top ]

$set =  null

[line 210]

DB_DEFAULT configuration set



Tags:

access:  public

Type:   string


[ Top ]

$suppressFormats =  false

[line 198]

Suppresses formats for all abstract fields



Tags:

access:  public

Type:   boolean


[ Top ]

$_datatypeAnalytic =  null

[line 158]

Datatype analytic



Tags:

access:  protected



[ Top ]

$_DBDependency =  null

[line 164]

DataBase dependency



Tags:

access:  protected

Type:   DSQLDependable


[ Top ]

$_extraParameters = array()

[line 171]

Extra parameters holder



Tags:

access:  protected

Type:   array


[ Top ]

$_fields = array()

[line 115]

Table fields



Tags:

access:  protected

Type:   array


[ Top ]

$_fieldTypes = array()

[line 121]

Type of the fields



Tags:

access:  protected

Type:   array


[ Top ]

$_requiredMisses = array()

[line 145]

On validate post if required fields are empty they are stored here



Tags:

access:  protected

Type:   array


[ Top ]

$_schema =  ""

[line 133]

Schema name



Tags:

access:  protected

Type:   string


[ Top ]

$_shellConfigXML =  ""

[line 109]

XML Configuration File



Tags:

access:  protected

Type:   string


[ Top ]

$_table =  ""

[line 127]

Table name



Tags:

access:  protected

Type:   string


[ Top ]

$_typeProblems = array()

[line 151]

On validate post if there is a type disorders in the fields they are stored here



Tags:

access:  protected

Type:   array


[ Top ]

$_uniqueDoubles = array()

[line 139]

On validate post if doubles in unireq fields they are stored here



Tags:

access:  protected

Type:   array


[ Top ]



Class Methods


static method getInstance [line 302]

static DTableShell &getInstance( [string $shellConfigXML = null], [string $set = PHP_DDATABASE_DEFAULT_SET])

Gets instance



Tags:

access:  public


Overrides DDataBase::getInstance() (Gets database instance)

Parameters:

string   $shellConfigXML  
string   $set  

[ Top ]

constructor __construct [line 232]

DTableShell __construct( string $shellConfigXML, [string $set = PHP_DDATABASE_DEFAULT_SET])

Class constructor



Tags:

access:  public


Overridden in child classes as:

DTableSQLExporter::__construct()
Class constructor

Overrides DDataBase::__construct() (Constructor)

Parameters:

string   $shellConfigXML  
string   $set  

[ Top ]

method deleteFromDB [line 625]

void deleteFromDB( mixed $conditions)

Delete record(s) from the table that match a $condition



Tags:

access:  public


Parameters:

mixed   $conditions  

[ Top ]

method extendValidatePOSTArray [line 727]

array extendValidatePOSTArray( [bool $checkForRequire = true], [bool $checkForTypes = true], [bool $checkForUnique = true], [ $editIdentifier = ""])

Extend validation POST array



Tags:

access:  public


Parameters:

bool   $checkForRequire  
bool   $checkForTypes  
bool   $checkForUnique  
   $editIdentifier  

[ Top ]

method getConditionedCount [line 762]

int getConditionedCount( [mixed $conditions = null])

Gets count of elements depending on specific condition



Tags:

access:  public


Parameters:

mixed   $conditions  

[ Top ]

method getExtraParameter [line 818]

object getExtraParameter( string $name)

Gets extra parameter



Tags:

access:  public


Parameters:

string   $name  

[ Top ]

method getFields [line 426]

array getFields( )

Return data fields



Tags:

access:  public


[ Top ]

method getFieldTypeProperty [line 902]

string getFieldTypeProperty( string $field, string $property)

Gets field type property value



Tags:

access:  public


Parameters:

string   $field  
string   $property  

[ Top ]

method getLastInsertID [line 333]

integer getLastInsertID( )

Return last insert id



Tags:

see:  DTableShell::getLatestInsertId()
deprecated:  Use getLatestInsertId() instead
access:  public


[ Top ]

method getLatestInsertId [line 322]

int getLatestInsertId( )

Gets the latest insert id



Tags:

access:  public


[ Top ]

method getRequiredMisses [line 645]

array getRequiredMisses( )

Returns required misses



Tags:

access:  public


[ Top ]

method getSafeFields [line 450]

DSafeArray getSafeFields( )

Gets safe fields



Tags:

access:  public


[ Top ]

method getSafeSingleRecord [line 477]

DSafeArray getSafeSingleRecord( )

Gets safe single record



Tags:

access:  public


[ Top ]

method getSchemaName [line 388]

string getSchemaName( )

Gets schema name



Tags:

access:  public


[ Top ]

method getShellConfigXML [line 355]

string getShellConfigXML( )

Gets shell config xml name



Tags:

access:  public


[ Top ]

method getSingleRecord [line 462]

array getSingleRecord( )

Returns single row query

In case of multirow query result it will return only the first one. In case of no result it will return empty array




Tags:

access:  public


[ Top ]

method getSQLExporterInstance [line 343]

DTableSQLExplorer getSQLExporterInstance( )

Gets instance of DTableSQLExplorer class



Tags:

access:  public


[ Top ]

method getTableDetails [line 398]

array getTableDetails( )

Gets table details



Tags:

access:  public


[ Top ]

method getTableFieldValue [line 839]

object getTableFieldValue( string $key)

Gets table field value



Tags:

access:  public


Parameters:

string   $key  

[ Top ]

method getTableName [line 365]

string getTableName( )

Gets table name



Tags:

access:  public


[ Top ]

method getTypeProblems [line 654]

array getTypeProblems( )

Return type problems



Tags:

access:  public


[ Top ]

method getUniqueDoubles [line 636]

array getUniqueDoubles( )

Return unique doubles



Tags:

access:  public


[ Top ]

method getValidatorErrors [line 663]

array getValidatorErrors( )

Return array of errors



Tags:

access:  public


[ Top ]

method initInstance [line 246]

void initInstance( string $shellConfigXML, [string $set = PHP_DDATABASE_DEFAULT_SET])

Inits DB instance



Tags:

access:  public


Parameters:

string   $shellConfigXML  
string   $set  

[ Top ]

method loadDataFromArray [line 489]

void loadDataFromArray( $arrayData, [boolean $nullEmpty = false], [boolean $nullMissing = false])

Loads data to table fields from array data - multi record



Tags:

access:  protected


Parameters:

array   $arrayData  
boolean   $nullEmpty  
boolean   $nullMissing  

[ Top ]

method loadDataFromDB [line 536]

mixed loadDataFromDB( [ $conditions = null], [integer $page = DTableShell::NO_PAGING], [integer $itemsPerPage = PHP_DDATABASE_DEFAULT_ITEMS_PER_PAGE], mixed $conditions
)

Loads data to table fields from database



Tags:

return:  Depends on results and success state
  • null on no data or error on codition
  • (boolean)true on data and no given $page
  • array("page", "pageCount") on data and $page given
access:  public


Parameters:

mixed   $conditions
  
    • (array) on paramed query
    integer   $page   Starts from 1
    integer   $itemsPerPage  
       $conditions  

    [ Top ]

    method loadDataFromPOSTArray [line 519]

    void loadDataFromPOSTArray( $arrayData, [boolean $nullEmpty = false], [boolean $nullMissing = false])

    Loads data from $_POST like array - one record



    Tags:

    access:  public


    Parameters:

    array   $arrayData  
    boolean   $nullEmpty  
    boolean   $nullMissing  

    [ Top ]

    method resetExtraParameters [line 828]

    void resetExtraParameters( )

    Clears extra parameters



    Tags:

    access:  public


    [ Top ]

    method saveDataToDB [line 592]

    boolean saveDataToDB( [string $extraWhereClause = ""])

    Saves data to DB. If you want to zero a field add value "__NULL"



    Tags:

    todo:  Make $extraWhereClause paramed
    access:  public


    Parameters:

    string   $extraWhereClause  

    [ Top ]

    method search [line 781]

    array search( [string $searchValue = null], [int $itemsPerPage = PHP_DDATABASE_DEFAULT_ITEMS_PER_PAGE], [int $currentPage = DTableShell::NO_PAGING], [mixed $orderBy = ""], [mixed $excludeFields = null], [string $where = ""], [pointer &$resultCount = 0])

    Perform search



    Tags:

    return:  of search result
    access:  public


    Parameters:

    string   $searchValue  
    int   $itemsPerPage  
    int   $currentPage  
    mixed   $orderBy   o string OrderFieldName ASC o array[0 => OrderFieldName, 1 => OrderDirection]
    mixed   $excludeFields   string/array
    string   $where   Custom where clause
    pointer   &$resultCount   int $resultCount

    [ Top ]

    method setExtraParameter [line 807]

    void setExtraParameter( string $name, object $value)

    Sets extra parameter



    Tags:

    access:  public


    Parameters:

    string   $name  
    object   $value  

    [ Top ]

    method setFieldTypeProperty [line 888]

    void setFieldTypeProperty( string $field, string $property, string $value)

    Sets field type property value



    Tags:

    access:  public


    Parameters:

    string   $field  
    string   $property  
    string   $value  

    [ Top ]

    method setRequiredStatus [line 793]

    void setRequiredStatus( string $field, [boolean $status = false])

    Sets required status



    Tags:

    access:  public


    Parameters:

    string   $field  
    boolean   $status  

    [ Top ]

    method setTableName [line 378]

    void setTableName( string $tableName)

    Sets table name

    Most of the times used to set up table aliases




    Tags:

    access:  public


    Parameters:

    string   $tableName  

    [ Top ]

    method setType [line 875]

    void setType( string $field, [string $type = "text"])

    Sets type of filed



    Tags:

    access:  public


    Parameters:

    string   $field  
    string   $type  

    [ Top ]

    method validatePOSTArray [line 694]

    mixed validatePOSTArray( [boolean $checkForUnique = true], [string $editIdentifier = ""])

    Checks the requirements, described in the table config before save to db
    • If there is a problem in required fields returns -1
    • If there is a problem in unique fields returns -2
    • If there is a problem in type fields returns -3
    • If everythig is OK returns 1




    Tags:

    access:  public


    Parameters:

    boolean   $checkForUnique  
    string   $editIdentifier   When validate is used in edit mode this string is put in the query where part that checks for unique doubles

    [ Top ]

    method validatePOSTArraySpecific [line 751]

    boolean validatePOSTArraySpecific( string $validateMode)

    Validates POST array with specific validation method



    Tags:

    access:  public


    Parameters:

    string   $validateMode  

    [ Top ]

    method _isDateTime [line 1059]

    boolean _isDateTime( string $fieldKey)

    Checks if the field is datetime



    Tags:

    access:  public


    Parameters:

    string   $fieldKey  

    [ Top ]

    method _isEmail [line 1070]

    boolean _isEmail( string $fieldKey)

    Checks if the field is email



    Tags:

    access:  public


    Parameters:

    string   $fieldKey  

    [ Top ]

    method _isFloat [line 1048]

    boolean _isFloat( string $fieldKey)

    Checks if the field is float



    Tags:

    access:  public


    Parameters:

    string   $fieldKey  

    [ Top ]

    method _isInt [line 1037]

    boolean _isInt( string $fieldKey)

    Checks if the field is int



    Tags:

    access:  public


    Parameters:

    string   $fieldKey  

    [ Top ]

    method _isNULLable [line 1004]

    boolean _isNULLable( string $fieldKey)

    Checks if the field can accept null or cannot

    Usually used in foreign key fields - they cannot be set to 0, but to null. In the same place int fields that are required cannot accept null, but 0.




    Tags:

    access:  public


    Parameters:

    string   $fieldKey  

    [ Top ]

    method _isQuotable [line 990]

    boolean _isQuotable( string $fieldKey)

    Checks if the field is quotable or non quotable



    Tags:

    access:  public


    Parameters:

    string   $fieldKey  

    [ Top ]

    method _isRegularColumn [line 1086]

    boolean _isRegularColumn( string $fieldKey)

    Checks if the field needs to be included in selects directly as a name of column



    Tags:

    access:  public


    Parameters:

    string   $fieldKey  

    [ Top ]

    method _isText [line 1075]

    void _isText( $fieldKey)



    Tags:

    access:  public


    Parameters:

       $fieldKey  

    [ Top ]


    Class Constants

    ERR_CODE_DOUBLED =  -2

    [line 73]

    Error code doubled


    [ Top ]

    ERR_CODE_NO_ERROR =  1

    [line 83]

    Error code no error


    [ Top ]

    ERR_CODE_PROBLEM =  -3

    [line 78]

    Error code syntax problem


    [ Top ]

    ERR_CODE_REQUIRED =  -1

    [line 68]

    Error core required


    [ Top ]

    SKIP_FIELD =  "skip"

    [line 103]

    Skip field constant


    [ Top ]

    VALIDATION_MODE_REQUIRED =  "_checkRequired"

    [line 93]

    Validation mode required


    [ Top ]

    VALIDATION_MODE_TYPES =  "_checkTypes"

    [line 88]

    Validation mode types


    [ Top ]

    VALIDATION_MODE_UNIQUE =  "_checkUnique"

    [line 98]

    Validation mode unique


    [ Top ]



    Documentation generated on Sat, 17 Apr 2010 22:13:15 +0300 by phpDocumentor 1.4.3