fernandobatels / rsfbclient

Rust Firebird Client
MIT License
74 stars 10 forks source link

cannot find tuple struct or tuple variant `Timestamp` in this scope #102

Closed hermanius closed 3 years ago

hermanius commented 3 years ago

After adding rsfbclient-rust = "0.15.0" to Cargo.toml and building I get the following error during the build:

Compiling rsfbclient-core v0.15.0 error[E0531]: cannot find tuple struct or tuple variant Timestamp in this scope --> /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/rsfbclient-core-0.15.0/src/params.rs:25:13 | 25 | Timestamp(_) => (ibase::SQL_TIMESTAMP + 1, 0), | ^^^^^^^^^ not found in this scope

error: aborting due to previous error

environment : inside docker container from image: rust:1.50.0-buster

What am I doing wrong?

dancingbug commented 3 years ago

Possible workaround: try enabling rsfbclient feature date_time explicitly in your build command or Cargo.toml (if you need help doing this, please say so)

It became essentially non-optional at some point and the breakage was never dealt with.

Please say if this works, so that this issue may be closed if so. I have opened a separate issue for the underlying problem i described, at #103

fernandobatels commented 3 years ago

What am I doing wrong?

Maybe you are turning off the default features. I think the @dancingbug workaround will work.

fernandobatels commented 3 years ago

Waiting your feedback.

hermanius commented 3 years ago

Yes, the tip from @dancinbug did solve the missing data_time feature issue, so thank you very much for that one. It is probably because I'm quite new to Rust that I'm running into some new issues.

Because I would like to try the pure rust option I now have this in Cargo.toml: rsfbclient = {version = "0.15.0", default-features = false, features = ["pure_rust", "date_time"]}

And a function, according to the string_conn.rs example from the Github repo, like this: fn wisatest() -> Result<(), rsfbclient::FbError> {

#[cfg(feature = "pure_rust")]
let mut conn = rsfbclient::builder_pure_rust()
 .from_string("firebird://SYSDBA:<mypassword>@<myhost>:3050/home/firebird/data/CVODEVERDIEPING.fb?charset=win1252")?
    .connect()?
    .into();

let rows = conn.query_iter("SELECT FIRST 10 LL_VOORNAAM,LL_NAAM FROM LEERLING",())?;
for row in rows {
    let (voornaam,naam,) : (String,String,) = row;
    println!("{} {}",voornaam,naam);
};
Ok(())

}

When I now build the project I get this: Compiling rsfbclient-native v0.15.0 Compiling rsfbclient v0.15.0 Compiling guessing_game v0.1.0 (/opt/rust/guessing_game) error[E0425]: cannot find value conn in this scope --> src/main.rs:51:16 | 51 | let rows = conn.query_iter("SELECT FIRST 10 LL_VOORNAAM,LL_NAAM FROM LEERLING",())?; | ^^^^ not found in this scope

error: aborting due to previous error

I don't understand why conn is not in scope since it is declared and defined one statement earlier? The strange thing also is that the last few dependencies are also always recompiled?

Again, maybe this is due to the fact I'm new to Rust, so don't feel obliged in any way to solve this for me if I should be able to figure it out by myself. Help is however very much appreciated :-)

fernandobatels commented 3 years ago

I don't understand why conn is not in scope since it is declared and defined one statement earlier?

You are using the #[cfg(feature = "pure_rust")]. Remove it. This is not used on this context.

dancingbug commented 3 years ago

Closing this issue as the original problem as stated was resolved. I am fairly certain removing the cfg guard like @fernandobatels suggested will resolve your other error.

@hermanius if you continue to run into new problems, feel free to open new issues as needed.