hi,
there are RDD for MySQL and PostgreSQL but it need OOP Syntax is like using a Db-Server or ADO.
Alaska have made PgDBE to "simulate" ISAM Style like SKIP or GOTO ... SEEK
they want to use it instead of ADS
but PgDBE Concept of "Index" is very strange as it use "internal" FIELD(s) to hold Value of IndexKey()
so when "edit" a Record you need to update "internal" Index FIELD(s) (done only with PgDBE)
---
ADS can be used with xBase ISAM Syntax. for SQL you need a CLASS to "simulate" ISAM Style.
i "think" we need a *.CH to "translate" xBase Command to OOP-Syntax
- Code: Select all Expand view
#command SKIP => o:SQLSkip(1)
#command SKIP <n> => o:SQLSkip(<n>)
than we write a CLASS and
- Code: Select all Expand view
Method SQLSkip(nRec)
i do have a Xbase++ CLASS but not made a *.CH
i´m working on a harbour CLASS using CLASS TPQServer ( \HARBOUR\contrib\hbpgsql\ ) for PostgreSQL
---
have work with MySQL and PostgreSQL under Xbase++
but as Xbase++ goes PostgreSQL i have build my Xbase++ App with LibPQ.DLL (using Ot4XB LIB)
i use Concept of "OFFSET" and "LIMIT" and have a
- Code: Select all Expand view
METHOD JimBrowse:NextCursor( cTable, cField, cWhere, cOrder, cLimit, cOffset )
...
cVar1 := "BEGIN WORK;"
IF SP_nVersion() < 9
cVar2 := "DECLARE MyCursor CURSOR FOR SELECT " + cField + ;
" FROM " + cTable + ;
IF( EMPTY( cWhere ), "", " WHERE " + cWhere ) + ;
" ORDER BY " + cOrder
ELSE
cVar2 := "DECLARE MyCursor CURSOR FOR SELECT " + cField + ;
", row_number() OVER (ORDER BY " + cOrder + ")" + ;
" FROM " + cTable + ;
IF( EMPTY( cWhere ), "", " WHERE " + cWhere ) + ;
" ORDER BY " + cOrder
ENDIF
cVar3 := "MOVE FORWARD " + cOffset + " IN MyCursor"
cVar4 := "FETCH FORWARD " + cLimit + " FROM MyCursor"
cVar5 := "CLOSE MyCursor;"
cVar6 := "COMMIT WORK;"
StartStop( "START" )
::oPG:exec( cVar1 )
Method use "Cursor"
you need to "exec" each "cVar" before successful "Transaction" was written.
! Note : need PostgreSQL Server > 8 for row_number()
row_number() will create a "extra" Column in Result-Set which is like OrdKeyNo()
this is useful when want to "SKIP" (in Order) in SQL Table
if "nSkip" is > FIELD row_number() it need call o:NextCursor()
i "think" i can "translate" my Xbase++ CLASS Code into harbour CLASS Syntax
as it need no (GUI/Console) "Output" it might be used with every Constribution / Distribution
p.s. will need help to "translate" Xbase++ Syntax to harbour (still Newbie under harbour)
who use PostgreSQL with harbour ?