24#ifndef SQLITE3XX_RESULT_H
25#define SQLITE3XX_RESULT_H
64 return _r->columns( );
68 return field( *
this, i );
74 return field( *
this, _r->column_number( s ) );
78 return _r->column_type( i );
82 return _r->GetValueInt( i );
86 return _r->GetValueText( i );
90 return _r->GetValueDouble( i );
108 case SQLITE_INTEGER:
return "SQLITE_INTEGER";
109 case SQLITE_FLOAT:
return "SQLITE_FLOAT";
110 case SQLITE_BLOB:
return "SQLITE_BLOB";
111 case SQLITE_NULL:
return "SQLITE_NULL";
112 case SQLITE3_TEXT:
return "SQLITE_TEXT";
113 default:
return "<unknown type>";
124 if( type == SQLITE_INTEGER ) {
125 obj = _t.GetValueInt( _c );
126 }
else if( type == SQLITE_NULL ) {
130 oss <<
"Invalid type conversion requested for integer type, type is "
131 << type_to_str( type ) <<
"(" << type <<
")";
132 throw invalid_argument( oss.str( ) );
137 if( type == SQLITE3_TEXT ) {
138 obj = string( (
const char *)_t.GetValueText( _c ) );
139 }
else if( type == SQLITE_NULL ) {
143 oss <<
"Invalid type conversion requested for string type, type is "
144 << type_to_str( type ) <<
"(" << type <<
")";
145 throw invalid_argument( oss.str( ) );
150 if( type == SQLITE_FLOAT ) {
151 obj = _t.GetValueDouble( _c );
152 }
else if( type == SQLITE_NULL ) {
156 oss <<
"Invalid type conversion requested for double type, type is "
157 << type_to_str( type ) <<
"(" << type <<
")";
158 throw invalid_argument( oss.str( ) );
162 template<
typename T>
bool to( T& obj )
const {
163 int type = _t.column_type( _c );
169 typedef sqlite3xxstd::iterator< std::random_access_iterator_tag,
203 typedef map<string, size_type> ColMap;
205 typedef vector<int> ColType;
226 CachedValue( ) { type = 0; value.s = NULL; };
227 CachedValue(
const CachedValue& v );
229 CachedValue& operator= (
const CachedValue& v );
232 typedef vector<CachedValue> ValueCache;
256 return _cache[i].value.i;
260 return _cache[i].value.s;
264 return _cache[i].value.d;
Definition result.hpp:178
const_iterator(const tuple &t)
Definition result.hpp:184
const tuple * pointer
Definition result.hpp:181
friend class result
Definition result.hpp:193
pointer operator->() const
Definition result.hpp:187
const_iterator operator++(int incr)
const_iterator()
Definition result.hpp:183
bool operator<(const const_iterator &i) const
Definition result.hpp:101
void GetValueOfType(int type, double &obj) const
Definition result.hpp:149
field(const tuple &t, tuple::size_type c)
Definition result.hpp:118
void GetValueOfType(int type, string &obj) const
Definition result.hpp:136
void GetValueOfType(int type, int &obj) const
Definition result.hpp:123
bool to(T &obj) const
Definition result.hpp:162
SQLITEXX_LIBEXPORT friend ostream & operator<<(ostream &o, const field &f)
int GetValueInt(size_type i) const
Definition result.hpp:81
int column_type(size_type i) const
Definition result.hpp:77
size_type size() const
Definition result.hpp:63
field operator[](string s) const
Definition result.hpp:73
~tuple()
Definition result.hpp:61
field operator[](size_type i) const
Definition result.hpp:67
const unsigned char * GetValueText(size_type i) const
Definition result.hpp:85
field operator[](int i) const
Definition result.hpp:70
tuple(const result *r, size_type i)
Definition result.hpp:59
size_type rownumber() const
Definition result.hpp:93
double GetValueDouble(size_type i) const
Definition result.hpp:89
unsigned int size_type
Definition result.hpp:52
unsigned long size_type
Definition result.hpp:47
const tuple operator[](size_type i)
size_type affected_rows() const
const_iterator end() const
Definition result.hpp:274
result(sqlite3_stmt *stmt)
int GetValueInt(size_type i) const
Definition result.hpp:255
sqlite3xxstd::iterator< std::random_access_iterator_tag, const tuple, result::difference_type, const_iterator, tuple > const_iterator_base
Definition result.hpp:174
size_type column_number(string name) const
double GetValueDouble(size_type i) const
Definition result.hpp:263
int column_type(string name) const
Definition result.hpp:251
size_type columns() const
const_iterator begin() const
Definition result.hpp:267
signed long difference_type
Definition result.hpp:48
const unsigned char * GetValueText(size_type i) const
Definition result.hpp:259
int column_type(size_type i) const
#define SQLITEXX_LIBEXPORT
Definition dllexport.h:35
#define SQLITEXX_PRIVATE
Definition dllexport.h:36
Definition connection.hpp:41