예제 #1
0
 /**
  * Override method to perform a property "Set"
  * This will set the property $strName to be $mixValue
  *
  * @param string strName Name of the property to set
  * @param string mixValue New value of the property
  * @return mixed
  */
 public function __set($strName, $mixValue)
 {
     try {
         switch ($strName) {
             case 'OwnerTable':
                 return $this->objOwnerTable = QType::cast($mixValue, 'QTable');
             case 'PrimaryKey':
                 return $this->blnPrimaryKey = QType::Cast($mixValue, QType::Boolean);
             case 'Name':
                 return $this->strName = QType::Cast($mixValue, QType::String);
             case 'PropertyName':
                 return $this->strPropertyName = QType::Cast($mixValue, QType::String);
             case 'VariableName':
                 return $this->strVariableName = QType::Cast($mixValue, QType::String);
             case 'VariableType':
                 return $this->strVariableType = QType::Cast($mixValue, QType::String);
             case 'VariableTypeAsConstant':
                 return $this->strVariableTypeAsConstant = QType::Cast($mixValue, QType::String);
             case 'DbType':
                 return $this->strDbType = QType::Cast($mixValue, QType::String);
             case 'Length':
                 return $this->intLength = QType::Cast($mixValue, QType::Integer);
             case 'Default':
                 if ($mixValue === null || ($mixValue == '' || $mixValue == '0000-00-00 00:00:00' || $mixValue == '0000-00-00') && !$this->blnNotNull) {
                     return $this->mixDefault = null;
                 } else {
                     if (is_int($mixValue)) {
                         return $this->mixDefault = QType::Cast($mixValue, QType::Integer);
                     } else {
                         if (is_numeric($mixValue)) {
                             return $this->mixDefault = QType::Cast($mixValue, QType::Float);
                         } else {
                             return $this->mixDefault = QType::Cast($mixValue, QType::String);
                         }
                     }
                 }
             case 'NotNull':
                 return $this->blnNotNull = QType::Cast($mixValue, QType::Boolean);
             case 'Identity':
                 return $this->blnIdentity = QType::Cast($mixValue, QType::Boolean);
             case 'Indexed':
                 return $this->blnIndexed = QType::Cast($mixValue, QType::Boolean);
             case 'Unique':
                 return $this->blnUnique = QType::Cast($mixValue, QType::Boolean);
             case 'Timestamp':
                 return $this->blnTimestamp = QType::Cast($mixValue, QType::Boolean);
             case 'Reference':
                 return $this->objReference = QType::Cast($mixValue, 'QReference');
             case 'Comment':
                 return $this->strComment = QType::Cast($mixValue, QType::String);
             default:
                 return parent::__set($strName, $mixValue);
         }
     } catch (QCallerException $objExc) {
         $objExc->IncrementOffset();
         throw $objExc;
     }
 }