/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-07-29 09:16:26 UTC
  • Revision ID: edam@waxworlds.org-20100729091626-h8fmg0r74eyfo5ae
- fixed error caused by finialising in-progress queries during rollback that were later finaliased by RAII.

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