Skip to content

Commit 471f8af

Browse files
committed
Fix #33
Slight oversight on my part
1 parent b958f9b commit 471f8af

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

hdr/sqlite_modern_cpp.h

+5-1
Original file line numberDiff line numberDiff line change
@@ -279,8 +279,12 @@ namespace sqlite {
279279
database(std::shared_ptr<sqlite3> db):
280280
_db(db) {}
281281

282+
database_binder::chain_type operator<<(const std::string& sql) {
283+
return database_binder::chain_type(new database_binder(_db, sql));
284+
}
285+
282286
database_binder::chain_type operator<<(const char* sql) {
283-
return database_binder::chain_type(new database_binder(_db, std::string(sql)));
287+
return *this << std::string(sql);
284288
}
285289

286290
connection_type connection() const { return _db; }

tests/simple_examples.cc

+5
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,11 @@ int main()
4444
exit(EXIT_FAILURE);
4545
}
4646

47+
std::string sql("select 1+1");
48+
int test = 0;
49+
db << sql >> test;
50+
51+
if(test != 2) exit(EXIT_FAILURE);
4752

4853
}
4954
catch(sqlite_exception e)

0 commit comments

Comments
 (0)