Merge pull request #2 from fluencelabs/fluence_0_6_0

Switch to marine-rs-sdk 0.6.0
This commit is contained in:
Mike Voronov 2021-09-01 17:57:06 +03:00 committed by GitHub
commit f821a3c891
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 55 additions and 55 deletions

View File

@ -1,6 +1,6 @@
[package]
name = "fce-sqlite-connector"
version = "0.3.0"
name = "marine-sqlite-connector"
version = "0.5.0"
license = "Apache-2.0/MIT"
authors = [
"Daniel Dulaney <ddy@vitronic.com>",
@ -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"
marine-rs-sdk = "0.6.10"
[dev-dependencies]
temporary = "0.6"

View File

@ -1,20 +1,20 @@
#![allow(unused_variables)]
#![allow(non_snake_case)]
extern crate fluence;
extern crate marine_rs_sdk;
use fluence::fce;
use marine_rs_sdk::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()
}

View File

@ -273,8 +273,8 @@ mod statement;
pub use connection::Connection;
pub use connection::OpenFlags;
pub use cursor::Cursor;
pub use statement::{Bindable, Readable, State, Statement};
pub use sqlite3_connector::*;
pub use statement::{Bindable, Readable, State, Statement};
/// Open a read-write connection to a new or existing database.
#[inline]

View File

@ -1,18 +1,18 @@
extern crate fluence;
extern crate marine_rs_sdk;
use self::fluence::fce;
use self::marine_rs_sdk::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" {
/*

View File

@ -1,14 +1,14 @@
extern crate fluence;
extern crate fce_sqlite_connector;
extern crate marine_rs_sdk;
extern crate marine_sqlite_connector;
use fluence::fce;
use fce_sqlite_connector::State;
use marine_rs_sdk::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(