|
@@ -3,13 +3,13 @@ use crate::{db::DBConnection, schema::AssocData, DBResult};
|
|
use super::{Datum, Entity, EntityPart, EntityPartList, EntityPartVisitor};
|
|
use super::{Datum, Entity, EntityPart, EntityPartList, EntityPartVisitor};
|
|
|
|
|
|
macro_rules! build_datum {
|
|
macro_rules! build_datum {
|
|
- ($conn:ident, $base_rowid:ident,$stmt:ident,$idx:ident,$d:ident,$t:ident) => {
|
|
|
|
|
|
+ ($conn:ident,$local_id:ident,$stmt:ident,$idx:ident,$d:ident,$t:ident) => {
|
|
let ($d, $idx) = <$t::Datum as Datum>::build_from(
|
|
let ($d, $idx) = <$t::Datum as Datum>::build_from(
|
|
AssocData {
|
|
AssocData {
|
|
conn: $conn.clone(),
|
|
conn: $conn.clone(),
|
|
- base_name: <$t::Entity as Entity>::entity_name(),
|
|
|
|
|
|
+ local_name: <$t::Entity as Entity>::entity_name(),
|
|
part_name: $t::part_name(),
|
|
part_name: $t::part_name(),
|
|
- base_rowid: $base_rowid,
|
|
|
|
|
|
+ local_id: $local_id,
|
|
},
|
|
},
|
|
$stmt,
|
|
$stmt,
|
|
$idx,
|
|
$idx,
|
|
@@ -38,9 +38,9 @@ impl<P0: EntityPart> EntityPartList for P0 {
|
|
conn: &DBConnection,
|
|
conn: &DBConnection,
|
|
stmt: &mut sqlite::Statement<'static>,
|
|
stmt: &mut sqlite::Statement<'static>,
|
|
) -> DBResult<Self::DatumList> {
|
|
) -> DBResult<Self::DatumList> {
|
|
- let base_rowid: i64 = stmt.read(0)?;
|
|
|
|
|
|
+ let local_id: i64 = stmt.read(0)?;
|
|
let idx = 1; // starting index is 1 since index 0 is the ID
|
|
let idx = 1; // starting index is 1 since index 0 is the ID
|
|
- build_datum!(conn, base_rowid, stmt, idx, d0, P0);
|
|
|
|
|
|
+ build_datum!(conn, local_id, stmt, idx, d0, P0);
|
|
|
|
|
|
let _ = idx;
|
|
let _ = idx;
|
|
Ok(d0)
|
|
Ok(d0)
|
|
@@ -79,10 +79,10 @@ impl<P0: EntityPart, P1: EntityPart> EntityPartList for (P0, P1) {
|
|
conn: &DBConnection,
|
|
conn: &DBConnection,
|
|
stmt: &mut sqlite::Statement<'static>,
|
|
stmt: &mut sqlite::Statement<'static>,
|
|
) -> DBResult<Self::DatumList> {
|
|
) -> DBResult<Self::DatumList> {
|
|
- let base_rowid: i64 = stmt.read(0)?;
|
|
|
|
|
|
+ let local_id: i64 = stmt.read(0)?;
|
|
let idx = 1; // starting index is 1 since index 0 is the ID
|
|
let idx = 1; // starting index is 1 since index 0 is the ID
|
|
- build_datum!(conn, base_rowid, stmt, idx, d0, P0);
|
|
|
|
- build_datum!(conn, base_rowid, stmt, idx, d1, P1);
|
|
|
|
|
|
+ build_datum!(conn, local_id, stmt, idx, d0, P0);
|
|
|
|
+ build_datum!(conn, local_id, stmt, idx, d1, P1);
|
|
|
|
|
|
let _ = idx;
|
|
let _ = idx;
|
|
Ok((d0, d1))
|
|
Ok((d0, d1))
|
|
@@ -105,11 +105,11 @@ impl<P0: EntityPart, P1: EntityPart, P2: EntityPart> EntityPartList for (P0, P1,
|
|
conn: &DBConnection,
|
|
conn: &DBConnection,
|
|
stmt: &mut sqlite::Statement<'static>,
|
|
stmt: &mut sqlite::Statement<'static>,
|
|
) -> DBResult<Self::DatumList> {
|
|
) -> DBResult<Self::DatumList> {
|
|
- let base_rowid: i64 = stmt.read(0)?;
|
|
|
|
|
|
+ let local_id: i64 = stmt.read(0)?;
|
|
let idx = 1; // starting index is 1 since index 0 is the ID
|
|
let idx = 1; // starting index is 1 since index 0 is the ID
|
|
- build_datum!(conn, base_rowid, stmt, idx, d0, P0);
|
|
|
|
- build_datum!(conn, base_rowid, stmt, idx, d1, P1);
|
|
|
|
- build_datum!(conn, base_rowid, stmt, idx, d2, P2);
|
|
|
|
|
|
+ build_datum!(conn, local_id, stmt, idx, d0, P0);
|
|
|
|
+ build_datum!(conn, local_id, stmt, idx, d1, P1);
|
|
|
|
+ build_datum!(conn, local_id, stmt, idx, d2, P2);
|
|
|
|
|
|
let _ = idx;
|
|
let _ = idx;
|
|
Ok((d0, d1, d2))
|
|
Ok((d0, d1, d2))
|
|
@@ -136,12 +136,12 @@ impl<P0: EntityPart, P1: EntityPart, P2: EntityPart, P3: EntityPart> EntityPartL
|
|
conn: &DBConnection,
|
|
conn: &DBConnection,
|
|
stmt: &mut sqlite::Statement<'static>,
|
|
stmt: &mut sqlite::Statement<'static>,
|
|
) -> DBResult<Self::DatumList> {
|
|
) -> DBResult<Self::DatumList> {
|
|
- let base_rowid: i64 = stmt.read(0)?;
|
|
|
|
|
|
+ let local_id: i64 = stmt.read(0)?;
|
|
let idx = 1; // starting index is 1 since index 0 is the ID
|
|
let idx = 1; // starting index is 1 since index 0 is the ID
|
|
- build_datum!(conn, base_rowid, stmt, idx, d0, P0);
|
|
|
|
- build_datum!(conn, base_rowid, stmt, idx, d1, P1);
|
|
|
|
- build_datum!(conn, base_rowid, stmt, idx, d2, P2);
|
|
|
|
- build_datum!(conn, base_rowid, stmt, idx, d3, P3);
|
|
|
|
|
|
+ build_datum!(conn, local_id, stmt, idx, d0, P0);
|
|
|
|
+ build_datum!(conn, local_id, stmt, idx, d1, P1);
|
|
|
|
+ build_datum!(conn, local_id, stmt, idx, d2, P2);
|
|
|
|
+ build_datum!(conn, local_id, stmt, idx, d3, P3);
|
|
|
|
|
|
let _ = idx;
|
|
let _ = idx;
|
|
Ok((d0, d1, d2, d3))
|
|
Ok((d0, d1, d2, d3))
|
|
@@ -170,13 +170,13 @@ impl<P0: EntityPart, P1: EntityPart, P2: EntityPart, P3: EntityPart, P4: EntityP
|
|
conn: &DBConnection,
|
|
conn: &DBConnection,
|
|
stmt: &mut sqlite::Statement<'static>,
|
|
stmt: &mut sqlite::Statement<'static>,
|
|
) -> DBResult<Self::DatumList> {
|
|
) -> DBResult<Self::DatumList> {
|
|
- let base_rowid: i64 = stmt.read(0)?;
|
|
|
|
|
|
+ let local_id: i64 = stmt.read(0)?;
|
|
let idx = 1; // starting index is 1 since index 0 is the ID
|
|
let idx = 1; // starting index is 1 since index 0 is the ID
|
|
- build_datum!(conn, base_rowid, stmt, idx, d0, P0);
|
|
|
|
- build_datum!(conn, base_rowid, stmt, idx, d1, P1);
|
|
|
|
- build_datum!(conn, base_rowid, stmt, idx, d2, P2);
|
|
|
|
- build_datum!(conn, base_rowid, stmt, idx, d3, P3);
|
|
|
|
- build_datum!(conn, base_rowid, stmt, idx, d4, P4);
|
|
|
|
|
|
+ build_datum!(conn, local_id, stmt, idx, d0, P0);
|
|
|
|
+ build_datum!(conn, local_id, stmt, idx, d1, P1);
|
|
|
|
+ build_datum!(conn, local_id, stmt, idx, d2, P2);
|
|
|
|
+ build_datum!(conn, local_id, stmt, idx, d3, P3);
|
|
|
|
+ build_datum!(conn, local_id, stmt, idx, d4, P4);
|
|
|
|
|
|
let _ = idx;
|
|
let _ = idx;
|
|
Ok((d0, d1, d2, d3, d4))
|
|
Ok((d0, d1, d2, d3, d4))
|
|
@@ -220,14 +220,14 @@ impl<
|
|
conn: &DBConnection,
|
|
conn: &DBConnection,
|
|
stmt: &mut sqlite::Statement<'static>,
|
|
stmt: &mut sqlite::Statement<'static>,
|
|
) -> DBResult<Self::DatumList> {
|
|
) -> DBResult<Self::DatumList> {
|
|
- let base_rowid: i64 = stmt.read(0)?;
|
|
|
|
|
|
+ let local_id: i64 = stmt.read(0)?;
|
|
let idx = 1; // starting index is 1 since index 0 is the ID
|
|
let idx = 1; // starting index is 1 since index 0 is the ID
|
|
- build_datum!(conn, base_rowid, stmt, idx, d0, P0);
|
|
|
|
- build_datum!(conn, base_rowid, stmt, idx, d1, P1);
|
|
|
|
- build_datum!(conn, base_rowid, stmt, idx, d2, P2);
|
|
|
|
- build_datum!(conn, base_rowid, stmt, idx, d3, P3);
|
|
|
|
- build_datum!(conn, base_rowid, stmt, idx, d4, P4);
|
|
|
|
- build_datum!(conn, base_rowid, stmt, idx, d5, P5);
|
|
|
|
|
|
+ build_datum!(conn, local_id, stmt, idx, d0, P0);
|
|
|
|
+ build_datum!(conn, local_id, stmt, idx, d1, P1);
|
|
|
|
+ build_datum!(conn, local_id, stmt, idx, d2, P2);
|
|
|
|
+ build_datum!(conn, local_id, stmt, idx, d3, P3);
|
|
|
|
+ build_datum!(conn, local_id, stmt, idx, d4, P4);
|
|
|
|
+ build_datum!(conn, local_id, stmt, idx, d5, P5);
|
|
|
|
|
|
let _ = idx;
|
|
let _ = idx;
|
|
Ok((d0, d1, d2, d3, d4, d5))
|
|
Ok((d0, d1, d2, d3, d4, d5))
|