Messages to Front End

Started by Jigishu P Bhattabout 26 years ago2 messagesgeneral
Jump to latest
#1Jigishu P Bhatt
jigishubhatt@icenet.net

I am developing an Information Management System. I am using PgAccess(0.98.5) as
front end. The backend is PostgreSQL-6.5.2 and OS is Red Hat Linux 6.1, on
Intel P-II 350 MHz connected with LAN. I have installed them using RPM of
Linux. I have learned some of the Tcl and Tk for programming.

Message to Front End :

I need to show confirmation message to front end, eg. "Record with name = name inserted." after the record is inserted. How can I do it?

I am using PgAccess as Front End. I had written some triggers using plpgsql and pltcl. Now, after inserting a record in table, I want to use an AFTER INSERT trigger to send message to front end as "Record is inserted with Name=New.name." or similar. But except Error messages (with RAISE EXCEPTION or elog ERROR ), no message comes to front end. But if EXCEPTION or ERROR is used, the operation is aborted. If I use elog NOTICE then it also comes as an ERROR message to the front end.

If I work on PgSQL monitor (psql) , I can get NOTICE message that confirms the operation and does not go to ABORT state. But how to get message I like to front end (PgAccess) from AFTER INSERT OR UPDATE Triggers?

Is there any better way ? Is there any way ?

Sincerely yours,

Jigishu Bhatt

#2Jurgen Defurne
defurnj@glo.be
In reply to: Jigishu P Bhatt (#1)
Re: Messages to Front End

Jigishu P Bhatt wrote:

I am developing an Information Management System. I am using
PgAccess(0.98.5) as
front end. The backend is PostgreSQL-6.5.2 and OS is Red Hat Linux
6.1, on
Intel P-II 350 MHz connected with LAN. I have installed them using RPM
of
Linux. I have learned some of the Tcl and Tk for programming. Message
to Front End : I need to show confirmation message to front end, eg.
"Record with name = name inserted." after the record is inserted. How
can I do it? I am using PgAccess as Front End. I had written some
triggers using plpgsql and pltcl. Now, after inserting a record in
table, I want to use an AFTER INSERT trigger to send message to front
end as "Record is inserted with Name=New.name." or similar. But except
Error messages (with RAISE EXCEPTION or elog ERROR ), no message comes
to front end. But if EXCEPTION or ERROR is used, the operation is
aborted. If I use elog NOTICE then it also comes as an ERROR message
to the front end. If I work on PgSQL monitor (psql) , I can get NOTICE
message that confirms the operation and does not go to ABORT state.
But how to get message I like to front end (PgAccess) from AFTER
INSERT OR UPDATE Triggers? Is there any better way ? Is there any way
? Sincerely yours, Jigishu Bhatt

Triggers are not meant to send messages to your front-end, but to
provide additional
processing on your database, processing for which you can say this
should not be done on the
front-end.

I have built a simple application (more as an exercise) to enter
author's name into a database. If
you want I can send it completely, but then I will have to translate it
into English first (native
language = Dutch).

This is the part that inserts the record.

# Create the query
set query "INSERT INTO \"Person\" (\"Name\", \"Surname\") \
VALUES ('${Name}', '${Surname}') ;"

# Send the query to the database
set QResult [pg_exec $connection $query]

if {![string compare [pg_result $QResult -status]
"PGRES_COMMAND_OK"]} {
clear_fields
} else {
message .errorMsg -text [pg_result $QResult -error]
}

What you can do is wait for your pg_result status, if it says OK then
your front-end can issue
the message itself. No need to write complex codings in a trigger.

Jurgen Defurne
defurnj@glo.be