-
Notifications
You must be signed in to change notification settings - Fork 11
data.md
zuowenjian@ayb edited this page Jun 22, 2016
·
1 revision
#数据访问
class User extends XEntity
{
static public function createByBiz($name,$passwd)
{
$obj = XEntity::createIns(__CLASS__);
$obj->logname = $name;
$obj->name = $name;
$obj->passwd = $passwd;
return $obj ;
}
}
##实体映射规则
- 数据库的表名与实体属性名一致;
- 不区分大小写(表全为小写)
- 实体中对象与对象1对1的关系:在表中使用classname__id的方式表示关联的对象
XQuery::obj()->get_Author_by_id("1000");
XQuery::arr()->get_Author_by_id("1000");
$pageno = 1 ;
$page = new DataPage(20);
$page->gotoPage($pageno);
$books = XQuery::obj()->list_book($page);
//列出加个大于10小于10.5的书籍
$books = XQuery::obj()->list_Book_by_price(QL('? > 10 and ? < 10.5 '));
//列出书名以c开头的书籍
$books2 = XQuery::obj()->list_Book_by_name(QL('? like "c%"'));
//列出书名以c开头并价格小于100的书
$books3 = XQuery::obj()->list_Book_by_name_price(QL('? like "c%"'),QL('? < 100'));