/sqlite3cc

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

« back to all changes in this revision

Viewing changes to include/sqlite3cc/row.h

  • 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

127
127
        {
128
128
                assert( index <
129
129
                        static_cast< unsigned int >( sqlite3_column_count( _handle ) ) );
130
 
 
131
 
                switch( column_type( index ) ) {
132
 
                case SQLITE_NULL:
 
130
                const char *text = reinterpret_cast< const char * >(
 
131
                        sqlite3_column_text( _handle, index ) );
 
132
                if( text )
 
133
                        value = boost::lexical_cast< T >( text );
 
134
                else
133
135
                        value = boost::get( boost::value_initialized< T >() );
134
 
                        break;
135
 
                case SQLITE_BLOB: {
136
 
                        int length = sqlite3_column_bytes( _handle, index );
137
 
                        std::string string_value( static_cast< const char * >(
138
 
                                        sqlite3_column_blob( _handle, index ) ), length );
139
 
                        value = boost::lexical_cast< T >( string_value );
140
 
                        break;
141
 
                }
142
 
                default:
143
 
                        const char *text = reinterpret_cast< const char * >(
144
 
                                sqlite3_column_text( _handle, index ) );
145
 
                        value = boost::lexical_cast< T >( text );
146
 
                }
147
136
        }
148
137
 
149
138
        /**