CSqliteCommandBuilder
| 包 | system.db.schema.sqlite |
|---|---|
| 继承 | class CSqliteCommandBuilder » CDbCommandBuilder » CComponent |
| 源自 | 1.0 |
| 版本 | $Id: CSqliteCommandBuilder.php 3515 2011-12-28 12:29:24Z mdomba $ |
| 源码 | framework/db/schema/sqlite/CSqliteCommandBuilder.php |
CSqliteCommandBuilder提供为SQLite表创建查询语句的基本方法。
公共属性
| 属性 | 类型 | 描述 | 定义在 |
|---|---|---|---|
| dbConnection | CDbConnection | database connection. | CDbCommandBuilder |
| schema | CDbSchema | the schema for this command builder. | CDbCommandBuilder |
公共方法
| 方法 | 描述 | 定义在 |
|---|---|---|
| __call() | 如果类中没有调的方法名,则调用这个方法。 | CComponent |
| __construct() | CDbCommandBuilder | |
| __get() | 返回一个属性值、一个事件处理程序列表或一个行为名称。 | CComponent |
| __isset() | 检查一个属性是否为null。 | CComponent |
| __set() | 设置一个组件的属性值。 | CComponent |
| __unset() | 设置一个组件的属性为null。 | CComponent |
| applyCondition() | Alters the SQL to apply WHERE clause. | CDbCommandBuilder |
| applyGroup() | Alters the SQL to apply GROUP BY. | CDbCommandBuilder |
| applyHaving() | Alters the SQL to apply HAVING. | CDbCommandBuilder |
| applyJoin() | Alters the SQL to apply JOIN clause. | CDbCommandBuilder |
| applyLimit() | Alters the SQL to apply LIMIT and OFFSET. | CDbCommandBuilder |
| applyOrder() | Alters the SQL to apply ORDER BY. | CDbCommandBuilder |
| asa() | 返回这个名字的行为对象。 | CComponent |
| attachBehavior() | 附加一个行为到组件。 | CComponent |
| attachBehaviors() | 附加一个行为列表到组件。 | CComponent |
| attachEventHandler() | 为事件附加一个事件处理程序。 | CComponent |
| bindValues() | Binds parameter values for an SQL command. | CDbCommandBuilder |
| canGetProperty() | 确定属性是否可读。 | CComponent |
| canSetProperty() | 确定属性是否可写。 | CComponent |
| createColumnCriteria() | Creates a query criteria with the specified column values. | CDbCommandBuilder |
| createCountCommand() | Creates a COUNT(*) command for a single table. | CDbCommandBuilder |
| createCriteria() | Creates a query criteria. | CDbCommandBuilder |
| createDeleteCommand() | Creates a DELETE command. | CDbCommandBuilder |
| createFindCommand() | Creates a SELECT command for a single table. | CDbCommandBuilder |
| createInCondition() | Generates the expression for selecting rows of specified primary key values. | CDbCommandBuilder |
| createInsertCommand() | Creates an INSERT command. | CDbCommandBuilder |
| createPkCondition() | Generates the expression for selecting rows of specified primary key values. | CDbCommandBuilder |
| createPkCriteria() | Creates a query criteria with the specified primary key. | CDbCommandBuilder |
| createSearchCondition() | Generates the expression for searching the specified keywords within a list of columns. | CDbCommandBuilder |
| createSqlCommand() | Creates a command based on a given SQL statement. | CDbCommandBuilder |
| createUpdateCommand() | Creates an UPDATE command. | CDbCommandBuilder |
| createUpdateCounterCommand() | Creates an UPDATE command that increments/decrements certain columns. | CDbCommandBuilder |
| detachBehavior() | 从组件中分离一个行为。 | CComponent |
| detachBehaviors() | 从组件中分离所有行为。 | CComponent |
| detachEventHandler() | 分离一个存在的事件处理程序。 | CComponent |
| disableBehavior() | 禁用一个附加行为。 | CComponent |
| disableBehaviors() | 禁用组件附加的所有行为。 | CComponent |
| enableBehavior() | 启用一个附加行为。 | CComponent |
| enableBehaviors() | 启用组件附加的所有行为。 | CComponent |
| evaluateExpression() | 计算一个PHP表达式,或根据组件上下文执行回调。 | CComponent |
| getDbConnection() | 返回database connection. | CDbCommandBuilder |
| getEventHandlers() | 返回一个事件的附加处理程序列表。 | CComponent |
| getLastInsertID() | Returns the last insertion ID for the specified table. | CDbCommandBuilder |
| getSchema() | 返回the schema for this command builder. | CDbCommandBuilder |
| hasEvent() | 确定一个事件是否定义。 | CComponent |
| hasEventHandler() | 检查事件是否有附加的处理程序。 | CComponent |
| hasProperty() | 确定属性是否被定义。 | CComponent |
| raiseEvent() | 发起一个事件。 | CComponent |
受保护方法
| 方法 | 描述 | 定义在 |
|---|---|---|
| createCompositeInCondition() | 生成根据指定符合键选择行的表达式。 | CSqliteCommandBuilder |
| ensureTable() | Checks if the parameter is a valid table schema. | CDbCommandBuilder |
方法详细
createCompositeInCondition()
方法
|
protected string createCompositeInCondition(CDbTableSchema $table, array $values, string $prefix)
| ||
| $table | CDbTableSchema | 表schema |
| $values | array | 要选择的主键值列表 |
| $prefix | string | 列前缀(以.结束) |
| {return} | string | 选择的表达式 |
源码: framework/db/schema/sqlite/CSqliteCommandBuilder.php#30 (显示)
protected function createCompositeInCondition($table,$values,$prefix)
{
$keyNames=array();
foreach(array_keys($values[0]) as $name)
$keyNames[]=$prefix.$table->columns[$name]->rawName;
$vs=array();
foreach($values as $value)
$vs[]=implode("||','||",$value);
return implode("||','||",$keyNames).' IN ('.implode(', ',$vs).')';
}
生成根据指定符合键选择行的表达式。 该方法被重写了,因为SQLite不支持 带有复合列的默认IN表达式。