SHOW:
|
|
- or go back to the newest paste.
| 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 | - | return query.exec(); |
| 18 | + |