Overview

Packages

  • application
    • commands
    • components
      • actions
      • filters
      • leftWidget
      • permissions
      • sortableWidget
      • util
      • webupdater
      • x2flow
        • actions
        • triggers
      • X2GridView
      • X2Settings
    • controllers
    • models
      • embedded
    • modules
      • accounts
        • controllers
        • models
      • actions
        • controllers
        • models
      • calendar
        • controllers
        • models
      • charts
        • models
      • contacts
        • controllers
        • models
      • docs
        • components
        • controllers
        • models
      • groups
        • controllers
        • models
      • marketing
        • components
        • controllers
        • models
      • media
        • controllers
        • models
      • mobile
        • components
      • opportunities
        • controllers
        • models
      • products
        • controllers
        • models
      • quotes
        • controllers
        • models
      • services
        • controllers
        • models
      • template
        • models
      • users
        • controllers
        • models
      • workflow
        • controllers
        • models
      • x2Leads
        • controllers
        • models
  • Net
  • None
  • PHP
  • system
    • base
    • caching
      • dependencies
    • collections
    • console
    • db
      • ar
      • schema
        • cubrid
        • mssql
        • mysql
        • oci
        • pgsql
        • sqlite
    • i18n
      • gettext
    • logging
    • test
    • utils
    • validators
    • web
      • actions
      • auth
      • filters
      • form
      • helpers
      • renderers
      • services
      • widgets
        • captcha
        • pagers
  • Text
    • Highlighter
  • zii
    • behaviors
    • widgets
      • grid
      • jui

Classes

  • CDbColumnSchema
  • CDbCommandBuilder
  • CDbCriteria
  • CDbExpression
  • CDbSchema
  • CDbTableSchema
  • X2DbCriteria
  • Overview
  • Package
  • Class
  • Tree
 1: <?php
 2: /**
 3:  * CDbExpression class file.
 4:  *
 5:  * @author Qiang Xue <qiang.xue@gmail.com>
 6:  * @link http://www.yiiframework.com/
 7:  * @copyright 2008-2013 Yii Software LLC
 8:  * @license http://www.yiiframework.com/license/
 9:  */
10: 
11: /**
12:  * CDbExpression represents a DB expression that does not need escaping.
13:  * CDbExpression is mainly used in {@link CActiveRecord} as attribute values.
14:  * When inserting or updating a {@link CActiveRecord}, attribute values of
15:  * type CDbExpression will be directly put into the corresponding SQL statement
16:  * without escaping. A typical usage is that an attribute is set with 'NOW()'
17:  * expression so that saving the record would fill the corresponding column
18:  * with the current DB server timestamp.
19:  *
20:  * Starting from version 1.1.1, one can also specify parameters to be bound
21:  * for the expression. For example, if the expression is 'LOWER(:value)', then
22:  * one can set {@link params} to be <code>array(':value'=>$value)</code>.
23:  *
24:  * @author Qiang Xue <qiang.xue@gmail.com>
25:  * @package system.db.schema
26:  */
27: class CDbExpression extends CComponent
28: {
29:     /**
30:      * @var string the DB expression
31:      */
32:     public $expression;
33:     /**
34:      * @var array list of parameters that should be bound for this expression.
35:      * The keys are placeholders appearing in {@link expression}, while the values
36:      * are the corresponding parameter values.
37:      * @since 1.1.1
38:      */
39:     public $params=array();
40: 
41:     /**
42:      * Constructor.
43:      * @param string $expression the DB expression
44:      * @param array $params parameters
45:      */
46:     public function __construct($expression,$params=array())
47:     {
48:         $this->expression=$expression;
49:         $this->params=$params;
50:     }
51: 
52:     /**
53:      * String magic method
54:      * @return string the DB expression
55:      */
56:     public function __toString()
57:     {
58:         return $this->expression;
59:     }
60: }
API documentation generated by ApiGen 2.8.0