X-Sharp/XSharpPublic

Compatibility problem (?) creating dbf with DBFNTX driver

Closed this issue · 2 comments

When creating a dbf with DBFNTX driver and then trying to use it from the ADS driver, an ADS error is reported:

Error 5096: Encryption is not enabled. Cannot append to an encrypted table unless encryption is enabled.

Is that to be expected?

FUNCTION Start() AS VOID STRICT
LOCAL cDbf AS STRING

cDbf := "c:\Test\testads"

RddSetDefault("DBFNTX")
// RddSetDefault("DBFCDX") // this works fine
DbCreate(cDbf, {{"TEST","C",10,0}} )

RddSetDefault("AXDBFCDX")
AdsSetServerType(1)

? DbUseArea(TRUE,,cDbf)
? DbAppend()
? FieldPut(1,"234")

? DbCloseArea()

handled exception:

XSharp.ADS.AdsError
Error 5096:  Encryption is not enabled.  Cannot append to an encrypted table unless encryption is enabled.

Callstack : 
System.Void XSharp.ADS.ADSRDD.ADSERROR(System.UInt32 iSubCode, System.UInt32 iGenCode, System.String strFunction, System.String strMessage, System.UInt32 iSeverity)() 
Boolean XSharp.ADS.ADSRDD._CheckError(System.UInt32 ulRetCode, System.UInt32 dwGenCode, System.String strFunction)() 
Advantage.AXDBFCDX.Boolean XSharp.ADS.ADSRDD.Append(System.Boolean fReleaseLocks)() 
Boolean XSharp.CoreDb+<>c__DisplayClass18_0.<Append>b__0()() 
static Object XSharp.CoreDb.Do(System.Func`1[System.Object] action)() 
static Boolean XSharp.CoreDb.Append(System.Boolean lReleaseLocks)() 
static Boolean XSharp.RT.Functions.DbAppend(XSharp.__Usual[] Xs$Args)() 

I suspect that the DBF is created with the Ansi bit in the header set (first byte is then 0x07 or 0x87).
What happens if you create the file with SetAnsi(FALSE) ?

Ah right, it works fine with SetAnsi(FALSE)! And VO does the same thing, depending on using DBFNTX or DBFCDX it creates the file differently, so it's expected behavior.