Re: Accessing a database via AJAX scripts

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Accessing a database via AJAX scripts
Дата
Msg-id 3464.1281281612@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Accessing a database via AJAX scripts  (Glen Eustace <geustace@godzone.net.nz>)
Ответы Re: Accessing a database via AJAX scripts  (Glen Eustace <geustace@godzone.net.nz>)
Список pgsql-general
Glen Eustace <geustace@godzone.net.nz> writes:
> My goal is to have a perl cgi script (that is accessed using AJAX)
> perform some operations in a database using DBI.  Some of the actions
> are likely to take a while so my intent was to have a table that the
> backend process periodically writes status messages into.  The front end
> web page then uses another AJAX script to watch this table.

Your note is awfully short of concrete details, but I'm guessing the
basic reason why this wasn't working for you was you were doing all the
operations as a single transaction.  The results of that transaction
wouldn't be visible to another one until it commits; so in particular
whatever changes it made in the status table wouldn't be visible.
You'd need to break the processing into something like
    begin;
    insert into status values ('working');
    commit;
    begin;
    ... do the useful stuff here ...
    commit;
    begin;
    insert into status values ('done');
    commit;

            regards, tom lane

В списке pgsql-general по дате отправления:

Предыдущее
От: Torsten Zühlsdorff
Дата:
Сообщение: Re: MySQL versus Postgres
Следующее
От: Lew
Дата:
Сообщение: Re: could you tell me this..?