<?php
class User implements Model {
private $_sqlObject = null ;
public function init(){
$dbo = null ; // null代表使用缺省的dbo对象,可以使用别的
$this->_sqlObject = Kenxu_DB_Sqlobject::newInstance($dbo);
}
public function getTableMetas(){
// 数据表已经存在
// return $this->_sqlObject->getTableMetaObject()->fromDatabase('system_users') ;
// 数据表不存在,自动构建
$tableMetaObject = $this->_sqlObject->getTableMetaObject() ;
return array(
'name' => $tableMetaObject->unicodeCol(
array('unique' => true ,'length' => 20 ,'comment' => '用户名' )
) ,
'password' => $tableMetaObject->stringCol(
array('length' => 64 ,'comment' => '用户密码')
) ,
'description' => $tableMetaObject->unicodeCol(
array('length' => 80 ,'default' => NULL ,'comment' => '用户描述')
) ,
'islock' => $tableMetaObject->booleanCol(
array(
'default' => false ,'comment' => '是否被锁定')
) ,
'created_at' => $tableMetaObject->timestampCol(
array('default' => 1 ,'comment' => '创建时间')
) ,
'updated_at' => $tableMetaObject->timestampCol(
array('default' => null ,'comment' => '更新时间')
) ,
) ;
}
}
Xser v0.2 版本开发 寄望增加SQLOBJECT功能 , 希望色色能够实现吧
最新推荐文章于 2024-06-25 22:18:48 发布