Guest User

Untitled

a guest
May 23rd, 2014
235
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. QMap<QString,QByteArray> commands = {
  2.    {"check durr",{0xF0,0xC0,0x4F}},
  3.    {"check derp",{0xF0,0xC0,0x4F}},
  4.    {"check hurr",{0xF0,0xC0,0x4F}}
  5.    .....
  6. };
  7.  
  8. if (database.open())
  9.     for (auto q : commands) {
  10.         QSqlQuery query(database);
  11.  
  12.         query.prepare("INSERT INTO :table (byteData,name) VALUES (:data,:command)");
  13.         query.bindValue(":table", table);
  14.         query.bindValue(":data",command.second, QSql::In | QSql::Binary);
  15.         query.bindValue(":command",command.first);
  16.  
  17.         query.exec();
  18.     }
Advertisement
Add Comment
Please, Sign In to add comment