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

  • CMssqlColumnSchema
  • CMssqlCommandBuilder
  • CMssqlPdoAdapter
  • CMssqlSchema
  • CMssqlSqlsrvPdoAdapter
  • CMssqlTableSchema
  • Overview
  • Package
  • Class
  • Tree
 1: <?php
 2: /**
 3:  * CMssqlColumnSchema class file.
 4:  *
 5:  * @author Qiang Xue <qiang.xue@gmail.com>
 6:  * @author Christophe Boulain <Christophe.Boulain@gmail.com>
 7:  * @link http://www.yiiframework.com/
 8:  * @copyright 2008-2013 Yii Software LLC
 9:  * @license http://www.yiiframework.com/license/
10:  */
11: 
12: /**
13:  * CMssqlColumnSchema class describes the column meta data of a MSSQL table.
14:  *
15:  * @author Qiang Xue <qiang.xue@gmail.com>
16:  * @author Christophe Boulain <Christophe.Boulain@gmail.com>
17:  * @package system.db.schema.mssql
18:  */
19: class CMssqlColumnSchema extends CDbColumnSchema
20: {
21: 
22:     /**
23:      * Initializes the column with its DB type and default value.
24:      * This sets up the column's PHP type, size, precision, scale as well as default value.
25:      * @param string $dbType the column's DB type
26:      * @param mixed $defaultValue the default value
27:      */
28:     public function init($dbType, $defaultValue)
29:     {
30:         if ($defaultValue=='(NULL)')
31:         {
32:             $defaultValue=null;
33:         }
34:         parent::init($dbType, $defaultValue);
35:     }
36: 
37: 
38:     /**
39:      * Extracts the PHP type from DB type.
40:      * @param string $dbType DB type
41:      */
42:     protected function extractType($dbType)
43:     {
44:         if(strpos($dbType,'float')!==false || strpos($dbType,'real')!==false)
45:             $this->type='double';
46:         elseif(strpos($dbType,'bigint')===false && (strpos($dbType,'int')!==false || strpos($dbType,'smallint')!==false || strpos($dbType,'tinyint')))
47:             $this->type='integer';
48:         elseif(strpos($dbType,'bit')!==false)
49:             $this->type='boolean';
50:         else
51:             $this->type='string';
52:     }
53: 
54:     /**
55:      * Extracts the default value for the column.
56:      * The value is typecasted to correct PHP type.
57:      * @param mixed $defaultValue the default value obtained from metadata
58:      */
59:     protected function extractDefault($defaultValue)
60:     {
61:         if($this->dbType==='timestamp' )
62:             $this->defaultValue=null;
63:         else
64:             parent::extractDefault(str_replace(array('(',')',"'"), '', $defaultValue));
65:     }
66: 
67:     /**
68:      * Extracts size, precision and scale information from column's DB type.
69:      * We do nothing here, since sizes and precisions have been computed before.
70:      * @param string $dbType the column's DB type
71:      */
72:     protected function extractLimit($dbType)
73:     {
74:     }
75: 
76:     /**
77:      * Converts the input value to the type that this column is of.
78:      * @param mixed $value input value
79:      * @return mixed converted value
80:      */
81:     public function typecast($value)
82:     {
83:         if($this->type==='boolean')
84:             return $value ? 1 : 0;
85:         else
86:             return parent::typecast($value);
87:     }
88: }
89: 
API documentation generated by ApiGen 2.8.0