query.clear(); // make sure the query is empty
ports << "first" << "second" << "third";
query.prepare("INSERT INTO switches(model,address,location,nas_ip,voltage,notes,ports) "
"VALUES ('1','3','test',INET_ATON('10.0.0.3'),220,'test',?)");
query.addBindValue(ports);
qDebug() << query.boundValue(0); // this returns the qstringlist as it should
query.exec();
qDebug() << query.executedQuery(); // this displays "INSERT INTO switches(model,address,location,nas_ip,voltage,notes,ports) VALUES ('1','3','test',INET_ATON('10.0.0.3'),220,'test',?)"
query.clear(); // make sure the query is empty
QStringList ports;
ports << "first" << "second" << "third";
query.prepare("INSERT INTO switches(model,address,location,nas_ip,voltage,notes,ports) "
"VALUES ('1','3','test',INET_ATON('10.0.0.3'),220,'test',?)");
query.addBindValue(ports);
qDebug() << query.boundValue(0); // this returns the qstringlist as it should
query.exec();
qDebug() << query.executedQuery(); // this displays "INSERT INTO switches(model,address,location,nas_ip,voltage,notes,ports) VALUES ('1','3','test',INET_ATON('10.0.0.3'),220,'test',?)"
To copy to clipboard, switch view to plain text mode
I tried using a placeholder and bindValue but the result is almost the same, instead of "?" the executed query contains the placeholder
Bookmarks