示例#1
0
 /**
  * @param SqlBinder $binds
  * @return null|string
  */
 public function compileSql(&$binds = null)
 {
     if (!$this->isValid()) {
         return null;
     }
     $value = SqlCompilerDefault::compileRef($this->column, $binds);
     $value = implode(', ', SqlHelper::toArray($value));
     $mods = $this->mods;
     krsort($mods);
     foreach ($mods as $mod) {
         $value = $mod . ' ' . $value;
     }
     return $value;
 }
示例#2
0
 /**
  * @param SqlBinder $binds
  * @return null|string
  */
 public function compileSql(&$binds = null)
 {
     if (!$this->isValid()) {
         return null;
     }
     $value = SqlCompilerDefault::compileComponent($this->value, $binds);
     if (!$this->isColumn) {
         if (!is_null($this->data_type)) {
             $value = $binds->bindValue($value, $this->data_type);
         } else {
             $value = $binds->bindValue($value);
         }
     } else {
         $value = SqlCompilerDefault::compileRef($value);
     }
     foreach ($this->functions as $function) {
         $value = $function[0] . $value . SqlHelper::array_element(1, $function);
     }
     return $value;
 }