Prev: Upgrade VO 2.8 SP3
Next: DB Editor
From: Rob Smith on 3 Dec 2009 08:22 Hello I wonder if anyone can help me with problems I am having using ADS. I have the following code at start up:- SetAnsi(.F.) AX_SetServerType(.T.,.F.,.F.) AX_AXSLocking(.F.) RddSetDefault("AXDBFCDX") I have a preinit for each dbServer with the following line:- self:xDriver:="AXDBFCDX" The application loads fine and looking at the Advantage Configuration Utility, the files are all opened ok. However when I try the following code:- if !AX_Transaction(AX_BEGIN_TRANSACTION) WarningBox{self,"Advantage","Can't start transaction"}:Show() lPublicTransaction:=false else lPublicTransaction:=true endif AX_Transaction(AX_BEGIN_TRANSACTION) returns false. Any ideas? Thanks Rob
From: Karl Wochele on 3 Dec 2009 08:42 Hi Rob, I think there is a bug in AX_Transaction Code of AX_Transaction: FUNCTION AX_Transaction( iAction ) AS LOGIC // Transaction call LOCAL usInTrans AS WORD LOCAL ulRetVal AS LONG /* * Transaction Processing function. The parameter can be * AX_BEGIN_TRANSACTION * AX_COMMIT_TRANSACTION * AX_ROLLBACK_TRANSACTION * AX_ISACTIVE_TRANSACTION */ usInTrans := 0 IF ( IsNil( iAction )) // if no arguments, the return ISACTIVE iAction := AX_ISACTIVE_TRANSACTION ENDIF DO CASE CASE iAction = AX_BEGIN_TRANSACTION ulRetVal := DBFAXSAdsBeginTransaction( 0 ) CASE iAction = AX_COMMIT_TRANSACTION ulRetVal := DBFAXSAdsCommitTransaction( 0 ) CASE iAction = AX_ROLLBACK_TRANSACTION ulRetVal := DBFAXSAdsRollbackTransaction( 0 ) CASE iAction = AX_ISACTIVE_TRANSACTION ulRetVal := DBFAXSAdsInTransaction( 0, @usInTrans ) ENDCASE RETURN ( usInTrans != 0 ) for AX_BEGIN_TRANSACTION usInTrans is always 0 and therefore the function will allways return FALSE !!!! We use the following functions (which seem to work): FUNCTION AXBeginTransaction() LOCAL iBegin AS DWORD LOCAL hConnect AS DWORD hConnect := AXGetConnHandle() iBegin := AdsBeginTransaction(hConnect) RETURN iBegin FUNCTION AXInTransaction() LOCAL lInTrans AS LOGIC LOCAL hConnect AS DWORD LOCAL pbInTrans AS WORD hConnect := AXGetConnHandle() AdsInTransaction(hConnect,@pbInTrans) lInTrans := (pbInTrans <> 0) RETURN lInTrans FUNCTION AXCommitTransaction() LOCAL hConnect AS DWORD hConnect := AXGetConnHandle() RETURN AdsCommitTransaction(hConnect) FUNCTION AXRollBackTransaction() LOCAL hConnect AS DWORD hConnect := AXGetConnHandle() RETURN AdsRollbackTransaction(hConnect) HTH Karl Rob Smith schrieb: > Hello > > I wonder if anyone can help me with problems I am having using ADS. I > have the following code at start up:- > > SetAnsi(.F.) > AX_SetServerType(.T.,.F.,.F.) > AX_AXSLocking(.F.) > RddSetDefault("AXDBFCDX") > > I have a preinit for each dbServer with the following line:- > > self:xDriver:="AXDBFCDX" > > The application loads fine and looking at the Advantage Configuration > Utility, the files are all opened ok. > > However when I try the following code:- > > if !AX_Transaction(AX_BEGIN_TRANSACTION) > WarningBox{self,"Advantage","Can't start transaction"}:Show() > lPublicTransaction:=false > else > lPublicTransaction:=true > endif > > AX_Transaction(AX_BEGIN_TRANSACTION) returns false. > > Any ideas? > > Thanks > > Rob >
From: Rob Smith on 3 Dec 2009 09:55 On Dec 3, 1:42 pm, Karl Wochele <kw@e©os-system.de> wrote: > Hi Rob, > > I think there is a bug in AX_Transaction > > Code of AX_Transaction: > > FUNCTION AX_Transaction( iAction ) AS LOGIC // Transaction call > LOCAL usInTrans AS WORD > LOCAL ulRetVal AS LONG > /* > * Transaction Processing function. The parameter can be > * AX_BEGIN_TRANSACTION > * AX_COMMIT_TRANSACTION > * AX_ROLLBACK_TRANSACTION > * AX_ISACTIVE_TRANSACTION > */ > usInTrans := 0 > > IF ( IsNil( iAction )) // if no arguments, the return ISACTIVE > iAction := AX_ISACTIVE_TRANSACTION > ENDIF > > DO CASE > CASE iAction = AX_BEGIN_TRANSACTION > ulRetVal := DBFAXSAdsBeginTransaction( 0 ) > CASE iAction = AX_COMMIT_TRANSACTION > ulRetVal := DBFAXSAdsCommitTransaction( 0 ) > CASE iAction = AX_ROLLBACK_TRANSACTION > ulRetVal := DBFAXSAdsRollbackTransaction( 0 ) > CASE iAction = AX_ISACTIVE_TRANSACTION > ulRetVal := DBFAXSAdsInTransaction( 0, @usInTrans ) > ENDCASE > > RETURN ( usInTrans != 0 ) > > for AX_BEGIN_TRANSACTION usInTrans is always 0 and therefore the > function will allways return FALSE !!!! > > We use the following functions (which seem to work): > > FUNCTION AXBeginTransaction() > LOCAL iBegin AS DWORD > LOCAL hConnect AS DWORD > hConnect := AXGetConnHandle() > iBegin := AdsBeginTransaction(hConnect) > RETURN iBegin > > FUNCTION AXInTransaction() > LOCAL lInTrans AS LOGIC > LOCAL hConnect AS DWORD > LOCAL pbInTrans AS WORD > > hConnect := AXGetConnHandle() > AdsInTransaction(hConnect,@pbInTrans) > lInTrans := (pbInTrans <> 0) > > RETURN lInTrans > > FUNCTION AXCommitTransaction() > LOCAL hConnect AS DWORD > hConnect := AXGetConnHandle() > RETURN AdsCommitTransaction(hConnect) > > FUNCTION AXRollBackTransaction() > LOCAL hConnect AS DWORD > hConnect := AXGetConnHandle() > RETURN AdsRollbackTransaction(hConnect) > > HTH > Karl > > Rob Smith schrieb: > > > > > Hello > > > I wonder if anyone can help me with problems I am having using ADS. I > > have the following code at start up:- > > > SetAnsi(.F.) > > AX_SetServerType(.T.,.F.,.F.) > > AX_AXSLocking(.F.) > > RddSetDefault("AXDBFCDX") > > > I have a preinit for each dbServer with the following line:- > > > self:xDriver:="AXDBFCDX" > > > The application loads fine and looking at the Advantage Configuration > > Utility, the files are all opened ok. > > > However when I try the following code:- > > > if !AX_Transaction(AX_BEGIN_TRANSACTION) > > WarningBox{self,"Advantage","Can't start transaction"}:Show() > > lPublicTransaction:=false > > else > > lPublicTransaction:=true > > endif > > > AX_Transaction(AX_BEGIN_TRANSACTION) returns false. > > > Any ideas? > > > Thanks > > > Rob- Hide quoted text - > > - Show quoted text - Thanks Karl Could you let me have the code you use for AXGetConnHandle() thanks Rob
From: Karl Wochele on 3 Dec 2009 10:14 Hi Rob, sorry, I forgot. FUNCTION AXGetConnHandle(cPath) LOCAL iConnect AS INT LOCAL pPath AS PSZ Default(@cPath,WorkDir()) pPath := StringAlloc(cPath) AdsFindConnection25(pPath,@iConnect) MemFree(pPath) RETURN iConnect cPath is of course the folder, where the data lies. Maybe you have to adapt this part a little bit. Karl Rob Smith schrieb: > On Dec 3, 1:42 pm, Karl Wochele <kw@e�os-system.de> wrote: >> Hi Rob, >> >> I think there is a bug in AX_Transaction >> >> Code of AX_Transaction: >> >> FUNCTION AX_Transaction( iAction ) AS LOGIC // Transaction call >> LOCAL usInTrans AS WORD >> LOCAL ulRetVal AS LONG >> /* >> * Transaction Processing function. The parameter can be >> * AX_BEGIN_TRANSACTION >> * AX_COMMIT_TRANSACTION >> * AX_ROLLBACK_TRANSACTION >> * AX_ISACTIVE_TRANSACTION >> */ >> usInTrans := 0 >> >> IF ( IsNil( iAction )) // if no arguments, the return ISACTIVE >> iAction := AX_ISACTIVE_TRANSACTION >> ENDIF >> >> DO CASE >> CASE iAction = AX_BEGIN_TRANSACTION >> ulRetVal := DBFAXSAdsBeginTransaction( 0 ) >> CASE iAction = AX_COMMIT_TRANSACTION >> ulRetVal := DBFAXSAdsCommitTransaction( 0 ) >> CASE iAction = AX_ROLLBACK_TRANSACTION >> ulRetVal := DBFAXSAdsRollbackTransaction( 0 ) >> CASE iAction = AX_ISACTIVE_TRANSACTION >> ulRetVal := DBFAXSAdsInTransaction( 0, @usInTrans ) >> ENDCASE >> >> RETURN ( usInTrans != 0 ) >> >> for AX_BEGIN_TRANSACTION usInTrans is always 0 and therefore the >> function will allways return FALSE !!!! >> >> We use the following functions (which seem to work): >> >> FUNCTION AXBeginTransaction() >> LOCAL iBegin AS DWORD >> LOCAL hConnect AS DWORD >> hConnect := AXGetConnHandle() >> iBegin := AdsBeginTransaction(hConnect) >> RETURN iBegin >> >> FUNCTION AXInTransaction() >> LOCAL lInTrans AS LOGIC >> LOCAL hConnect AS DWORD >> LOCAL pbInTrans AS WORD >> >> hConnect := AXGetConnHandle() >> AdsInTransaction(hConnect,@pbInTrans) >> lInTrans := (pbInTrans <> 0) >> >> RETURN lInTrans >> >> FUNCTION AXCommitTransaction() >> LOCAL hConnect AS DWORD >> hConnect := AXGetConnHandle() >> RETURN AdsCommitTransaction(hConnect) >> >> FUNCTION AXRollBackTransaction() >> LOCAL hConnect AS DWORD >> hConnect := AXGetConnHandle() >> RETURN AdsRollbackTransaction(hConnect) >> >> HTH >> Karl >> >> Rob Smith schrieb: >> >> >> >>> Hello >>> I wonder if anyone can help me with problems I am having using ADS. I >>> have the following code at start up:- >>> SetAnsi(.F.) >>> AX_SetServerType(.T.,.F.,.F.) >>> AX_AXSLocking(.F.) >>> RddSetDefault("AXDBFCDX") >>> I have a preinit for each dbServer with the following line:- >>> self:xDriver:="AXDBFCDX" >>> The application loads fine and looking at the Advantage Configuration >>> Utility, the files are all opened ok. >>> However when I try the following code:- >>> if !AX_Transaction(AX_BEGIN_TRANSACTION) >>> WarningBox{self,"Advantage","Can't start transaction"}:Show() >>> lPublicTransaction:=false >>> else >>> lPublicTransaction:=true >>> endif >>> AX_Transaction(AX_BEGIN_TRANSACTION) returns false. >>> Any ideas? >>> Thanks >>> Rob- Hide quoted text - >> - Show quoted text - > > Thanks Karl > > Could you let me have the code you use for AXGetConnHandle() > > thanks Rob
From: Peter Funk on 3 Dec 2009 12:45 Rob, Karl, I fixed the problem in our source for newer versions of Advantage. Below is the fix if you need it. Regards, Peter Funk Advantage R&D FUNCTION AX_Transaction( iAction ) AS LOGIC // Transaction call LOCAL usInTrans AS WORD LOCAL ulRetVal AS LONGINT /* * Transaction Processing METHOD. The parameter can be * AX_BEGIN_TRANSACTION * AX_COMMIT_TRANSACTION * AX_ROLLBACK_TRANSACTION * AX_ISACTIVE_TRANSACTION */ usInTrans := 0 IF ( IsNil( iAction )) // if no arguments, the return ISACTIVE iAction := AX_ISACTIVE_TRANSACTION ENDIF DO CASE CASE iAction = AX_BEGIN_TRANSACTION ulRetVal := DBFAXSAdsBeginTransaction( 0 ) RETURN (ulRetVal == 0) CASE iAction = AX_COMMIT_TRANSACTION ulRetVal := DBFAXSAdsCommitTransaction( 0 ) RETURN (ulRetVal == 0) CASE iAction = AX_ROLLBACK_TRANSACTION ulRetVal := DBFAXSAdsRollbackTransaction( 0 ) RETURN (ulRetVal == 0) CASE iAction = AX_ISACTIVE_TRANSACTION ulRetVal := DBFAXSAdsInTransaction( 0, @usInTrans ) RETURN ( usInTrans != 0 ) ENDCASE // Shouldn't get here RETURN FALSE
|
Pages: 1 Prev: Upgrade VO 2.8 SP3 Next: DB Editor |