postgresql7.1
insert into acs_mail_lite_queue
(message_id,
creation_date,
locking_server,
to_addr,
cc_addr,
bcc_addr,
from_addr,
reply_to,
subject,
body,
package_id,
file_ids,
mime_type,
no_callback_p,
extraheaders,
use_sender_p,
object_id
)
values
(nextval('acs_mail_lite_id_seq'),
:creation_date,
:locking_server,
:to_addr,
:cc_addr,
:bcc_addr,
:from_addr,
:reply_to,
:subject,
:body,
:package_id,
:file_ids,
:mime_type,
(case when :no_callback_p = '1' then TRUE else FALSE end),
:extraheaders,
(case when :use_sender_p = '1' then TRUE else FALSE end),
:object_id
)
update acs_mail_lite_mail_log
set last_mail_date = current_timestamp
where party_id = :user_id
insert into acs_mail_lite_mail_log (party_id, last_mail_date)
values (:user_id, current_timestamp)
select
message_id as id,
creation_date,
locking_server,
to_addr,
cc_addr,
bcc_addr,
from_addr,
reply_to,
subject,
body,
package_id,
file_ids,
mime_type,
(case when no_callback_p = TRUE then 1 else 0 end) as no_callback_p,
extraheaders,
(case when use_sender_p = TRUE then 1 else 0 end) as use_sender_p,
object_id
from acs_mail_lite_queue
where locking_server = '' or locking_server is NULL