Issue Details (XML | Word | Printable)

Key: MDL-14967
Type: Sub-task Sub-task
Status: Resolved Resolved
Resolution: Fixed
Priority: Critical Critical
Assignee: Petr Skoda
Reporter: Nicolas Connault
Votes: 0
Watchers: 3
Operations

Add/Edit UI Mockup to this issue
If you were logged in you would be able to see more operations.
Moodle
MDL-14679

M2-M3-M4 Upgrade all code using DML

Created: 23/May/08 10:51 PM   Updated: 15/Jun/08 06:13 PM
Return to search
Component/s: Database SQL/XMLDB
Affects Version/s: 2.0
Fix Version/s: 2.0

Issue Links:
Cloners
 

Participants: Nicolas Connault and Petr Skoda
Security Level: None
Resolved date: 15/Jun/08
Affected Branches: MOODLE_20_STABLE
Fixed Branches: MOODLE_20_STABLE


 Description  « Hide
Since the new DML 2.0 API is now in place, all code using the old dmllib needs to be upgraded. In essence, this means the following changes:

1. Wherever old functions are used (get_record*, get_field*, set_field, insert_record, update_record), the global $DB must be used as the object on which these functions are called (e.g. get_record_select becomes $DB->get_record_select).
2. All the functions that used to accept a list of string params in the form "param1, value1, param2, value2" now need to be given an array of key=>value pairs as a replacement for these params. Other params remain as before. Check the new API for any exceptions.
3. rs_fetch_next_record($rs) is deprecated, in favour of the simple foreach($rs as $var). Calls to rs_close() must be replaced by $rs->close();

As an example to #3, if you have the original code:

     while($result = rs_fetch_next_record($rs)) {
         ...
     }
     rs_close();

you would replace it with

     foreach ($rs as $result) {
          ....
     }
     $rs->close();

 All   Comments   Change History   Version Control      Sort Order: Ascending order - Click to sort in descending order
Nicolas Connault made changes - 24/May/08 04:17 AM
Field Original Value New Value
Status Open [ 1 ] In Progress [ 3 ]
Petr Skoda made changes - 03/Jun/08 06:37 AM
Link This issue is a clone of MDL-15094 [ MDL-15094 ]
Petr Skoda made changes - 09/Jun/08 08:31 PM
Resolution Fixed [ 1 ]
Status In Progress [ 3 ] Resolved [ 5 ]
Assignee Nicolas Connault [ nicolasconnault ] Petr Skoda [ skodak ]
Petr Skoda made changes - 15/Jun/08 05:51 PM
Resolution Fixed [ 1 ]
Status Resolved [ 5 ] Reopened [ 4 ]
Petr Skoda made changes - 15/Jun/08 06:13 PM
Resolution Fixed [ 1 ]
Status Reopened [ 4 ] Resolved [ 5 ]