mirror of
https://github.com/fluencelabs/sqlite-wasm-connector
synced 2025-03-15 06:20:50 +00:00
move to sdk 0.6.3
This commit is contained in:
parent
3e482d538e
commit
e46463da23
10
Cargo.toml
10
Cargo.toml
@ -1,5 +1,5 @@
|
||||
[package]
|
||||
name = "fce-sqlite-connector"
|
||||
name = "marine-sqlite-connector"
|
||||
version = "0.4.0"
|
||||
license = "Apache-2.0/MIT"
|
||||
authors = [
|
||||
@ -23,19 +23,19 @@ categories = ["api-bindings", "database"]
|
||||
keywords = ["database"]
|
||||
|
||||
[lib]
|
||||
name = "fce_sqlite_connector"
|
||||
name = "marine_sqlite_connector"
|
||||
path = "src/lib.rs"
|
||||
|
||||
[[bin]]
|
||||
name = "wit_generator"
|
||||
path = "src/wit_generator.rs"
|
||||
name = "it_generator"
|
||||
path = "src/it_generator.rs"
|
||||
|
||||
[[bin]]
|
||||
name = "test"
|
||||
path = "src/test.rs"
|
||||
|
||||
[dependencies]
|
||||
fluence = "0.6.1"
|
||||
fluence = "0.6.3"
|
||||
|
||||
[dev-dependencies]
|
||||
temporary = "0.6"
|
||||
|
@ -3,18 +3,18 @@
|
||||
|
||||
extern crate fluence;
|
||||
|
||||
use fluence::fce;
|
||||
use fluence::marine;
|
||||
|
||||
pub fn main() {}
|
||||
|
||||
#[fce]
|
||||
#[marine]
|
||||
#[derive(Default)]
|
||||
pub struct DBOpenDescriptor {
|
||||
pub ret_code: i32,
|
||||
pub db_handle: u32,
|
||||
}
|
||||
|
||||
#[fce]
|
||||
#[marine]
|
||||
#[derive(Default)]
|
||||
pub struct DBPrepareDescriptor {
|
||||
pub ret_code: i32,
|
||||
@ -22,7 +22,7 @@ pub struct DBPrepareDescriptor {
|
||||
pub tail: u32,
|
||||
}
|
||||
|
||||
#[fce]
|
||||
#[marine]
|
||||
#[derive(Default)]
|
||||
pub struct DBExecDescriptor {
|
||||
pub ret_code: i32,
|
||||
@ -37,13 +37,13 @@ pub struct DBExecDescriptor {
|
||||
const char *zVfs /* Name of VFS module to use */
|
||||
);
|
||||
*/
|
||||
#[fce]
|
||||
#[marine]
|
||||
pub fn sqlite3_open_v2(filename: String, flags: i32, vfs: String) -> DBOpenDescriptor {
|
||||
<_>::default()
|
||||
}
|
||||
|
||||
// SQLITE_API int sqlite3_close(sqlite3*);
|
||||
#[fce]
|
||||
#[marine]
|
||||
pub fn sqlite3_close(db_handle: u32) -> i32 {
|
||||
<_>::default()
|
||||
}
|
||||
@ -57,7 +57,7 @@ pub fn sqlite3_close(db_handle: u32) -> i32 {
|
||||
const char **pzTail /* OUT: Pointer to unused portion of zSql */
|
||||
);
|
||||
*/
|
||||
#[fce]
|
||||
#[marine]
|
||||
pub fn sqlite3_prepare_v2(db_handle: u32, sql: String) -> DBPrepareDescriptor {
|
||||
<_>::default()
|
||||
}
|
||||
@ -71,7 +71,7 @@ pub fn sqlite3_prepare_v2(db_handle: u32, sql: String) -> DBPrepareDescriptor {
|
||||
char **errmsg /* Error msg written here */
|
||||
);
|
||||
*/
|
||||
#[fce]
|
||||
#[marine]
|
||||
pub fn sqlite3_exec(
|
||||
db_handle: u32,
|
||||
sql: String,
|
||||
@ -82,133 +82,133 @@ pub fn sqlite3_exec(
|
||||
}
|
||||
|
||||
// SQLITE_API int sqlite3_libversion_number(void);
|
||||
#[fce]
|
||||
#[marine]
|
||||
pub fn sqlite3_libversion_number() -> i32 {
|
||||
<_>::default()
|
||||
}
|
||||
|
||||
// SQLITE_API int sqlite3_changes(sqlite3*);
|
||||
#[fce]
|
||||
#[marine]
|
||||
pub fn sqlite3_changes(db_handle: u32) -> i32 {
|
||||
<_>::default()
|
||||
}
|
||||
|
||||
// SQLITE_API int sqlite3_total_changes(sqlite3*);
|
||||
#[fce]
|
||||
#[marine]
|
||||
pub fn sqlite3_total_changes(db_handle: u32) -> i32 {
|
||||
<_>::default()
|
||||
}
|
||||
|
||||
// SQLITE_API int sqlite3_busy_timeout(sqlite3*, int ms);
|
||||
#[fce]
|
||||
#[marine]
|
||||
pub fn sqlite3_busy_timeout(db_handle: u32, ms: u32) -> i32 {
|
||||
<_>::default()
|
||||
}
|
||||
|
||||
// SQLITE_API const char *sqlite3_errmsg(sqlite3*);
|
||||
#[fce]
|
||||
#[marine]
|
||||
pub fn sqlite3_errmsg(db_handle: u32) -> String {
|
||||
<_>::default()
|
||||
}
|
||||
|
||||
// SQLITE_API int sqlite3_errcode(sqlite3 *db);
|
||||
#[fce]
|
||||
#[marine]
|
||||
pub fn sqlite3_errcode(db: u32) -> i32 {
|
||||
<_>::default()
|
||||
}
|
||||
|
||||
// SQLITE_API int sqlite3_column_type(sqlite3_stmt*, int iCol);
|
||||
#[fce]
|
||||
#[marine]
|
||||
pub fn sqlite3_column_type(stmt_handle: u32, icol: u32) -> i32 {
|
||||
<_>::default()
|
||||
}
|
||||
|
||||
// SQLITE_API const char *sqlite3_column_name(sqlite3_stmt*, int N);
|
||||
#[fce]
|
||||
#[marine]
|
||||
pub fn sqlite3_column_name(stmt_handle: u32, N: u32) -> String {
|
||||
<_>::default()
|
||||
}
|
||||
|
||||
// SQLITE_API int sqlite3_step(sqlite3_stmt*);
|
||||
#[fce]
|
||||
#[marine]
|
||||
pub fn sqlite3_step(stmt_handle: u32) -> i32 {
|
||||
<_>::default()
|
||||
}
|
||||
|
||||
// SQLITE_API int sqlite3_reset(sqlite3_stmt *pStmt);
|
||||
#[fce]
|
||||
#[marine]
|
||||
pub fn sqlite3_reset(stmt_handle: u32) -> i32 {
|
||||
<_>::default()
|
||||
}
|
||||
|
||||
// SQLITE_API int sqlite3_bind_blob(sqlite3_stmt*, int, const void*, int n, void(*)(void*));
|
||||
#[fce]
|
||||
#[marine]
|
||||
pub fn sqlite3_bind_blob(stmt_handle: u32, pos: i32, blob: Vec<u8>, xDel: i32) -> i32 {
|
||||
<_>::default()
|
||||
}
|
||||
|
||||
// SQLITE_API int sqlite3_bind_double(sqlite3_stmt*, int, double);
|
||||
#[fce]
|
||||
#[marine]
|
||||
pub fn sqlite3_bind_double(stmt_handle: u32, pos: i32, value: f64) -> i32 {
|
||||
<_>::default()
|
||||
}
|
||||
|
||||
// SQLITE_API int sqlite3_bind_int64(sqlite3_stmt*, int, sqlite3_int64);
|
||||
#[fce]
|
||||
#[marine]
|
||||
pub fn sqlite3_bind_int64(stmt_handle: u32, pos: i32, value: i64) -> i32 {
|
||||
<_>::default()
|
||||
}
|
||||
|
||||
// SQLITE_API int sqlite3_bind_null(sqlite3_stmt*, int);
|
||||
#[fce]
|
||||
#[marine]
|
||||
pub fn sqlite3_bind_null(stmt_handle: u32, pos: i32) -> i32 {
|
||||
<_>::default()
|
||||
}
|
||||
|
||||
// SQLITE_API int sqlite3_bind_text(sqlite3_stmt*,int,const char*,int,void(*)(void*));
|
||||
#[fce]
|
||||
#[marine]
|
||||
pub fn sqlite3_bind_text(stmt_handle: u32, pos: i32, text: String, xDel: i32) -> i32 {
|
||||
<_>::default()
|
||||
}
|
||||
|
||||
// SQLITE_API int sqlite3_column_count(sqlite3_stmt *pStmt)
|
||||
#[fce]
|
||||
#[marine]
|
||||
pub fn sqlite3_column_count(stmt_handle: u32) -> i32 {
|
||||
<_>::default()
|
||||
}
|
||||
|
||||
// SQLITE_API const void *sqlite3_column_blob(sqlite3_stmt*, int iCol);
|
||||
#[fce]
|
||||
#[marine]
|
||||
pub fn sqlite3_column_blob(stmt_handle: u32, icol: i32) -> Vec<u8> {
|
||||
<_>::default()
|
||||
}
|
||||
|
||||
// SQLITE_API double sqlite3_column_double(sqlite3_stmt*, int iCol);
|
||||
#[fce]
|
||||
#[marine]
|
||||
pub fn sqlite3_column_double(stmt_handle: u32, icol: i32) -> f64 {
|
||||
<_>::default()
|
||||
}
|
||||
|
||||
// SQLITE_API sqlite3_int64 sqlite3_column_int64(sqlite3_stmt*, int iCol);
|
||||
#[fce]
|
||||
#[marine]
|
||||
pub fn sqlite3_column_int64(stmt_handle: u32, icol: u32) -> i64 {
|
||||
<_>::default()
|
||||
}
|
||||
|
||||
// SQLITE_API const unsigned char *sqlite3_column_text(sqlite3_stmt*, int iCol);
|
||||
#[fce]
|
||||
#[marine]
|
||||
pub fn sqlite3_column_text(stmt_handle: u32, icol: u32) -> String {
|
||||
<_>::default()
|
||||
}
|
||||
|
||||
// SQLITE_API int sqlite3_column_bytes(sqlite3_stmt*, int iCol);
|
||||
#[fce]
|
||||
#[marine]
|
||||
pub fn sqlite3_column_bytes(stmt_handle: u32, icol: u32) -> i32 {
|
||||
<_>::default()
|
||||
}
|
||||
|
||||
// SQLITE_API int sqlite3_finalize(sqlite3_stmt *pStmt);
|
||||
#[fce]
|
||||
#[marine]
|
||||
pub fn sqlite3_finalize(stmt_handle: u32) -> i32 {
|
||||
<_>::default()
|
||||
}
|
@ -1,18 +1,18 @@
|
||||
extern crate fluence;
|
||||
|
||||
use self::fluence::fce;
|
||||
use self::fluence::marine;
|
||||
|
||||
pub(crate) type Sqlite3DbHandle = u32;
|
||||
pub(crate) type Sqlite3StmtHandle = u32;
|
||||
|
||||
#[fce]
|
||||
#[marine]
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct DBOpenDescriptor {
|
||||
pub ret_code: i32,
|
||||
pub db_handle: u32,
|
||||
}
|
||||
|
||||
#[fce]
|
||||
#[marine]
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct DBPrepareDescriptor {
|
||||
pub ret_code: i32,
|
||||
@ -20,14 +20,14 @@ pub struct DBPrepareDescriptor {
|
||||
pub tail: u32,
|
||||
}
|
||||
|
||||
#[fce]
|
||||
#[marine]
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct DBExecDescriptor {
|
||||
pub ret_code: i32,
|
||||
pub err_msg: String,
|
||||
}
|
||||
|
||||
#[fce]
|
||||
#[marine]
|
||||
#[link(wasm_import_module = "sqlite3")]
|
||||
extern "C" {
|
||||
/*
|
||||
|
20
src/test.rs
20
src/test.rs
@ -1,14 +1,14 @@
|
||||
extern crate fluence;
|
||||
extern crate fce_sqlite_connector;
|
||||
extern crate marine_sqlite_connector;
|
||||
|
||||
use fluence::fce;
|
||||
use fce_sqlite_connector::State;
|
||||
use fluence::marine;
|
||||
use marine_sqlite_connector::State;
|
||||
|
||||
pub fn main() {}
|
||||
|
||||
#[fce]
|
||||
#[marine]
|
||||
pub fn test1() {
|
||||
let connection = fce_sqlite_connector::open(":memory:").unwrap();
|
||||
let connection = marine_sqlite_connector::open(":memory:").unwrap();
|
||||
|
||||
connection
|
||||
.execute(
|
||||
@ -30,9 +30,9 @@ pub fn test1() {
|
||||
.unwrap();
|
||||
}
|
||||
|
||||
#[fce]
|
||||
#[marine]
|
||||
pub fn test2() {
|
||||
let connection = fce_sqlite_connector::open(":memory:").unwrap();
|
||||
let connection = marine_sqlite_connector::open(":memory:").unwrap();
|
||||
|
||||
println!("connection id = {}\n", connection.as_raw());
|
||||
connection
|
||||
@ -56,11 +56,11 @@ pub fn test2() {
|
||||
println!("age = {}", statement.read::<i64>(1).unwrap());
|
||||
}
|
||||
}
|
||||
#[fce]
|
||||
#[marine]
|
||||
pub fn test3() {
|
||||
use fce_sqlite_connector::Value;
|
||||
use marine_sqlite_connector::Value;
|
||||
|
||||
let connection = fce_sqlite_connector::open(":memory:").unwrap();
|
||||
let connection = marine_sqlite_connector::open(":memory:").unwrap();
|
||||
|
||||
connection
|
||||
.execute(
|
||||
|
Loading…
x
Reference in New Issue
Block a user