Recent

Author Topic: The output of the PostgreSQL server....  (Read 12576 times)

BigChimp

  • Hero Member
  • *****
  • Posts: 5740
  • Add to the wiki - it's free ;)
    • FPCUp, PaperTiger scanning and other open source projects
Re: The output of the PostgreSQL server....
« Reply #15 on: June 22, 2012, 07:28:08 am »
Elmug, I'm sure you don't have unreasonable questions ;)... it's just that it's difficult for me to understand what you mean because you give out information that confuses me.

Very glad about your last post, this clears things up. As I said, you could then try running the string to a query parser (or, as you said, just scan for DROP etc).
Want quicker answers to your questions? Read http://wiki.lazarus.freepascal.org/Lazarus_Faq#What_is_the_correct_way_to_ask_questions_in_the_forum.3F

Open source including papertiger OCR/PDF scanning:
https://bitbucket.org/reiniero

Lazarus trunk+FPC trunk x86, Windows x64 unless otherwise specified

snorkel

  • Hero Member
  • *****
  • Posts: 817
Re: The output of the PostgreSQL server....
« Reply #16 on: June 28, 2012, 08:53:06 pm »
I believe PostgreSQL sends the query hints/warnings etc using the postgreSQL notification system and the default Lazarus components do not have the capability built in to get the info needed.

I use the postgres components from Devart.com which work on Lazarus and fully support getting the proper error messages from the PG notification system.
Libpq does have the ability to get this info, so it's possible for the default Lazarus components to implement this.

Hope that helps out a bit.

***Snorkel***
If I forget, I always use the latest stable 32bit version of Lazarus and FPC. At the time of this signature that is Laz 3.0RC2 and FPC 3.2.2
OS: Windows 10 64 bit

Elmug

  • Hero Member
  • *****
  • Posts: 849
Re: The output of the PostgreSQL server....
« Reply #17 on: June 28, 2012, 10:34:54 pm »
I believe PostgreSQL sends the query hints/warnings etc using the postgreSQL notification system and the default Lazarus components do not have the capability built in to get the info needed.

I use the postgres components from Devart.com which work on Lazarus and fully support getting the proper error messages from the PG notification system.
Libpq does have the ability to get this info, so it's possible for the default Lazarus components to implement this.

Hope that helps out a bit.

Hi and thank you very much for this valuable explanation. It helps a lot.

I just saw that it is cross-platform, and has extra features. They even have an option to include the source-code!

Thank you also for mentioning your finding it adequate.

I am making it a point to explore what you mention.

Perhaps eventually the capability might be added to the Lazarus components, too, as you suggest! ;D

BigChimp

  • Hero Member
  • *****
  • Posts: 5740
  • Add to the wiki - it's free ;)
    • FPCUp, PaperTiger scanning and other open source projects
Re: The output of the PostgreSQL server....
« Reply #18 on: June 29, 2012, 11:41:55 am »
I believe PostgreSQL sends the query hints/warnings etc using the postgreSQL notification system and the default Lazarus components do not have the capability built in to get the info needed.

I use the postgres components from Devart.com which work on Lazarus and fully support getting the proper error messages from the PG notification system.
Libpq does have the ability to get this info, so it's possible for the default Lazarus components to implement this.
Testing indicates SQLDB catches and processes PostgreSQL errors:
If I run the attached test program and enter some invalid SQL like
Quote
this is not sql;
...  SQLDB properly picks up the error from PostgreSQL. The program tells me this:
Quote
Database error: EDatabaseError/Execution of query failed (PostgreSQL: ERROR:  syntax error at or near "this"
LINE 1: this is not sql;
        ^
)
SQL statement was: this is not sql;

I do agree that it would be handy to have an error code property as well (such as implemented in the SQLDB Firebird, MS SQL Server, Sybase and Oracle drivers)...
« Last Edit: June 29, 2012, 11:45:42 am by BigChimp »
Want quicker answers to your questions? Read http://wiki.lazarus.freepascal.org/Lazarus_Faq#What_is_the_correct_way_to_ask_questions_in_the_forum.3F

Open source including papertiger OCR/PDF scanning:
https://bitbucket.org/reiniero

Lazarus trunk+FPC trunk x86, Windows x64 unless otherwise specified

ludob

  • Hero Member
  • *****
  • Posts: 1173
Re: The output of the PostgreSQL server....
« Reply #19 on: June 29, 2012, 03:24:38 pm »
Quote
I do agree that it would be handy to have an error code property as well (such as implemented in the SQLDB Firebird, MS SQL Server, Sybase and Oracle drivers)...
A patch for extended error information can be found at http://bugs.freepascal.org/view.php?id=22336. The error info is returned in the exception message and as a convenient EPQDatabaseError exception class with the following definition:
Code: [Select]
  EPQDatabaseError = class(EDatabaseError)
    public
      SEVERITY:string;
      SQLSTATE: string;
      MESSAGE_PRIMARY:string;
      MESSAGE_DETAIL:string;
      MESSAGE_HINT:string;
      STATEMENT_POSITION:string;
  end;

 

TinyPortal © 2005-2018