Bugfix for SAMPLE POSTGRESQL.5

Moderator: Rathinagiri

Post Reply
User avatar
raumi75
Posts: 135
Joined: Wed Dec 17, 2008 2:31 am
Location: Lünen, Germany
Contact:

Bugfix for SAMPLE POSTGRESQL.5

Post by raumi75 »

Hello,

the sample-file SAMPLES\POSTGRESQL.5\tstpgrdd.prg throws a syntax error in the line

Code: Select all

 use "select <fields,...> from <table> order by <same order as dbf>" alias <table> via "pgrdd" connection nConn 
At first I thought, I was too stupid to fill in the correct parameters, but then I found the bugfix in another forum:

http://www.matrixlist.com/pipermail/har ... 03857.html

Master Roberto, please be so kind as to add the following definition to the top of the program file.

Code: Select all

#command USE <(db)> [VIA <rdd>] [ALIAS <a>] [<nw: NEW>] ;
            [<ex: EXCLUSIVE>] [<sh: SHARED>] [<ro: READONLY>] ;
            [CODEPAGE <cp>] [CONNECTION <nConn>] [INDEX <(index1)> [, <(indexN)>]] => ;
         dbUseArea( <.nw.>, <rdd>, <(db)>, <(a)>, ;
                    if(<.sh.> .or. <.ex.>, !<.ex.>, NIL), <.ro.>,  [<cp>], [<nConn>] ) ;
         [; dbSetIndex( <(index1)> )] ;
         [; dbSetIndex( <(indexN)> )]
There was another slight problem with the file in the line

Code: Select all

   nConn := dbpgconnection( "<host>;<database>;<user>;<password>;<port>;<scheme>" )
When I explicitly defined the port-number, the connection was refused and the error message asked, if the postgresql-server was listening on port 0. After I left out the port-number and the scheme, everything was fine. The default port number 5432 and scheme "public" was used.

I could not find any documentation on the pgrdd-driver, so I don't know how to fix this other than to leave out port and scheme and alter the line to

Code: Select all

   nConn := dbpgconnection( "<host>;<database>;<user>;<password>" )
This should work for everybody who uses default port and scheme.

Applying those to changes to the sample file will be a big leap forward for others, who try to connect to postgresl-servers.

Thank you very much and have a great weekend!

Raumi75
User avatar
Roberto Lopez
HMG Founder
Posts: 4004
Joined: Wed Jul 30, 2008 6:43 pm

Re: Bugfix for SAMPLE POSTGRESQL.5

Post by Roberto Lopez »

raumi75 wrote: <...>
Master Roberto, please be so kind as to add the following definition to the top of the program file.
<...>
Thanks. I'll check it ASAP.
Regards/Saludos,

Roberto


(Veritas Filia Temporis)
Post Reply