示例#1
0
 public function onCreateTable(\Extasy\ORM\QueryBuilder $queryBuilder)
 {
     $queryBuilder->addFields(sprintf('`%s` int not null default 0', $this->szFieldName));
     if (!empty($this->fieldInfo['index'])) {
         $queryBuilder->addFields(sprintf('index `search_%s` (`%s`)', $this->szFieldName, $this->szFieldName));
     }
 }
示例#2
0
 public function onUpdate(\Extasy\ORM\QueryBuilder $query)
 {
     $query->setSet($this->szFieldName, serialize($this->aValue));
 }
示例#3
0
 public function onCreateTable(\Extasy\ORM\QueryBuilder $queryBuilder)
 {
     $queryBuilder->addFields(sprintf('`%s` int not null default 0', $this->szFieldName));
 }
示例#4
0
 public function Update(\Extasy\ORM\QueryBuilder $query)
 {
     $query->setSet($this->szFieldName, $this->aValue);
     $this->generateImage();
 }
示例#5
0
文件: Index.php 项目: gudwin/extasy
 public function onCreateTable(\Extasy\ORM\QueryBuilder $queryBuilder)
 {
     $queryBuilder->addFields(sprintf('`%s` int not null auto_increment', $this->szFieldName));
     $queryBuilder->addFields(sprintf('primary key (`%s`) ', $this->szFieldName));
     $queryBuilder->setTableOptions('AUTO_INCREMENT=1');
 }
示例#6
0
 function onUpdate(\Extasy\ORM\QueryBuilder $query)
 {
     $this->formatValue();
     //
     $query->setSet($this->szFieldName, $this->aValue);
 }
示例#7
0
文件: Model.php 项目: gudwin/extasy
 public function createDatabaseTable($dropTable = false)
 {
     $fields = static::getFieldsInfo();
     if ($dropTable) {
         $sql = sprintf('DROP TABLE IF EXISTS `%s`', $fields['table']);
         DB::post($sql);
     }
     $queryBuilder = new \Extasy\ORM\QueryBuilder('create');
     $queryBuilder->setTableName($fields['table']);
     foreach ($this->columns as $column) {
         $column->onCreateTable($queryBuilder);
     }
     $sql = $queryBuilder->prepare();
     DB::post($sql);
 }
示例#8
0
 function onUpdate(\Extasy\ORM\QueryBuilder $query)
 {
     $this->aValue = $this->calculateValue();
     $query->setSet($this->szFieldName, $this->aValue);
 }
示例#9
0
文件: Model.php 项目: gudwin/extasy
 public function delete()
 {
     $queryBuilder = new QueryBuilder('delete');
     $queryBuilder->setFrom(static::getTableName());
     foreach ($this->columns as $column) {
         $column->onDelete($queryBuilder);
     }
     $sql = $queryBuilder->prepare();
     DB::post($sql);
     EventController::callEvent('document_delete', $this);
     // unset all columns
     foreach ($this->columns as $key => $row) {
         unset($this->columns[$key]);
     }
     $this->columns = [];
 }
示例#10
0
 /**
  * (non-PHPdoc)
  * @see \Extasy\Columns\BaseColumn::onInsert()
  */
 function onInsert(\Extasy\ORM\QueryBuilder $query)
 {
     $values = serialize($this->aValue);
     $query->setSet($this->szFieldName, $this->aValue);
 }
示例#11
0
 /**
  * 
  */
 public function onUpdate(\Extasy\ORM\QueryBuilder $query)
 {
     $value = $this->getSerializedValue();
     $query->setSet($this->szFieldName, $value);
 }
示例#12
0
 public function onCreateTable(\Extasy\ORM\QueryBuilder $queryBuilder)
 {
     $queryBuilder->addFields(sprintf('`%s` datetime not null default "0000-00-00 00:00:00"', $this->szFieldName));
 }
示例#13
0
文件: Boolean.php 项目: gudwin/extasy
 public function onCreateTable(\Extasy\ORM\QueryBuilder $queryBuilder)
 {
     $queryBuilder->addFields(sprintf('`%s` bool not null default 0', $this->szFieldName));
     $queryBuilder->addFields(sprintf('index `search_%s` (`%s`)', $this->szFieldName, $this->szFieldName));
 }