本文整理汇总了C++中Computer::getBuild方法的典型用法代码示例。如果您正苦于以下问题:C++ Computer::getBuild方法的具体用法?C++ Computer::getBuild怎么用?C++ Computer::getBuild使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Computer
的用法示例。
在下文中一共展示了Computer::getBuild方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: addToDatabase
bool Computerrepository::addToDatabase(Computer newComp) {
QSqlQuery query;
QString name = QString::fromStdString((newComp.getName()));
int builtY = newComp.getBuildYear();
QString type = QString::fromStdString((newComp.getType()));
bool builtOrNot = newComp.getBuild();
query.prepare("INSERT INTO Computers (Name, YearBuilt, Type, BuiltOrNot) "
"VALUES (:Name, :YearBuilt, :Type, :BuiltOrNot)");
query.bindValue(":Name", name);
query.bindValue(":YearBuilt", builtY);
query.bindValue(":Type", type);
query.bindValue(":BuiltOrNot", builtOrNot);
return query.exec();
}
示例2: updateComputer
bool Computerrepository::updateComputer(Computer computerUpdate) {
QSqlQuery query;
int id = computerUpdate.getId();
QString name = QString::fromStdString((computerUpdate.getName()));
int builtY = computerUpdate.getBuildYear();
QString type = QString::fromStdString((computerUpdate.getType()));
bool builtOrNot = computerUpdate.getBuild();
query.prepare("UPDATE Computers SET Name=:Name, YearBuilt=:YearBuilt,"
" Type=:Type, BuiltOrNot=:BuiltOrNot WHERE id=:id");
query.bindValue(":id", id);
query.bindValue(":Name", name);
query.bindValue(":YearBuilt", builtY);
query.bindValue(":Type", type);
query.bindValue(":BuiltOrNot", builtOrNot);
return query.exec();
}