Open kolinfluence opened 1 month ago
@wyhaya can u pls help look into it? i have no idea why the functions are not mapped properly.
I created a demo with dynamic link crossdb: crossdb-rs-dylib, which runs perfectly on Linux. You can take a look. If you need static link, you can refer to this repo (there are still some warnings.
If you need more help, please give me some detailed information.
@wyhaya can u try to make my code work? what's wrong with my linking?
by the way i have issues with: https://github.com/wyhaya/crossdb-rs-dylib/issues/1
@wyhaya can u help take a look at this?
transaction etc is built in
https://github.com/kolinfluence/crossdb-rs-dylib
cargo run --example basic
Compiling crossdb-rs-dylib v0.1.0 (/usr/local/src/crossdb-rs-dylib)
Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.49s
Running `target/debug/examples/basic`
Starting CrossDB example
Connection opened successfully
Table created successfully
Data inserted successfully
Query executed successfully
All users:
Fetched row: 0x728d4be7b038
Column 0: 0
Column 1: NULL
Column 2: 0
---
Fetched row: 0x728d4be7b050
Column 0: 0
Column 1: NULL
Column 2: 0
---
Fetched row: 0x728d4be7b068
Column 0: 0
Column 1: NULL
Column 2: 0
---
Results printed and freed
Updated user:
Fetched row: 0x728d4be7b038
Column 0: 0
Column 1: NULL
Column 2: 0
Result freed
Remaining users:
Fetched row: 0x728d4be7b038
Column 0: 0
Column 1: NULL
Column 2: 0
---
Fetched row: 0x728d4be7b050
Column 0: 0
Column 1: NULL
Column 2: 0
---
Finished fetching rows
Results freed
User added in transaction:
Fetched row: 0x728d4be7b038
Column 0: 0
Column 1: NULL
Column 2: 0
Freeing result
Result freed
CrossDB Version: 0.8.0
@wyhaya it is not showing any results, this is wrong. can u help fix it?
xdb_column_...
require col_meta
, which comes from res, but your res is a pointer
. You need to convert it to a struct first and then retrieve col_meta
from it.
+ let res = *res;
for i in 0..3 {
match i {
0 | 2 => {
- let value = xdb_column_int(res as u64, row, i);
+ let value = xdb_column_int(res.col_meta, row, i);
println!("Column {}: {}", i, value);
}
1 => {
- let ptr = xdb_column_str(res as u64, row, i);
+ let ptr = xdb_column_str(res.col_meta, row, i);
...
_ => unreachable!(),
}
}
@wyhaya it's done. thx!
https://github.com/kolinfluence/crossdb-rs-dylib
what's the difference between mine and urs and when it is better to use urs?
@wyhaya
https://github.com/kolinfluence/rscrossdb/
i'm new to rustlang binding not sure why i cant get it done.
can u try git clone crossdb into the folder and then make build and check how to get the binding to work?
i've done it here with claude sonnet 3.5 but cant get it to work