Class yii\db\sqlite\Command

Inheritanceyii\db\sqlite\Command » yii\db\Command » yii\base\Component » yii\base\BaseObject
Implementsyii\base\Configurable
Available since version2.0.14
Source Code https://github.com/yiisoft/yii2/blob/master/framework/db/sqlite/Command.php

Command represents an SQLite's SQL statement to be executed against a database.

{@inheritdoc}

Public Properties

Hide inherited properties

PropertyTypeDescriptionDefined By
$behaviors yii\base\Behavior[] List of behaviors attached to this component yii\base\Component
$db yii\db\Connection The DB connection that this command is associated with yii\db\Command
$fetchMode integer The default fetch mode for this command. yii\db\Command
$params array The parameters (name => value) that are bound to the current PDO statement. yii\db\Command
$pdoStatement PDOStatement The PDOStatement object that this command is associated with yii\db\Command
$queryCacheDependency yii\caching\Dependency The dependency to be associated with the cached query result for this command yii\db\Command
$queryCacheDuration integer The default number of seconds that query results can remain valid in cache. yii\db\Command
$rawSql string The SQL statement to be set. yii\db\Command
$sql string The SQL statement to be executed yii\db\Command

Public Methods

Hide inherited methods

MethodDescriptionDefined By
__call() Calls the named method which is not a class method. yii\base\Component
__clone() This method is called after the object is created by cloning an existing one. yii\base\Component
__construct() Constructor. yii\base\BaseObject
__get() Returns the value of a component property. yii\base\Component
__isset() Checks if a property is set, i.e. defined and not null. yii\base\Component
__set() Sets the value of a component property. yii\base\Component
__unset() Sets a component property to be null. yii\base\Component
addCheck() Creates a SQL command for adding a check constraint to an existing table. yii\db\Command
addColumn() Creates a SQL command for adding a new DB column. yii\db\Command
addCommentOnColumn() Builds a SQL command for adding comment to column. yii\db\Command
addCommentOnTable() Builds a SQL command for adding comment to table. yii\db\Command
addDefaultValue() Creates a SQL command for adding a default value constraint to an existing table. yii\db\Command
addForeignKey() Creates a SQL command for adding a foreign key constraint to an existing table. yii\db\Command
addPrimaryKey() Creates a SQL command for adding a primary key constraint to an existing table. yii\db\Command
addUnique() Creates a SQL command for adding an unique constraint to an existing table. yii\db\Command
alterColumn() Creates a SQL command for changing the definition of a column. yii\db\Command
attachBehavior() Attaches a behavior to this component. yii\base\Component
attachBehaviors() Attaches a list of behaviors to the component. yii\base\Component
batchInsert() Creates a batch INSERT command. yii\db\Command
behaviors() Returns a list of behaviors that this component should behave as. yii\base\Component
bindParam() Binds a parameter to the SQL statement to be executed. yii\db\Command
bindValue() Binds a value to a parameter. yii\db\Command
bindValues() Binds a list of values to the corresponding parameters. yii\db\Command
cache() Enables query cache for this command. yii\db\Command
canGetProperty() Returns a value indicating whether a property can be read. yii\base\Component
canSetProperty() Returns a value indicating whether a property can be set. yii\base\Component
cancel() Cancels the execution of the SQL statement. yii\db\Command
checkIntegrity() Builds a SQL command for enabling or disabling integrity check. yii\db\Command
className() Returns the fully qualified name of this class. yii\base\BaseObject
createIndex() Creates a SQL command for creating a new index. yii\db\Command
createTable() Creates a SQL command for creating a new DB table. yii\db\Command
createView() Creates a SQL View. yii\db\Command
delete() Creates a DELETE command. yii\db\Command
detachBehavior() Detaches a behavior from the component. yii\base\Component
detachBehaviors() Detaches all behaviors from the component. yii\base\Component
dropCheck() Creates a SQL command for dropping a check constraint. yii\db\Command
dropColumn() Creates a SQL command for dropping a DB column. yii\db\Command
dropCommentFromColumn() Builds a SQL command for dropping comment from column. yii\db\Command
dropCommentFromTable() Builds a SQL command for dropping comment from table. yii\db\Command
dropDefaultValue() Creates a SQL command for dropping a default value constraint. yii\db\Command
dropForeignKey() Creates a SQL command for dropping a foreign key constraint. yii\db\Command
dropIndex() Creates a SQL command for dropping an index. yii\db\Command
dropPrimaryKey() Creates a SQL command for removing a primary key constraint to an existing table. yii\db\Command
dropTable() Creates a SQL command for dropping a DB table. yii\db\Command
dropUnique() Creates a SQL command for dropping an unique constraint. yii\db\Command
dropView() Drops a SQL View. yii\db\Command
ensureBehaviors() Makes sure that the behaviors declared in behaviors() are attached to this component. yii\base\Component
execute() Executes the SQL statement. yii\db\sqlite\Command
executeResetSequence() Executes a db command resetting the sequence value of a table's primary key. yii\db\Command
getBehavior() Returns the named behavior object. yii\base\Component
getBehaviors() Returns all behaviors attached to this component. yii\base\Component
getRawSql() Returns the raw SQL by inserting parameter values into the corresponding placeholders in $sql. yii\db\Command
getSql() Returns the SQL statement for this command. yii\db\Command
hasEventHandlers() Returns a value indicating whether there is any handler attached to the named event. yii\base\Component
hasMethod() Returns a value indicating whether a method is defined. yii\base\Component
hasProperty() Returns a value indicating whether a property is defined for this component. yii\base\Component
init() Initializes the object. yii\base\BaseObject
insert() Creates an INSERT command. yii\db\Command
noCache() Disables query cache for this command. yii\db\Command
off() Detaches an existing event handler from this component. yii\base\Component
on() Attaches an event handler to an event. yii\base\Component
prepare() Prepares the SQL statement to be executed. yii\db\Command
query() Executes the SQL statement and returns query result. yii\db\Command
queryAll() Executes the SQL statement and returns ALL rows at once. yii\db\Command
queryColumn() Executes the SQL statement and returns the first column of the result. yii\db\Command
queryOne() Executes the SQL statement and returns the first row of the result. yii\db\Command
queryScalar() Executes the SQL statement and returns the value of the first column in the first row of data. yii\db\Command
renameColumn() Creates a SQL command for renaming a column. yii\db\Command
renameTable() Creates a SQL command for renaming a DB table. yii\db\Command
resetSequence() Creates a SQL command for resetting the sequence value of a table's primary key. yii\db\Command
setRawSql() Specifies the SQL statement to be executed. The SQL statement will not be modified in any way. yii\db\Command
setSql() Specifies the SQL statement to be executed. The SQL statement will be quoted using yii\db\Connection::quoteSql(). yii\db\Command
trigger() Triggers an event. yii\base\Component
truncateTable() Creates a SQL command for truncating a DB table. yii\db\Command
update() Creates an UPDATE command. yii\db\Command
upsert() Creates a command to insert rows into a database table if they do not already exist (matching unique constraints), or update them if they do. yii\db\Command

Protected Methods

Hide inherited methods

MethodDescriptionDefined By
bindPendingParams() Binds pending parameters that were registered via bindValue() and bindValues(). yii\db\Command
getCacheKey() Returns the cache key for the query. yii\db\Command
internalExecute() Executes a prepared statement. yii\db\Command
logQuery() Logs the current database query if query logging is enabled and returns the profiling token if profiling is enabled. yii\db\Command
queryInternal() Performs the actual DB query of a SQL statement. yii\db\sqlite\Command
refreshTableSchema() Refreshes table schema, which was marked by requireTableSchemaRefresh(). yii\db\Command
requireTableSchemaRefresh() Marks a specified table schema to be refreshed after command execution. yii\db\Command
requireTransaction() Marks the command to be executed in transaction. yii\db\Command
reset() Resets command properties to their initial state. yii\db\Command
setRetryHandler() Sets a callable (e.g. anonymous function) that is called when yii\db\Exception is thrown when executing the command. The signature of the callable should be: yii\db\Command

Method Details

execute() public method

Executes the SQL statement.

This method should only be used for executing non-query SQL statement, such as INSERT, DELETE, UPDATE SQLs. No result set will be returned.

public integer execute ( )
return integer

Number of rows affected by the execution.

throws yii\db\Exception

execution failed

queryInternal() protected method

Performs the actual DB query of a SQL statement.

protected mixed queryInternal ( $method, $fetchMode null )
$method string

Method of PDOStatement to be called

$fetchMode integer

The result fetch mode. Please refer to PHP manual for valid fetch modes. If this parameter is null, the value set in $fetchMode will be used.

return mixed

The method execution result

throws yii\db\Exception

if the query causes any problem