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 |
鍏叡鏂规硶
鍙椾繚鎶ゆ柟娉
鏂规硶 | 鎻忚堪 | 瀹氫箟鍦 |
---|---|---|
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绫诲瀷銆