/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-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:
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
 
62
55
sqlite::row &sqlite::row::operator >>(
63
 
        sqlite::detail::set_index_t t )
 
56
        _set_index_t t )
64
57
{
65
58
        _column_index = t._index;
66
59
        return *this;
68
61
 
69
62
 
70
63
template< >
71
 
sqlite::row &sqlite::row::operator >> < sqlite::detail::null_t >(
72
 
        sqlite::detail::null_t & )
 
64
sqlite::row &sqlite::row::operator >> < sqlite::_null_t >(
 
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
}