Newer
Older
- postgresql(libpq)
- sqlite(sqlite-dev)
- duckdb(duckdb headers)
- C++14
1. cd libdbpp
2. mkdir build
3. cd build
4. cmake ../
5. make || ninja
6. make install || ninja install
int main(int argc,char **argv){
dbpp::Database db(atoi(argv[1]),argv[2]);
dbpp::DBResult res;
dbpp::SQL sql;
sql << "CREATE TABLE IF NOT EXISTS test"
<< "(id integer PRIMARY KEY "
<< db.autoincrement(sql)
<< ",name VARCHAR(255),value TEXT);";
std::cout << "Enter Value: " << std::endl;
std::cin >> value;
sql << "INSERT INTO test (name,value) VALUES"
<< "('"<< name.c_str() <<"','" << value.c_str() << "');";
for(int i=0; i<count; ++i){
std::cout << "name: " << res[i][0]
<< " value:" << res[i][1]
<< std::endl;
}