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

Class: KDatabaseTableAbstract

Source Location: /libraries/koowa/database/table/abstract.php

Class Overview

KObject
   |
   --KDatabaseTableAbstract

Abstract Table Class


Author(s):

Variables

Methods


Child classes:

KDatabaseTableDefault
Default Database Table Class

Inherited Variables

Inherited Methods

Class: KObject

KObject::__construct()
Constructor
KObject::get()
Get the object properties
KObject::getHandle()
Get a handle for this object
KObject::getIdentifier()
Gets the service identifier.
KObject::getMethods()
Get a list of all the available methods
KObject::getService()
Get an instance of a class based on a class identifier only creating it if it does not exist yet.
KObject::inherits()
Checks if the object or one of it's mixin's inherits from a class.
KObject::mixin()
Mixin an object
KObject::set()
Set the object properties
KObject::_initialize()
Initializes the options for the object
KObject::__call()
Search the mixin method map and call the method or trigger an error
KObject::__clone()
Preform a deep clone of the object.

Class Details

[line 22]
Abstract Table Class

Parent class to all tables.




Tags:

author:  Johan Janssens <johan@nooku.org>
abstract:  
uses:  KFilter
uses:  KMixinClass


[ Top ]


Class Variables

$_base =

[line 36]

Base name of the table in the db schema



Tags:

access:  protected

Type:   string


[ Top ]

$_column_map = array()

[line 50]

Array of column mappings by column name



Tags:

access:  protected

Type:   array


[ Top ]

$_database =  false

[line 57]

Database adapter



Tags:

access:  protected

Type:   object


[ Top ]

$_defaults =

[line 64]

Default values for this table



Tags:

access:  protected

Type:   array


[ Top ]

$_identity_column =

[line 43]

Name of the identity column in the table



Tags:

access:  protected

Type:   string


[ Top ]

$_name =

[line 29]

Real name of the table in the db schema



Tags:

access:  protected

Type:   string


[ Top ]



Class Methods


constructor __construct [line 71]

KDatabaseTableAbstract __construct( [ $config = null])

Object constructor



Tags:

access:  public


Overrides KObject::__construct() (Constructor)

Parameters:

object An   $config   optional KConfig object with configuration options.

[ Top ]

method count [line 564]

int count( [mixed $query = null])

Count table rows



Tags:

return:  Number of rows
access:  public


Parameters:

mixed   $query   KDatabaseQuery object or query string or null to count all rows

[ Top ]

method delete [line 706]

bool|integer delete( KDatabaseRowInterface $row)

Table delete method



Tags:

return:  Returns the number of rows deleted, or FALSE if delete query was not executed.
access:  public


Parameters:

object A   $row   KDatabaseRow object

[ Top ]

method filter [line 815]

array filter( boolean $data, [array $base = true])

Table filter method

This function removes extra columns based on the table columns taking any table mappings into account and filters the data based on each column type.




Tags:

return:  The filtered data array
access:  public


Parameters:

boolean   $data   If TRUE, get the column information from the base table. Default is TRUE.
array   $base   An associative array of data to be filtered

[ Top ]

method getBase [line 206]

string getBase( )

Gets the base table name without the table prefix

If the table type is 'VIEW' the base name will be the name of the base table that is connected to the view. If the table type is 'BASE' this function will return the same as getName




Tags:

access:  public


[ Top ]

method getColumn [line 260]

KDatabaseColumn getColumn( boolean $columnname, [ $base = false])

Get a column by name



Tags:

return:  Returns a KDatabaseSchemaColumn object or NULL if the column does not exist
access:  public


Parameters:

boolean   $columnname   If TRUE, get the column information from the base table. Default is FALSE.
   $base  

[ Top ]

method getColumns [line 273]

array getColumns( [boolean $base = false])

Gets the columns for the table



Tags:

return:  Associative array of KDatabaseSchemaColumn objects
throws:  KDatabaseTableException
access:  public


Parameters:

boolean   $base   If TRUE, get the column information from the base table. Default is FALSE.

[ Top ]

method getDatabase [line 160]

KDatabaseAdapterAbstract getDatabase( )

Get the database adapter



Tags:

access:  public


[ Top ]

method getDefault [line 400]

mixed getDefault( $columnname)

Get a default by name



Tags:

return:  Returns the column default value or NULL if the column does not exist
access:  public


Parameters:

   $columnname  

[ Top ]

method getDefaults [line 377]

array getDefaults( )

Get default values for all columns



Tags:

access:  public


[ Top ]

method getIdentityColumn [line 342]

string getIdentityColumn( )

Gets the identitiy column of the table.



Tags:

access:  public


[ Top ]

method getName [line 192]

string getName( )

Gets the table schema name without the table prefix



Tags:

access:  public


[ Top ]

method getPrimaryKey [line 216]

array getPrimaryKey( )

Gets the primary key(s) of the table



Tags:

return:  An asscociate array of fields defined in the primary key
access:  public


[ Top ]

method getRow [line 412]

KDatabaseRowInterface getRow( [ $options = array()])

Get an instance of a row object for this table



Tags:

access:  public


Parameters:

array   $options   An optional associative array of configuration settings.

[ Top ]

method getRowset [line 431]

KDatabaseRowInterface getRowset( [ $options = array()])

Get an instance of a rowset object for this table



Tags:

access:  public


Parameters:

array   $options   An optional associative array of configuration settings.

[ Top ]

method getSchema [line 237]

object|null getSchema( )

Gets the schema of the table



Tags:

return:  Returns a KDatabaseSchemaTable object or NULL if the table doesn't exists
throws:  KDatabaseTableException
access:  public


[ Top ]

method getUniqueColumns [line 357]

array getUniqueColumns( )

Gets the unqiue columns of the table



Tags:

return:  An asscociate array of unique table columns by column name
access:  public


[ Top ]

method insert [line 603]

bool|integer insert( KDatabaseRowInterface $row)

Table insert method



Tags:

return:  Returns the number of rows inserted, or FALSE if insert query was not executed.
access:  public


Parameters:

object A   $row   KDatabaseRow object

[ Top ]

method isConnected [line 182]

boolean isConnected( )

Test the connected status of the table



Tags:

return:  Returns TRUE if we have a reference to a live KDatabaseAdapterAbstract object.
access:  public


[ Top ]

method lock [line 750]

void lock( )

Lock the table.

return boolean True on success, false otherwise.




Tags:

access:  public


[ Top ]

method mapColumns [line 293]

array|string mapColumns( array|string $data, [boolean $reverse = false])

Table map method

This functions maps the column names to those in the table schema




Tags:

return:  The mapped data or column name
access:  public


Parameters:

array|string   $data   An associative array of data to be mapped, or a column name
boolean   $reverse   If TRUE, perform a reverse mapping

[ Top ]

method select [line 456]

KDatabaseRow select( [mixed $query = null], [integer $mode = KDatabase::FETCH_ROWSET])

Table select method

The name of the resulting row(set) class is based on the table class name eg Com<Mycomp>Table<Tablename> -> Com<Mycomp>Row(set)<Tablename>

This function will return an empty rowset if called without a parameter.




Tags:

return:  or KDatabaseRowset depending on the mode. By default will return a KDatabaseRowset
access:  public


Parameters:

mixed   $query   KDatabaseQuery, query string, array of row id's, or an id or null
integer   $mode   The database fetch style. Default FETCH_ROWSET.

[ Top ]

method setDatabase [line 171]

KDatabaseTableAbstract setDatabase( KDatabaseAdapterAbstract $database)

Set the database adapter



Tags:

access:  public


Parameters:

object A   $database   KDatabaseAdapterAbstract

[ Top ]

method unlock [line 780]

void unlock( )

Unlock the table.

return boolean True on success, false otherwise.




Tags:

access:  public


[ Top ]

method update [line 651]

boolean|integer update( KDatabaseRowInterface $row)

Table update method



Tags:

return:  Returns the number of rows updated, or FALSE if insert query was not executed.
access:  public


Parameters:

object A   $row   KDatabaseRow object

[ Top ]

method _initialize [line 132]

void _initialize( $config)

Initializes the options for the object

Called from __construct() as a first step of object instantiation.




Tags:

access:  protected


Overrides KObject::_initialize() (Initializes the options for the object)

Parameters:

object An   $config   optional KConfig object with configuration options.

[ Top ]

method __call [line 842]

mixed __call( string $method, array $arguments)

Search the behaviors to see if this table behaves as.

Function is also capable of checking is a behavior has been mixed succesfully using is[Behavior] function. If the behavior exists the function will return TRUE, otherwise FALSE.




Tags:

return:  The result of the function
throws:  BadMethodCallException If method could not be found
access:  public


Overrides KObject::__call() (Search the mixin method map and call the method or trigger an error)

Parameters:

string   $method   The function name
array   $arguments   The function arguments

[ Top ]


Documentation generated on Fri, 24 May 2013 03:00:47 +0200 by phpDocumentor 1.4.3