postgresql 7.1 select ec_reinst_gift_cert_on_order (:order_id) update ec_orders set order_state = 'authorized', authorized_date = current_timestamp where order_id = :order_id insert into ec_shipments (shipment_id, order_id, shipment_date, expected_arrival_date, carrier, shippable_p, last_modified, last_modifying_user, modified_ip_address) select :shipment_id, :order_id, current_timestamp, current_timestamp, 'none', 'f', current_timestamp, user_id, :peeraddr from ec_orders where order_id = :order_id update ec_orders set order_state='confirmed', confirmed_date=current_timestamp where order_id=:order_id select ec_order_cost(:order_id) insert into ec_financial_transactions (transaction_id, order_id, transaction_amount, transaction_type, inserted_date) values (:transaction_id, :order_id, :total_amount, 'charge', current_timestamp) select ec_order_amount_owed(:order_id) select gift_certificate_id, gift_certificate_amount_left(gift_certificate_id) as amount_available from ec_gift_certificates_approved where user_id = :user_id and current_timestamp - expires < 0 and amount_remaining_p = 't' and gift_certificate_amount_left(gift_certificate_id) > 0 order by expires insert into ec_gift_certificate_usage (gift_certificate_id, order_id, amount_used, used_date) values (:gift_certificate_id, :order_id, least(:amount_available, :amount_owed), current_timestamp) select ec_gift_certificate_balance(:user_id) select ec_order_amount_owed(:order_id) select item_id from ec_items i, ec_products p where i.order_id = :order_id and i.product_id = p.product_id and p.no_shipping_avail_p = 't' limit 1 update ec_items set item_state = 'to_be_shipped' from ec_products p where ec_items.order_id = :order_id and ec_items.product_id = p.product_id and p.no_shipping_avail_p = 'f' update ec_items set item_state = 'shipped', shipment_id = :shipment_id from ec_products p where ec_items.order_id = :order_id and ec_items.product_id = p.product_id and p.no_shipping_avail_p = 't'