Alaska Software Inc. - Doubt About Dbes
Username: Password:
AuthorTopic: Doubt About Dbes
Carlos a Beling Doubt About Dbes
on Fri, 16 Dec 2016 12:28:10 -0200
Good afternoon.
Merry Christmas and Happy New Year.

Using Xbase++ 2.0.
1) I have a Dbf with Dbt memo file. It could to be created using Clipper 
or Xbase
2) I want to convert it for FoxCdx that uses FTP files
3) after convertion I want destroy the DBT file

The problem:
1) The DBE DBFCDX opens the DBT file  (???)
2) The DBE DBFCDX returns memo extension as 'FTP'

Questions:
1) Is it correct?
2) How can destroy safety the DBT file

I attached a testing program. Please compile and run it for to see the 
problem.

Fraternaly
Beling


DbtFtp.zip
Jim LeeRe: Doubt About Dbes
on Fri, 16 Dec 2016 18:25:09 +0100
>1) I have a Dbf with Dbt memo file. It could to be created using Clipper
>or Xbase
> 2) I want to convert it for FoxCdx that uses FTP files
> 3) after convertion I want destroy the DBT file
>
> The problem:
> 1) The DBE DBFCDX opens the DBT file  (???)
> 2) The DBE DBFCDX returns memo extension as 'FTP'

forget DBFCDX, it is not compatible !
use FOXCDX if you want to convert your DBFNTX
Carlos a Beling Re: Doubt About Dbes
on Fri, 16 Dec 2016 16:04:59 -0200
Hello Jim.
Merry Christmas and a Happy  New Year.
Many thanks.
My intend is to convert DBFNTX and DBFCDX to FOXCDX; then I need both DBEs.

Fraternaly
Beling


Em 16/12/2016 15:25, Jim Lee escreveu:
>> 1) I have a Dbf with Dbt memo file. It could to be created using Clipper
>> or Xbase
>> 2) I want to convert it for FoxCdx that uses FTP files
>> 3) after convertion I want destroy the DBT file
>>
>> The problem:
>> 1) The DBE DBFCDX opens the DBT file  (???)
>> 2) The DBE DBFCDX returns memo extension as 'FTP'
>
> forget DBFCDX, it is not compatible !
> use FOXCDX if you want to convert your DBFNTX
>
>
Andreas Gehrs-Pahl
Re: Doubt About Dbes
on Fri, 16 Dec 2016 12:34:24 -0500
Carlos,

>2) The DBE DBFCDX returns memo extension as 'FTP'

No, it doesn't! Your code is incorrect, as it queries the FOXDBE what it's 
Memo extension is, and it uses a DBF #define constant to this. It is very 
important that you use DbeSetDefault() before using DbeInfo(), as DbeInfo() 
always ONLY works on the current default DBE. One exception is right after 
DbeBuild(), as DbeBuild() implicitly sets the default DBE to the one that 
was just built.

To fix your code:

1) Make the DBE that was used to open the database the Default DBE using 
   DbeSetDefault().

2) Use the correct #define constant, even if they (coincidentally) have the 
   same value!

Replace line 30 with something like this:

cFileName := DbInfo(DBO_FILENAME)
cDBE_Used := DbInfo(DBO_DBENAME)
cOld_DBE  := DbeSetDefault(cDBE_Used)
cDBE_Data := DbeInfo(COMPONENT_DATA, DBE_NAME)

if cDBE_Data == 'DBFDBE'
   cMemoExt := DbeInfo(COMPONENT_DATA, DBFDBE_MEMOFILE_EXT)
elseif cDBE_Data == 'FOXDBE'
   cMemoExt := DbeInfo(COMPONENT_DATA, FOXDBE_MEMOFILE_EXT)
elseif cDBE_Data == 'ADSDBE'
   cMemoExt := DbeInfo(COMPONENT_DATA, ADSDBE_MEMOFILE_EXT)
else
   cMemo_Ext := ''
endif

DbeSetDefault(cOld_DBE)

if empty(cMemoExt)
   cReturned := cFileName + ' has no Memo File!'
else
   cReturned := left(cFileName, RAt('.', cFileName)) + cMemoExt
endif

Hope that helps,

Andreas

Andreas Gehrs-Pahl
Absolute Software, LLC

phone: (989) 723-9927
email: Andreas@AbsoluteSoftwareLLC.com
web:   http://www.AbsoluteSoftwareLLC.com
[F]:   https://www.facebook.com/AbsoluteSoftwareLLC
Carlos a Beling Re: Doubt About Dbes
on Fri, 16 Dec 2016 16:02:05 -0200
Hello Andreas:
good afternoon.
Again and again many thanks.

Fraternaly
Beling

Em 16/12/2016 15:34, Andreas Gehrs-Pahl escreveu:
> Carlos,
>
>> 2) The DBE DBFCDX returns memo extension as 'FTP'
>
> No, it doesn't! Your code is incorrect, as it queries the FOXDBE what it's
> Memo extension is, and it uses a DBF #define constant to this. It is very
> important that you use DbeSetDefault() before using DbeInfo(), as DbeInfo()
> always ONLY works on the current default DBE. One exception is right after
> DbeBuild(), as DbeBuild() implicitly sets the default DBE to the one that
> was just built.
>
> To fix your code:
>
> 1) Make the DBE that was used to open the database the Default DBE using
>     DbeSetDefault().
>
> 2) Use the correct #define constant, even if they (coincidentally) have the
>     same value!
>
> Replace line 30 with something like this:
>
> cFileName := DbInfo(DBO_FILENAME)
> cDBE_Used := DbInfo(DBO_DBENAME)
> cOld_DBE  := DbeSetDefault(cDBE_Used)
> cDBE_Data := DbeInfo(COMPONENT_DATA, DBE_NAME)
>
> if cDBE_Data == 'DBFDBE'
>     cMemoExt := DbeInfo(COMPONENT_DATA, DBFDBE_MEMOFILE_EXT)
> elseif cDBE_Data == 'FOXDBE'
>     cMemoExt := DbeInfo(COMPONENT_DATA, FOXDBE_MEMOFILE_EXT)
> elseif cDBE_Data == 'ADSDBE'
>     cMemoExt := DbeInfo(COMPONENT_DATA, ADSDBE_MEMOFILE_EXT)
> else
>     cMemo_Ext := ''
> endif
>
> DbeSetDefault(cOld_DBE)
>
> if empty(cMemoExt)
>     cReturned := cFileName + ' has no Memo File!'
> else
>     cReturned := left(cFileName, RAt('.', cFileName)) + cMemoExt
> endif
>
> Hope that helps,
>
> Andreas
>