Page 1 of 1

FWH HbSix DBF/NSX/SMT File Management

Posted: Thu Mar 01, 2012 1:06 pm
by RiazKhan
Dear All,

I have recently converted my applications to 32 Bits. Most are working well, with some minor change in source.
Previously in my clipper 16 bit application I was using Six3 and SixNsx driver to manage the dbf files. Converting to FWH, the dbf/nsx files are managed well.
The problem is that I have some files with memo fields with are stored in SMT files. My DBF files are encrypted with password. So in general I have DBF-Database Files/NSX-Index Files/SMT-Memo Files

My request in the Main prg is as follows :

REQUEST DBFNSX
RDDREGISTER( "DBFNSX" , 1 )
RDDSETDEFAULT( "DBFNSX" )
Sx_AutoOpen(.F.)

This function SX_MemoExt() return ".SMT"

The files without memo fields open okay and seek works fine within the application.. The files with memo fields do not open in dialog. Produces an error of corruption detected.

Create index of these files produces NO errors. But when a PACK is issued withing the application, the file with memo field produces the following error..:

Error description: (Application: 38) DBFNSX/1010 Read error: \PPFNSX\PFL\PFL-1112\P1_PURS.smt
Stack Calls
===========
Called from: => __DBPACK( 0 )
Called from: .\W_623.PRG => W_6231( 78 )

and this corrupts the first record...

Any suggestion to resolve this issue....

Riaz Khan

Re: FWH HbSix DBF/NSX/SMT File Management

Posted: Thu Mar 01, 2012 5:45 pm
by Antonio Linares
Riaz,

Have you already reported it, as you explained it here, in the Harbour developers list ?

http://groups.google.es/group/harbour-devel

Re: FWH HbSix DBF/NSX/SMT File Management

Posted: Thu Mar 01, 2012 7:29 pm
by RiazKhan
Hi Antonoio,

Yes, I did report it at Harbour Developers Group. They asked for a working sample, which I prepared and tested locally. It worked fine.
The sample is listed below.:
*************************************************************************************8
DbCreate( FileName , aDbf , "DBFNSX" )
DbUseArea(.T.,"DBFNSX",FileName)
FErase( FileName+'.NSX' )
Index On CODE+Str(RecNo()) TAG "P5_PFLT1"
Index On NAME+Str(RecNo()) TAG "P5_PFLT2"
DbCloseArea()
DbUseArea(.T.,"DBFNSX",FileName)
Set Index To P5_PflT
DbAppend() //Appended two records
DbUseArea(.T.,"DBFNSX",FileName)
Set Index To P5_PflT
DBSeek('PFL0002') // Is .T.
PACK // NO Error
The above worked fine. The Seek is true.....The PACK produced no error..
************************************************************************************
But If I Do This..:
File := "P1_Purs" ; cDriver := "DBFNSX"
Use (File) New VIA (cDriver) EXCLUSIVE PASSWORD (DBFPass)
Index On P_NO+DTOS(P_DT)+Str(RecNo()) TAG "P1_PURS1"
Index On DTOS(P_DT)+P_NO+Str(RecNo()) TAG "P1_PURS2"

Set Index To P1_Purs
P1_Purs->(DBSeek('0100P'))

Here The Seek is .F. And PACK produces Read Error..? The seek and PACK only fails for files having memo fields....
All my files are encrypted, the rest open and seek and pack...no erros...

Can you suggest anything.....

Re: FWH HbSix DBF/NSX/SMT File Management

Posted: Thu Mar 01, 2012 9:39 pm
by Antonio Linares
Here The Seek is .F. And PACK produces Read Error..? The seek and PACK only fails for files having memo fields....
All my files are encrypted, the rest open and seek and pack...no erros...
What the Harbour dev list answered about this ?

Re: FWH HbSix DBF/NSX/SMT File Management

Posted: Fri Mar 02, 2012 8:48 am
by RiazKhan
Hi Antonio,

I have posted the problem again at Harbour Developers Group.
Creating a self contained sample without password encryption worked fine. So I left it at that and did not pursue the issue. Now I have posted the sample with password encryption.
I will wait for a solution for there for the mean time..
Will keep you posted..

https://groups.google.com/group/harbour ... 048d?hl=en

Thanks and Regards

Re: FWH HbSix DBF/NSX/SMT File Management

Posted: Mon Mar 05, 2012 11:00 am
by RiazKhan
Dear Antonio,


I have had no positive response from Harbour Developers Group.. A self contained sample was posted and listed below with no luck....:

****************************************************************************************************************
#Include "hbsix.ch"

FUNCTION Main( )

LOCAL hBorland
LOCAL x, aDbf[0]
LOCAL DBFPass := 'bogus'
*
FIELD P_NO

SET CENT ON
SET DATE TO BRITISH
SET EPOCH TO 1980
SET DELETED ON

REQUEST DBFNSX,DBFSMT
RDDREGISTER( "DBFNSX" , 1 )
RDDSETDEFAULT( "DBFNSX" )
Sx_AutoOpen(.F.)

aSize( aDbf, 0 )

aAdd(aDbf,{"P_NO" ,"C",05,0 })
aAdd(aDbf,{"P_APP_MS" ,"L",01,0 })
aAdd(aDbf,{"P_APP_GM" ,"L",01,0 })

Sx_DBcreate("APur.dbf" , aDbf )

Use APur New VIA "DBFNSX" PASSWORD (DBFPass)
Sx_DBFencrypt()

Index On P_NO+Str(RecNo()) TAG "APur1"
Set Index To APur

PACK // NO Errors

DbAppend()

APur->P_No := "0100P"
APur->P_App_MS := .T.
APur->P_App_GM := .F.

DbAppend()

APur->P_No := "0101P"
APur->P_App_MS := .F.
APur->P_App_GM := .T.

DbSelectAr('APur')
DbSeek('0101P') // Returns .T.

DBCloseAll()

aSize( aDbf, 0 )

aAdd(aDbf,{"P_NO" ,"C",05,0 })
aAdd(aDbf,{"P_APP_MS" ,"L",01,0 })
aAdd(aDbf,{"P_APP_GM" ,"L",01,0 })
aAdd(aDbf,{"P_Memo" ,"M",10,0 })

Sx_DBcreate("BPur.dbf" , aDbf )

Use BPur New VIA "DBFNSX" PASSWORD (DBFPass)
Sx_DBFencrypt()

Index On P_NO+Str(RecNo()) TAG "BPur1"
Set Index To BPur

PACK // NO Error Because No Encryption

DbAppend()

BPur->P_No := "0100P"
BPur->P_App_MS := .T.
BPur->P_App_GM := .F.

DbAppend()

BPur->P_No := "0101P"
BPur->P_App_MS := .F.
BPur->P_App_GM := .T.

DbSelectAr('BPur')
DbSeek('0101P') // Returns .T.

DbCloseAll()

RETURN (NIL)
************************************************************************************************************
Can you direct me, please as this is the only factor remaining of the migration process..

Regards

Re: FWH HbSix DBF/NSX/SMT File Management

Posted: Mon Mar 05, 2012 4:32 pm
by RiazKhan
Hi All,

This is the info. from Harbour Developers Group..:
[Quote]
When I was adding support for SIX3 encryption to [x]Harbour i blocked
it for tables with memos. I made it intentionally when I found few
serious bugs in SIX3 implementation when tables with memos are encrypted.
I didn't want to replicate them and make [x]Harbour RDDs bug compatible
with SIX3 because SIX3 is corrupting data in some cases.
I left them to the moment when I'll find some spare time to precisely
document SIX3 bugs and differences in new implementation.
Meanwhile I decided to block support for SIX3 encrypted tables with
memos to not have backward compatibility problems with data created
by [x]Harbour RDDs before I'll introduce workarounds for SIX3 bugs.
[UnQuote]