DboMysql Class Reference

Public Member Functions | |
| _execute ($sql) | |
| alterSchema ($compare, $table=null) | |
| column ($real) | |
| connect () | |
| delete (&$model, $conditions=null) | |
| describe (&$model) | |
| disconnect () | |
| dropSchema ($schema, $table=null) | |
| fetchResult () | |
| getEncoding () | |
| index ($model) | |
| insertMulti ($table, $fields, $values) | |
| lastAffected () | |
| lastError () | |
| lastInsertId ($source=null) | |
| lastNumRows () | |
| listSources () | |
| resultSet (&$results) | |
| setEncoding ($enc) | |
| update (&$model, $fields=array(), $values=null, $conditions=null) | |
| value ($data, $column=null, $safe=false) | |
Public Attributes | |
| $_baseConfig | |
| $_commands | |
| $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 151 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 528 of file dbo_mysql.php.
References $out, DboSource::buildColumn(), DboSource::fullTableName(), and DboSource::name().
| 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 378 of file dbo_mysql.php.
References DboSource::length(), DboSource::limit(), and DboSource::name().
Referenced by describe(), and index().
| 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 111 of file dbo_mysql.php.
References DataSource::$config, config(), and setEncoding().
| DboMysql::delete | ( | &$ | model, | |
| $ | conditions = null | |||
| ) |
Generates and executes an SQL DELETE statement for given id/conditions on given model.
- Parameters:
-
Model $model mixed $conditions
- Returns:
- boolean Success
Reimplemented from DboSource.
Definition at line 300 of file dbo_mysql.php.
References DboSource::$alias, DboSource::_getJoins(), DboSource::conditions(), DboSource::defaultConditions(), DboSource::execute(), DboSource::fullTableName(), DboSource::name(), and DboSource::renderStatement().
| 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 184 of file dbo_mysql.php.
References column(), DboSource::fullTableName(), index(), DboSource::length(), and DboSource::query().
| DboMysql::disconnect | ( | ) |
Disconnects from database.
- Returns:
- boolean True if the database could be disconnected, else false
Definition at line 139 of file dbo_mysql.php.
| DboMysql::dropSchema | ( | $ | schema, | |
| $ | table = null | |||
| ) |
Generate a MySQL "drop table" statement 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 578 of file dbo_mysql.php.
References $columns, $out, and DboSource::fullTableName().
| DboMysql::fetchResult | ( | ) |
Fetches the next row from the current result set
- Returns:
- unknown
Definition at line 450 of file dbo_mysql.php.
References DboSource::$index.
| DboMysql::getEncoding | ( | ) |
Gets the database encoding
- Returns:
- string The database encoding
Definition at line 477 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 501 of file dbo_mysql.php.
References DboSource::$index, column(), Set::extract(), DboSource::fullTableName(), ife(), and DboSource::query().
Referenced by describe().
| DboMysql::insertMulti | ( | $ | table, | |
| $ | fields, | |||
| $ | values | |||
| ) |
Inserts multiple values into a table
- Parameters:
-
string $table string $fields array $values
Reimplemented from DboSource.
Definition at line 487 of file dbo_mysql.php.
References DboSource::fullTableName(), DboSource::name(), and DboSource::query().
| DboMysql::lastAffected | ( | ) |
Returns number of affected rows in previous database operation. If no previous operation exists, this returns false.
- Returns:
- integer Number of affected rows
Definition at line 340 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 328 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 364 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:
- integer Number of rows in resultset
Definition at line 352 of file dbo_mysql.php.
| DboMysql::listSources | ( | ) |
Returns an array of sources (tables) in the database.
- Returns:
- array Array of tablenames in the database
Definition at line 159 of file dbo_mysql.php.
References _execute(), config(), and DboSource::name().
| DboMysql::resultSet | ( | &$ | results | ) |
Enter description here...
- Parameters:
-
unknown_type $results
Definition at line 427 of file dbo_mysql.php.
References DboSource::$index, and DboSource::name().
| DboMysql::setEncoding | ( | $ | enc | ) |
Sets the database encoding
- Parameters:
-
string $enc Database encoding
Definition at line 469 of file dbo_mysql.php.
References _execute().
Referenced by connect().
| DboMysql::update | ( | &$ | model, | |
| $ | fields = array(), |
|||
| $ | values = null, |
|||
| $ | conditions = null | |||
| ) |
Generates and executes an SQL UPDATE statement for given model, fields, and values.
- Parameters:
-
Model $model array $fields array $values mixed $conditions
- Returns:
- array
Reimplemented from DboSource.
Definition at line 261 of file dbo_mysql.php.
References DboSource::$alias, DboSource::_getJoins(), DboSource::_prepareUpdateFields(), DboSource::conditions(), DboSource::defaultConditions(), DboSource::execute(), DboSource::fields(), DboSource::fullTableName(), DboSource::name(), and DboSource::renderStatement().
| 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 220 of file dbo_mysql.php.
References DboSource::boolean(), and DboSource::introspectType().
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 73 of file dbo_mysql.php.
| DboMysql::$_commands |
| DboMysql::$columns |
Initial value:
array(
'primary_key' => array('name' => 'NOT 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 87 of file dbo_mysql.php.
Referenced by dropSchema().
| DboMysql::$description = "MySQL DBO Driver" |
| DboMysql::$endQuote = "`" |
| DboMysql::$startQuote = "`" |
The documentation for this class was generated from the following file:
- 1.2.x.x/cake/libs/model/datasources/dbo/dbo_mysql.php