Home > Archive > Clipper > February 2006 > Index files placement (CDX) - Clipper 5.20
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Index files placement (CDX) - Clipper 5.20
|
|
| surfacing 2006-02-21, 6:55 pm |
| Hello,
I ran into unexpexcted problem:
my database files and respective indexes are located in (let's say)
_DATABASE_ folder and SET DEFAULT points to this folder. For intermediate
processing I use another folder (let's say) _TEMP_. I never had the need for
indexing the intermediate files. Finally this happened. Here's fragment of
the program:
locDBase="_TEMP_\locDBase.dbf" // the base exists
locCDX="_TEMP_\locCDX.cdx" // index file does not exist yet - will be
created
use &locDBase exclusive new
index on someField tag tagName to &locCDX
The last command creates index file but... in _DATABASE_ folder instead of
_TEMP_ folder.
Is there any possibility to force Clipper to create the index files in the
same folder where the database file resides? I am using Clipper 5.20e with
it's CDX driver.
For now before indexing the temporary databases, I close them, change
default path to temporary, open databases again and create indexes. After
finishing the task I get back to actual default path, but this is annoying a
bit... besides it creates additional gap to make programming mistakes...
tia
Marek
| |
| Stephen Quinn 2006-02-21, 9:55 pm |
| Marek
> Is there any possibility to force Clipper to create the index files in the
> same folder where the database file resides? I am using Clipper 5.20e with
> it's CDX driver.
Try it without specifying the index path\filename
use &locDBase exclusive new
index on someField tag tagName
> For now before indexing the temporary databases, I close them, change
> default path to temporary, open databases again and create indexes. After
> finishing the task I get back to actual default path, but this is annoying
> a
> bit... besides it creates additional gap to make programming mistakes...
Easier to just create them in the default directory.
All you need do is use a function to create a UNIQUE temporary filename so
multiple users don't clash trying to do things with the same file.
SuperLib has a function for creating UNIQUE file names.
HTH
Steve
| |
| Dave P 2006-02-22, 6:55 pm |
| sometimes i need temporary indexs (exclusive per user)
lets say im reporting on customer.dbf and customer
has Customer.cdx......in this case
tmpidx:=TempIdx("_xx",set(_SET_DEFAULT),".IDX")
//_XX name starts
//_look in path
//_extension too use
temidx will create a filename make sure i does not exist
and return the name along with the path
? Tmpidx -> "w:\_xx00000.idx"
use customer new shared alias customer
//single bag file like NTX.. most CDX Drivers Support
//Single Bag Files (Comix,DBFntx,Six)
//I Use Comix
index on &("cust_no") to (Tmpidx)
Customer->(setindex(Tmpidx))
//do what you have too do
//close the index
ferase(TmpIdx)
DAVE
"surfacing" <surfacing@poczta.onet.pl> wrote in message
news:dtfpvd$cok$1@news.onet.pl...
> Hello,
>
> I ran into unexpexcted problem:
>
> my database files and respective indexes are located in (let's say)
> _DATABASE_ folder and SET DEFAULT points to this folder. For intermediate
> processing I use another folder (let's say) _TEMP_. I never had the need
for
> indexing the intermediate files. Finally this happened. Here's fragment of
> the program:
>
> locDBase="_TEMP_\locDBase.dbf" // the base exists
> locCDX="_TEMP_\locCDX.cdx" // index file does not exist yet - will
be
> created
>
> use &locDBase exclusive new
> index on someField tag tagName to &locCDX
>
> The last command creates index file but... in _DATABASE_ folder instead of
> _TEMP_ folder.
>
> Is there any possibility to force Clipper to create the index files in the
> same folder where the database file resides? I am using Clipper 5.20e with
> it's CDX driver.
>
> For now before indexing the temporary databases, I close them, change
> default path to temporary, open databases again and create indexes. After
> finishing the task I get back to actual default path, but this is annoying
a
> bit... besides it creates additional gap to make programming mistakes...
>
> tia
>
> Marek
>
>
>
| |
| Stephen Quinn 2006-02-22, 9:55 pm |
| Dave
> //Single Bag Files (Comix,DBFntx,Six)
COMIX V3.x doesn't support this, you get a CDX (with an '.IDX' extension)
whether you want it or not<g>
It states this in the manual.
HTH
Steve
| |
| Dave P 2006-02-23, 6:55 pm |
| I understand this...emulation of single bag files with comix
and others.....i use it all the time for temp indexes on the fly
dave
"Stephen Quinn" <steveq@NOSPAMsherlock.com.au> wrote in message
news:dtj3fc$p39$1@news-02.connect.com.au...
> Dave
>
> COMIX V3.x doesn't support this, you get a CDX (with an '.IDX' extension)
> whether you want it or not<g>
> It states this in the manual.
>
> HTH
> Steve
>
>
| |
| Dave P 2006-02-23, 6:55 pm |
| Sure you get a CDX file....but if you use the TO Without the TAG clause
In the Index on Command......you will
overwrite the file with the new index key
just a single bag index....
Do a Test: The below will produce a Single Bag index file....(CDX) ore
whaever Extension that you want
request comix
FUNCTION MAIN()
startclr() //my color system
rddsetdefault("COMIX") //set comix as default rdd
errorsys() //i replace clippers errorsystem with my own
Produces ABC.CDX ... on Key Inside
dbuse("test.dbf") // replace dbuse with dbusearea()
ferase("abc.cdx")
index on &("field1") to "abc"
index on &("field2") to "abc"
//where produces "test.cdx" with 2 Keys Inside
ferase("test.cdx")
index on &("field1") tag "field3"
index on &("field2") tab "field4"
//then look in the clipper ordlist array
you will see tag field3 key field1
tag field4 key field2
tag abc key field2 (single bag index)
Dave
"Stephen Quinn" <steveq@NOSPAMsherlock.com.au> wrote in message
news:dtj3fc$p39$1@news-02.connect.com.au...
> Dave
>
> COMIX V3.x doesn't support this, you get a CDX (with an '.IDX' extension)
> whether you want it or not<g>
> It states this in the manual.
>
> HTH
> Steve
>
>
| |
| Stephen Quinn 2006-02-23, 9:55 pm |
| Dave
My point is that '.IDX' and '.CDX' are different formats.
COMIX dropped '.IDX' support in V3 but SIXDRIVER V3 still supports it.
HTH
Steve
| |
| Dave P 2006-02-24, 6:55 pm |
| i know.....i said in my post use any extension that you want...you. (I was
not meaning the idx format just single bag index file).....
I was Just STATING That If you use the TO (FILENAME) Clause and No TAG you
will end up
with a Single key File...not the Native Open Index (cdx) file
Test.dbf (creates) TEST.cdx By Default if no bag name is Specified...i dont
like too mix Tmp Index keys in side the
Main CDX file., and by useing the TO clause only
I end up with a Single Bag (CDX) again.....
Use any extension (IDX),dpx,dxx,txx, bob,car,ali,)
Im just use too using the IDX Extension....But you Can use whatever your
heart desires
DAVE
"Stephen Quinn" <steveq@NOSPAMintegritynet.com.au> wrote in message
news:J7tLf.14835$yK1.1185@news-server.bigpond.net.au...
> Dave
>
> My point is that '.IDX' and '.CDX' are different formats.
> COMIX dropped '.IDX' support in V3 but SIXDRIVER V3 still supports it.
>
> HTH
> Steve
>
>
| |
| surfacing 2006-02-28, 6:55 pm |
| Hi Dave,
> tmpidx:=TempIdx("_xx",set(_SET_DEFAULT),".IDX")
> (...)
> index on &("cust_no") to (Tmpidx)
> (...)
> ferase(TmpIdx)
>
Yes, and this is what I do for now. Well, I don't see another simple
solution - perhaps apart the one with temporary file with autogenerated
names (see my another post - answer to Stephen).
Thanks for answering
Marek
| |
| surfacing 2006-02-28, 6:55 pm |
|
Hi Stephen,
thanks for answering.
> Try it without specifying the index path\filename
I did it - it was my first guess. I'd say more: it seemed to be obvious that
IF I open database file in given _TEMP_ area, the index SHOULD be created
there too. But I was wrong.
>
> use &locDBase exclusive new
> index on someField tag tagName
>
> Easier to just create them in the default directory.
Yes, but it creates a difficult to remove overhead in this directory. Temp
directory I can clear not checking for important files which shouldn't be
removed. Just del *.* and I am done.
An alternative is to create in default directory temp files with unique
names and removing them after use. A bit annoying though... But... no other
choice given... :-)
> All you need do is use a function to create a UNIQUE temporary filename so
> multiple users don't clash trying to do things with the same file.
I created such a function time ago for quite different purposes. It's based
on system date and clock and compresses it's value to the number with 36
basis (digits 0-9 and A-Z). In this way the file name is kind of file
timestamp. It works. But... I was trying to be lazy thinking the system
behaves in the way I expected it... LOL
thanks for your advices
Marek
|
|
|
|
|