Class: I2CE CachedForm: Difference between revisions

From IHRIS Wiki
No edit summary
No edit summary
Line 1: Line 1:
This article desrcibes the class '''I2CE_CachedForm''' which extends the class [[Class: I2CE_Fuzzy | I2CE_Fuzzy]]
This article desrcibes the class '''I2CE_CachedForm'''.
*Extends the class: [[Class: I2CE_Fuzzy | I2CE_Fuzzy]].
It is contained in the module [[iHRIS Module List#CachedForms|CachedForms]] in the package [https://launchpad.net/i2ce I2CE]
It is contained in the module [[iHRIS Module List#CachedForms|CachedForms]] in the package [https://launchpad.net/i2ce I2CE]


Line 41: Line 42:
*Signature: public function __construct($form)
*Signature: public function __construct($form)
Parameters:
Parameters:
* [http://www.php.net/manual/en/language.types.string.php string] $form<br/>The form we wish to cash into a table
* [http://www.php.net/manual/en/language.types.string.php string ] $form<br/>The form we wish to cash into a table
===createCacheTable()===
===createCacheTable()===
setup of the queries used to create and populate the cached table
setup of the queries used to create and populate the cached table
Line 52: Line 53:
Drops the existing cached table from the database
Drops the existing cached table from the database
*Signature: public function dropTable()
*Signature: public function dropTable()
*Returns: [http://www.php.net/manual/en/language.types.boolean.php boolean]
*Returns: [http://www.php.net/manual/en/language.types.boolean.php boolean ]
===fastPopulate()===
===fastPopulate()===
Method used to populate the cache table in case the form storage mechanism is  DB like
Method used to populate the cache table in case the form storage mechanism is  DB like
Line 60: Line 61:
*Signature: public function generateCachedTable($check_stale)
*Signature: public function generateCachedTable($check_stale)
Parameters:
Parameters:
* [http://www.php.net/manual/en/language.types.boolean.php boolean] $check_stale<br/>Defaults to true.  If false, it skips the staleness check
* [http://www.php.net/manual/en/language.types.boolean.php boolean ] $check_stale<br/>Defaults to true.  If false, it skips the staleness check
**Default Value: true
**Default Value: true
===getCacheDatabase()===
===getCacheDatabase()===
Get the name of the database that the cached tables are stored in.
Get the name of the database that the cached tables are stored in.
*Signature: static public function getCacheDatabase()
*Signature: static public function getCacheDatabase()
*Returns: [http://www.php.net/manual/en/language.types.string.php string] The string may be empty meaning that we are using the database for the DB connection
*Returns: [http://www.php.net/manual/en/language.types.string.php string ] The string may be empty meaning that we are using the database for the DB connection
===getCachedTableName()===
===getCachedTableName()===
Get the name of the cached table for the specfiied form.
Get the name of the cached table for the specfiied form.
we return simplt table_name
we return simplt table_name
*Signature: static public function getCachedTableName($form,$withDB,$table_prefix)
*Signature: static public function getCachedTableName($form,$withDB,$table_prefix)
*Returns: [http://www.php.net/manual/en/language.types.string.php string]
*Returns: [http://www.php.net/manual/en/language.types.string.php string ]
Parameters:
Parameters:
* [http://www.php.net/manual/en/language.types.string.php string] $form
* [http://www.php.net/manual/en/language.types.string.php string ] $form
* [http://www.php.net/manual/en/language.types.boolean.php boolean] $withDB<br/>defaults to true.  If true we return the table in the form `database_name`.`table_name`.  Otherwise
* [http://www.php.net/manual/en/language.types.boolean.php boolean ] $withDB<br/>defaults to true.  If true we return the table in the form `database_name`.`table_name`.  Otherwise
**Default Value: true  
**Default Value: true  
*$table_prefix  
*$table_prefix  
Line 83: Line 84:
Checks to see if the cached table is stale
Checks to see if the cached table is stale
*Signature: public function isStale()
*Signature: public function isStale()
*Returns: [http://www.php.net/manual/en/language.types.boolean.php boolean]
*Returns: [http://www.php.net/manual/en/language.types.boolean.php boolean ]
===slowPopulate()===
===slowPopulate()===
Method used to populate the cache table in case the form storage mechanism is not DB like
Method used to populate the cache table in case the form storage mechanism is not DB like
Line 91: Line 92:
drop the table.
drop the table.
*Signature: public function tableExists()
*Signature: public function tableExists()
*Returns: [http://www.php.net/manual/en/language.types.boolean.php boolean]
*Returns: [http://www.php.net/manual/en/language.types.boolean.php boolean ]
==Inherited Fuzzy Methods==
==Inherited Fuzzy Methods==
===userMessage()===
===userMessage()===

Revision as of 22:24, 16 October 2009

This article desrcibes the class I2CE_CachedForm.

It is contained in the module CachedForms in the package I2CE

The class is defined in the file: modules/Forms/modules/CachedForms/lib/I2CE_CachedForm.php

I2CE_CachedForm @subpackage Core

  • Author: Carl Leitner <litlfred@ibiblio.org>

Variables

$form

The form we are caching

  • Type: protected ng $form

$database

the database name (unquoted)

  • Type: protected ng $database

$table_name

the table name for this form.

  • Type: protected ng $table_name

$short_table_name

the table name for this form without quotes and without the databse

  • Type: protected ng $short_table_name

$last_entry_database

the database name (unquoted) where last_entry is

  • Type: protected ng $last_entry_database

$formObj

An instance of the form object

$formMech

An instance of the form storage mechansim for the form

Methods

__construct()

The constructor

  • Signature: public function __construct($form)

Parameters:

  • string $form
    The form we wish to cash into a table

createCacheTable()

setup of the queries used to create and populate the cached table

  • Signature: protected function createCacheTable()
  • Returns: boolean. True on success, false on error

createTable()

Create the cached table if does not exist and does not have the correct columns

  • Signature: protected function createTable()

dropTable()

Drops the existing cached table from the database

  • Signature: public function dropTable()
  • Returns: boolean

fastPopulate()

Method used to populate the cache table in case the form storage mechanism is DB like

  • Signature: protected function fastPopulate()

generateCachedTable()

Generates the cahced table for the form

  • Signature: public function generateCachedTable($check_stale)

Parameters:

  • boolean $check_stale
    Defaults to true. If false, it skips the staleness check
    • Default Value: true

getCacheDatabase()

Get the name of the database that the cached tables are stored in.

  • Signature: static public function getCacheDatabase()
  • Returns: string The string may be empty meaning that we are using the database for the DB connection

getCachedTableName()

Get the name of the cached table for the specfiied form. we return simplt table_name

  • Signature: static public function getCachedTableName($form,$withDB,$table_prefix)
  • Returns: string

Parameters:

  • string $form
  • boolean $withDB
    defaults to true. If true we return the table in the form `database_name`.`table_name`. Otherwise
    • Default Value: true
  • $table_prefix
    • Default Value:

getIDs()

Get the id's of the cached forms.

  • Signature: public function getIDs()

isStale()

Checks to see if the cached table is stale

  • Signature: public function isStale()
  • Returns: boolean

slowPopulate()

Method used to populate the cache table in case the form storage mechanism is not DB like

  • Signature: protected function slowPopulate()

tableExists()

Check to see if the cached table for this table exists and has the the proper fields for its columns. If it is invalud, it will drop the table.

  • Signature: public function tableExists()
  • Returns: boolean

Inherited Fuzzy Methods

userMessage()

This method is inherited from I2CE_Fuzzy->userMessage()