PHP Class BcSqlite

Inheritance: extends Sqlite
Mostrar archivo Open project: baserproject/basercms

Public Properties

Property Type Description
$columns array SQLite3 column definition
$description string ..
$endQuote string ..
$last_error
$pdo_statement
$row_count
$rows
$startQuote string ..

Protected Properties

Property Type Description
$_baseConfig array Base configuration settings for SQLite3 driver

Public Methods

Method Description
alterSchema ( array $compare, $table = null ) : array Generate a MySQL Alter Table syntax for the given Schema comparison
alterTable ( array $options ) : boolean テーブル構造を変更する
begin ( ) : boolean Begin a transaction TODO データベースがロックされてしまい正常に処理が実行されないのでとりあえず未実装とする ロックに関する原因については未解析
buildColumn ( array $column ) : string Generate a database-native column schema string
buildIndex ( array $indexes, string $table = null ) : string Removes redundant primary key indexes, as they are handled in the column def of the key.
buildRenameTable ( string $sourceName, string $targetName ) : string テーブル名のリネームステートメントを生成
column ( string $real ) : string Converts database-layer column types to basic types
commit ( ) : boolean Commit a transaction TODO データベースがロックされてしまい正常に処理が実行されないのでとりあえず未実装とする ロックに関する原因については未解析
connect ( ) : mixed Connects to the database using config['database'] as a filename.
describe ( $model ) : array Returns an array of the fields in given table name.
disconnect ( ) : boolean Disconnects from database.
dropColumn ( array $options ) : boolean カラムを削除する
fetchResult ( ) : unknown Fetches the next row from the current result set
hasResult ( ) PDO deals in objects, not resources, so overload accordingly.
index ( string $model ) : array Overrides DboSource::index to handle SQLite indexe introspection Returns an array of the indexes in given table name.
lastAffected ( $source = null ) : integer Returns number of affected rows in previous database operation. If no previous operation exists, this returns false.
lastError ( PDOStatement $query = null ) : string Returns a formatted error message from previous database operation.
lastInsertId ( $source = null ) : integer Returns the ID generated from the previous INSERT operation.
lastNumRows ( $source = null ) : integer Returns number of rows in previous resultset. If no previous resultset exists, this returns false.
limit ( integer $limit, integer $offset = null ) : string Returns a limit statement in the correct format for the particular database.
listSources ( $data = null ) : array Returns an array of tables in the database. If there are no tables, an error is raised and the application exits.
renameColumn ( array $options ) : boolean カラムを変更する
renderStatement ( string $type, array $data ) : string Overrides DboSource::renderStatement to handle schema generation with SQLite3-style indexes
resultSet ( mixed $results ) : void Generate ResultSet
rollback ( ) : boolean Rollback a transaction TODO データベースがロックされてしまい正常に処理が実行されないのでとりあえず未実装とする ロックに関する原因については未解析
update ( Model $model, array $fields = null, array $values = null, mixed $conditions = null ) : array Generates and executes an SQL UPDATE statement for given model, fields, and values.
value ( string $data, string $column = null, integer $safe = false ) : string Returns a quoted and escaped string of $data for use in an SQL statement.

Protected Methods

Method Description
_alterIndexes ( string $table, $indexes ) : array Generate index alteration statements for a table.
_convertCsvFieldsFromSchema ( array $schema ) : string スキーマ情報よりCSV形式のフィールドリストを取得する
_execute ( string $sql, $params = [], $prepareOptions = [] ) : resource Executes given SQL statement.
_moveData ( string $sourceTableName, string $targetTableName, array $schema ) : booelan テーブルからテーブルへデータを移動する

Private Methods

Method Description
__describe ( Model $model ) : mixed Returns a Model description (metadata) or null if none found.

Method Details

_alterIndexes() protected method

TODO 未サポート
protected _alterIndexes ( string $table, $indexes ) : array
$table string Table to alter indexes for
return array Index alteration statements

_convertCsvFieldsFromSchema() protected method

スキーマ情報よりCSV形式のフィールドリストを取得する
protected _convertCsvFieldsFromSchema ( array $schema ) : string
$schema array
return string

_execute() protected method

Executes given SQL statement.
protected _execute ( string $sql, $params = [], $prepareOptions = [] ) : resource
$sql string SQL statement
return resource Result resource identifier

_moveData() protected method

テーブルからテーブルへデータを移動する
protected _moveData ( string $sourceTableName, string $targetTableName, array $schema ) : booelan
$sourceTableName string
$targetTableName string
$schema array
return booelan

alterSchema() public method

Generate a MySQL Alter Table syntax for the given Schema comparison
public alterSchema ( array $compare, $table = null ) : array
$compare array Result of a CakeSchema::compare()
return array Array of alter statements to make.

alterTable() public method

テーブル構造を変更する
public alterTable ( array $options ) : boolean
$options array [ new / old ]
return boolean

begin() public method

Begin a transaction TODO データベースがロックされてしまい正常に処理が実行されないのでとりあえず未実装とする ロックに関する原因については未解析
public begin ( ) : boolean
return boolean True on success, false on fail (i.e. if the database/model does not support transactions).

buildColumn() public method

Generate a database-native column schema string
public buildColumn ( array $column ) : string
$column array An array structured like the following: array('name'=>'value', 'type'=>'value'[, options]), where options can be 'default', 'length', or 'key'.
return string

buildIndex() public method

Removes redundant primary key indexes, as they are handled in the column def of the key.
public buildIndex ( array $indexes, string $table = null ) : string
$indexes array
$table string
return string

buildRenameTable() public method

テーブル名のリネームステートメントを生成
public buildRenameTable ( string $sourceName, string $targetName ) : string
$sourceName string
$targetName string
return string

column() public method

Converts database-layer column types to basic types
public column ( string $real ) : string
$real string Real database-layer column type (i.e. "varchar(255)")
return string Abstract column type (i.e. "string")

commit() public method

Commit a transaction TODO データベースがロックされてしまい正常に処理が実行されないのでとりあえず未実装とする ロックに関する原因については未解析
public commit ( ) : boolean
return boolean True on success, false on fail (i.e. if the database/model does not support transactions, or a transaction has not started).

connect() public method

Connects to the database using config['database'] as a filename.
public connect ( ) : mixed
return mixed

describe() public method

Returns an array of the fields in given table name.
public describe ( $model ) : array
return array Fields in table. Keys are name and type

disconnect() public method

Disconnects from database.
public disconnect ( ) : boolean
return boolean True if the database could be disconnected, else false

dropColumn() public method

カラムを削除する
public dropColumn ( array $options ) : boolean
$options array [ table / field / prefix ]
return boolean

fetchResult() public method

Fetches the next row from the current result set
public fetchResult ( ) : unknown
return unknown

hasResult() public method

PDO deals in objects, not resources, so overload accordingly.
public hasResult ( )

index() public method

Overrides DboSource::index to handle SQLite indexe introspection Returns an array of the indexes in given table name.
public index ( string $model ) : array
$model string Name of model to inspect
return array Fields in table. Keys are column and unique

lastAffected() public method

Returns number of affected rows in previous database operation. If no previous operation exists, this returns false.
public lastAffected ( $source = null ) : integer
return integer Number of affected rows

lastError() public method

Returns a formatted error message from previous database operation.
public lastError ( PDOStatement $query = null ) : string
$query PDOStatement
return string Error message

lastInsertId() public method

Returns the ID generated from the previous INSERT operation.
public lastInsertId ( $source = null ) : integer
return integer

lastNumRows() public method

Returns number of rows in previous resultset. If no previous resultset exists, this returns false.
public lastNumRows ( $source = null ) : integer
return integer Number of rows in resultset

limit() public method

Returns a limit statement in the correct format for the particular database.
public limit ( integer $limit, integer $offset = null ) : string
$limit integer Limit of results returned
$offset integer Offset from which to start results
return string SQL limit/offset statement

listSources() public method

Returns an array of tables in the database. If there are no tables, an error is raised and the application exits.
public listSources ( $data = null ) : array
return array Array of tablenames in the database

renameColumn() public method

カラムを変更する
public renameColumn ( array $options ) : boolean
$options array [ table / new / old ]
return boolean

renderStatement() public method

Overrides DboSource::renderStatement to handle schema generation with SQLite3-style indexes
public renderStatement ( string $type, array $data ) : string
$type string
$data array
return string

resultSet() public method

Generate ResultSet
public resultSet ( mixed $results ) : void
$results mixed The results to modify.
return void

rollback() public method

Rollback a transaction TODO データベースがロックされてしまい正常に処理が実行されないのでとりあえず未実装とする ロックに関する原因については未解析
public rollback ( ) : boolean
return boolean True on success, false on fail (i.e. if the database/model does not support transactions, or a transaction has not started).

update() public method

Generates and executes an SQL UPDATE statement for given model, fields, and values.
public update ( Model $model, array $fields = null, array $values = null, mixed $conditions = null ) : array
$model Model
$fields array
$values array
$conditions mixed
return array

value() public method

Returns a quoted and escaped string of $data for use in an SQL statement.
public value ( string $data, string $column = null, integer $safe = false ) : string
$data string String to be prepared for use in an SQL statement
$column string
$safe integer
return string Quoted and escaped

Property Details

$_baseConfig protected_oe property

Base configuration settings for SQLite3 driver
protected array $_baseConfig
return array

$columns public_oe property

SQLite3 column definition
public array $columns
return array

$description public_oe property

..
public string $description
return string

$endQuote public_oe property

..
public string $endQuote
return string

$last_error public_oe property

public $last_error

$pdo_statement public_oe property

public $pdo_statement

$row_count public_oe property

public $row_count

$rows public_oe property

public $rows

$startQuote public_oe property

..
public string $startQuote
return string