File tree Expand file tree Collapse file tree 2 files changed +60
-1
lines changed Expand file tree Collapse file tree 2 files changed +60
-1
lines changed Original file line number Diff line number Diff line change @@ -471,7 +471,7 @@ template <typename BoostOptionalT> database_binder::chain_type& operator <<(data
471471 exceptions::throw_sqlite_error (hresult);
472472 }
473473
474- ++db. _inx ;
474+ ++db-> _inx ;
475475 return db;
476476}
477477
Original file line number Diff line number Diff line change 1+ #include < iostream>
2+ #include < cstdlib>
3+ #include < unistd.h>
4+ #include < sqlite_modern_cpp.h>
5+
6+ using namespace sqlite ;
7+ using namespace std ;
8+
9+ struct TmpFile {
10+ string fname;
11+
12+ TmpFile () {
13+ char f[] = " /tmp/sqlite_modern_cpp_test_XXXXXX" ;
14+ int fid = mkstemp (f);
15+ close (fid);
16+
17+ fname = f;
18+ }
19+
20+ ~TmpFile () {
21+ unlink (fname.c_str ());
22+ }
23+ };
24+
25+ int main () {
26+ try {
27+
28+ TmpFile file;
29+ database db (file.fname );
30+
31+ {
32+
33+ auto con = db.get_sqlite3_connection ();
34+
35+ {
36+ database db2 (con);
37+ int test = 0 ;
38+ db2 << " select 1" >> test;
39+ if (test != 1 ) exit (EXIT_FAILURE);
40+ }
41+
42+ int test = 0 ;
43+ db << " select 1" >> test;
44+ if (test != 1 ) exit (EXIT_FAILURE);
45+
46+ }
47+
48+
49+ } catch (sqlite_exception e) {
50+ cout << " Unexpected error " << e.what () << endl;
51+ exit (EXIT_FAILURE);
52+ } catch (...) {
53+ cout << " Unknown error\n " ;
54+ exit (EXIT_FAILURE);
55+ }
56+
57+ cout << " OK\n " ;
58+ exit (EXIT_SUCCESS);
59+ }
You can’t perform that action at this time.
0 commit comments