10.07.2015 Views

Unit Testing a C++ Database Appli Mock Objects Mock ... - PNSQC

Unit Testing a C++ Database Appli Mock Objects Mock ... - PNSQC

Unit Testing a C++ Database Appli Mock Objects Mock ... - PNSQC

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Typical Usage (Simplified)std::string DbApp::query_("SELECT * FROM names WHERE last LIKE ?");DbApp::DbApp(db::sql* sql): sql_(sql),stmt_(sql->prepare(query_)){}void DbApp::get_names(std::string last_name, Names& names) {stmt_->bind_param(last_name);std::string first, last;stmt_->bind_result(first, last);stmt_->execute();while (stmt_->fetch())names.push_back(Name(first, last));}___________________________________________________________________________________________________________________________Copies may not be made or distributed for commercial use Excerpt from <strong>PNSQC</strong> 2011 <strong>PNSQC</strong>.ORG 4

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!