mdsteele / rust-msi

Rust library for reading/writing Windows Installer (MSI) files
MIT License
58 stars 11 forks source link

How can I `inner_join` twice? #10

Closed xnuk closed 3 years ago

xnuk commented 3 years ago
use msi::Expr;

#[inline]
fn col<T: Into<String>>(item: T) -> Expr {
    Expr::col(item)
}

let query = Select::table("File")
    .inner_join(
        select("Component"),
        col("Component.Component").eq(col("File.Component_"))
    ).inner_join(
        select("Directory"),
        col("Directory.Directory").eq(col("Component.Directory_"))
    );

This query makes unsatisfied output (Display):

SELECT * FROM (SELECT * FROM File INNER JOIN Component ON Component.Component = File.Component_) INNER JOIN Directory ON Directory.Directory = Component.Directory_

which makes:

thread 'main' panicked at 'Table "<InnerJoin>" has no column named "Component.Directory_"'

in query execution, and seems <InnerJoin> is an undocumented stuff.

xnuk commented 3 years ago

Priority can be low, because (instead of making join query) downloading whole tables and comparing stuffs at home can be a workaround.

mdsteele commented 3 years ago

Thanks for the report. I was able to reproduce this, and it seems to be fixed by a287c4fd90496f8dfd5e172080d253bcd1d1b446.