Mercurial > hg > orthanc
comparison Core/SQLite/StatementReference.cpp @ 1582:bd1889029cbb
encoding of exceptions
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 25 Aug 2015 17:39:38 +0200 |
parents | f967bdf8534e |
children | b1291df2f780 |
comparison
equal
deleted
inserted
replaced
1581:357c4bb15701 | 1582:bd1889029cbb |
---|---|
70 StatementReference::StatementReference(sqlite3* database, | 70 StatementReference::StatementReference(sqlite3* database, |
71 const char* sql) | 71 const char* sql) |
72 { | 72 { |
73 if (database == NULL || sql == NULL) | 73 if (database == NULL || sql == NULL) |
74 { | 74 { |
75 throw OrthancSQLiteException("Parameter out of range"); | 75 throw OrthancSQLiteException(ErrorCode_ParameterOutOfRange); |
76 } | 76 } |
77 | 77 |
78 root_ = NULL; | 78 root_ = NULL; |
79 refCount_ = 0; | 79 refCount_ = 0; |
80 | 80 |
81 int error = sqlite3_prepare_v2(database, sql, -1, &statement_, NULL); | 81 int error = sqlite3_prepare_v2(database, sql, -1, &statement_, NULL); |
82 if (error != SQLITE_OK) | 82 if (error != SQLITE_OK) |
83 { | 83 { |
84 throw OrthancSQLiteException("SQLite: " + std::string(sqlite3_errmsg(database))); | 84 #if ORTHANC_SQLITE_STANDALONE != 1 |
85 LOG(ERROR) << "SQLite: " << sqlite3_errmsg(database); | |
86 #endif | |
87 | |
88 throw OrthancSQLiteException(ErrorCode_SQLitePrepareStatement); | |
85 } | 89 } |
86 | 90 |
87 assert(IsRoot()); | 91 assert(IsRoot()); |
88 } | 92 } |
89 | 93 |