[Gambas-user] [Gambas Bug Tracker] Bug #1296: not able to use db.find or sql.request with postgreSQL

bugtracker at gambaswiki.org bugtracker at gambaswiki.org
Thu Apr 19 13:55:22 CEST 2018


http://gambaswiki.org/bugtracker/edit?object=BUG.1296&from=L21haW4-

Comment #21 by Benoît MINISINI:

You have to ask for examples on the mailing-list. Here is for reporting bugs.

I tried SqlRequest() and DB.Find(), and it seems to works as expected.

But beware:

- With PostgreSQL, you have to quote all your identifiers (tabls and field names) as soon as they are not in lowercase.

  For example: you have to write DB.Find("SCHEMA.TABLE", "\"FIELD_IN_UPPERCASE\" = &1", Value)

- Table and schema names are automatically quoted. A table named SCHEMA.NAME will be quoted as "SCHEMA"."NAME".

- When using a substitution database method (DB.Find, SqlRequest.Where...), you have to provide values of accurate datatypes.

  For example, DB.Find("<SCHEMA>.<TABLE>", "<FIELD> = &1", 1) will fail if FIELD is a string field. Because the number 1 will not be 
  converted to the string syntax ("E'1'") automatically.

Benoît MINISINI changed the state of the bug to: Fixed.




More information about the User mailing list