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. QSqlQuery fails to execute "drop database xyz" query
Forum Updated to NodeBB v4.3 + New Features

QSqlQuery fails to execute "drop database xyz" query

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 1.7k 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.
  • A Offline
    A Offline
    adnan
    wrote on last edited by
    #1

    Suppose, i start my app and connect to the database as root user. Now i create a database:
    @QSqlQuery query("create database "+ui->create_db->text());
    ui->choose_db->clear();
    QSqlQuery squery("show databases"); // listing all databases
    squery.next();
    while (squery.next())
    {
    ui->choose_db->addItem(squery.value(0).toString()); // storing the list of all databases
    }@

    Now, if i drop the previously created database, it works fine:
    @QSqlQuery query("drop database "+ui->create_db->text());
    ui->choose_db->clear();
    QSqlQuery squery("show databases"); // listing all databases
    squery.next();
    while (squery.next())
    {
    ui->choose_db->addItem(squery.value(0).toString()); // storing the list of all databases
    }@

    But, only those databases can be droped which are created during the session. i.e, if i close the app and start again and try to delete the database created in previous session, it simply fails, no effect

    1 Reply Last reply
    0
    • A Offline
      A Offline
      adnan
      wrote on last edited by
      #2

      No reply so far, is this a bug!

      1 Reply Last reply
      0
      • G Offline
        G Offline
        GentooXativa
        wrote on last edited by
        #3

        What error they gives with lastError() ? Worked fine for me in 4.8

        Jose Vicente Giner Sanchez - Senior Mobile Developer

        www.gigigo.com

        C/ Dr. Zamenhof 36bis, 1ºA 28027 Madrid
        T: +34 917431436

        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