示例#1
0
/**
* remove unmatched records from import data
*
* @param mixed $session_id
* @param mixed $idfield
*/
function delete_unmatched_records($session_id, $idfield)
{
    global $mysqli;
    $session = get_import_session($mysqli, $session_id);
    if (!is_array($session)) {
        print $session;
        return;
    }
    $import_table = $session['import_table'];
    $query = " DELETE FROM " . $import_table . " WHERE " . $idfield . "<0";
    $res = $mysqli->query($query);
    if ($res) {
        //read content of tempfile and send it to client
        print $mysqli->affected_rows;
        $query = " SELECT count(*) FROM " . $import_table;
        $row = mysql__select_array2($mysqli, $query);
        if ($row && $row[0] > 0) {
            $session['reccount'] = $row[0];
            saveSession($mysqli, $session);
        }
    } else {
        print "SQL error: " . $mysqli->error;
    }
}
示例#2
0
$step = intval(@$_REQUEST["step"]);
if (!$step) {
    $step = 0;
}
/* ART 2016-02-01
        ob_start();
        echo '<div id="div-progress" style="display:none" class="loading">&nbsp;</div>';
        ob_flush();flush();
*/
//load session
if (intval(@$_REQUEST["import_id"]) > 0) {
    ob_start();
    echo '<script>showProgressMsg("Please wait, processing ... ")</script>';
    ob_flush();
    flush();
    $imp_session = get_import_session($mysqli, $_REQUEST["import_id"]);
}
//first step - load file into import table
if ($step == 1 && $imp_session == null) {
    ob_start();
    echo '<script>showProgressMsg("Please wait, file is processing on server")</script>';
    ob_flush();
    flush();
    if (@$_REQUEST["upload_file_name"]) {
        //load file into db
        $imp_session = postmode_file_load_to_db(HEURIST_FILESTORE_DIR . 'scratch/' . $_REQUEST["upload_file_name"], $_REQUEST["upload_file_name"], true);
    } else {
        if (@$_REQUEST["filename"]) {
            //after postprocessing - additional step load from temp file
            $imp_session = postmode_file_load_to_db($_REQUEST["filename"], $_REQUEST["original"], @$_REQUEST["preprocess"] == "1");
        } else {