mirror of
https://github.com/fluencelabs/examples
synced 2025-04-24 18:22:15 +00:00
update to marine, marine-test, bump versions
This commit is contained in:
parent
e17fab988e
commit
9ba8c49898
@ -10,5 +10,6 @@ name = "sqlite_test"
|
||||
path = "src/main.rs"
|
||||
|
||||
[dependencies]
|
||||
fluence = "0.5.0"
|
||||
fce-sqlite-connector = "0.2.0"
|
||||
fluence = "0.6.9"
|
||||
marine-sqlite-connector = "0.4.1"
|
||||
|
||||
|
@ -2,10 +2,11 @@
|
||||
set -o errexit -o nounset -o pipefail
|
||||
|
||||
# This script builds all subprojects and puts all created Wasm modules in one dir
|
||||
cargo update
|
||||
fce build --release
|
||||
cargo update --aggressive
|
||||
marine build --release
|
||||
|
||||
rm artifacts/*
|
||||
cp ../../target/wasm32-wasi/release/sqlite_test.wasm artifacts/
|
||||
wget https://github.com/fluencelabs/sqlite/releases/download/v0.10.0_w/sqlite3.wasm
|
||||
mkdir -p artifacts
|
||||
rm -f artifacts/*.wasm
|
||||
cp target/wasm32-wasi/release/sqlite_test.wasm artifacts/
|
||||
wget https://github.com/fluencelabs/sqlite/releases/download/v0.14.0_w/sqlite3.wasm
|
||||
mv sqlite3.wasm artifacts/
|
||||
|
@ -14,19 +14,19 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
use fluence::fce;
|
||||
use fluence::marine;
|
||||
use fluence::module_manifest;
|
||||
|
||||
use fce_sqlite_connector;
|
||||
use fce_sqlite_connector::State;
|
||||
use marine_sqlite_connector;
|
||||
use marine_sqlite_connector::State;
|
||||
|
||||
module_manifest!();
|
||||
|
||||
pub fn main() {}
|
||||
|
||||
#[fce]
|
||||
#[marine]
|
||||
pub fn test1(age: i64) {
|
||||
let connection = fce_sqlite_connector::open(":memory:").unwrap();
|
||||
let connection = marine_sqlite_connector::open(":memory:").unwrap();
|
||||
|
||||
connection
|
||||
.execute(
|
||||
@ -50,11 +50,11 @@ pub fn test1(age: i64) {
|
||||
}
|
||||
}
|
||||
|
||||
#[fce]
|
||||
#[marine]
|
||||
pub fn test2(age: i64) {
|
||||
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(
|
||||
@ -85,10 +85,10 @@ pub fn test2(age: i64) {
|
||||
}
|
||||
}
|
||||
|
||||
#[fce]
|
||||
#[marine]
|
||||
pub fn test3() {
|
||||
let db_path = "/tmp/users.sqlite";
|
||||
let connection = fce_sqlite_connector::open(db_path).expect("db should be opened");
|
||||
let connection = marine_sqlite_connector::open(db_path).expect("db should be opened");
|
||||
|
||||
connection
|
||||
.execute(
|
||||
@ -100,7 +100,7 @@ pub fn test3() {
|
||||
)
|
||||
.expect("table should be created successfully");
|
||||
|
||||
let connection = fce_sqlite_connector::open(db_path).expect("db should be opened");
|
||||
let connection = marine_sqlite_connector::open(db_path).expect("db should be opened");
|
||||
let cursor = connection.prepare("SELECT * FROM users").unwrap().cursor();
|
||||
|
||||
println!("table size is: {:?}", cursor.count());
|
||||
|
Loading…
x
Reference in New Issue
Block a user