summaryrefslogtreecommitdiff
path: root/src/prepared_statement.cpp
diff options
context:
space:
mode:
authorAndreas Baumann <Andreas.Baumann@eurospider.com>2010-09-06 10:53:02 +0200
committerAndreas Baumann <Andreas.Baumann@eurospider.com>2010-09-06 10:53:02 +0200
commit1dcc640c490a6619eeba19a6bdb93c4ac8d5a6fc (patch)
treefa6db7059152ef1f34ed925b39c92d068812cb75 /src/prepared_statement.cpp
parent73a0556dca6ff98da2a77a34e75c5eec5969cd87 (diff)
downloadsqlitexx-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.cpp19
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 );
+ }
}
}