Yii Framework v1.1.10 绫诲弬鑰

CPgsqlColumnSchema

system.db.schema.pgsql
缁ф壙 class CPgsqlColumnSchema » CDbColumnSchema » CComponent
婧愯嚜 1.0
鐗堟湰 $Id: CPgsqlColumnSchema.php 2799 2011-01-01 19:31:13Z qiang.xue $
婧愮爜 framework/db/schema/pgsql/CPgsqlColumnSchema.php
CPgsqlColumnSchema鎻忚堪PostgreSQL琛ㄧ殑鍒楀厓鏁版嵁銆

鍏叡灞炴

闅愯棌缁ф壙灞炴

灞炴绫诲瀷鎻忚堪瀹氫箟鍦
allowNull boolean 璇ュ垪鏄惁鍙互涓簄ull CDbColumnSchema
autoIncrement boolean 璇ュ垪鏄惁涓鸿嚜澧炲垪 CDbColumnSchema
dbType string 璇ュ垪鐨勬暟鎹被鍨嬨 CDbColumnSchema
defaultValue mixed 璇ュ垪鐨勯粯璁ゅ CDbColumnSchema
isForeignKey boolean 璇ュ垪鏄惁涓哄閿 CDbColumnSchema
isPrimaryKey boolean 璇ュ垪鏄惁涓轰富閿 CDbColumnSchema
name string 鍒楀悕锛堟棤寮曞彿锛夈 CDbColumnSchema
precision integer 璇ュ垪鏁版嵁鐨勭簿搴︼紝鑻ュ畠鏄竴涓暟銆 CDbColumnSchema
rawName string 鍘熷鍒楀悕銆傚畠琚紩鐢ㄤ簡浠ヤ究鍦⊿QL鏌ヨ涓娇鐢ㄣ CDbColumnSchema
scale integer 璇ュ垪鏁版嵁鐨勮妯★紝鑻ュ畠鏄竴涓暟銆 CDbColumnSchema
size integer 璇ュ垪鐨勫ぇ灏忋 CDbColumnSchema
type string 璇ュ垪鐨凥P绫诲瀷銆 CDbColumnSchema

鍏叡鏂规硶

闅愯棌缁ф壙鏂规硶

鏂规硶鎻忚堪瀹氫箟鍦
__call() 濡傛灉绫讳腑娌℃湁璋冪殑鏂规硶鍚嶏紝鍒欒皟鐢ㄨ繖涓柟娉曘 CComponent
__get() 杩斿洖涓涓睘鎬у笺佷竴涓簨浠跺鐞嗙▼搴忓垪琛ㄦ垨涓涓涓哄悕绉般 CComponent
__isset() 妫鏌ヤ竴涓睘鎬ф槸鍚︿负null銆 CComponent
__set() 璁剧疆涓涓粍浠剁殑灞炴у笺 CComponent
__unset() 璁剧疆涓涓粍浠剁殑灞炴т负null銆 CComponent
asa() 杩斿洖杩欎釜鍚嶅瓧鐨勮涓哄璞° CComponent
attachBehavior() 闄勫姞涓涓涓哄埌缁勪欢銆 CComponent
attachBehaviors() 闄勫姞涓涓涓哄垪琛ㄥ埌缁勪欢銆 CComponent
attachEventHandler() 涓轰簨浠堕檮鍔犱竴涓簨浠跺鐞嗙▼搴忋 CComponent
canGetProperty() 纭畾灞炴ф槸鍚﹀彲璇汇 CComponent
canSetProperty() 纭畾灞炴ф槸鍚﹀彲鍐欍 CComponent
detachBehavior() 浠庣粍浠朵腑鍒嗙涓涓涓恒 CComponent
detachBehaviors() 浠庣粍浠朵腑鍒嗙鎵鏈夎涓恒 CComponent
detachEventHandler() 鍒嗙涓涓瓨鍦ㄧ殑浜嬩欢澶勭悊绋嬪簭銆 CComponent
disableBehavior() 绂佺敤涓涓檮鍔犺涓恒 CComponent
disableBehaviors() 绂佺敤缁勪欢闄勫姞鐨勬墍鏈夎涓恒 CComponent
enableBehavior() 鍚敤涓涓檮鍔犺涓恒 CComponent
enableBehaviors() 鍚敤缁勪欢闄勫姞鐨勬墍鏈夎涓恒 CComponent
evaluateExpression() 璁$畻涓涓狿HP琛ㄨ揪寮忥紝鎴栨牴鎹粍浠朵笂涓嬫枃鎵ц鍥炶皟銆 CComponent
getEventHandlers() 杩斿洖涓涓簨浠剁殑闄勫姞澶勭悊绋嬪簭鍒楄〃銆 CComponent
hasEvent() 纭畾涓涓簨浠舵槸鍚﹀畾涔夈 CComponent
hasEventHandler() 妫鏌ヤ簨浠舵槸鍚︽湁闄勫姞鐨勫鐞嗙▼搴忋 CComponent
hasProperty() 纭畾灞炴ф槸鍚﹁瀹氫箟銆 CComponent
init() 鏍规嵁瀹冪殑鏁版嵁绫诲瀷鍜岄粯璁ゅ煎垵濮嬪寲璇ュ垪銆 CDbColumnSchema
raiseEvent() 鍙戣捣涓涓簨浠躲 CComponent
typecast() 灏嗚緭鍏ュ艰浆鎹负鏈垪鐨勭被鍨嬨 CDbColumnSchema

鍙椾繚鎶ゆ柟娉

闅愯棌缁ф壙鏂规硶

鏂规硶鎻忚堪瀹氫箟鍦
extractDefault() 鎻愬彇鍒楃殑榛樿鍊笺 CPgsqlColumnSchema
extractLimit() 浠庡垪绫诲瀷涓彁鍙栧ぇ灏忋佺簿纭害鍜岃妯° CDbColumnSchema
extractType() 浠庢暟鎹被鍨嬩腑鎻愬彇PHP绫诲瀷銆 CPgsqlColumnSchema

鏂规硶璇︾粏

extractDefault() 鏂规硶
protected void extractDefault(mixed $defaultValue)
$defaultValue mixed 浠庡厓鏁版嵁涓幏寰楃殑榛樿鍊笺
婧愮爜锛 framework/db/schema/pgsql/CPgsqlColumnSchema.php#44 (鏄剧ず)
protected function extractDefault($defaultValue)
{
    if(
$defaultValue==='true')
        
$this->defaultValue=true;
    else if(
$defaultValue==='false')
        
$this->defaultValue=false;
    else if(
strpos($defaultValue,'nextval')===0)
        
$this->defaultValue=null;
    else if(
preg_match('/^\'(.*)\'::/',$defaultValue,$matches))
        
$this->defaultValue=$this->typecast(str_replace("''","'",$matches[1]));
    else if(
preg_match('/^-?\d+(\.\d*)?$/',$defaultValue,$matches))
        
$this->defaultValue=$this->typecast($defaultValue);
    
// else is null
}

鎻愬彇鍒楃殑榛樿鍊笺 璇ュ间細琚浆鎹㈠埌姝g‘鐨凱HP绫诲瀷銆

extractType() 鏂规硶
protected void extractType(string $dbType)
$dbType string 鏁版嵁绫诲瀷
婧愮爜锛 framework/db/schema/pgsql/CPgsqlColumnSchema.php#25 (鏄剧ず)
protected function extractType($dbType)
{
    if(
strpos($dbType,'[')!==false || strpos($dbType,'char')!==false || strpos($dbType,'text')!==false)
        
$this->type='string';
    else if(
strpos($dbType,'bool')!==false)
        
$this->type='boolean';
    else if(
preg_match('/(real|float|double)/',$dbType))
        
$this->type='double';
    else if(
preg_match('/(integer|oid|serial|smallint)/',$dbType))
        
$this->type='integer';
    else
        
$this->type='string';
}

浠庢暟鎹被鍨嬩腑鎻愬彇PHP绫诲瀷銆

Copyright © 2008-2011 by Yii Software LLC
All Rights Reserved.