Page 1 of 1

Is anyone using PostGreSql?

Posted: Sat Dec 22, 2018 8:06 pm
by rdonnay
I can’t find any documentation on how to get Data Dictionary information from PostGreSql.
The below statement works in PgAdmin but not in Xbase++.

I tried the SELECT command and the USE command to no avail.

SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE table_schema = 'public'

I am not having problems accessing data from Northwind and also other databases that I have upsized, so I know that I am communicating with the server.

Re: Is anyone using PostGreSql?

Posted: Sat Dec 22, 2018 8:33 pm
by Auge_Ohr
hi,
rdonnay wrote:

Code: Select all

SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE table_schema = 'public'
try this way

Code: Select all

   ::cQuery := "SELECT table_name FROM information_schema.tables " + ;
                     "WHERE table_schema = 'public'"

Re: Is anyone using PostGreSql?

Posted: Sun Dec 23, 2018 8:57 am
by rdonnay
That doesn't work either.

What is ::cQuery ?

What command or function do you run after creating the statement?

It appears that the only way that Postgresql is useful is via the ODBCDBE.

Re: Is anyone using PostGreSql?

Posted: Sun Dec 23, 2018 12:40 pm
by Auge_Ohr
hi,

i'm using PostgreSQL native this Way.

Code: Select all

         // send Query
         //
         IF ::oPG:Exec( ::cQuery )
            ::oR_Table := ::oPG:result
merry Xmas :occasion-xmas:

Re: Is anyone using PostGreSql?

Posted: Sun Dec 23, 2018 5:17 pm
by rdonnay
What class is ::oPG ?

What do you mean by native?

Are you using a 3rd party library?

Re: Is anyone using PostGreSql?

Posted: Sun Dec 23, 2018 6:14 pm
by Auge_Ohr
hi,

i just use libpq.dll*** (32bit) native to access PostgreSQL. it is based on Phil Ide CLASS from 2003.
xbpgsql.zip
Original Version from Phil Ide
(38.57 KiB) Downloaded 834 times
as i use ot4xb i use Xbase++ Wrapper from Pablo Botella.
libpq4xb.zip
ot4xb Version
(3.6 KiB) Downloaded 821 times
have fun

*** Note : libpq.dll itself need some *.DLL
copy all *.DLL (except wxbase28u*.DLL) from \PostgreSQL\xx.x\bin\ into your Xbase++ App Directory

Re: Is anyone using PostGreSql?

Posted: Sun Dec 23, 2018 6:51 pm
by rdonnay
I found a solution. I discovered DacSqlStatement().

Code: Select all

IF(!DbeLoad("pgdbe"))
  Alert( "Unable to load the PostgreSQL DatabaseEngine", {"Quit"} )
  QUIT
ENDIF

// Establish the connection
cConnect := "DBE=pgdbe;SERVER=localhost;DB=northwind;UID=postgres;PWD=" + GetEnv('POSTGRESQL_PASSWORD')

oSession := DacSession():New( cConnect ):GetDefault()

IF .NOT. oSession:isConnected()
  DCMSGBOX oSession:GetLastMessage(), ;
           "Unable to establish connection to server"
  QUIT
ENDIF

cSql := "SELECT * FROM INFORMATION_SCHEMA.COLUMNS" + ;
        " WHERE table_schema = 'public'"  + ;
        " ORDER BY table_name,column_name"

oStmt := DacSqlStatement():FromChar(cSql)

oStmt:Build():Query(,'TABLES')

DC_Dot()

Re: Is anyone using PostGreSql?

Posted: Mon Dec 24, 2018 8:08 am
by unixkd
Hi Roger

How about the performance of pgdbe from your current interraction ?

Thanks

Joe

Re: Is anyone using PostGreSql?

Posted: Mon Dec 24, 2018 10:13 am
by rdonnay
How about the performance of pgdbe
I don't use it in ISAM mode because it still doesn't work.

If I open a table with dbUsearea() it doesn't navigate correctly.
But if I open the same table with SELECT * it works fine.

Performance seems pretty good in SQL mode.