Is there a more expressive way of executing SQL query using Qt?

I currently have this code:

  // Construct query
  QString const statement = QString("drop database if exists %1")

  QSqlQuery query(db);

Is there a better way to code than the above?

Specifically, I dont like how I use QString for SQL statement. It'd be nice if Qt has some class so that I could do something like:

  // Construct query
  QSomeClass statement = "drop database if exists %1";
  statement.setArg(1, databaseName_); // Replace all %1 in the original string.

  QSqlQuery query(db);


I think you are basically describing query placeholders:

QSqlQuery query;
query.prepare("INSERT INTO person (id, forename, surname) "
              "VALUES (:id, :forename, :surname)");
query.bindValue(":id", 1001);
query.bindValue(":forename", "Bart");
query.bindValue(":surname", "Simpson");

The only difference between the code snipped above and QSomeClass you described is the fact that you have to specify database when creating the query.

Need Your Help

How to include javascript files using 'import name from "module-name"' syntax in Ember.js?

ember.js ember-cli

I see that Ember.js includes files using 'import name from "module-name"' syntax. For example, in app.js:

Dynamic Animation for SVG Elements is not working in IE

javascript internet-explorer svg smil fakesmile

I'm trying to do SVG element's animation while dynamically adding DOM elements with jquery. If I add those elements inside <body> as below its working.Working Sample for this is