diff --git a/include/class.export.php b/include/class.export.php index 51ab41b8b3155a6f8cb36220a8077c23fca61b61..984c1da074da2a05c2b19619731f8afd79e0d626 100644 --- a/include/class.export.php +++ b/include/class.export.php @@ -375,4 +375,32 @@ class DatabaseExporter { $this->write_block(array('end-table')); } } + + function transfer($destination, $query, $callback=false, $options=array()) { + $header_out = false; + $res = db_query($query, true, false); + $i = 0; + while ($row = db_fetch_array($res)) { + if (is_callable($callback)) + $callback($row); + if (!$header_out) { + $fields = array_keys($row); + $this->write_block( + array('table', $destination, $fields, $options)); + $header_out = true; + + } + $this->write_block(array_values($row)); + } + $this->write_block(array('end-table')); + } + + function transfer_array($destination, $array, $keys, $options=array()) { + $this->write_block( + array('table', $destination, $keys, $options)); + foreach ($array as $row) { + $this->write_block(array_values($row)); + } + $this->write_block(array('end-table')); + } }