xsharp.eu • VODBAppend() returns false
Page 1 of 1

VODBAppend() returns false

Posted: Wed Aug 17, 2022 3:18 pm
by ArunBerlin

Code: Select all

   
LOCAL nRet := 1 AS LONG
nRet := iif((nArea)->(VODBAppend(TRUE)) .and. !NetErr(),1,0)
Edit:

Code: Select all

 
FUNCTION _DictCreate(pszDictName AS PSZ) AS LONG PASCAL
   LOCAL cFile AS STRING
   LOCAL aStruc AS ARRAY
   LOCAL strRDDList AS _RDDLIST
   LOCAL nRet := 0 AS LONG

   SetAnsi(FALSE)
   SetCollation(#CLIPPER)
   SetDateCountry(XSharp.Core.Functions.BRITISH)
   SetCentury(TRUE)
   cFile := Psz2String(pszDictName) + '.DBZ' // Index file
   strRDDList := GetRDDList()
   aStruc := {{"DATA","M",10,0}}
   
   IF VODBCreate(cFile, aStruc, strRDDList, TRUE, "blob", NULL_STRING, FALSE, FALSE)
       nRet := 1
   ENDIF
RETURN nRet

FUNCTION _DictOpen(pszDictName AS STRING,nShare AS LONG,nRO AS LONG) AS LONG PASCAL
   LOCAL cFile,cAlias AS STRING
   LOCAL strRDDList AS _RDDLIST
   LOCAL nRet := 0 AS LONG
  
   SetAnsi(FALSE)
   SetCollation(#CLIPPER)
   SetDateCountry(XSharp.Core.Functions.BRITISH)
   SetCentury(TRUE)
   
   cFile := UPPER(pszDictName) + '.DBZ' // Index file
   cAlias := "__" + Str(100000 + VODBSetSelect(0),6,0)
   strRDDList := GetRDDList()
   IF VODBUseArea(TRUE, strRDDlist, cFile, cAlias, TRUE, TRUE) .and. !NetErr()
       nRet := (cAlias)->(VODBGetSelect())
   ENDIF  
RETURN nRet

INTERNAL FUNCTION GetRDDList() AS _RDDLIST
   LOCAL strRDDList AS _RDDLIST
   LOCAL DIM aRDDNames2[2] AS STRING
   LOCAL DIM aRDDNames3[3] AS STRING
   LOCAL dwRDDs AS DWORD
   
   dwRDDs := iif(Empty(NULL_SYMBOL), 2, 3)

   IF dwRDDs == 3
      aRDDNames3[1] := "CAVODBF"
      aRDDNames3[2] := #DBFNTX
      aRDDNames3[3] := NULL_SYMBOL     
      strRDDList := _RDDList{aRDDNames3}
   ELSE
      aRDDNames2[1] := "CAVODBF"
      aRDDNames2[2] := #DBFNTX
      strRDDList := _RDDList{aRDDNames2}
   ENDIF
RETURN strRDDList
nRet is returning 0, eventhough the nArea(LONG) is having a valid handle (2) of DBT file opened.
What could be the reasons for VODBAppend() returning always false ?

VODBAppend() returns false

Posted: Wed Aug 17, 2022 3:43 pm
by Chris
Hi Arun,

That's too hard to tell, without any other information about the RDD used, how the file is opened etc. Can you please post a (compilable) full sample (including necessary dbfs) that demonstrates this problem?

VODBAppend() returns false

Posted: Mon Aug 22, 2022 7:10 am
by ArunBerlin
Hi, Thankyou for looking into this issue. I've edited the Question with explanatory functions

VODBAppend() returns false

Posted: Mon Aug 22, 2022 8:41 am
by Chris
Hi Arun,

Thanks for sending the code! In this particular case, the problem is caused because the dbf is opened in read only mode (the last TRUE argument in the call to VoDbUseArea(). Is this the same in your real code?

VODBAppend() returns false

Posted: Mon Aug 22, 2022 9:06 am
by ArunBerlin
Yes, The ReadOnly Param in VoDbUseArea() was causing the issue. Thankyou Chris !!!