KWeb  6.4
KDB Class Reference

Static Public Member Functions

static createFromSettings ($name, array $override=null)
 Creates KDB_Driver instance from KSetting.
static instance ($database=false, $create=true)
 Returns the database object.
static quote ($str, $handleTypes=true)
static quoteArray ($arr, $handleTypes=true)
static buildValues (array $tab, $glue, $escape=true, $handleTypes=true)

Data Fields

const EVENT_ERROR = 'kdb.error'
 Notifies about DB error.
const EVENT_TIMEOUT = 'kdb.timeout'
 Notifies about a query that exceeded queryTimeLimit.
const OPT_PREPARE = 'prepare'
 Query will be precompiled and stored for the next call with the same query.
const OPT_CACHE = 'cache'
 Results of this query will be cached on disk.
const OPT_CACHE_TIMEOUT = 'cache_timeout'
 Cache timeout in seconds.
const OPT_CACHE_ITEMS = 'cache_items'
 Items hint for CacheBlock::makePath()
const OPT_NO_ERROR_HANDLING = 'no_onerror'
 Prevent DB errors from breaking transactions and calling events.
const OPT_KEEP_DB = 'keep_db'
 Doesn`t change or reset current database.
const OPT_NO_LOG = 'no_log'
 Disables query logging for this one.
const OPT_FETCH = 'fetch'
 Fetch type (default FETCH_NAME)
const OPT_FETCH_CLASS = 'fetch_class'
 Rows will be returned as objects of specified class.
const FETCH_NAME = 'name'
const FETCH_INDEX = 'index'
const FETCH_BOTH = 'both'
const PARAM_HOST = 'host'
const PARAM_USER = 'user'
const PARAM_PASS = 'pass'
const PARAM_DATABASE = 'database'
const PARAM_TRANSACTIONS = 'transactions'
const PARAM_ENCODING = 'encoding'
const PARAM_ALIAS = 'alias'
const PARAM_REUSE = 'reuse'
const PARAM_PERSIST = 'persist'

Static Public Attributes

static $lastUsed = null

Static Protected Attributes

static $instances = array()

Member Function Documentation

static KDB::buildValues ( array $  tab,
glue,
escape = true,
handleTypes = true 
) [static]
static KDB::createFromSettings ( name,
array $  override = null 
) [static]

Creates KDB_Driver instance from KSetting.

Possible seetings are:

  • host
  • user
  • pass
  • driver - driver's Class
  • database
  • transactions - true/false
  • encoding - default encoding
  • alias - will return specified KDB instance, discards all settings
  • reuse - will reuse specified connection, depends on the driver
Returns:
KDB_Driver
static KDB::instance ( database = false,
create = true 
) [static]

Returns the database object.

Connection is established on first call.

Parameters:
$databaseName of the database settings from KSetting to use, or false to use KSetting::$inst->db_default
Returns:
KDB_Driver
static KDB::quote ( str,
handleTypes = true 
) [static]
static KDB::quoteArray ( arr,
handleTypes = true 
) [static]

Field Documentation

KDB::$instances = array() [static, protected]
KDB::$lastUsed = null [static]
const KDB::EVENT_ERROR = 'kdb.error'

Notifies about DB error.

$subject is set to the KDBException object

If event handler returns true, the error handling will be stopped and the exception won't be thrown.

const KDB::EVENT_TIMEOUT = 'kdb.timeout'

Notifies about a query that exceeded queryTimeLimit.

const KDB::FETCH_BOTH = 'both'
const KDB::FETCH_INDEX = 'index'
const KDB::FETCH_NAME = 'name'
const KDB::OPT_CACHE = 'cache'

Results of this query will be cached on disk.

Not every query* function will handle this... Value should be set to unique key (it doesn't HAVE to be unique)

const KDB::OPT_CACHE_ITEMS = 'cache_items'

Items hint for CacheBlock::makePath()

$opts = array( KDB::OPT_CACHE => true, KDB::OPT_CACHE_ITEMS => array(1,200,350), )

const KDB::OPT_CACHE_TIMEOUT = 'cache_timeout'

Cache timeout in seconds.

const KDB::OPT_FETCH = 'fetch'

Fetch type (default FETCH_NAME)

const KDB::OPT_FETCH_CLASS = 'fetch_class'

Rows will be returned as objects of specified class.

Be aware, that not every function will cooperate with this feature

const KDB::OPT_KEEP_DB = 'keep_db'

Doesn`t change or reset current database.

const KDB::OPT_NO_ERROR_HANDLING = 'no_onerror'

Prevent DB errors from breaking transactions and calling events.

const KDB::OPT_NO_LOG = 'no_log'

Disables query logging for this one.

const KDB::OPT_PREPARE = 'prepare'

Query will be precompiled and stored for the next call with the same query.

Value should be set to unique key (it doesn't HAVE to be unique)

const KDB::PARAM_ALIAS = 'alias'
const KDB::PARAM_DATABASE = 'database'
const KDB::PARAM_ENCODING = 'encoding'
const KDB::PARAM_HOST = 'host'
const KDB::PARAM_PASS = 'pass'
const KDB::PARAM_PERSIST = 'persist'
const KDB::PARAM_REUSE = 'reuse'
const KDB::PARAM_TRANSACTIONS = 'transactions'
const KDB::PARAM_USER = 'user'

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