浏览 1365 次
精华帖 (0) :: 良好帖 (0) :: 新手帖 (0) :: 隐藏帖 (0)
|
|
---|---|
作者 | 正文 |
发表时间:2010-10-15
<?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' => '更新时间') ) , ) ; } } 声明:ITeye文章版权属于作者,受法律保护。没有作者书面许可不得转载。
推荐链接
|
|
返回顶楼 | |