Sqlite: per-connection phase-targetable fault guard (VL-SQLITE-03)
This commit is contained in:
1 parent
103523f04a
commit
3b1ef4b028
3 files changed
+170
-11
No files matched your search
@@ -15,6 +15,8 @@
|
||||
#include <variant>
|
||||
#include <vector>
|
||||
|
||||
struct sqlite3;
|
||||
|
||||
namespace Void::Sqlite
|
||||
{
|
||||
using Void::Result::Error;
|
||||
@@ -458,7 +460,26 @@ namespace Void::Sqlite
|
||||
Ignore
|
||||
};
|
||||
|
||||
/// Operation phase a fault can target.
|
||||
enum class FaultPhase : std::uint8_t {
|
||||
any,
|
||||
prepare,
|
||||
step,
|
||||
exec,
|
||||
commit,
|
||||
checkpoint,
|
||||
close
|
||||
};
|
||||
|
||||
struct FaultConfig {
|
||||
/// Restrict the injected fault to this connection. Null targets every
|
||||
/// connection, preserving the original process-wide behavior.
|
||||
sqlite3* connection{nullptr};
|
||||
/// Restrict the generic phase fault below to this operation phase.
|
||||
FaultPhase phase{FaultPhase::any};
|
||||
/// If non-zero, the next matching phase operation fails with this
|
||||
/// SQLite result code before running the native operation.
|
||||
int fail_next_rc{0};
|
||||
/// If non-zero, next COMMIT returns this SQLite error code without
|
||||
/// calling SQLite COMMIT (leaving transaction active so autocommit==0).
|
||||
int fail_next_commit_rc{0};
|
||||
|
||||
Reference in new issue
Block a user