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

Class: TeraWurflDatabase

Source Location: /DatabaseConnectors/TeraWurflDatabase.php

Class Overview


Abstract class to provide a skeleton for the Tera-WURFL database connectors.


Author(s):

Variables

Methods


Child classes:

TeraWurflDatabase_MSSQL2005
Provides connectivity from Tera-WURFL to Microsoft SQL Server 2005/2008
TeraWurflDatabase_MySQL4
Provides connectivity from Tera-WURFL to MySQL 4. This connector is also compatible with MySQL 5.
TeraWurflDatabase_MySQL5
Provides connectivity from Tera-WURFL to MySQL 5

Class Details

[line 25]
Abstract class to provide a skeleton for the Tera-WURFL database connectors.



Tags:

abstract:  


[ Top ]


Class Variables

static $DB_TEMP_EXT =  "_TEMP"

[line 73]

Database table name extension for temporary tables



Tags:

access:  public

Type:   string


[ Top ]

$connected =  false

[line 63]

True if connection to database is active



Tags:

access:  public

Type:   bool


[ Top ]

$dbcon =

[line 68]

Raw database connection



Tags:

access:  protected

Type:   database_object


[ Top ]

$db_implements_fallback =  false

[line 48]

Database connector implements the building of a fallback tree directly



Tags:

access:  public

Type:   bool


[ Top ]

$db_implements_ld =  false

[line 43]

Database connector implements the LD search function directly



Tags:

access:  public

Type:   bool


[ Top ]

$db_implements_ris =  false

[line 38]

Database connector implements the RIS search function directly



Tags:

access:  public

Type:   bool


[ Top ]

$errors =

[line 33]

Errors



Tags:

access:  public

Type:   array


[ Top ]

$numQueries =  0

[line 53]

Number of queries to database



Tags:

access:  public

Type:   int


[ Top ]

$tablename =

[line 58]

Full table name to use for the search functions



Tags:

access:  public

Type:   string


[ Top ]



Class Methods


constructor __construct [line 76]

TeraWurflDatabase __construct( )



Tags:

access:  public


Overridden in child classes as:

TeraWurflDatabase_MSSQL2005::__construct()
TeraWurflDatabase_MySQL4::__construct()
TeraWurflDatabase_MySQL5::__construct()

[ Top ]

method clearTable [line 179]

bool clearTable( $tablename $tablename)

Truncate or drop+create the given table



Tags:

return:  Success
abstract:  
access:  public


Overridden in child classes as:

TeraWurflDatabase_MSSQL2005::clearTable()
TeraWurflDatabase_MySQL4::clearTable()
TeraWurflDatabase_MySQL5::clearTable()

Parameters:

$tablename   $tablename  

[ Top ]

method connect [line 184]

bool connect( )

Establishes a database connection and stores connection in $this->dbcon



Tags:

return:  Success
abstract:  
access:  public


Overridden in child classes as:

TeraWurflDatabase_MSSQL2005::connect()
Establishes connection to database (does not check for DB sanity)
TeraWurflDatabase_MySQL4::connect()
Establishes connection to database (does not check for DB sanity)
TeraWurflDatabase_MySQL5::connect()
Establishes connection to database (does not check for DB sanity)
TeraWurflDatabase_MySQL5_Profiling::connect()
Establishes connection to database (does not check for DB sanity)

[ Top ]

method createCacheTable [line 161]

bool createCacheTable( )

Creates the cache table



Tags:

return:  Success
abstract:  
access:  public


Overridden in child classes as:

TeraWurflDatabase_MSSQL2005::createCacheTable()
TeraWurflDatabase_MySQL4::createCacheTable()
TeraWurflDatabase_MySQL5::createCacheTable()

[ Top ]

method createGenericDeviceTable [line 139]

bool createGenericDeviceTable( $tablename $tablename)

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



Tags:

return:  Success
abstract:  
access:  public


Overridden in child classes as:

TeraWurflDatabase_MSSQL2005::createGenericDeviceTable()
Drops and creates the given device table
TeraWurflDatabase_MySQL4::createGenericDeviceTable()
Drops and creates the given device table
TeraWurflDatabase_MySQL5::createGenericDeviceTable()
Drops and creates the given device table

Parameters:

$tablename   $tablename   Name of the table

[ Top ]

method createIndexTable [line 173]

unknown_type createIndexTable( )

Creates the index table



Tags:

abstract:  
access:  public


Overridden in child classes as:

TeraWurflDatabase_MSSQL2005::createIndexTable()
Drops and creates the given device table
TeraWurflDatabase_MySQL4::createIndexTable()
Drops and creates the given device table
TeraWurflDatabase_MySQL5::createIndexTable()
Drops and creates the given device table

[ Top ]

method createProcedures [line 191]

bool createProcedures( )

Creates supporting stored procedures



Tags:

return:  Success
access:  public


Overridden in child classes as:

TeraWurflDatabase_MSSQL2005::createProcedures()
TeraWurflDatabase_MySQL5::createProcedures()

[ Top ]

method getActualDeviceAncestor [line 93]

string getActualDeviceAncestor( $wurflID $wurflID)

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.



Tags:

return:  WURFL ID
abstract:  
access:  public


Overridden in child classes as:

TeraWurflDatabase_MSSQL2005::getActualDeviceAncestor()
TeraWurflDatabase_MySQL4::getActualDeviceAncestor()
TeraWurflDatabase_MySQL5::getActualDeviceAncestor()

Parameters:

$wurflID   $wurflID   WURFL ID

[ Top ]

method getCachedUserAgents [line 218]

array getCachedUserAgents( )

Returns and array of the cached User Agents



Tags:

abstract:  
access:  public


Overridden in child classes as:

TeraWurflDatabase_MSSQL2005::getCachedUserAgents()
TeraWurflDatabase_MySQL4::getCachedUserAgents()
TeraWurflDatabase_MySQL5::getCachedUserAgents()

[ Top ]

method getDeviceFallBackTree [line 127]

string getDeviceFallBackTree( string $wurflID)

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



Tags:

return:  WURFL ID
access:  public


Overridden in child classes as:

TeraWurflDatabase_MySQL5::getDeviceFallBackTree()

Parameters:

string   $wurflID   WURFL ID

[ Top ]

method getDeviceFromCache [line 149]

array getDeviceFromCache( $userAgent $userAgent)

Return capabilities array for the given User Agent, or null if not found



Tags:

return:  Capabilities
abstract:  
access:  public


Overridden in child classes as:

TeraWurflDatabase_MSSQL2005::getDeviceFromCache()
TeraWurflDatabase_MySQL4::getDeviceFromCache()
TeraWurflDatabase_MySQL5::getDeviceFromCache()

Parameters:

$userAgent   $userAgent  

[ Top ]

method getDeviceFromID [line 87]

array getDeviceFromID( $wurflID $wurflID)

Returns the capabilities array from a given WURFL Device ID



Tags:

return:  Device capabilities
abstract:  
access:  public


Overridden in child classes as:

TeraWurflDatabase_MSSQL2005::getDeviceFromID()
TeraWurflDatabase_MySQL4::getDeviceFromID()
TeraWurflDatabase_MySQL5::getDeviceFromID()

Parameters:

$wurflID   $wurflID   WURFL ID

[ Top ]

method getDeviceFromUA [line 105]

string getDeviceFromUA( $userAgent $userAgent)

Returns the WURFL ID from a raw User Agent if an exact match is found



Tags:

return:  WURFL ID
abstract:  
access:  public


Overridden in child classes as:

TeraWurflDatabase_MSSQL2005::getDeviceFromUA()
TeraWurflDatabase_MySQL4::getDeviceFromUA()
TeraWurflDatabase_MySQL5::getDeviceFromUA()

Parameters:

$userAgent   $userAgent  

[ Top ]

method getDeviceFromUA_LD [line 121]

string getDeviceFromUA_LD( $userAgent, int $tolerance, &$matcher, string $ua, UserAgentMatcher $matcher)

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



Tags:

return:  WURFL ID
access:  public


Overridden in child classes as:

TeraWurflDatabase_MSSQL2005::getDeviceFromUA_LD()
TeraWurflDatabase_MySQL5::getDeviceFromUA_LD()

Parameters:

string   $ua   User Agent
int   $tolerance   Tolerance that is still considered a match
UserAgentMatcher   $matcher   The UserAgentMatcherInstance that is matching the User Agent
   $userAgent  
UserAgentMatcher   &$matcher  

[ Top ]

method getDeviceFromUA_RIS [line 113]

string getDeviceFromUA_RIS( $userAgent, int $tolerance, &$matcher, string $ua, UserAgentMatcher $matcher)

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



Tags:

return:  WURFL ID
access:  public


Overridden in child classes as:

TeraWurflDatabase_MSSQL2005::getDeviceFromUA_RIS()
TeraWurflDatabase_MySQL5::getDeviceFromUA_RIS()
TeraWurflDatabase_MySQL5_Profiling::getDeviceFromUA_RIS()

Parameters:

string   $ua   User Agent
int   $tolerance   How short the strings are allowed to get before a match is abandoned
UserAgentMatcher   $matcher   The UserAgentMatcherInstance that is matching the User Agent
   $userAgent  
UserAgentMatcher   &$matcher  

[ Top ]

method getFullDeviceList [line 99]

array getFullDeviceList( $tablename $tablename)

Returns an associative array of all the data from the given table in the form [WURFL ID] => [User Agent]



Tags:

abstract:  
access:  public


Overridden in child classes as:

TeraWurflDatabase_MSSQL2005::getFullDeviceList()
TeraWurflDatabase_MySQL4::getFullDeviceList()
TeraWurflDatabase_MySQL5::getFullDeviceList()

Parameters:

$tablename   $tablename  

[ Top ]

method getLastError [line 247]

string getLastError( )

Returns the most recent error message



Tags:

return:  Error message
access:  public


[ Top ]

method getMatcherTableList [line 207]

array getMatcherTableList( )

Returns an array of the User Agent Matcher tables in the database



Tags:

abstract:  
access:  public


Overridden in child classes as:

TeraWurflDatabase_MSSQL2005::getMatcherTableList()
TeraWurflDatabase_MySQL4::getMatcherTableList()
TeraWurflDatabase_MySQL5::getMatcherTableList()

[ Top ]

method getServerVersion [line 242]

string getServerVersion( )

Returns the version string of the database server



Tags:

abstract:  
access:  public


Overridden in child classes as:

TeraWurflDatabase_MSSQL2005::getServerVersion()
TeraWurflDatabase_MySQL4::getServerVersion()
TeraWurflDatabase_MySQL5::getServerVersion()

[ Top ]

method getTableList [line 202]

array getTableList( )

Returns an array of all the tables in the database



Tags:

abstract:  
access:  public


Overridden in child classes as:

TeraWurflDatabase_MSSQL2005::getTableList()
TeraWurflDatabase_MySQL4::getTableList()
TeraWurflDatabase_MySQL5::getTableList()

[ Top ]

method getTableStats [line 213]

array getTableStats( $table $table)

Returns an associative array of statistics from given table



Tags:

abstract:  
access:  public


Overridden in child classes as:

TeraWurflDatabase_MSSQL2005::getTableStats()
TeraWurflDatabase_MySQL4::getTableStats()
TeraWurflDatabase_MySQL5::getTableStats()

Parameters:

$table   $table  

[ Top ]

method initializeDB [line 223]

void initializeDB( )

Creates and prepares the database



Tags:

access:  public


[ Top ]

method loadDevices [line 133]

array loadDevices( string &$tables)

Loads the pre-processed WURFL tables into the database



Tags:

return:  Array of devices in fallback tree
abstract:  
access:  public


Overridden in child classes as:

TeraWurflDatabase_MSSQL2005::loadDevices()
TeraWurflDatabase_MySQL4::loadDevices()
TeraWurflDatabase_MySQL5::loadDevices()

Parameters:

string   &$tables   Device tables

[ Top ]

method rebuildCacheTable [line 166]

bool rebuildCacheTable( )

Rebuilds the cache table by redetecting the cached devices against the loaded WURFL



Tags:

return:  Success
abstract:  
access:  public


Overridden in child classes as:

TeraWurflDatabase_MSSQL2005::rebuildCacheTable()
TeraWurflDatabase_MySQL4::rebuildCacheTable()
TeraWurflDatabase_MySQL5::rebuildCacheTable()

[ Top ]

method saveDeviceInCache [line 156]

bool saveDeviceInCache( $userAgent $userAgent, $device $device)

Save the given User Agent and Device capabilities array to the database



Tags:

return:  Success
abstract:  
access:  public


Overridden in child classes as:

TeraWurflDatabase_MSSQL2005::saveDeviceInCache()
TeraWurflDatabase_MySQL4::saveDeviceInCache()
TeraWurflDatabase_MySQL5::saveDeviceInCache()

Parameters:

$userAgent   $userAgent   User Agent
$device   $device   Device capabilities array

[ Top ]

method SQLPrep [line 197]

string SQLPrep( $raw_text $raw_text)

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



Tags:

return:  SQL-Safe text
abstract:  
access:  public


Overridden in child classes as:

TeraWurflDatabase_MSSQL2005::SQLPrep()
TeraWurflDatabase_MySQL4::SQLPrep()
TeraWurflDatabase_MySQL5::SQLPrep()

Parameters:

$raw_text   $raw_text  

[ Top ]

method verifyConfig [line 235]

array verifyConfig( )

Checks if the database configuration is correct and that all required permissions

are properly configured




Tags:

return:  list of errors
access:  public


Overridden in child classes as:

TeraWurflDatabase_MySQL5::verifyConfig()

[ Top ]


Documentation generated on Thu, 20 May 2010 20:20:25 +0000 by phpDocumentor 1.4.3