QMYSQL crash when execute DATA LOAD LOCAL INFILE on Windows



  • Hi,

    i need to insert very large data (31M records) to mysql server then i decided to use DATA LOAD LOCAL INFILE instead of INSERT INTO. but every time i execute it, my program crash. then i tried execute it (using the same file as data source) inside mysql shell, and it has no problem. what have i done, add this code before QSqlDatabase::open and no effect

    @my_bool opt_local_infile = true;
    QVariant handle = database.driver()->handle();
    if (!qstrcmp(handle.typeName(), "MYSQL*")) {
    MYSQL *nativeHandle = static_cast<MYSQL *>(handle.data());
    if (nativeHandle != 0)
    mysql_options(nativeHandle , MYSQL_OPT_LOCAL_INFILE, &opt_local_infile);
    }@

    query
    @LOAD DATA LOCAL INFILE 'D:/Data.txt' INTO TABLE tablename FIELDS TERMINATED BY ',' ENCLOSED BY '"' LINES TERMINATED BY '\n'@

    how can i fix it? thank you...


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.