Пример #1
0
 /**
  * Method to do full backup of data and structure
  * @param 
  */
 function dataAndStruct(&$db, $appname, $myurl, $backupPath)
 {
     //get the table names
     $tableNames = $db->getTables();
     //get the structure of the db
     $struct = Exporter::dbStructure($db, $tableNames);
     //build the headers bit
     $writefile = Exporter::sqlfileHeaders($appname, $myurl);
     //set the data variable to null
     $dataArray = null;
     //get the data
     $dataArray = Exporter::getDBDataDump($db, ANYDB_DUMP_SQL);
     //how many tables are there?
     $tblCount = count($tableNames);
     //pass the count and the arrays to the filebuilder function
     $dataFile = Exporter::writeData($dataArray);
     //build the writefile for the create table statements
     foreach ($struct as $output) {
         $writefile .= Exporter::writeStructure($output);
     }
     //put in a sql comment to start the table data
     $writefile .= "-- Table data... \n\n";
     //write table data to sql file
     $writefile .= $dataFile;
     $filename = Exporter::writeSQL($backupPath, $writefile);
     return $filename;
 }