Re: Messages to Front End

From: Jurgen Defurne <defurnj(at)glo(dot)be>
To: Jigishu P Bhatt <jigishubhatt(at)icenet(dot)net>, postgreSQL general mailing list <pgsql-general(at)postgresql(dot)org>
Subject: Re: Messages to Front End
Date: 2000-04-16 11:55:38
Message-ID: 38F9AA3A.ED432D92@glo.be
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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(at)glo(dot)be

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Webb Sprague 2000-04-16 17:25:10 Invisible tables
Previous Message Jurgen Defurne 2000-04-16 11:55:21 Re: Parallel databases?