DboMysql Class Reference

Inheritance diagram for DboMysql:

DboSource DataSource Object

List of all members.


Public Member Functions

 _execute ($sql)
 alterSchema ($compare, $table=null)
 begin (&$model)
 buildColumn ($column)
 buildIndex ($indexes)
 column ($real)
 commit (&$model)
 connect ()
 createSchema ($schema, $table=null)
 describe (&$model)
 disconnect ()
 dropSchema ($schema, $table=null)
 fetchResult ()
 getEncoding ()
 index ($model)
 lastAffected ()
 lastError ()
 lastInsertId ($source=null)
 lastNumRows ()
 length ($real)
 listSources ()
 resultSet (&$results)
 rollback (&$model)
 setEncoding ($enc)
 value ($data, $column=null, $safe=false)

Public Attributes

 $_baseConfig
 $columns
 $description = "MySQL DBO Driver"
 $endQuote = "`"
 $startQuote = "`"

Detailed Description

Definition at line 38 of file dbo_mysql.php.


Member Function Documentation

DboMysql::_execute ( sql  ) 

Executes given SQL statement.

Parameters:
string $sql SQL statement
Returns:
resource Result resource identifier protected

Definition at line 132 of file dbo_mysql.php.

Referenced by listSources(), and setEncoding().

DboMysql::alterSchema ( compare,
table = null 
)

Generate a MySQL Alter Table syntax for the given Schema comparison

Parameters:
unknown_type $schema
Returns:
unknown

Reimplemented from DboSource.

Definition at line 537 of file dbo_mysql.php.

References buildColumn(), DboSource::fullTableName(), and DboSource::name().

DboMysql::begin ( &$  model  ) 

Begin a transaction

Parameters:
unknown_type $model
Returns:
boolean True on success, false on fail (i.e. if the database/model does not support transactions).

Reimplemented from DataSource.

Definition at line 245 of file dbo_mysql.php.

References DboSource::execute().

DboMysql::buildColumn ( column  ) 

Generate a MySQL-native column schema string

Parameters:
array $column An array structured like the following: array('name'=>'value', 'type'=>'value'[, options]), where options can be 'default', 'length', or 'key'.
Returns:
string

Reimplemented from DboSource.

Definition at line 607 of file dbo_mysql.php.

References length(), DboSource::limit(), DboSource::name(), and value().

Referenced by alterSchema(), and createSchema().

DboMysql::buildIndex ( indexes  ) 

Format indexes for create table

Parameters:
array $indexes
Returns:
string

Reimplemented from DboSource.

Definition at line 659 of file dbo_mysql.php.

References column(), and DboSource::name().

Referenced by createSchema().

DboMysql::column ( real  ) 

Converts database-layer column types to basic types

Parameters:
string $real Real database-layer column type (i.e. "varchar(255)")
Returns:
string Abstract column type (i.e. "string")

Reimplemented from DataSource.

Definition at line 338 of file dbo_mysql.php.

References length(), DboSource::limit(), and DboSource::name().

Referenced by buildIndex(), createSchema(), describe(), and index().

DboMysql::commit ( &$  model  ) 

Commit a transaction

Parameters:
unknown_type $model
Returns:
boolean True on success, false on fail (i.e. if the database/model does not support transactions, or a transaction has not started).

Reimplemented from DataSource.

Definition at line 262 of file dbo_mysql.php.

References DboSource::execute().

DboMysql::connect (  ) 

Connects to the database using options in the given configuration array.

Returns:
boolean True if the database could be connected, else false

Definition at line 94 of file dbo_mysql.php.

References DataSource::$config, and setEncoding().

DboMysql::createSchema ( schema,
table = null 
)

Generate a MySQL schema for the given Schema object

Parameters:
object $schema An instance of a subclass of CakeSchema
string $table Optional. If specified only the table name given will be generated. Otherwise, all tables defined in the schema are generated.
Returns:
string

Reimplemented from DboSource.

Definition at line 493 of file dbo_mysql.php.

References $columns, DboSource::$index, buildColumn(), buildIndex(), column(), DboSource::fullTableName(), and DboSource::name().

DboMysql::describe ( &$  model  ) 

Returns an array of the fields in given table name.

Parameters:
string $tableName Name of database table to inspect
Returns:
array Fields in table. Keys are name and type

Definition at line 165 of file dbo_mysql.php.

References column(), DboSource::fullTableName(), index(), length(), and DboSource::query().

DboMysql::disconnect (  ) 

Disconnects from database.

Returns:
boolean True if the database could be disconnected, else false

Definition at line 120 of file dbo_mysql.php.

DboMysql::dropSchema ( schema,
table = null 
)

Generate a MySQL Drop table for the given Schema object

Parameters:
object $schema An instance of a subclass of CakeSchema
string $table Optional. If specified only the table name given will be generated. Otherwise, all tables defined in the schema are generated.
Returns:
string

Reimplemented from DboSource.

Definition at line 587 of file dbo_mysql.php.

References $columns, and DboSource::fullTableName().

DboMysql::fetchResult (  ) 

Fetches the next row from the current result set

Returns:
unknown

Definition at line 427 of file dbo_mysql.php.

References DboSource::$index.

DboMysql::getEncoding (  ) 

Gets the database encoding

Returns:
string The database encoding

Definition at line 455 of file dbo_mysql.php.

DboMysql::index ( model  ) 

Returns an array of the indexes in given table name.

Parameters:
string $model Name of model to inspect
Returns:
array Fields in table. Keys are column and unique

Reimplemented from DboSource.

Definition at line 464 of file dbo_mysql.php.

References DboSource::$index, column(), Set::extract(), DboSource::fullTableName(), and DboSource::query().

Referenced by describe().

DboMysql::lastAffected (  ) 

Returns number of affected rows in previous database operation. If no previous operation exists, this returns false.

Returns:
int Number of affected rows

Definition at line 300 of file dbo_mysql.php.

DboMysql::lastError (  ) 

Returns a formatted error message from previous database operation.

Returns:
string Error message with error number

Definition at line 288 of file dbo_mysql.php.

DboMysql::lastInsertId ( source = null  ) 

Returns the ID generated from the previous INSERT operation.

Parameters:
unknown_type $source
Returns:
in

Reimplemented from DataSource.

Definition at line 324 of file dbo_mysql.php.

References DboSource::fetchRow().

DboMysql::lastNumRows (  ) 

Returns number of rows in previous resultset. If no previous resultset exists, this returns false.

Returns:
int Number of rows in resultset

Definition at line 312 of file dbo_mysql.php.

DboMysql::length ( real  ) 

Gets the length of a database-native column description, or null if no length

Parameters:
string $real Real database-layer column type (i.e. "varchar(255)")
Returns:
int An integer representing the length of the column

Reimplemented from DboSource.

Definition at line 386 of file dbo_mysql.php.

Referenced by buildColumn(), column(), and describe().

DboMysql::listSources (  ) 

Returns an array of sources (tables) in the database.

Returns:
array Array of tablenames in the database

Definition at line 140 of file dbo_mysql.php.

References _execute(), and DboSource::name().

DboMysql::resultSet ( &$  results  ) 

Enter description here...

Parameters:
unknown_type $results

Definition at line 404 of file dbo_mysql.php.

References DboSource::$index, and DboSource::name().

DboMysql::rollback ( &$  model  ) 

Rollback a transaction

Parameters:
unknown_type $model
Returns:
boolean True on success, false on fail (i.e. if the database/model does not support transactions, or a transaction has not started).

Reimplemented from DataSource.

Definition at line 277 of file dbo_mysql.php.

References DboSource::execute().

DboMysql::setEncoding ( enc  ) 

Sets the database encoding

Parameters:
string $enc Database encoding
Returns:
void

Definition at line 447 of file dbo_mysql.php.

References _execute().

Referenced by connect().

DboMysql::value ( data,
column = null,
safe = false 
)

Returns a quoted and escaped string of $data for use in an SQL statement.

Parameters:
string $data String to be prepared for use in an SQL statement
string $column The column into which this data will be inserted
boolean $safe Whether or not numeric data should be handled automagically if no column data is provided
Returns:
string Quoted and escaped data

Definition at line 204 of file dbo_mysql.php.

References $data, DboSource::boolean(), and DboSource::introspectType().

Referenced by buildColumn().


Member Data Documentation

DboMysql::$_baseConfig

Initial value:

 array(
        'persistent' => true,
        'host' => 'localhost',
        'login' => 'root',
        'password' => '',
        'database' => 'cake',
        'port' => '3306',
        'connect' => 'mysql_pconnect'
    )

Reimplemented from DataSource.

Definition at line 62 of file dbo_mysql.php.

DboMysql::$columns

Initial value:

 array(
        'primary_key' => array('name' => 'int(11) DEFAULT NULL auto_increment'),
        'string' => array('name' => 'varchar', 'limit' => '255'),
        'text' => array('name' => 'text'),
        'integer' => array('name' => 'int', 'limit' => '11', 'formatter' => 'intval'),
        'float' => array('name' => 'float', 'formatter' => 'floatval'),
        'datetime' => array('name' => 'datetime', 'format' => 'Y-m-d H:i:s', 'formatter' => 'date'),
        'timestamp' => array('name' => 'timestamp', 'format' => 'Y-m-d H:i:s', 'formatter' => 'date'),
        'time' => array('name' => 'time', 'format' => 'H:i:s', 'formatter' => 'date'),
        'date' => array('name' => 'date', 'format' => 'Y-m-d', 'formatter' => 'date'),
        'binary' => array('name' => 'blob'),
        'boolean' => array('name' => 'tinyint', 'limit' => '1')
    )

Definition at line 76 of file dbo_mysql.php.

Referenced by createSchema(), and dropSchema().

DboMysql::$description = "MySQL DBO Driver"

Reimplemented from DboSource.

Definition at line 44 of file dbo_mysql.php.

DboMysql::$endQuote = "`"

Reimplemented from DboSource.

Definition at line 56 of file dbo_mysql.php.

DboMysql::$startQuote = "`"

Reimplemented from DboSource.

Definition at line 50 of file dbo_mysql.php.


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