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

Class: KDatabaseAdapterMysqli

Source Location: /libraries/koowa/database/adapter/mysqli.php

Class Overview

KObject
   |
   --KDatabaseAdapterAbstract
      |
      --KDatabaseAdapterMysqli

Mysqli Database Adapter


Author(s):

Variables

Methods


Child classes:

ComDefaultDatabaseAdapterMysqli
Default Database MySQLi Adapter

Inherited Variables

Inherited Methods

Class: KDatabaseAdapterAbstract

KDatabaseAdapterAbstract::__construct()
Constructor.
KDatabaseAdapterAbstract::delete()
Deletes rows from the table based on a WHERE clause.
KDatabaseAdapterAbstract::disconnect()
Disconnect from db
KDatabaseAdapterAbstract::execute()
Use and other queries that don't return rows
KDatabaseAdapterAbstract::getConnection()
Get the connection
KDatabaseAdapterAbstract::getDatabase()
Get the database name
KDatabaseAdapterAbstract::getInsertId()
Get the insert id of the last insert operation
KDatabaseAdapterAbstract::getQuery()
Get a database query object
KDatabaseAdapterAbstract::getTableNeedle()
Get the table needle
KDatabaseAdapterAbstract::getTablePrefix()
Get the table prefix
KDatabaseAdapterAbstract::insert()
Inserts a row of data into a table.
KDatabaseAdapterAbstract::quoteName()
Quotes a single identifier name (table, table alias, table column, index, sequence). Ignores empty values.
KDatabaseAdapterAbstract::quoteValue()
Safely quotes a value for an SQL statement.
KDatabaseAdapterAbstract::reconnect()
Reconnect to the db
KDatabaseAdapterAbstract::replaceTableNeedle()
This function replaces the table needles in a query string with the actual table prefix.
KDatabaseAdapterAbstract::select()
Preforms a select query
KDatabaseAdapterAbstract::setConnection()
Set the connection
KDatabaseAdapterAbstract::setDatabase()
Set the database name
KDatabaseAdapterAbstract::setTablePrefix()
Set the table prefix
KDatabaseAdapterAbstract::show()
Preforms a show query
KDatabaseAdapterAbstract::update()
Updates a table with specified data based on a WHERE clause
KDatabaseAdapterAbstract::_fetchArray()
Fetch the first row of a result set as an associative array
KDatabaseAdapterAbstract::_fetchArrayList()
Fetch all result rows of a result set as an array of associative arrays
KDatabaseAdapterAbstract::_fetchField()
Fetch the first field of the first row
KDatabaseAdapterAbstract::_fetchFieldList()
Fetch an array of single field results
KDatabaseAdapterAbstract::_fetchObject()
Fetch the first row of a result set as an object
KDatabaseAdapterAbstract::_fetchObjectList()
Fetch all rows of a result set as an array of objects
KDatabaseAdapterAbstract::_initialize()
Initializes the options for the object
KDatabaseAdapterAbstract::_parseColumnInfo()
Parse the raw column schema information
KDatabaseAdapterAbstract::_parseColumnType()
Given a raw column specification, parse into datatype, size, and decimal scope.
KDatabaseAdapterAbstract::_parseTableInfo()
Parse the raw table schema information
KDatabaseAdapterAbstract::_quoteName()
Quotes an identifier name (table, index, etc). Ignores empty values.
KDatabaseAdapterAbstract::_quoteValue()
Safely quotes a value for an SQL statement.
KDatabaseAdapterAbstract::__destruct()
Destructor

Class: KObject

KObject::__construct()
Constructor
KObject::get()
Get the object properties
KObject::getHandle()
Get a handle for this object
KObject::getIdentifier()
Gets the service identifier.
KObject::getMethods()
Get a list of all the available methods
KObject::getService()
Get an instance of a class based on a class identifier only creating it if it does not exist yet.
KObject::inherits()
Checks if the object or one of it's mixin's inherits from a class.
KObject::mixin()
Mixin an object
KObject::set()
Set the object properties
KObject::_initialize()
Initializes the options for the object
KObject::__call()
Search the mixin method map and call the method or trigger an error
KObject::__clone()
Preform a deep clone of the object.

Class Details

[line 18]
Mysqli Database Adapter



Tags:

author:  Johan Janssens <johan@nooku.org>


[ Top ]


Class Variables

$_database =

[line 92]

The database name of the active connection



Tags:

access:  protected

Type:   string


[ Top ]

$_name_quote =  '`'

[line 25]

Quote for named objects



Tags:

access:  protected

Type:   string
Overrides:   Array


[ Top ]

$_typemap = array(

        // numeric
        'smallint'          => 'int',
        'int'               => 'int',
        'integer'           => 'int',
        'bigint'            => 'int',
       'mediumint'         => 'int',
       'smallint'         => 'int',
       'tinyint'         => 'int',
        'numeric'         => 'numeric',
        'dec'               => 'numeric',
          'decimal'           => 'numeric',
          'float'            => 'float'  ,
      'double'            => 'float'  ,
      'real'             => 'float'  ,

       // boolean
       'bool'            => 'boolean',
       'boolean'          => 'boolean',

          // date & time
          'date'              => 'date'     ,
          'time'              => 'time'     ,
          'datetime'          => 'timestamp',
          'timestamp'         => 'int'  ,
          'year'            => 'int'  ,

          // string
          'national char'     => 'string',
          'nchar'             => 'string',
          'char'              => 'string',
          'binary'            => 'string',
          'national varchar'  => 'string',
          'nvarchar'          => 'string',
          'varchar'           => 'string',
          'varbinary'         => 'string',
       'text'            => 'string',
       'mediumtext'      => 'string',
       'tinytext'         => 'string',
       'longtext'         => 'string',

          // blob
          'blob'            => 'raw',
       'tinyblob'         => 'raw',
       'mediumblob'      => 'raw',
          'longtext'          => 'raw',
        'longblob'          => 'raw',

       //other
       'set'            => 'string',
       'enum'            => 'string',
   )

[line 33]

Map of native MySQL types to generic types used when reading table column information.



Tags:

access:  protected

Type:   array


[ Top ]



Class Methods


method connect [line 123]

KDatabaseAdapterMysqli connect( )

Connect to the db



Tags:

access:  public


[ Top ]

method disconnect [line 159]

KDatabaseAdapterMysqli disconnect( )

Disconnect from db



Tags:

access:  public


Overrides KDatabaseAdapterAbstract::disconnect() (Disconnect from db)

[ Top ]

method getDatabase [line 203]

string getDatabase( )

Get the database name



Tags:

return:  The database name
access:  public


Overrides KDatabaseAdapterAbstract::getDatabase() (Get the database name)

[ Top ]

method getTableSchema [line 234]

KDatabaseSchemaTable getTableSchema( string $table)

Retrieves the table schema information about the given table



Tags:

access:  public


Overridden in child classes as:

ComDefaultDatabaseAdapterMysqli::getTableSchema()
Retrieves the table schema information about the given table

Parameters:

string   $table   A table name or a list of table names

[ Top ]

method isConnected [line 176]

boolean isConnected( )

Check if the connection is active



Tags:

access:  public


[ Top ]

method lockTable [line 254]

boolean lockTable( string $base, string $name)

Lock a table.



Tags:

return:  True on success, false otherwise.
access:  public


Parameters:

string   $base   Base name of the table.
string   $name   Real name of the table.

[ Top ]

method setConnection [line 188]

KDatabaseAdapterAbstract setConnection( resource $resource)

Set the connection



Tags:

throws:  KDatabaseAdapterException If the resource is not an MySQLi instance
access:  public


Overrides KDatabaseAdapterAbstract::setConnection() (Set the connection)

Parameters:

resource   $resource   The connection resource

[ Top ]

method setDatabase [line 218]

KDatabaseAdapterAbstract setDatabase( string $database)

Set the database name



Tags:

access:  public


Overrides KDatabaseAdapterAbstract::setDatabase() (Set the database name)

Parameters:

string   $database   The database name

[ Top ]

method unlockTable [line 281]

boolean unlockTable( )

Unlock a table.



Tags:

return:  True on success, false otherwise.
access:  public


[ Top ]

method _fetchArray [line 345]

array _fetchArray( mysqli_result $result)

Fetch the first row of a result set as an associative array



Tags:

access:  protected


Overrides KDatabaseAdapterAbstract::_fetchArray() (Fetch the first row of a result set as an associative array)

Parameters:

mysqli_result   $result   The result object. A result set identifier returned by the select() function

[ Top ]

method _fetchArrayList [line 363]

array _fetchArrayList( mysqli_result $result, [string $key = ''])

Fetch all result rows of a result set as an array of associative arrays

If key is not empty then the returned array is indexed by the value of the database key. Returns null if the query fails.




Tags:

return:  If key is empty as sequential list of returned records.
access:  protected


Overrides KDatabaseAdapterAbstract::_fetchArrayList() (Fetch all result rows of a result set as an array of associative arrays)

Parameters:

mysqli_result   $result   The result object. A result set identifier returned by the select() function
string   $key   The column name of the index to use

[ Top ]

method _fetchField [line 306]

The _fetchField( mysqli_result $result, [integer $key = 0])

Fetch the first field of the first row



Tags:

return:  value returned in the query or null if the query failed.
access:  protected


Overrides KDatabaseAdapterAbstract::_fetchField() (Fetch the first field of the first row)

Parameters:

mysqli_result   $result   The result object. A result set identifier returned by the select() function
integer   $key   The index to use

[ Top ]

method _fetchFieldList [line 326]

array _fetchFieldList( mysqli_result $result, [integer $key = 0])

Fetch an array of single field results



Tags:

return:  A sequential array of returned rows.
access:  protected


Overrides KDatabaseAdapterAbstract::_fetchFieldList() (Fetch an array of single field results)

Parameters:

mysqli_result   $result   The result object. A result set identifier returned by the select() function
integer   $key   The index to use

[ Top ]

method _fetchObject [line 386]

void _fetchObject( mysqli_result $result, object 1)

Fetch the first row of a result set as an object



Tags:

access:  protected


Overrides KDatabaseAdapterAbstract::_fetchObject() (Fetch the first row of a result set as an object)

Parameters:

object   1  
mysqli_result   $result   The result object. A result set identifier returned by the select() function

[ Top ]

method _fetchObjectList [line 404]

array _fetchObjectList( mysqli_result $result, [string $key = ''])

Fetch all rows of a result set as an array of objects

If key is not empty then the returned array is indexed by the value of the database key. Returns null if the query fails.




Tags:

return:  If key is empty as sequential array of returned rows.
access:  protected


Overrides KDatabaseAdapterAbstract::_fetchObjectList() (Fetch all rows of a result set as an array of objects)

Parameters:

mysqli_result   $result   The result object. A result set identifier returned by the select() function
string   $key   The column name of the index to use

[ Top ]

method _fetchTableColumns [line 459]

array _fetchTableColumns( string $table)

Retrieves the column schema information about the given table



Tags:

return:  An array of columns
access:  protected


Parameters:

string   $table   A table name

[ Top ]

method _fetchTableIndexes [line 487]

array _fetchTableIndexes( string $table)

Retrieves the index information about the given table



Tags:

return:  An associative array of indexes by index name
access:  protected


Parameters:

string   $table   A table name

[ Top ]

method _fetchTableInfo [line 439]

DatabaseSchemaTable _fetchTableInfo( array|string $table)

Retrieves the table schema information about the given tables



Tags:

return:  or NULL if the table doesn't exist
access:  protected


Parameters:

array|string   $table   A table name or a list of table names

[ Top ]

method _initialize [line 102]

void _initialize( $config)

Initializes the options for the object

Called from __construct() as a first step of object instantiation.




Tags:

access:  protected


Overridden in child classes as:

ComDefaultDatabaseAdapterMysqli::_initialize()
Initializes the options for the object

Overrides KDatabaseAdapterAbstract::_initialize() (Initializes the options for the object)

Parameters:

object An   $config   optional KConfig object with configuration options.

[ Top ]

method _parseColumnInfo [line 529]

KDatabaseSchemaColumn _parseColumnInfo( object The $info)

Parse the raw column schema information



Tags:

access:  protected


Overrides KDatabaseAdapterAbstract::_parseColumnInfo() (Parse the raw column schema information)

Parameters:

object The   $info   raw column schema information

[ Top ]

method _parseColumnType [line 590]

array _parseColumnType( string $spec)

Given a raw column specification, parse into datatype, length, and decimal scope.



Tags:

return:  A sequential array of the column type, size, and scope.
access:  protected


Overrides KDatabaseAdapterAbstract::_parseColumnType() (Given a raw column specification, parse into datatype, size, and decimal scope.)

Parameters:

string   $spec   The column specification; for example, "VARCHAR(255)" or "NUMERIC(10,2)" or "float(6,2) UNSIGNED" or ENUM('yes','no','maybe')

[ Top ]

method _parseTableInfo [line 508]

KDatabaseSchemaTable _parseTableInfo( object The $info)

Parse the raw table schema information



Tags:

access:  protected


Overrides KDatabaseAdapterAbstract::_parseTableInfo() (Parse the raw table schema information)

Parameters:

object The   $info   raw table schema information

[ Top ]

method _quoteValue [line 427]

string _quoteValue( mixed $value)

Safely quotes a value for an SQL statement.



Tags:

return:  An SQL-safe quoted value
access:  protected


Overrides KDatabaseAdapterAbstract::_quoteValue() (Safely quotes a value for an SQL statement.)

Parameters:

mixed   $value   The value to quote

[ Top ]


Documentation generated on Fri, 24 May 2013 03:02:18 +0200 by phpDocumentor 1.4.3