BusinessAccountSqlDao.sql.stg

91 lines | 1.615 kB Blame History Raw Download
group BusinessAccount;

getAccount(account_id) ::= <<
  select
    account_id
  , account_key
  , created_date
  , updated_date
  , balance
  , name
  , last_invoice_date
  , total_invoice_balance
  , last_payment_status
  , payment_method
  , credit_card_type
  , billing_address_country
  from bac
  where account_id=:account_id
  limit 1
  ;
>>

getAccountByKey(account_key) ::= <<
  select
    account_id
  , account_key
  , created_date
  , updated_date
  , balance
  , name
  , last_invoice_date
  , total_invoice_balance
  , last_payment_status
  , payment_method
  , credit_card_type
  , billing_address_country
  from bac
  where account_key=:account_key
  limit 1
  ;
>>

createAccount() ::= <<
  insert into bac(
    account_id
  , account_key
  , created_date
  , updated_date
  , balance
  , name
  , last_invoice_date
  , total_invoice_balance
  , last_payment_status
  , payment_method
  , credit_card_type
  , billing_address_country
  ) values (
    :account_id
  , :account_key
  , :created_date
  , :updated_date
  , :balance
  , :name
  , :last_invoice_date
  , :total_invoice_balance
  , :last_payment_status
  , :payment_method
  , :credit_card_type
  , :billing_address_country
  );
>>

saveAccount() ::= <<
  update bac set
    updated_date=:updated_date
  , balance=:balance
  , name=:name
  , last_invoice_date=:last_invoice_date
  , total_invoice_balance=:total_invoice_balance
  , last_payment_status=:last_payment_status
  , payment_method=:payment_method
  , credit_card_type=:credit_card_type
  , billing_address_country=:billing_address_country
  where account_id=:account_id
  ;
>>

test() ::= <<
  select 1 from bac;
>>