group BundleSqlDao;

insertBundle() ::= <<
    insert into bundles (
      id
      , start_dt
      , external_key
      , account_id
      , last_sys_update_dt
    ) values (
      :id
      , :start_dt
      , :external_key
      , :account_id
      , :last_sys_update_dt
    );
>>

updateBundleLastSysTime(id, last_sys_update_dt)  ::= <<
    update bundles
    set
        last_sys_update_dt = :last_sys_update_dt
    where id = :id
    ;
>>

getBundleFromId(id) ::= <<
    select
      id
      , start_dt
      , external_key
      , account_id
      , last_sys_update_dt
    from bundles
    where
      id = :id
    ;
>>

getBundleFromKey(external_key) ::= <<
    select
      id
      , start_dt
      , external_key
      , account_id
      , last_sys_update_dt
    from bundles
    where
      external_key = :external_key
    ;
>>


getBundleFromAccount(account_id) ::= <<
    select
      id
      , start_dt
      , external_key
      , account_id
      , last_sys_update_dt
    from bundles
    where
      account_id = :account_id
    ;
>>

