Add error codes to C bindings

This commit is contained in:
Pekka Enberg
2023-05-09 10:41:13 +03:00
parent 34a4f1a269
commit 779ad3066a
2 changed files with 7 additions and 2 deletions

View File

@@ -0,0 +1,3 @@
pub const MVCC_OK: i32 = 0;
pub const MVCC_IO_ERROR_WRITE: i32 = 778;

View File

@@ -1,8 +1,10 @@
#![allow(non_camel_case_types)]
mod errors;
mod types;
use types::{MVCCDatabaseRef, DbContext};
use errors::*;
use mvcc_rs::*;
/// cbindgen:ignore
@@ -81,11 +83,11 @@ pub unsafe extern "C" fn MVCCDatabaseInsert(
}) {
Ok(_) => {
tracing::debug!("MVCCDatabaseInsert: success");
0 // SQLITE_OK
MVCC_OK
}
Err(e) => {
tracing::error!("MVCCDatabaseInsert: {e}");
778 // SQLITE_IOERR_WRITE
MVCC_IO_ERROR_WRITE
}
}
}