* License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. ******************************************************************************/ include_once 'utils.php'; /** * Clean all the current data. * * @author Richard Friedman */ writeDatabaseInformation(); writeLine("<b>Cleaning up all the data.</b>"); $database = RingsideApiDbDatabase::getDatabaseConnection(); if ($database === false) { writeLine("No such database is currently available"); RingsideApiDbDatabase::closeConnection($database); } else { $schema = readSqlFile('RingsideDbCleanData.sql'); if ($schema === false) { writeError(' The SQL could not be loade from the application '); exit; } $result = RingsideApiDbDatabase::queryMultiLine($schema, $database); if ($result === false) { writeError('The database was not cleaned properly, check the error log.'); } else { writeLine("Database " . RingsideApiConfig::$db_name . " cleaned successfully "); } } writeLine(); writeLine("<b>Other options</b>");
/** * Drop the schema. * @return true/false */ function dropSchema() { $database = RingsideApiDbDatabase::getDatabaseConnection(); if ($database === false) { writeLine("No such database is currently available"); RingsideApiDbDatabase::closeConnection($database); } else { //RingsideApiDbDatabase::closeConnection( $database ); //$database = RingsideApiDbDatabase::getConnection(); $drop = mysql_query('DROP DATABASE ' . RingsideApiConfig::$db_name, $database); if ($drop === false) { writeError("Error dropping database {RingsideApiConfig::{$db_name}} : (" . mysql_errno($database) . ") " . mysql_error($database)); return false; } else { writeLine("Database " . RingsideApiConfig::$db_name . " dropped successfully "); } } return true; }