AccountSqlDao.sql.stg

56 lines | 2.04 kB Blame History Raw Download
group AccountDaoSql;

create() ::= <<
    INSERT INTO accounts
      (id, external_key, email, name, first_name_length, currency, billing_cycle_day,
      payment_provider_name, time_zone, locale,
      address1, address2, company_name, city, state_or_province, country, postal_code, phone)
    VALUES
      (:id, :externalKey, :email, :name, :firstNameLength, :currency, :billingCycleDay,
      :paymentProviderName, :timeZone, :locale,
      :address1, :address2, :companyName, :city, :stateOrProvince, :country, :postalCode, :phone);
>>

update() ::= <<
    UPDATE accounts
    SET external_key = :externalKey, email = :email, name = :name, first_name_length = :firstNameLength,
        currency = :currency, billing_cycle_day = :billingCycleDay, payment_provider_name = :paymentProviderName,
        time_zone = :timeZone, locale = :locale,
        address1 = :address1, address2 = :address2, company_name = :companyName, city = :city, state_or_province = :stateOrProvince,
        country = :country, postal_code = :postalCode, phone = :phone
    WHERE id = :id;
>>

getAccountByKey() ::= <<
    select id, external_key, email, name, first_name_length, currency, billing_cycle_day,
      payment_provider_name, time_zone, locale,
      address1, address2, company_name, city, state_or_province, country, postal_code, phone
    from accounts
    where external_key = :externalKey;
>>

getById() ::= <<
    select id, external_key, email, name, first_name_length, currency, billing_cycle_day,
      payment_provider_name, time_zone, locale,
      address1, address2, company_name, city, state_or_province, country, postal_code, phone
    from accounts
    where id = :id;
>>

get() ::= <<
    select id, external_key, email, name, first_name_length, currency, billing_cycle_day,
      payment_provider_name, time_zone, locale,
      address1, address2, company_name, city, state_or_province, country, postal_code, phone
    from accounts;
>>

getIdFromKey() ::= <<
    select id
    from accounts
    where external_key = :externalKey;
>>

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