It returns false
bool prep = groupQuery.prepare(SQL);
bool prep = groupQuery.prepare(SQL);
To copy to clipboard, switch view to plain text mode
...
std::cout <<"<br />prep: ";
std::cout <<std::boolalpha <<prep <<"<br />";
std::cout <<"<br />prep: ";
std::cout <<std::boolalpha <<prep <<"<br />";
To copy to clipboard, switch view to plain text mode
Added after 6 minutes:
Changing the prepare statement to ODBC style placeholders (?) instead of oracle style placeholders gives me another kind of error message "Parameter count mismatch"
bool prep = groupQuery.prepare("SELECT groups.name FROM groups "
"INNER JOIN shiptypes ON groups.id = shiptypes.groupid "
"INNER JOIN ships ON shiptypes.id = ships.shiptype "
"INNER JOIN reports ON ships.id = reports.ship "
"INNER JOIN posts ON posts.id = reports.postid "
"WHERE posts.stamp = ?");
groupQuery.bindValue(0,reportKey);
if (!groupQuery.exec()) {
errorCode = 510;
error = true;
errorMessage = groupQuery.lastError().text();
} else {
while (groupQuery.next()) {
groups.append(groupQuery.value(0).toString());
}
}
QStringList groups;
QSqlQuery groupQuery(connection);
bool prep = groupQuery.prepare("SELECT groups.name FROM groups "
"INNER JOIN shiptypes ON groups.id = shiptypes.groupid "
"INNER JOIN ships ON shiptypes.id = ships.shiptype "
"INNER JOIN reports ON ships.id = reports.ship "
"INNER JOIN posts ON posts.id = reports.postid "
"WHERE posts.stamp = ?");
groupQuery.bindValue(0,reportKey);
if (!groupQuery.exec()) {
errorCode = 510;
error = true;
errorMessage = groupQuery.lastError().text();
} else {
while (groupQuery.next()) {
groups.append(groupQuery.value(0).toString());
}
}
To copy to clipboard, switch view to plain text mode
prep still returns false
Bookmarks