pub const FETCH_OPS_BY_REGION: &str = "SELECT\n DhtOp.hash,\n DhtOp.type,\n Action.blob AS action_blob,\n Entry.blob AS entry_blob\nFROM\n DhtOp\n JOIN Action ON DhtOp.action_hash = Action.hash\n LEFT JOIN Entry ON Action.entry_hash = Entry.hash\nWHERE\n (\n (\n -- non-wrapping case: everything within the given range\n :storage_start_loc <= :storage_end_loc\n AND (\n storage_center_loc >= :storage_start_loc\n AND storage_center_loc <= :storage_end_loc\n )\n )\n OR (\n -- wrapping case: everything *outside* the given range\n :storage_start_loc > :storage_end_loc\n AND (\n storage_center_loc <= :storage_end_loc\n OR storage_center_loc >= :storage_start_loc\n )\n )\n ) -- op timestamp is within temporal bounds\n AND (\n authored_timestamp >= :timestamp_min\n AND authored_timestamp <= :timestamp_max\n ) -- ops are integrated, i.e. not in limbo\n AND DhtOp.when_integrated IS NOT NULL\n";