C ++从SQL数据库加载文件

时间:2013-06-24 09:44:53

标签: c++ sql

我想知道是否可以在C ++中从SQL数据库加载二进制文件并像使用fstream的普通文件一样使用它们?如果是这样,怎么样?

1 个答案:

答案 0 :(得分:0)

是的可能,我使用sqlite3数据库和stringstream在c ++中工作。

An Introduction To The SQLite C/C++ Interface

    sqlite3 *db; 
    sqlite3_open("dbfile.db", &db);
    sqlite3_stmt *companydetails;
    std::stringstream companystr;
    companystr << "select companyname,companydetails from company";
    sqlite3_prepare(db, companystr.str().c_str(), companystr.str().size(),&companydetails, NULL);
    sqlite3_step(companydetails);