dc_dbposition and db_position

Xbase++ 2.0 Build 554 or later
Message
Author
User avatar
rdonnay
Site Admin
Posts: 4775
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: dc_dbposition and db_position

#11 Post by rdonnay »

Piotr.

Unfortunately, PGDBE doesn't support dbPosition().
I could write a DC_DbPosition() that would work but it would be slow on large databases.

I wrote functions like DC_KeyNo(), DC_KeyCount(), DC_KeyPos() back in the Clipper days before they were available for DBFNTX.
If Alaska doesn't eventually support this for PGDBE, I will use the same algorithm.

Currently, DC_DbPosition() returns a 0 if the dbe is PGDBE.
The eXpress train is coming - and it has more cars.

Piotr D
Posts: 131
Joined: Mon Jul 28, 2014 1:26 am
Location: Poznań, Poland

Re: dc_dbposition and db_position

#12 Post by Piotr D »

Roger
thanks for your reply. In this case in DCBROWSE a THUMBLOCK option os a good solution for the vertical scrollbar.
Piotr

User avatar
Auge_Ohr
Posts: 1422
Joined: Wed Feb 24, 2010 3:44 pm

Re: dc_dbposition and db_position

#13 Post by Auge_Ohr »

rdonnay wrote:Unfortunately, PGDBE doesn't support dbPosition().
I could write a DC_DbPosition() that would work but it would be slow on large databases.
this is when use pgDBE while you have to wait for last Element of Result Set.
rdonnay wrote:I wrote functions like DC_KeyNo(), DC_KeyCount(), DC_KeyPos() back in the Clipper days before they were available for DBFNTX.
If Alaska doesn't eventually support this for PGDBE, I will use the same algorithm.
Problem of pgDBE is Alaska still using Postgre v8.x API.

using Postgre v9.x API, e.g. native with Phil Ide PG Class, you can use Function ROW_NUMBER() in a SELECT Statment.

Code: Select all

cQuery := "SELECT "+cDBSfield+", "+cOrder+", row_number() OVER (ORDER BY "+cDBSfield+") FROM "+ cTable +;
           IF( EMPTY( ::_cWhere ), "", " WHERE " + ::_cWhere ) + ;
           " ORDER BY "+cDBSfield
rdonnay wrote:Currently, DC_DbPosition() returns a 0 if the dbe is PGDBE.
using pgDBE i do NOT recommend to use a normal Browse with DbSkipper() yet.
every SKIP meed to send a Qwery to PostgreSQL Server ... this is very slow on large Table.

as you got a Result Set you can build a Class and move within a Result Set without using a Array to Browse.
here Sample from Phil Ide Mybrowse CLASS ( XbpBrowse() wrapper ) from 2001 ( !!! )
myPGSQLBrowse.zip
(1.5 KiB) Downloaded 870 times
greetings by OHR
Jimmy

Post Reply