0

I am converting existing Clipper code from free tables to data dictionary. I can read and write to tables but I can't create an index.

Here is the code :

connSaisie := DacSession():new(GetSsoConnection(1))
connSaisie:SetDefault()
DbeInfo( COMPONENT_DATA, ADSDBE_RIGHTS_MODE, ADSDBE_CHECKRIGHTS  )
DbeInfo( COMPONENT_DATA, ADSDBE_LOCK_MODE, ADSDBE_PROPRIETARY_LOCKING )
DbeInfo( COMPONENT_DATA , ADSDBE_TBL_MODE, ADSDBE_CDX )
DbeInfo( COMPONENT_ORDER, ADSDBE_TBL_MODE, ADSDBE_CDX )

DBUSEAREA (.F., , "Nomencla", connSaisie, .F., .F.)  
cTag:="SEBTAG"
SELECT Nomencla
Index on Code_nomen + Padl(Alltrim(Nom_champ1), 5, "0") +;
Padl(Alltrim(Nom_champ2), 4, "0") +;
Padl(Alltrim(Nom_champ3), 3, "0") TAG (cTag)

Set Order to TAG (cTag)

The (GetSsoConnection(1)) syntax takes care of retrieving the proper connection string.

The problem is that the index is created but in the executable directory instead of the database or temp folder defined for the data dictionary.

I am looking forward to any help or pointers and am more than willing to provide a sql script to create a sample table to reproduce the problem.

Thanks !

kuzkot
  • 81
  • 4

3 Answers3

2

I think you need the TO clause of the INDEX ON command, in order to specify the directory where the index is created (rather than just the name of the order). I haven't tried it out as I don't have Clipper (although I might be able to dig it out at work :-)).

This page suggests changing the directory is possible: http://www.itlnet.net/programming/program/reference/c53g01c/ngcc94d.html (for Clipper 5.3)

INDEX ON <expKey> TAG <cOrderName> TO <cOrderBagName>

However, it doesn't say how you actually specify the directory in the TO clause.

This page includes the line 'INDEX ON ID TO (cFileName)', so I think you can maybe do INDEX ON blah TAG (cTag) TO ("d:\example\SEBTAG") (perhaps needs a file extension)

marnir
  • 1,187
  • 10
  • 13
  • Thanks for your answer marnir. This is actually my problem : I want Clipper to automatically understand where the files are, given that they belong to a data dictionary. The process does not have access to the data directory, it has to go through the data dictionary. So in essence I am looking for a way to open a connection to a data dictionary, then open a table within that data dictionary, then create an index attached to that table. That index has to be created by the server straight into the data directory. – kuzkot Dec 13 '12 at 16:23
2

If I am not mistaken, the Advantage Clipper Library only uses the Data Dictionary as an authentication mechanism for AIS (Advantage Internet Server) communication, however the tables are opened outside of the dictionary.

In this case, I don't believe that Clipper has any knowledge of any of the default settings, etc from the Data Dictionary.

Are you using clipper or are you using one of the number of other languages that support Clipper syntax, but produce 32-bit applications?

Edgar
  • 943
  • 4
  • 4
0

Thanks for your help but I've solved (or rather circumvented) the problem by removing all these calls and replacing them instead by permanent indexes.

Again, thanks for your input.

kuzkot
  • 81
  • 4