dc_dbposition and db_position

Xbase++ 2.0 Build 554 or later
Message
Author
reganc
Posts: 257
Joined: Thu Jan 28, 2010 3:08 am
Location: Hersham, Surrey, UK
Contact:

dc_dbposition and db_position

#1 Post by reganc »

Roger

We are testing out CTP3R4 at present. The previous CTPs gave us various headaches, most of which appear to have been resolved) and now is the first time that I have been able to get past our login screen and into our application proper.

Our current headache is with the current lack of support in PGDBE for dbposition().

We get the following error:

Code: Select all

------------------------------------------------------------------------------
Rba Version: 10.81.0011 (29/04/2013)
Express++ Version: eXPress++ (c) Version 1.9 Build 258
Xbase++ version: Xbase++ (R) Version 2.00.470
Operating system: Windows 7 06.01 Build 07601 Service Pack 1
------------------------------------------------------------------------------
oError:args         :oError:canDefault   :.T.
oError:canRetry     :.F.
oError:canSubstitute:.F.
oError:cargo        :NIL
oError:description  :Operation not supported by this DBE
oError:filename     :
oError:genCode      :58
oError:operation    :DbPosition
oError:osCode       :0
oError:severity     :2
oError:subCode      :8015
oError:subSystem    :BASE
oError:thread       :5
oError:tries        :0
------------------------------------------------------------------------------
CURRENT DATABASE:
------------------------------------------------------------------------------
Alias(): STK_SUP  Record: 283  Index: 2,STK_SUP2
  Extra DbInfo details
    Filename: STK_SUP.DBF
    Database Alias: STK_SUP  No. of Relations: 1  No. of Orders: 4
    In Shared Mode: .T.  Storage on Remote Drive: .F.  Database Engine: PGDBE
    Client/Server: .F.  ReadOnly Access: .F.
------------------------------------------------------------------------------
CALLSTACK:
------------------------------------------------------------------------------
Called from DC_DBPOSITION(949)
Called from (B)DC_XBPBROWSE:INIT(669)
Called from XBPBROWSE:FORCESTABLE(1142)
Called from DC_XBPBROWSE:FORCESTABLE(1352)
Called from XBPBROWSE:HANDLEEVENT(1538)
Called from DC_XBPBROWSE:HANDLEEVENT(1101)
Called from XBPBROWSE:SHOW(3304)
Called from DC_GETLIST:READGUI(3163)
Called from DC_READGUI(109)
Called from CS_UPDATE(2560)
Called from (B)MENURUN(0)
Called from RUNFUNCTION(87)
Called from (B)RUN_PROCEDURE(74)
------------------------------------------------------------------------------
Tracking this through, I can see the dbposition() function is used in the Dc_XbpBrowse:init procedure in ::posblock.

This means that any of our dialogs that contain a DCBROWSE will immediately crash on opening.

I presume that this means that our app will not work until CTP4 gets released which is supposed to add support for dbposition into PGDBE?
Regan Cawkwell
Real Business Applications Ltd
http://www.rbauk.com

User avatar
rdonnay
Site Admin
Posts: 4729
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: dc_dbposition and db_position

#2 Post by rdonnay »

Regan -

I just started working with CTP4 today.
I will look into this.

Do you have a sample program that uses PGDBE?

Roger
The eXpress train is coming - and it has more cars.

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

Re: dc_dbposition and db_position

#3 Post by Auge_Ohr »

preview.xbase++.20
9. Oktober 2013
Steffen Pirsig
Re: These functions are not Supported by PGDBE OrdKeyno () and dbPosition()
we need to postpone these functions to a later point for performance
reasons. Implementation of them in the context of a SQL server is rather
complex and we need to find a way to realize them with acceptable
performance.

However dbposition() and dbgoposition() are working SQL result set,
therefore you can use as a workaround instead of creating a filter/index
with for condition use the SQL SELECT command with a WHERE and ORDER BY
clause. Then orderkeyno equals record# and dbgoposition and dbposition work
properly.

Anyway, we will provide these two missing features in the context of logical
orders with CTP4 and one of the refresh.
see also http://bb.donnay-software.com/donnay/vi ... f=2&t=1119
greetings by OHR
Jimmy

User avatar
rdonnay
Site Admin
Posts: 4729
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: dc_dbposition and db_position

#4 Post by rdonnay »

For now, just replace the DC_DbPosition() function in _DCSCOPE.PRG and rebuild DCLIPX.DLL. The new code is below.

Code: Select all

FUNCTION DC_dbPosition ( nTimeOut, lDescending )

LOCAL nRecCount, nKeyNo, aScope, bErrorBlock, nPosition := 0, xScopeTop, xScopeBot
LOCAL lExact, aScopeArray, nPointer

IF Empty(Alias()) .OR. RecCount() = 0 .OR. Upper(_SetRdd())='PGDBE'
  RETURN 0
ENDIF

DEFAULT lDescending := .f.

aScopeArray := DC_SetScopeArray()
IF Valtype(aScopeArray) = 'A'
  IF Empty(aScopeArray)
    RETURN 0
  ENDIF
  nPointer := DC_SetScopeArrayPointer()
  IF nPointer = 1
    nPointer := 0
  ENDIF
  nPosition := (nPointer/Len(aScopeArray))*100
  IF lDescending
    RETURN 100-nPosition
  ELSE
    RETURN nPosition
  ENDIF
ENDIF

IF !DC_ScopeExpress()
  IF lDescending
    RETURN 100-dbPosition()
  ELSE
    RETURN dbPosition()
  ENDIF
ENDIF

IF IndexOrd() = 0
  bErrorBlock := ErrorBlock({||_PosError()})
  BEGIN SEQUENCE
  nPosition := dbPosition()
  END SEQUENCE
  ErrorBlock(bErrorBlock)
  RETURN nPosition
ENDIF

lExact := Set(_SET_EXACT,.f.)
aScope := DC_DbCargo()

xScopeTop := aScope[DCCARGO_ORDER_ARRAY, IndexOrd(),DCCARGO_ORDER_TOP]
xScopeBot := aScope[DCCARGO_ORDER_ARRAY, IndexOrd(),DCCARGO_ORDER_BOTTOM]

IF Valtype(xScopeTop) = 'C' .AND. Len(xScopeTop) = 0
  xScopeTop := nil
ENDIF

IF Valtype(xScopeBot) = 'C' .AND. Len(xScopeBot) = 0
  xScopeBot := nil
ENDIF

IF Valtype(xScopeTop) # 'U' .AND. Valtype(xScopeBot) # 'U'
  nKeyNo := DC_KeyNo( nTimeOut, @nRecCount )
  IF nKeyNo = -1 .OR. nRecCount = 0
    Set(_SET_EXACT,lExact)
    RETURN 0
  ENDIF
  nPosition := Int(100*(nKeyNo/nRecCount))
  IF lDescending
    nPosition := 100 - nPosition
  ENDIF
  Set(_SET_EXACT,lExact)
  RETURN nPosition
ELSE
  nRecCount := DC_KeyCount()
ENDIF

bErrorBlock := ErrorBlock({||_PosError()})
BEGIN SEQUENCE
nPosition := dbPosition()
END SEQUENCE
ErrorBlock(bErrorBlock)

IF lDescending
  nPosition := nRecCount - nPosition
ENDIF

Set(_SET_EXACT,lExact)

RETURN nPosition
The eXpress train is coming - and it has more cars.

reganc
Posts: 257
Joined: Thu Jan 28, 2010 3:08 am
Location: Hersham, Surrey, UK
Contact:

Re: dc_dbposition and db_position

#5 Post by reganc »

rdonnay wrote:For now, just replace the DC_DbPosition() function in _DCSCOPE.PRG and rebuild DCLIPX.DLL. The new code is below.

Code: Select all


FUNCTION DC_dbPosition ( nTimeOut, lDescending )

snip...

Thanks for that.

I am trying to build Express++ and for some reason I do not have a BUILD20.BAT in my C:\EXP19 folder.

I ran the BUILD19_SL1.bat and then tried running the BUILD20.bat in C:\EXP19\SOURCE\DCLIPX folder. On running the V2 app after I get the 'needs 1.9 dlls' alert. Just trying to get past that now...
Last edited by reganc on Tue Nov 05, 2013 2:52 am, edited 1 time in total.
Regan Cawkwell
Real Business Applications Ltd
http://www.rbauk.com

User avatar
rdonnay
Site Admin
Posts: 4729
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: dc_dbposition and db_position

#6 Post by rdonnay »

Alaska changed the project builder in 2.0.

I had to modify all the BUILD20.BAT files and DC*_20.XPJ files.
Here's the changes for DCLIPX.DLL:

BUILD20.BAT

WAS:

@call ver20.bat
@call pbuild dclipx_20.xpj %1 %2
@erase ..\..\lib\dclipx.lib
@erase ..\..\lib\dclipx.exp
@erase ..\..\lib\dclipx.def
@move ..\..\bin20\dclipx.lib ..\..\lib
@move ..\..\bin20\dclipx.exp ..\..\lib
@move ..\..\bin20\dclipx.def ..\..\lib

IS:

@call ver20.bat
@call pbuild dclipx_20.xpj %1 %2
if errorlevel 1 goto end
@erase ..\..\lib\dclipx.lib
@erase ..\..\lib\dclipx.exp
@erase ..\..\lib\dclipx.def
@move dclipx.lib ..\..\lib
@move dclipx.exp ..\..\lib
@move dclipx.def ..\..\lib
:end

DCLIPX_20.XPJ

WAS:

[DCLIPX.XPJ]
..\..\bin20\DCLIPX.DLL

[..\..\bin20\DCLIPX.DLL]

..\..\lib\dcdlls.res
_DCGETBX.PRG
_DCCLASS.PRG
_DCXBUTT.PRG

IS:

[DCLIPX.XPJ]
DCLIPX.DLL

[DCLIPX.DLL]
TARGET_DIR=..\..\bin20
..\..\lib\dcdlls.res
_DCGETBX.PRG
_DCCLASS.PRG
_DCXBUTT.PRG
....
The eXpress train is coming - and it has more cars.

reganc
Posts: 257
Joined: Thu Jan 28, 2010 3:08 am
Location: Hersham, Surrey, UK
Contact:

Re: dc_dbposition and db_position

#7 Post by reganc »

rdonnay wrote:Alaska changed the project builder in 2.0.

I had to modify all the BUILD20.BAT files and DC*_20.XPJ files.

snip...
OK.

Sorry but I don't appear to have a Ver20.bat either...
Regan Cawkwell
Real Business Applications Ltd
http://www.rbauk.com

User avatar
rdonnay
Site Admin
Posts: 4729
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: dc_dbposition and db_position

#8 Post by rdonnay »

Sorry but I don't appear to have a Ver20.bat either...
That's a public batch file that I use to set the compile and runtime environment.
The eXpress train is coming - and it has more cars.

reganc
Posts: 257
Joined: Thu Jan 28, 2010 3:08 am
Location: Hersham, Surrey, UK
Contact:

Re: dc_dbposition and db_position

#9 Post by reganc »

rdonnay wrote:
Sorry but I don't appear to have a Ver20.bat either...
That's a public batch file that I use to set the compile and runtime environment.
Ok. I didn't know that.

I presume that means I don't need it.

I'll make the changes to the batch file and project and see how it goes then.

Thanks.
Regan Cawkwell
Real Business Applications Ltd
http://www.rbauk.com

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

Re: dc_dbposition and db_position

#10 Post by Piotr D »

Hi Roger, hi all,
after a few years i am back ;)
Last week I begin test with Alaska Xbase 2.0 with PostgreSQL. My first experience was good, it's look like
a good way for transformation existing DBF-version to SQL. For me is important, that it's possible to have
only one (the same) version of PRGs user with DBF and user with SQL tables. Now the PGDBE not support
dbposition(), dbgoposition() and ordkeyno(), which you use id DC_dbposition() and DC_dbgopositon(). My question
is, if in current version of Express (I have 2.42) or in next version you solve these problems and your (IMO fantastic)
library will support PGDBE?

Regards
Piotr

Post Reply