/sqlite3cc

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

« back to all changes in this revision

Viewing changes to src/row.cc

  • Committer: edam
  • Date: 2010-02-02 16:13:16 UTC
  • Revision ID: edam@waxworlds.org-20100202161316-tceybmdeotltldow
- print "ok" when test program is successful!
- renamed 'Makefile's 'subdir.mk' so that the edam.mk build system will live happily along side an autotools build system

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
 */
22
22
 
23
23
#include <sqlite3cc/row.h>
 
24
#include <sqlite3cc/query.h>
24
25
#include <sqlite3cc/manipulator.h>
25
26
#include <cassert>
26
27
 
27
28
 
28
29
sqlite::row::row(
29
 
        sqlite3_stmt *handle,
30
 
        unsigned long long index )
 
30
        query &query,
 
31
        bool valid )
31
32
        :
32
 
        _handle( handle ),
 
33
        _query( query ),
33
34
        _column_index( 0 ),
34
 
        _index( index )
35
 
{
36
 
}
37
 
 
38
 
 
39
 
sqlite::row::row()
40
 
        :
41
 
        _index( std::numeric_limits< unsigned long long >::max() )
 
35
        _valid( valid )
42
36
{
43
37
}
44
38
 
46
40
int sqlite::row::column_type(
47
41
        unsigned int index )
48
42
{
49
 
        assert( index <
50
 
                static_cast< unsigned int >( sqlite3_column_count( _handle ) ) );
51
 
        return sqlite3_column_type( _handle, index );
 
43
        assert( index <= _query.column_count() );
 
44
        return sqlite3_column_type( _query._handle, index );
52
45
}
53
46
 
54
47
 
55
48
unsigned int sqlite::row::column_bytes(
56
49
        unsigned int index )
57
50
{
58
 
        return sqlite3_column_bytes( _handle, index );
 
51
        return sqlite3_column_bytes( _query._handle, index );
59
52
}
60
53
 
61
54
 
71
64
sqlite::row &sqlite::row::operator >> < sqlite::_null_t >(
72
65
        _null_t & )
73
66
{
74
 
        assert( _column_index <
75
 
                static_cast< unsigned int >( sqlite3_column_count( _handle ) ) );
 
67
        assert( _column_index < _query.column_count() );
76
68
        _column_index++;
77
69
        return *this;
78
70
}