flagflag  
3: 2013-03-16 (Sat) 13:33:22 iseki source 4: 2013-03-20 (Wed) 10:20:04 iseki source
Line 1: Line 1:
* 2.4 [#oca60059] * 2.4 [#oca60059]
 +
 +** DB [#z14aa49f]
 +- lib/dml/moodle_database.php
 +#br
 +
 +*** 大域変数 $DB [#df2c344a]
 +**** $DB->insert_record [#ua6949a2]
 +- record_id insert_record($table, $dataobject, $returnid=true, $bulk=false);
 + $apply_id = $DB->insert_record('apply', $apply);
 +
 +**** $DB->update_record [#h3d4dcda]
 +- bool update_record($table, $dataobject, $bulk=false);
 + update_record('apply', $apply);
 +
 +**** $DB->delete_records [#kbebef5f]
 +- bool delete_records($table, array $conditions=null)
 + $ret = $DB->delete_records('event', array('modulename'=>'apply', 'instance'=>$apply_id));
 +
 +**** $DB->get_record [#ddb2fca9]
 +- object get_record($table, array $conditions, $fields='*', $strictness=IGNORE_MISSING)
 + $item = $DB->get_record('apply_item', array('id'=>$apply_id));
 + $name = $item->name;
 +
 +**** $DB->get_records [#d0deebeb]
 +- array(object) get_records($table, array $conditions=null, $sort='', $fields='*', $limitfrom=0, $limitnum=0)
 + $params = array('apply_id'=>$item->apply_id);
 + $items = $DB->get_records('apply_item', $params, 'position');
 + foreach ($items as $item) {
 +     $name = $item->name;
 +     ......
 +
 +**** $DB->get_records_select [#w11aa7e9]
 +- array(object) get_records_select($table, $select, array $params=null, $sort='', $fields='*', $limitfrom=0, $limitnum=0)
 +- $select の ''?'' に 配列 $params の要素が対応(並び順)
 + $templates = $DB->get_records_select('apply_template'​, 'course=? OR ispublic=1', array($course->id), 'name');
 +
 +**** $DB->get_records_sql [#kb220662]
 +- array(object) get_records_sql($sql, array $params=null, $limitfrom=0, $limitnum=0)
 +- $sql 中の '':変数名'' に $params の各要素が対応
 + $where = 'WHERE as.id=av.submit_id AND av.version=0 AND as.apply_id=:apply_id AND ai.id=av.item_id ';
 + $sql  = 'SELECT MAX(ai.position) FROM {apply_submit} as, {apply_value} av, {apply_item} ai '.$where;
 + $params = array();
 + $params['apply_id'] = $apply_id;
 + $lastpos = $DB->get_field_sql($sql, $params);
** Block [#p1b83bad] ** Block [#p1b83bad]


Front page   New List of Pages Search Recent changes   Help   RSS of recent changes (RSS 1.0) RSS of recent changes (RSS 2.0) RSS of recent changes (RSS Atom)

Site Search

Login

Username:

Password:


Lost Password?
Register now!!

Sub Menu

mini Calendar

Last MonthJun 2024Next Month
Su Mo Tu We Th Fr Sa
1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30
Today

Who's Online

41 user(s) are online (6 user(s) are browsing xpwiki)

Members: 0
Guests: 41

more...

Access Counter

Today : 1640164016401640
Yesterday : 4505450545054505
Total : 2372513223725132237251322372513223725132237251322372513223725132
Powered by XOOPS Cube 2.1© 2001-2006 XOOPS Cube Project
Design by XoopsDesign.com