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

Class: TeraWurflDatabase_PDO

Source Location: /DatabaseConnectors/TeraWurflDatabase_PDO.php

Class Overview

TeraWurflDatabase
   |
   --TeraWurflDatabase_PDO

Provides connectivity from Tera-WURFL to MySQL 5 using PDO_MySQL


Author(s):

Variables

Methods


Child classes:

TeraWurflDatabase_PDO_NestedSet
Provides connectivity from Tera-WURFL to MySQL 5 This version adds a right and left nested-set value (`rt` and `lt`) to the TeraWurflIndex table, then uses those values and the Nested Set method to lookup the fallback tree in one very efficient query.

Inherited Variables

Inherited Methods

Class: TeraWurflDatabase

TeraWurflDatabase::__construct()
TeraWurflDatabase::atomicRenameAll()
Rename all tables from $oldPrefix to $newPrefix in one transaction. This is used when loading the WURFL device data to atomically switch from the old data to the new data.
TeraWurflDatabase::clearTable()
Truncate or drop+create the given table
TeraWurflDatabase::connect()
Establishes a database connection and stores connection in $this->dbcon
TeraWurflDatabase::createCacheTable()
Creates the cache table
TeraWurflDatabase::createGenericDeviceTable()
Creates a table capable of holding devices (WURFL ID, User Agent and Capabilities)
TeraWurflDatabase::createIndexTable()
Creates the index table
TeraWurflDatabase::createProcedures()
Creates supporting stored procedures
TeraWurflDatabase::createSettingsTable()
Creates the settings table
TeraWurflDatabase::getActualDeviceAncestor()
Returns the WURFL ID for the Actual Device Root in the given device's fall back tree. This can be null if it does not exist.
TeraWurflDatabase::getCachedUserAgents()
Returns an array of the cached User Agents
TeraWurflDatabase::getDeviceFallBackTree()
Returns the Fallback tree directly from the database. If this is implemented, you must set TeraWurflDatabase::$db_implements_fallback = true for Tera-WURFL to use it.
TeraWurflDatabase::getDeviceFromCache()
Return capabilities array for the given User Agent, or null if not found
TeraWurflDatabase::getDeviceFromID()
Returns the capabilities array from a given WURFL Device ID. This is NOT the full device capabilities, just the capabilities that are defined on this device.
TeraWurflDatabase::getDeviceFromUA()
Returns the WURFL ID from a raw User Agent if an exact match is found
TeraWurflDatabase::getDeviceFromUA_LD()
Find the matching Device ID for a given User Agent using LD (Leveshtein Distance)
TeraWurflDatabase::getDeviceFromUA_RIS()
Find the matching Device ID for a given User Agent using RIS (Reduction in String)
TeraWurflDatabase::getFullDeviceList()
Returns an associative array of all the data from the given table in the form [WURFL ID] => [User Agent]
TeraWurflDatabase::getLastError()
Returns the most recent error message
TeraWurflDatabase::getMatcherTableList()
Returns an array of the User Agent Matcher tables in the database
TeraWurflDatabase::getServerVersion()
Returns the version string of the database server
TeraWurflDatabase::getSetting()
Get setting from settings table by a given key
TeraWurflDatabase::getTableList()
Returns an array of all the tables in the database
TeraWurflDatabase::getTableStats()
Returns an associative array of statistics from given table
TeraWurflDatabase::initializeDB()
Drops and recreates the current database and procedures
TeraWurflDatabase::loadDevices()
Loads the pre-processed WURFL tables into the database
TeraWurflDatabase::rebuildCacheTable()
Rebuilds the cache table by redetecting the cached devices against the loaded WURFL
TeraWurflDatabase::saveDeviceInCache()
Save the given User Agent and Device capabilities array to the database
TeraWurflDatabase::SQLPrep()
Prepares raw text for use in queries (adding quotes and escaping characters if necessary)
TeraWurflDatabase::updateSetting()
Adds/updates a key=>value pair in the settings table
TeraWurflDatabase::verifyConfig()
Checks if the database configuration is correct and that all required permissions

Class Details

[line 25]
Provides connectivity from Tera-WURFL to MySQL 5 using PDO_MySQL



Tags:



[ Top ]


Class Variables

static $CACHE_STORAGE_ENGINE =  "MyISAM"

[line 51]



Tags:

access:  protected

Type:   mixed


[ Top ]

static $DB_MAX_INSERTS =  500

[line 46]

The maximum number of new rows that the database can handle in one INSERT statement



Tags:

access:  protected

Type:   int


[ Top ]

static $DRIVER_OPTIONS = array()

[line 53]



Tags:

access:  protected

Type:   mixed


[ Top ]

static $PERSISTENT_CONNECTION =  true

[line 52]



Tags:

access:  protected

Type:   mixed


[ Top ]

static $STORAGE_ENGINE =  "MyISAM"

[line 49]



Tags:

access:  protected

Type:   mixed


[ Top ]

static $WURFL_ID_COLUMN_TYPE =  "VARCHAR"

[line 47]



Tags:

access:  protected

Type:   mixed


[ Top ]

static $WURFL_ID_MAX_LENGTH =  64

[line 48]



Tags:

access:  protected

Type:   mixed


[ Top ]

$connected =  false

[line 34]



Tags:

access:  public

Type:   mixed
Overrides:   Array


[ Top ]

$dbcon =

[line 39]



Tags:

access:  protected

Type:   PDO
Overrides:   Array


[ Top ]

$db_implements_fallback =  true

[line 31]



Tags:

access:  public

Type:   mixed
Overrides:   Array


[ Top ]

$db_implements_ld =  false

[line 30]



Tags:

access:  public

Type:   mixed
Overrides:   Array


[ Top ]

$db_implements_ris =  true

[line 29]



Tags:

access:  public

Type:   mixed
Overrides:   Array


[ Top ]

$errors =

[line 28]



Tags:

access:  public

Type:   mixed
Overrides:   Array


[ Top ]

$maxquerysize =  0

[line 41]



Tags:

access:  public

Type:   mixed


[ Top ]

$numQueries =  0

[line 33]



Tags:

access:  public

Type:   mixed
Overrides:   Array


[ Top ]

$use_nested_set =  false

[line 32]



Tags:

access:  public

Type:   mixed


[ Top ]



Class Methods


constructor __construct [line 55]

TeraWurflDatabase_PDO __construct( )



Tags:

access:  public


Overrides TeraWurflDatabase::__construct() (parent method not documented)

[ Top ]

destructor __destruct [line 64]

void __destruct( )

Destructor, disconnect from database



Tags:

access:  public


[ Top ]

method clearMatcherTables [line 286]

boolean clearMatcherTables( )

Drops then creates all the UserAgentMatcher device tables



Tags:

return:  success
access:  protected


[ Top ]

method clearTable [line 465]

void clearTable( $tablename)



Tags:

access:  public


Overrides TeraWurflDatabase::clearTable() (Truncate or drop+create the given table)

Parameters:

   $tablename  

[ Top ]

method connect [line 510]

void connect( )



Tags:

access:  public


Overrides TeraWurflDatabase::connect() (Establishes a database connection and stores connection in $this->dbcon)

[ Top ]

method createCacheTable [line 385]

void createCacheTable( )



Tags:

access:  public


Overrides TeraWurflDatabase::createCacheTable() (Creates the cache table)

[ Top ]

method createGenericDeviceTable [line 261]

boolean createGenericDeviceTable( string $tablename)

Drops and creates the given device table



Tags:

return:  success
access:  public


Overrides TeraWurflDatabase::createGenericDeviceTable() (Creates a table capable of holding devices (WURFL ID, User Agent and Capabilities))

Parameters:

string   $tablename   Table name (ex: TeraWurflConfig::$HYBRID)

[ Top ]

method createIndexTable [line 316]

boolean createIndexTable( )

Drops and creates the index table



Tags:

return:  success
access:  public


Overrides TeraWurflDatabase::createIndexTable() (Creates the index table)

[ Top ]

method createMergeTable [line 299]

boolean createMergeTable( array $tables)

Drops and creates the MERGE table



Tags:

return:  success
access:  public


Parameters:

array   $tables   Table names

[ Top ]

method createProcedures [line 472]

void createProcedures( )



Tags:

access:  public


Overrides TeraWurflDatabase::createProcedures() (Creates supporting stored procedures)

[ Top ]

method createSettingsTable [line 334]

boolean createSettingsTable( )

Creates the settings table if it does not already exist



Tags:

return:  success
access:  public


Overrides TeraWurflDatabase::createSettingsTable() (Creates the settings table)

[ Top ]

method createTempCacheTable [line 399]

void createTempCacheTable( )



Tags:

access:  public


[ Top ]

method getActualDeviceAncestor [line 82]

void getActualDeviceAncestor( $wurflID)



Tags:

access:  public


Overrides TeraWurflDatabase::getActualDeviceAncestor() (Returns the WURFL ID for the Actual Device Root in the given device's fall back tree. This can be null if it does not exist.)

Parameters:

   $wurflID  

[ Top ]

method getCachedUserAgents [line 590]

void getCachedUserAgents( )



Tags:

access:  public


Overrides TeraWurflDatabase::getCachedUserAgents() (Returns an array of the cached User Agents)

[ Top ]

method getDeviceFallBackTree [line 132]

void getDeviceFallBackTree( $wurflID)



Tags:

access:  public


Overrides TeraWurflDatabase::getDeviceFallBackTree() (Returns the Fallback tree directly from the database. If this is implemented, you must set TeraWurflDatabase::$db_implements_fallback = true for Tera-WURFL to use it.)

Parameters:

   $wurflID  

[ Top ]

method getDeviceFallBackTree_NS [line 166]

array getDeviceFallBackTree_NS( $wurflID $wurflID)

Returns an Array containing the complete capabilities array for each

device in the fallback tree. These arrays would need to be flattened in order to be used for any real puropse




Tags:

return:  array of the capabilities arrays for all the devices in the fallback tree
access:  public


Parameters:

$wurflID   $wurflID  

[ Top ]

method getDeviceFromCache [line 354]

void getDeviceFromCache( $userAgent)



Tags:

access:  public


Overrides TeraWurflDatabase::getDeviceFromCache() (Return capabilities array for the given User Agent, or null if not found)

Parameters:

   $userAgent  

[ Top ]

method getDeviceFromID [line 69]

void getDeviceFromID( $wurflID)



Tags:

access:  public


Overrides TeraWurflDatabase::getDeviceFromID() (Returns the capabilities array from a given WURFL Device ID. This is NOT the full device capabilities, just the capabilities that are defined on this device.)

Parameters:

   $wurflID  

[ Top ]

method getDeviceFromUA [line 104]

void getDeviceFromUA( $userAgent)



Tags:

access:  public


Overrides TeraWurflDatabase::getDeviceFromUA() (Returns the WURFL ID from a raw User Agent if an exact match is found)

Parameters:

   $userAgent  

[ Top ]

method getDeviceFromUA_LD [line 129]

void getDeviceFromUA_LD( $userAgent, $tolerance, UserAgentMatcher &$matcher)



Tags:

access:  public


Overrides TeraWurflDatabase::getDeviceFromUA_LD() (Find the matching Device ID for a given User Agent using LD (Leveshtein Distance))

Parameters:

   $userAgent  
   $tolerance  
UserAgentMatcher   &$matcher  

[ Top ]

method getDeviceFromUA_RIS [line 116]

void getDeviceFromUA_RIS( $userAgent, $tolerance, UserAgentMatcher &$matcher)



Tags:

access:  public


Overrides TeraWurflDatabase::getDeviceFromUA_RIS() (Find the matching Device ID for a given User Agent using RIS (Reduction in String))

Parameters:

   $userAgent  
   $tolerance  
UserAgentMatcher   &$matcher  

[ Top ]

method getFullDeviceList [line 92]

void getFullDeviceList( $tablename)



Tags:

access:  public


Overrides TeraWurflDatabase::getFullDeviceList() (Returns an associative array of all the data from the given table in the form [WURFL ID] => [User Agent])

Parameters:

   $tablename  

[ Top ]

method getMatcherTableList [line 558]

void getMatcherTableList( )



Tags:

access:  public


Overrides TeraWurflDatabase::getMatcherTableList() (Returns an array of the User Agent Matcher tables in the database)

[ Top ]

method getServerVersion [line 613]

void getServerVersion( )



Tags:

access:  public


Overrides TeraWurflDatabase::getServerVersion() (Returns the version string of the database server)

[ Top ]

method getSetting [line 534]

void getSetting( $key)



Tags:

access:  public


Overrides TeraWurflDatabase::getSetting() (Get setting from settings table by a given key)

Parameters:

   $key  

[ Top ]

method getTableList [line 551]

void getTableList( )



Tags:

access:  public


Overrides TeraWurflDatabase::getTableList() (Returns an array of all the tables in the database)

[ Top ]

method getTableStats [line 565]

void getTableStats( $table)



Tags:

access:  public


Overrides TeraWurflDatabase::getTableStats() (Returns an associative array of statistics from given table)

Parameters:

   $table  

[ Top ]

method loadDevices [line 186]

void loadDevices( &$tables)



Tags:

access:  public


Overrides TeraWurflDatabase::loadDevices() (Loads the pre-processed WURFL tables into the database)

Parameters:

   &$tables  

[ Top ]

method rebuildCacheTable [line 413]

void rebuildCacheTable( )



Tags:

access:  public


Overrides TeraWurflDatabase::rebuildCacheTable() (Rebuilds the cache table by redetecting the cached devices against the loaded WURFL)

[ Top ]

method saveDeviceInCache [line 369]

void saveDeviceInCache( $userAgent, &$device)



Tags:

access:  public


Overrides TeraWurflDatabase::saveDeviceInCache() (Save the given User Agent and Device capabilities array to the database)

Parameters:

   $userAgent  
   &$device  

[ Top ]

method SQLPrep [line 546]

void SQLPrep( $value)



Tags:

access:  public


Overrides TeraWurflDatabase::SQLPrep() (Prepares raw text for use in queries (adding quotes and escaping characters if necessary))

Parameters:

   $value  

[ Top ]

method updateSetting [line 522]

void updateSetting( $key, $value)



Tags:

access:  public


Overrides TeraWurflDatabase::updateSetting() (Adds/updates a key=>value pair in the settings table)

Parameters:

   $key  
   $value  

[ Top ]

method verifyConfig [line 597]

void verifyConfig( )



Tags:

access:  public


Overrides TeraWurflDatabase::verifyConfig() (Checks if the database configuration is correct and that all required permissions)

[ Top ]


Documentation generated on Sat, 31 Mar 2012 15:45:10 -0400 by phpDocumentor 1.4.4