Beispiel #1
0
 public function testIlNYAPasDeTablesRestantesApresUnDropDB()
 {
     global $config, $db;
     dropDB();
     $this->assertEquals(array(), preg_grep('/^' . str_replace('/', '\\/', $config['db']['prefix']) . '/', $db->fetchAll("show tables;", PDO::FETCH_COLUMN)));
     reinitDB();
 }
Beispiel #2
0
function cleanUp()
{
    if ($_SESSION['cMethod'] == 'new' || $_SESSION['dbCreateMethod'] == 'new') {
        if (!connectDB()) {
            return false;
        }
        if (isset($_SESSION['dbInfo']['dbOHRMUserName'])) {
            $query = dropUser();
        }
        $query[0] = dropDB();
        $sucExec = $query;
        $overall = true;
        for ($i = 0; $i < count($query); $i++) {
            $sucExec[$i] = mysql_query($query[$i]);
            if (!$sucExec[$i]) {
                $overall = false;
            }
        }
        if (!$overall) {
            connectDB();
            for ($i = 0; $i < count($query); $i++) {
                if (!$sucExec[$i]) {
                    $sucExec[$i] = mysql_query($query[$i]);
                }
                if (!$sucExec[$i]) {
                    $overall = false;
                }
            }
        }
    }
    $sucExec[] = delConf();
    return $sucExec;
}
Beispiel #3
0
function reinitDB()
{
    global $db, $config, $adminPassword, $adminLogin;
    //Nettoyage des précedents tests en cas d'interuption
    dropDB();
    initDB();
    upgradeDB(FALSE);
    $ret = $db->query($sql = "INSERT " . $config['db']['prefix'] . "users VALUES (NULL, '{$adminLogin}','{$adminPassword}','',1);");
    return $ret;
}
function remove_DB()
{
    dropDB();
}
$importLog = array();
$importedRecTypes = array();
//import field id -> target id - IMPORTANT for proper titlemask conversion
$fields_correspondence = array();
mysql_connection_insert($targetDBName);
$mysqli = mysqli_connection_overwrite($targetDBName);
// mysqli for saveStructureLib
switch ($_GET["action"]) {
    case "crosswalk":
        crosswalk();
        break;
    case "import":
        import();
        break;
    case "drop":
        dropDB();
        break;
    default:
        echo "Error: Unknown action received";
}
exit;
function crosswalk()
{
    /*	$res = mysql_query("insert into `defCrosswalk` (`crw_SourcedbID`, `crw_SourceCode`, `crw_DefType`, `crw_LocalCode`) values ('".$_GET["crwSourceDBID"]."','".$_GET["importRtyID"]."','rectype','".$_GET["crwLocalCode"]."')");
    	if(!mysql_error()) {
    		echo "Successfully crosswalked rectypes (IDs: " . $_GET["importRtyID"] . " and " . $_GET["crwLocalCode"] . ")";
    	} else {
    		echo "Error: " . mysql_error();
    	}
    */
}