ホームページ  >  記事  >  php教程  >  orm フレームワーク:php orm フレームワーク ezpdo (2) ezpdosql

orm フレームワーク:php orm フレームワーク ezpdo (2) ezpdosql

WBOY
WBOYオリジナル
2016-06-21 08:51:481073ブラウズ

実際には、このフレームワークのいわゆる ezpdosql は Hibernate の hsql です。これは特別なことではありません。
最初の句は、
$m = epmanager です。 ::instance();
$books = $m->find("from book as b where b.title = ?", $title);
//例のように
$books = $ m->find( "from book as b where b.title like 'intro%'");
//null example
$books = $m->find("from book as b where b .title は null" );
$books = $m->find("from book as b where b.pages < ?", $pages);
$books = $m->find ("from book as b where b.title like ? and b.pages < ?", $title, $pages);
in パラメータがサポートされるようになりました
$books = $m->find( "from book as b where b.price in (2.50, 100.01)");
$books = $m->find("from book as b where b.author.name in ('joe smith', ' jane smith')" );
in は配列もサポートしています
books = $m->find("from book as b where b.price in (?)", array(2.50, 100.01));
$books = $m->find("from book as b where b.author.name in (?)", array('joe smith', 'jane smith'));
もちろん、並べ替えます制限がサポートされている必要があります
// 書籍を検索し、書籍 ID で並べ替えます (デフォルトは昇順)
$books = $m->find("from book as b where b.title like ? order by b. id", $title) ;
// 本を検索し、ID で昇順に並べ替えます
$books = $m->find("from book as b where b.title like ? order by b.id asc", $title) ;
// 本を検索し、ID で降順に並べ替えます
$books = $m->find("from book as b where b.title like ? order by b.id desc", $title) ;
// 本を検索し、ID で降順に並べ替え、最初の 2 冊のみに制限します
$books = $m->find("from book as b where b.title like ? order by b. id desc limit 0, 2", $title);
は次の集計関数
avg()、
count()、
max()、
をサポートします。 min()
sum()

$cost = $m->find("タイトルが '%php%' のような本の合計(価格)"
$num_pages = $m->find ("タイトルが '%php%' のような本からの合計(ページ数)");
$num_books = $m->find("タイトルが '% のような本のカウント(*) php%'");
$cost_per_page = $cost/$num_pages;
$cost_per_book = $cost/$num_books; この記事へのリンク http://www.cxybl.com/html/wlbc/Php/ 20120531/27130.html



声明:
この記事の内容はネチズンが自主的に寄稿したものであり、著作権は原著者に帰属します。このサイトは、それに相当する法的責任を負いません。盗作または侵害の疑いのあるコンテンツを見つけた場合は、admin@php.cn までご連絡ください。