Xbase and ADT tables with ADS (compability)

This forum is for general support of Xbase++
Post Reply
Message
Author
skiman
Posts: 1185
Joined: Thu Jan 28, 2010 1:22 am
Location: Sijsele, Belgium
Contact:

Xbase and ADT tables with ADS (compability)

#1 Post by skiman »

Hi,

We are testing the ADS system to see if this could be a solution for the long term. We already played a lot with it, and tested with the advantage architect.

Since we have some specific problems we needed to solve, as a lot of UDF's in indexkeys, we explored the system of triggers and so on. Our search system which is based on 'fread' of the NTX files, was solved with the use of FTS indexes. To use them we need to move to DBFCDX of the real stuff, the ADT and ADI tables. We thought it would be the best to move to the real advantage tables.

This is giving us problems with the indexes. We even don't succeed to open an ADT table with a USE command. If we use the ADS functions, we can open the ADT tables with Xbase++. With the standard Xbase commands, we don't succeed. Anyone who can confirm that the USE is working with ADT tables?

We have in our data architect a DBF file and the same data converted as ADT. In the same testprogram we can open the DBF file, but we can't open the ADT file. Only when we use the ADS function the ADT file opens without problem. If this is true, we can't use the ADT files.

Another problem is creating the indexes. With ADI files the index key is just the list of fields. We have a field Type, Journal and Number. In Xbase we do index on 'Type+journal+str(number,6)'. For the ADI index we have to say 'Type;Journal;Number'. If journal is empty, then this is seen as a NULL value. This means that our DBSEEK() isn't working anymore. This would mean that the ADI index system isn't compatible with Xbase++ at all. :|

Code: Select all

DbeSetDefault( "ADSDBE" ) 
nHandle := 0
nError := AdsConnect60("Aboservice.add", ADS_REMOTE_SERVER+ADS_LOCAL_SERVER, 'adssys', , ADS_DEFAULT, @nHandle)
nTable := 0
AdsOpenTable(nHandle,"fakt_000",,ADS_DEFAULT,,,,ADS_DEFAULT,@nTable)
The adsOpenTable is working, replacing this with a USE command is not?

Anyone with experience with this problem?
Best regards,

Chris.
www.aboservice.be

User avatar
rdonnay
Site Admin
Posts: 4729
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: Xbase and ADT tables with ADS (compability)

#2 Post by rdonnay »

Chris -

About 4 years ago, I put a lot of time into converting an old application for a customer.
We worked at his ranch for weeks at a time with the objective of using data-dictionaries, SQL and ADT.

We finally had to give up on using ADT tables.
I had a discussion with Steffen at that time and he said that ADT was not a good idea.
I too, had the same problem with indexes.

We both came to the realization that if you must use ADT, then you also must do all your database management via SQL, not the ADSDBE.

After finally deciding to go back to DBF files, I realized months later that ADT probably would have been the best solution if there was no requirement to create indexes with legacy code.

If you are not using SQL to do database management, then I recommend that you do so.
You can create databases, modify structure, create indexes, insert records, replace data, delete records, pack tables, etc. with simple SQL commands.

My ADS tutorial shows how to use SQL with the ADSDBE. You will find this tutorial on the Advantage Database website.

Roger
The eXpress train is coming - and it has more cars.

skiman
Posts: 1185
Joined: Thu Jan 28, 2010 1:22 am
Location: Sijsele, Belgium
Contact:

Re: Xbase and ADT tables with ADS (compability)

#3 Post by skiman »

Hi Roger,

Thanks for the answer. I was expecting this.

It's a pitty that this isn't clearly communicated in the docs when talking about Xbase++ compability. As you, we already spend a lot of time in this.

Our goal was to move to ADT tables, and afterwards to optimize the complete application step by step using SQL commands and the ACE functions. It seems that this won't work. :(

I have your tutorial from the Advantage site.

I have to reconsider the way to follow. Advantage with DBF, SQLExpress or even another language...
Best regards,

Chris.
www.aboservice.be

User avatar
rdonnay
Site Admin
Posts: 4729
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: Xbase and ADT tables with ADS (compability)

#4 Post by rdonnay »

s
I have to reconsider the way to follow. Advantage with DBF, SQLExpress or even another language...
I think I would disagree with you on choosing another language.
You are a very productive Xbase++ programmer.
Once you decide to go to SQL, the language is entirely separated from the database.

I still think that Xbase legacy code is easier to migrate to SQL via ADS.
The eXpress train is coming - and it has more cars.

User avatar
unixkd
Posts: 565
Joined: Thu Feb 11, 2010 1:39 pm

Re: Xbase and ADT tables with ADS (compability)

#5 Post by unixkd »

I have being using ADT/ADI for more than 4 years now without any problems using PURE Xbase++/Express++ Commands/functions and occasionally ACE API.

1. First, you need to establish connection to ADS. See my function below
*
FUNCTION Ads_Session(cAdsServer, cUser, cPassword)
LOCAL cSession, nThread := ThreadID()
STATIC aADSSession[0]
DC_POINTERWAIT(SetAppWindow())
SETDEFAULT cUser := "Dummy"
SETDEFAULT cPassword := "xxxxxx-yyyyyy-uuuuuuu-eerrrrrrr"
SETDEFAULT cAdsServer := "\\myServer\PPSDB.ADD"
IF Len(aADSSession) < nThread
ASize(aADSSession,nThread)
ENDIF
DbeInfo( COMPONENT_DATA , ADSDBE_TBL_MODE, ADSDBE_ADT )
DbeInfo( COMPONENT_ORDER, ADSDBE_TBL_MODE, ADSDBE_ADT )
IF Valtype(aADSSession[nThread]) # 'O' .OR. !aADSSession[nThread]:isConnected()
cSession := "DBE=ADSDBE;SERVER="+cAdsServer+";UID="+cUser+";PWD="+cPassword
aADSSession[nThread] := DacSession():new(cSession)
IF !aADSSession[nThread]:isConnected()
MsgBox( "Unable to establish connection to ADS Server" + Chr(13) + ;
"Error Code: " + Alltrim(Str(aADSSession[nThread]:getLastError())) + Chr(13) + ;
aADSSession[nThread]:getLastMessage() )
Quit
EndIf
ENDIF
DC_PointerArrow(SetAppWindow())
RETURN ( aADSSession[nThread] )
*

2. Once you successfully get connected, you are home and dry. Use

DbUseArea(.f., oSession, cTableName ) to open your ADT table

Thanks

Joseph Owoyemi
NIGERIA.

skiman
Posts: 1185
Joined: Thu Jan 28, 2010 1:22 am
Location: Sijsele, Belgium
Contact:

Re: Xbase and ADT tables with ADS (compability)

#6 Post by skiman »

Hi,

Thanks, we will check it.
Best regards,

Chris.
www.aboservice.be

Post Reply