[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
Sun Apr 15 23:12:06 CEST 2018


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

Comment #2 by Michael ALTROGGE:

First, thank you for the fast answer (as usual) :)

But maybe you should understand how important an existing and "working" documantation is:

http://gambaswiki.org/wiki/comp/gb.db/sqlrequest?nh says:

Print hSqlRequest.Select("id", "name", "age").From("people").Where("age >= &1", iAgeMin).And().Where("age <= &2", iAgeMax).OrderBy("name", "age DESC").Get()

Anyhow, IT DID NOT WORK

Print objRequest.Select("HDR", "TXT").From("MA00").Where("MDL = &1", VAR.INFCOD).And().Where("TNR = &1", VAR.INFMOD).And().Where("AS4LOCAL = &1", VAR.SYSLNG).OrderBy("HDR DESC").Get()

result in

SELECT "HDR","TXT" FROM "MA00" WHERE (MDL = E'ADRESSEN') AND (TNR = 1) AND (AS4LOCAL = E'DE' ) ORDER BY "HDR" DESC

This is not a working SQL Request in no way ... even without the >E'<'s it will work with mySQL (not tested) but will not work with postgreSQL ... 

About gb.db:

...

The class preserves Gambas DBMS independence. In other words the same code will produce a request that is syntactically correct for the dialect of the underlying database.

...

will result in an SQL DML sentence that is correct for the database type specified by the hConn Connection

...

In my case the connection typ IS postgres and while using sqlrequest and db.find the resulting SQL DML sentence is wrong ...




More information about the User mailing list