Ejemplo n.º 1
0
function FullImport($file, $date)
{
    $sqlite_db = new PDO('sqlite:./' . $file);
    create_tables($sqlite_db);
    setup_params($sqlite_db, $date, "FULL");
    convert_auth($sqlite_db, 0);
    convert_book($sqlite_db, 0);
    convert_seqn($sqlite_db, 0);
    convert_date($sqlite_db, 0);
    convert_genr($sqlite_db, 0);
    convert_info($sqlite_db, 0);
    create_indexes($sqlite_db);
    /*
      convert_sequences($mysql_db, $sqlite_db, 0);
      convert_dates($mysql_db, $sqlite_db, 0);
      
      convert_zips($mysql_db, $sqlite_db, 0);
      convert_files($mysql_db, $sqlite_db, 0, 0);
    */
}
Ejemplo n.º 2
0
function FullImport($mysql_db, $file, $date)
{
    $sqlite_db = new PDO('sqlite:./' . $file);
    create_tables($sqlite_db);
    setup_params($sqlite_db, $date, "FULL");
    $sqlite_db->query("DROP TABLE tables");
    $sqlite_db->query("DROP TABLE dir0");
    $sqlite_db->query("DROP TABLE ref0");
    $sqlite_db->query("CREATE TABLE dir0(code INTEGER PRIMARY KEY, name, info, parent INTEGER NOT NULL)");
    $sqlite_db->query("CREATE TABLE ref0(code INTEGER, book INTEGER, PRIMARY KEY(code, book))");
    $sqlite_db->query("CREATE INDEX dir0_parent ON dir0(parent)");
    $sqlite_db->query("CREATE INDEX ref0_book ON ref0(book)");
    $sqlite_db->query("CREATE TABLE tables(id INTEGER PRIMARY KEY AUTOINCREMENT,title,\n\tdir_file,dir_data,dir_type,dir_code,dir_name,dir_info,dir_prnt,\n\tref_file,ref_data,ref_type,ref_code,ref_book,fb2_code)");
    $sqlite_db->query("INSERT INTO tables(title,dir_data,dir_type,dir_code,dir_name,dir_prnt,ref_data,ref_type,ref_code,ref_book)\n\tVALUES ('Тематический рубрикатор','dir0','INTEGER','code','name','parent','ref0','id','code','book')");
    convert_books($mysql_db, $sqlite_db);
    convert_auth($mysql_db, $sqlite_db);
    convert_dates($mysql_db, $sqlite_db);
    convert_topics($mysql_db, $sqlite_db);
    create_indexes($sqlite_db);
}
Ejemplo n.º 3
0
function DeltaImport($mysql_db, $date)
{
    $mysql_db->query("CREATE TABLE myrulib_update(date integer primary key, aid integer, bid integer, sid integer, zid integer)");
    $sqltest = "SELECT * FROM myrulib_update WHERE date=(SELECT MAX(date) FROM myrulib_update WHERE date<{$date})";
    $query = $mysql_db->query($sqltest);
    if ($row = $query->fetch_array()) {
        $code = $row["date"];
        $sqlite_db = new PDO("sqlite:./{$code}.upd");
        create_tables($sqlite_db, $date);
        setup_params($sqlite_db, $date, "DELTA");
        convert_authors($mysql_db, $sqlite_db, $row['aid']);
        convert_seqnames($mysql_db, $sqlite_db, $row['sid']);
        convert_books($mysql_db, $sqlite_db, $row['bid']);
        convert_sequences($mysql_db, $sqlite_db, $row['bid']);
        convert_genres($mysql_db, $sqlite_db, $row['bid']);
        convert_dates($mysql_db, $sqlite_db, $row['bid']);
        convert_zips($mysql_db, $sqlite_db, $row['zid']);
        convert_files($mysql_db, $sqlite_db, $row['zid'], $row['bid']);
        system("zip {$code}.zip {$code}.upd");
    }
    $mysql_db->query("INSERT INTO myrulib_update(date) VALUES(" . $date . ")");
    $mysql_db->query("\n\tUPDATE myrulib_update SET \n\t  aid=(SELECT MAX(aid) FROM libavtorname),\n\t  bid=(SELECT MAX(bid) FROM libbook),\n\t  sid=(SELECT MAX(sid) FROM libseq),\n\t  zid=(SELECT MAX(zid) FROM myrulib_zip)\n\tWHERE date={$date}");
}