process "RAISE INFO" via zeoslib
Posted: 22.07.2023, 04:30
(I use google translate for english, sorry )
I want to "catch" RAISE INFO messages from a PostgreSQL 9.6 server (for example, get two RAISE with a level below EXCEPTION after ExecSQL for the query "DO $$ BEGIN RAISE NOTICE 'test1, notice'; RAISE WARNING 'test2, warning'; END $$;")
as I understand it, now (zeoslib r8046) in the dbcZDbcPostgreSql.pas file in TZPostgreSQLConnection.AfterConstruction for FNoticeProcessor the NoticeProcessorDispatcher is set statically, then TZPostgreSQLConnection(..).HandleErrorOrWarning is called from it, but HandleErrorOrWarning checks FPlainDriver.PQerrorMessage(..) and catches only "RAISE EXCEPTION", and RAISE INFO/NOTICE/WARNING does not catch.
the documentation https://postgrespro.ru/docs/postgresql/ ... ng?lang=en says that in the libpq library I can call PQsetNoticeProcessor and specify my handler through it, and such a function (PQsetNoticeProcessor) is in zeoslib (for example, for ZConnection.AfterConnect we can refer to IZPostgreSQLConnection(ZConnection.DbcConnection).GetPlainDriver.PQsetNoticeProcessor ), but how to use it correctly in lazarus 2.2.6 with the latest version of zeoslib, can you show a working example?
I want to "catch" RAISE INFO messages from a PostgreSQL 9.6 server (for example, get two RAISE with a level below EXCEPTION after ExecSQL for the query "DO $$ BEGIN RAISE NOTICE 'test1, notice'; RAISE WARNING 'test2, warning'; END $$;")
as I understand it, now (zeoslib r8046) in the dbcZDbcPostgreSql.pas file in TZPostgreSQLConnection.AfterConstruction for FNoticeProcessor the NoticeProcessorDispatcher is set statically, then TZPostgreSQLConnection(..).HandleErrorOrWarning is called from it, but HandleErrorOrWarning checks FPlainDriver.PQerrorMessage(..) and catches only "RAISE EXCEPTION", and RAISE INFO/NOTICE/WARNING does not catch.
the documentation https://postgrespro.ru/docs/postgresql/ ... ng?lang=en says that in the libpq library I can call PQsetNoticeProcessor and specify my handler through it, and such a function (PQsetNoticeProcessor) is in zeoslib (for example, for ZConnection.AfterConnect we can refer to IZPostgreSQLConnection(ZConnection.DbcConnection).GetPlainDriver.PQsetNoticeProcessor ), but how to use it correctly in lazarus 2.2.6 with the latest version of zeoslib, can you show a working example?