ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
inc.meta_data_converter.php File Reference

Go to the source code of this file.

Functions

 ilMDConvert ($table, $fields, $key)
 

Function Documentation

◆ ilMDConvert()

ilMDConvert (   $table,
  $fields,
  $key 
)

Definition at line 3 of file inc.meta_data_converter.php.

4{
5 global $ilDB;
6
7 $where = "WHERE ";
8 $where .= implode(" LIKE '%\%' ESCAPE '�' OR ", ilUtil::quoteArray($fields));
9 $where .= " LIKE '%\\%' ESCAPE '�'";
10
11 $query = "SELECT * FROM ".$table." ".
12 $where;
13
14 $res = $ilDB->query($query);
15 while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
16 {
17 $query = "UPDATE $table ";
18
19 $counter = 0;
20 foreach($fields as $field)
21 {
22 if($counter++)
23 $query .= ", ";
24 else
25 $query .= "SET ";
26
27 $query .= ($field ." = ".$ilDB->quote(stripslashes($row->$field))." ");
28 }
29 $query .= (" WHERE ".$key." = ".$ilDB->quote($row->$key));
30
31 // Perform the query
32 $ilDB->query($query);
33 }
34}
const DB_FETCHMODE_OBJECT
Definition: class.ilDB.php:11
static quoteArray($a_array)
Quotes all members of an array for usage in DB query statement.
global $ilDB

References $ilDB, $query, $res, $row, DB_FETCHMODE_OBJECT, and ilUtil\quoteArray().

+ Here is the call graph for this function: