diff options
author | Andreas Baumann <Andreas.Baumann@eurospider.com> | 2010-09-06 10:53:02 +0200 |
---|---|---|
committer | Andreas Baumann <Andreas.Baumann@eurospider.com> | 2010-09-06 10:53:02 +0200 |
commit | 1dcc640c490a6619eeba19a6bdb93c4ac8d5a6fc (patch) | |
tree | fa6db7059152ef1f34ed925b39c92d068812cb75 /src/prepared_statement.cpp | |
parent | 73a0556dca6ff98da2a77a34e75c5eec5969cd87 (diff) | |
download | sqlitexx-1dcc640c490a6619eeba19a6bdb93c4ac8d5a6fc.tar.gz sqlitexx-1dcc640c490a6619eeba19a6bdb93c4ac8d5a6fc.tar.bz2 |
more cleanup in exceptions, added a database_locked exception,
now we must fix the code to throw this exception all the time
and not do funny sleeps in the middle of the sqlitexx layer!
Diffstat (limited to 'src/prepared_statement.cpp')
-rw-r--r-- | src/prepared_statement.cpp | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/src/prepared_statement.cpp b/src/prepared_statement.cpp index b8074b3..674fbec 100644 --- a/src/prepared_statement.cpp +++ b/src/prepared_statement.cpp @@ -122,11 +122,20 @@ prepared_stmt::prepared_stmt( sqlite3 *db, string __sql ) : #else rc = sqlite3_prepare( db, _sql.c_str( ), -1, &_stmt, &tail ); #endif - if( rc != SQLITE_OK ) { - ostringstream s; - s << "sqlite3::prepared_stmt::prepared_stmt error: " << sqlite3_errmsg( _db ); - string msg = s.str( ); - throw sql_error( msg, _sql ); + switch( rc ) { + case SQLITE_BUSY: + throw database_locked( ); + + case SQLITE_OK: + break; + + default: + { + ostringstream s; + s << "sqlite3::prepared_stmt::prepared_stmt error: " << sqlite3_errmsg( _db ); + string msg = s.str( ); + throw sql_error( msg, _sql ); + } } } |