DboSqlite Class Reference

Public Member Functions | |
| _execute ($sql) | |
| buildColumn ($column) | |
| buildIndex ($indexes, $table=null) | |
| column ($real) | |
| connect () | |
| describe (&$model) | |
| disconnect () | |
| execute ($sql) | |
| fetchResult () | |
| getEncoding () | |
| lastAffected () | |
| lastError () | |
| lastInsertId () | |
| lastNumRows () | |
| limit ($limit, $offset=null) | |
| listSources () | |
| renderStatement ($type, $data) | |
| resultSet (&$results) | |
| setEncoding ($enc) | |
| truncate ($table) | |
| update (&$model, $fields=array(), $values=null, $conditions=null) | |
| value ($data, $column=null, $safe=false) | |
Public Attributes | |
| $_baseConfig | |
| $_commands | |
| $_queryStats = array() | |
| $columns | |
| $description = "SQLite DBO Driver" | |
| $endQuote = '"' | |
| $startQuote = '"' | |
Detailed Description
Definition at line 38 of file dbo_sqlite.php.
Member Function Documentation
| DboSqlite::_execute | ( | $ | sql | ) |
Executes given SQL statement.
- Parameters:
-
string $sql SQL statement
- Returns:
- resource Result resource identifier
Definition at line 136 of file dbo_sqlite.php.
References fetchResult(), and resultSet().
Referenced by connect(), and setEncoding().
| DboSqlite::buildColumn | ( | $ | column | ) |
Generate a database-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 441 of file dbo_sqlite.php.
References $out, DboSource::length(), limit(), DboSource::name(), and value().
| DboSqlite::buildIndex | ( | $ | indexes, | |
| $ | table = null | |||
| ) |
Removes redundant primary key indexes, as they are handled in the column def of the key.
- Parameters:
-
array $indexes string $table
- Returns:
- string
Reimplemented from DboSource.
Definition at line 514 of file dbo_sqlite.php.
References $out, column(), and DboSource::name().
| DboSqlite::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 337 of file dbo_sqlite.php.
References limit(), and DboSource::name().
Referenced by buildIndex(), and describe().
| DboSqlite::connect | ( | ) |
Connects to the database using config['database'] as a filename.
- Parameters:
-
array $config Configuration array for connecting
- Returns:
- mixed
Definition at line 110 of file dbo_sqlite.php.
References DataSource::$config, _execute(), and config().
| DboSqlite::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 193 of file dbo_sqlite.php.
References column(), DboSource::fetchAll(), DboSource::fullTableName(), DboSource::index(), DboSource::length(), and DboSource::name().
| DboSqlite::disconnect | ( | ) |
Disconnects from database.
- Returns:
- boolean True if the database could be disconnected, else false
Definition at line 125 of file dbo_sqlite.php.
| DboSqlite::execute | ( | $ | sql | ) |
Overrides DboSource::execute() to correctly handle query statistics
- Parameters:
-
string $sql
- Returns:
- unknown
Reimplemented from DboSource.
Definition at line 151 of file dbo_sqlite.php.
Referenced by truncate().
| DboSqlite::fetchResult | ( | ) |
Fetches the next row from the current result set
- Returns:
- unknown
Definition at line 394 of file dbo_sqlite.php.
References DboSource::$index.
Referenced by _execute().
| DboSqlite::getEncoding | ( | ) |
Gets the database encoding
- Returns:
- string The database encoding
Definition at line 504 of file dbo_sqlite.php.
References DboSource::fetchRow().
| DboSqlite::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 301 of file dbo_sqlite.php.
| DboSqlite::lastError | ( | ) |
Returns a formatted error message from previous database operation.
- Returns:
- string Error message
Definition at line 289 of file dbo_sqlite.php.
References DataSource::$error.
| DboSqlite::lastInsertId | ( | ) |
Returns the ID generated from the previous INSERT operation.
- Returns:
- int
Definition at line 328 of file dbo_sqlite.php.
| DboSqlite::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 317 of file dbo_sqlite.php.
References DboSource::hasResult().
| DboSqlite::limit | ( | $ | limit, | |
| $ | offset = null | |||
| ) |
Returns a limit statement in the correct format for the particular database.
- Parameters:
-
integer $limit Limit of results returned integer $offset Offset from which to start results
- Returns:
- string SQL limit/offset statement
Reimplemented from DboSource.
Definition at line 420 of file dbo_sqlite.php.
Referenced by buildColumn(), and column().
| DboSqlite::listSources | ( | ) |
Returns an array of tables in the database. If there are no tables, an error is raised and the application exits.
- Returns:
- array Array of tablenames in the database
Definition at line 161 of file dbo_sqlite.php.
References config(), DboSource::fetchAll(), and DboSource::name().
| DboSqlite::renderStatement | ( | $ | type, | |
| $ | data | |||
| ) |
Overrides DboSource::renderStatement to handle schema generation with SQLite-style indexes
- Parameters:
-
string $type array $data
- Returns:
- string
Reimplemented from DboSource.
Definition at line 544 of file dbo_sqlite.php.
| DboSqlite::resultSet | ( | &$ | results | ) |
Enter description here...
- Parameters:
-
unknown_type $results
Definition at line 371 of file dbo_sqlite.php.
References DboSource::$index.
Referenced by _execute().
| DboSqlite::setEncoding | ( | $ | enc | ) |
Sets the database encoding
- Parameters:
-
string $enc Database encoding
Definition at line 493 of file dbo_sqlite.php.
References _execute().
| DboSqlite::truncate | ( | $ | table | ) |
Deletes all the records in a table and resets the count of the auto-incrementing primary key, where applicable.
- Parameters:
-
mixed $table A string or model class representing the table to be truncated
- Returns:
- boolean SQL TRUNCATE TABLE statement, false if not applicable. public
Reimplemented from DboSource.
Definition at line 281 of file dbo_sqlite.php.
References execute(), and DboSource::fullTableName().
| DboSqlite::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 259 of file dbo_sqlite.php.
| DboSqlite::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
- Returns:
- string Quoted and escaped
Definition at line 228 of file dbo_sqlite.php.
References DboSource::boolean().
Referenced by buildColumn().
Member Data Documentation
| DboSqlite::$_baseConfig |
Initial value:
array(
'persistent' => true,
'database' => null,
'connect' => 'sqlite_popen'
)
Reimplemented from DataSource.
Definition at line 70 of file dbo_sqlite.php.
| DboSqlite::$_commands |
| DboSqlite::$_queryStats = array() |
Definition at line 64 of file dbo_sqlite.php.
| DboSqlite::$columns |
Initial value:
array(
'primary_key' => array('name' => 'integer primary key'),
'string' => array('name' => 'varchar', 'limit' => '255'),
'text' => array('name' => 'text'),
'integer' => array('name' => 'integer', 'limit' => null, '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' => 'boolean')
)
Definition at line 91 of file dbo_sqlite.php.
| DboSqlite::$description = "SQLite DBO Driver" |
| DboSqlite::$endQuote = '"' |
| DboSqlite::$startQuote = '"' |
The documentation for this class was generated from the following file:
- 1.2.x.x/cake/libs/model/datasources/dbo/dbo_sqlite.php