Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QMYSQL crash when execute DATA LOAD LOCAL INFILE on Windows

QMYSQL crash when execute DATA LOAD LOCAL INFILE on Windows

Scheduled Pinned Locked Moved General and Desktop
1 Posts 1 Posters 668 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • I Offline
    I Offline
    ichdyan
    wrote on last edited by
    #1

    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...

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved