/sqlite3cc

To get this branch, use:
bzr branch http://bzr.ed.am/sqlite3cc

« back to all changes in this revision

Viewing changes to test/test-main.cc

  • Committer: edam
  • Date: 2010-02-08 22:08:57 UTC
  • Revision ID: edam@waxworlds.org-20100208220857-5up6fi4y6jh5bz4k
- removed "OK" from test-main when test is successful
- aranged for test/test-main to buld properly and be called from "make check"
- added include/Makefile.am to arrange for installation of library headers
- added project website to configure.ac
- added library interface configuration variable to configure.ac

Show diffs side-by-side

added added

removed removed

Lines of Context:
59
59
        // test basic_statement binding via stream operator
60
60
        sqlite::command c4( db, "INSERT INTO pets VALUES( ?, ? )" );
61
61
        c4 << "tessa" << 16 << sqlite::exec;
62
 
        sqlite::command c5( db, "INSERT INTO pets VALUES( ?, ? )" );
63
 
        c5 << sqlite::null << sqlite::null <<
 
62
        sqlite::command( db, "INSERT INTO pets VALUES( ?, ? )" ) <<
 
63
                sqlite::null << sqlite::null <<
64
64
                sqlite::set_index( 1 ) << "tamara" << sqlite::exec;
65
65
 
66
66
        // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
96
96
        // test end of results
97
97
        assert( !q1.step() );
98
98
 
 
99
        // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 
100
 
 
101
        // test transactions
 
102
        {       sqlite::transaction_guard< > t1( db ); }
 
103
        {       sqlite::transaction_guard< sqlite::exclusive_transaction > t1( db ); }
 
104
        {       sqlite::transaction_guard< sqlite::recursive_transaction > t1( db );
 
105
                sqlite::transaction_guard< sqlite::recursive_transaction > t2( db ); }
 
106
 
 
107
        // test transaction guard rollback
 
108
        {
 
109
                sqlite::transaction_guard< > t1( db );
 
110
                db.exec( "UPDATE pets SET age = 99" );
 
111
        }
 
112
        sqlite::query( db, "SELECT age FROM pets ORDER BY age DESC LIMIT 1" )
 
113
                .step() >> age; assert( age == 123 );
 
114
 
 
115
        // text recursive transactions
 
116
        {
 
117
                sqlite::transaction_guard< sqlite::recursive_transaction > t1( db );
 
118
                db.exec( "UPDATE pets SET age = 99" );
 
119
 
 
120
                {
 
121
                        sqlite::transaction_guard< sqlite::recursive_transaction > t2( db );
 
122
                        db.exec( "UPDATE pets SET age = 1" );
 
123
                }
 
124
 
 
125
                sqlite::query( db, "SELECT age FROM pets ORDER BY age DESC LIMIT 1" )
 
126
                        .step() >> age; assert( age == 99 );
 
127
 
 
128
                t1.commit();
 
129
        }
 
130
        sqlite::query( db, "SELECT age FROM pets ORDER BY age DESC LIMIT 1" )
 
131
                .step() >> age; assert( age == 99 );
 
132
 
 
133
        // ok
99
134
        return 0;
100
135
}