ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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(ilDBConstants::FETCHMODE_OBJECT)) {
16 $query = "UPDATE $table ";
17
18 $counter = 0;
19 foreach ($fields as $field) {
20 if ($counter++) {
21 $query .= ", ";
22 } else {
23 $query .= "SET ";
24 }
25
26 $query .= ($field . " = " . $ilDB->quote(stripslashes($row->$field)) . " ");
27 }
28 $query .= (" WHERE " . $key . " = " . $ilDB->quote($row->$key));
29
30 // Perform the query
31 $ilDB->query($query);
32 }
33}
static quoteArray($a_array)
Quotes all members of an array for usage in DB query statement.
$key
Definition: croninfo.php:18
$row
$query
if(empty($password)) $table
Definition: pwgen.php:24
foreach($_POST as $key=> $value) $res
global $ilDB

References $ilDB, $key, $query, $res, $row, $table, ilDBConstants\FETCHMODE_OBJECT, and ilUtil\quoteArray().

+ Here is the call graph for this function: