mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-09-08 19:08:57 +00:00
new method createDump() which was in SeedDMS_Core_DMS
This commit is contained in:
parent
2789e017eb
commit
90aac2f1ad
|
@ -913,4 +913,33 @@ class SeedDMS_Core_DatabaseAccess {
|
|||
}
|
||||
return $field;
|
||||
} /* }}} */
|
||||
|
||||
/**
|
||||
* Create an sql dump of the complete database
|
||||
*
|
||||
* @param resource $fp name of dump file
|
||||
* @return bool
|
||||
*/
|
||||
function createDump($fp) { /* {{{ */
|
||||
$tables = $this->TableList('TABLES');
|
||||
foreach($tables as $table) {
|
||||
$query = "SELECT * FROM `".$table."`";
|
||||
$records = $this->getResultArray($query);
|
||||
fwrite($fp,"\n-- TABLE: ".$table."--\n\n");
|
||||
foreach($records as $record) {
|
||||
$values="";
|
||||
$i = 1;
|
||||
foreach ($record as $column) {
|
||||
if (is_numeric($column)) $values .= $column;
|
||||
else $values .= $this->qstr($column);
|
||||
|
||||
if ($i<(count($record))) $values .= ",";
|
||||
$i++;
|
||||
}
|
||||
|
||||
fwrite($fp, "INSERT INTO `".$table."` VALUES (".$values.");\n");
|
||||
}
|
||||
}
|
||||
return true;
|
||||
} /* }}} */
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user