Skip to content

Iterate two or more objects over a joined table #1443

@xiaopi-ouo

Description

@xiaopi-ouo

Hi, thank for your work on this!

I wonder if I can assoicated an object by an id to another corresponding object during iteration.
i.e. Getting the object A, B during the iteration by inner join.

// SELECT A.*, B.*
// FROM A
// INNER JOIN B
// ON A.b_uid = B.uid
for (auto& [a, b] : storage.iterate<A, B>(inner_join<B>(on(c(&A::b_uid) == &B::uid)))) {
  // do something to a, b
  ...
}

According to the inner join example, now I can only use select with a batch size to avoid memory issue when the tables are too large to be loaded once.

get_all return objects but only for the left one. i.e. get_all<A>(statement), so if there is a usage like get_all<A, B>(statement), it'll also solve the problem by setting a reading batch size

Is there any hidden method I ignored to do that?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions