Xataface  2.0alpha2
Xataface Application Framework
 All Data Structures Namespaces Files Functions Variables Groups Pages
Public Member Functions | Static Public Member Functions | Data Fields
Dataface_DB Class Reference

Public Member Functions

 Dataface_DB ($db=null)
 _loadCache ()
 cache ($key, $value, $lang=null)
_getParser ()
_getCompiler ()
 prepareQuery ($query)
 _replacePrepareDigits ($matches)
 _replaceCompileStrings ($matches)
 _replaceCompileDigits ($matches)
 _replaceBlobs ($matches)
 compilePreparedQuery ($prepared_query)
 translate_query ($query, $lang=null)
 query ($sql, $db=null, $lang=null, $as_array=false, $enumerated=false)
 insert_id ()
 writeCache ()
 registerBlob ($blobData)
 checkoutBlob ($blobID)
 startTransaction ()
 commitTransaction ()
 rollbackTransaction ()
 memcache_get ($sql, $lang=null)
 memcache_mtime ($key, $set=false)
 fcache_mtime ($key)
 fcache_get ($key)
 fcache_set ($key, $value)
 fcache_path ($key)
 memcache_get_key ($sql, $lang)
 memcache_set ($sql, $lang, $value)
 getTableDependencies ($sql, $lang=null)

Static Public Member Functions

static & getInstance ()

Data Fields

 $_db
 $_fieldIndex = array()
 $_queryCache = array()
 $_parser = null
 $_compiler = null
 $_cache = null
 $_cacheDirtyFlag = false
 $app
 $_matchCount
 $_matches
 $_insert_id
 $count = 0
 $_fcache_base_path = null
 $db_hits = 0
 $cache_hits = 0
 $cache_fails = 0
 $blobs = array()

Detailed Description

Definition at line 34 of file DB.php.

Member Function Documentation

& _getCompiler ( )

Obtains a reference to this object's SQL compiler.

Definition at line 134 of file DB.php.

& _getParser ( )

Obtains reference to this class's SQL Parser.

Definition at line 122 of file DB.php.

_loadCache ( )

Loads cached queries from the file Dataface_DB.cache in the DATAFACE_CACHE directory - usually Dataface/templates_c/__cache . This file will be a php file with an array by the name of "cache" defined.

Definition at line 86 of file DB.php.

_replaceBlobs (   $matches)

Definition at line 230 of file DB.php.

_replaceCompileDigits (   $matches)

Definition at line 226 of file DB.php.

_replaceCompileStrings (   $matches)

Definition at line 222 of file DB.php.

_replacePrepareDigits (   $matches)

Definition at line 217 of file DB.php.

cache (   $key,
  $value,
  $lang = null 
)

Adds a value to the cache.

Definition at line 109 of file DB.php.

checkoutBlob (   $blobID)

Definition at line 472 of file DB.php.

commitTransaction ( )

Definition at line 481 of file DB.php.

compilePreparedQuery (   $prepared_query)

Definition at line 240 of file DB.php.

Dataface_DB (   $db = null)

Definition at line 54 of file DB.php.

fcache_get (   $key)

Definition at line 587 of file DB.php.

fcache_mtime (   $key)

Definition at line 577 of file DB.php.

fcache_path (   $key)

Definition at line 600 of file DB.php.

fcache_set (   $key,
  $value 
)

Definition at line 595 of file DB.php.

static& getInstance ( )
static

Definition at line 411 of file DB.php.

getTableDependencies (   $sql,
  $lang = null 
)

Definition at line 638 of file DB.php.

insert_id ( )

Definition at line 406 of file DB.php.

memcache_get (   $sql,
  $lang = null 
)

Definition at line 484 of file DB.php.

memcache_get_key (   $sql,
  $lang 
)

Definition at line 604 of file DB.php.

memcache_mtime (   $key,
  $set = false 
)

Returns the modification time of the memcache entry for a particular key.

Definition at line 557 of file DB.php.

memcache_set (   $sql,
  $lang,
  $value 
)

Definition at line 620 of file DB.php.

prepareQuery (   $query)

Takes a select SQL query and separates the query portion from the data in the query. This will return an array where the first elemement is the generified SQL query sans any of the specified column values in the where clause and the remaining elements are the values that have been removed.

For example: Input = SELECT * FROM Players where FirstName = 'Bruce' Output = array( 'SELECT * FROM Players where FirstName = '{!#$S1%$#@!}', 'Bruce' );

Definition at line 152 of file DB.php.

query (   $sql,
  $db = null,
  $lang = null,
  $as_array = false,
  $enumerated = false 
)

Queries the database with the given sql query. This currently passes the query straight through to mysql_query, but it will be modified in the future to automatically filter out blobs (because normally we don't want to retrieve blob columns.

Definition at line 307 of file DB.php.

registerBlob (   $blobData)

Definition at line 464 of file DB.php.

rollbackTransaction ( )

Definition at line 482 of file DB.php.

startTransaction ( )

Definition at line 480 of file DB.php.

translate_query (   $query,
  $lang = null 
)

Translates a select SQL query into a multilanguage query. It will compute the appropriate joins to the translation tables and swap the original column for its translated column in the join table.

Parameters
$queryThe query.
$langThe 2 digit language code for the translation we wish to obtain.

Definition at line 264 of file DB.php.

writeCache ( )

Writes the cache of SQL queries to a PHP file. This method is registered in DB constructor to automatically run on shutdown.

Definition at line 426 of file DB.php.

Field Documentation

$_cache = null

Definition at line 40 of file DB.php.

$_cacheDirtyFlag = false

Definition at line 41 of file DB.php.

$_compiler = null

Definition at line 39 of file DB.php.

$_db

Definition at line 35 of file DB.php.

$_fcache_base_path = null

Definition at line 47 of file DB.php.

$_fieldIndex = array()

Definition at line 36 of file DB.php.

$_insert_id

Definition at line 45 of file DB.php.

$_matchCount

Definition at line 43 of file DB.php.

$_matches

Definition at line 44 of file DB.php.

$_parser = null

Definition at line 38 of file DB.php.

$_queryCache = array()

Definition at line 37 of file DB.php.

$app

Definition at line 42 of file DB.php.

$blobs = array()

Definition at line 52 of file DB.php.

$cache_fails = 0

Definition at line 50 of file DB.php.

$cache_hits = 0

Definition at line 49 of file DB.php.

$count = 0

Definition at line 46 of file DB.php.

$db_hits = 0

Definition at line 48 of file DB.php.


The documentation for this class was generated from the following file: