/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: 2012-04-23 18:40:10 UTC
  • Revision ID: tim@ed.am-20120423184010-3zaiqkhxwequfaey
Removed an optimisation in command::step() (calling finalize() here prevents
the command from being reset() and reused), and added a wrapper for a
transaction's begin() method to transaction_guard (both thanks to Ron Wilson).

Show diffs side-by-side

added added

removed removed

Lines of Context:
48
48
                ")" );
49
49
        c1.step();
50
50
 
51
 
        // test basic_statement bind() calls, via command
 
51
        // test basic_statement::bind() calls, via command
52
52
        sqlite::command c2( conn, "INSERT INTO pets VALUES( ?, ? )" );
53
53
        c2.bind( 1, "billy" ); c2.bind( 2, 12 ); c2.exec();
54
54
        sqlite::command c3( conn, "INSERT INTO pets VALUES( ?6, ?9 )" );
73
73
                "name = ? OR name = ?" ) << "foo" << sqlite::null << sqlite::null
74
74
                << sqlite::set_index( 1 ) << "bar" << "baz";
75
75
 
 
76
        // test connection command and query factory methods
 
77
        conn.make_command( "PRAGMA user_version = 12")->step();
 
78
        assert( conn.make_query( "PRAGMA user_version" )->step()
 
79
                .column< int >( 0 ) == 12 );
 
80
 
76
81
        // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
77
82
 
78
83
        // test basic queries
163
168
        sqlite::query( conn, "SELECT age FROM pets ORDER BY age DESC LIMIT 1" )
164
169
                .step() >> age; assert( age == 123 );
165
170
 
166
 
        // text recursive transactions
 
171
        // test recursive transactions
167
172
        {
168
173
                sqlite::transaction_guard< sqlite::recursive_transaction > t1( conn );
169
174
                conn.exec( "UPDATE pets SET age = 66" );