|
Home > Archive > Programming with dBASE > December 2006 > Creating Indexes
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]
|
|
| Dulux 2006-12-07, 12:13 am |
| Hi All,
I'm having trouble getting the following to work. Its probably a silly
mistake, but if someone can have a look and point out where I'm going wrong
I'd be greatful
<db is a database reference which is working properly>
i = new index()
if db.tableexists("old_ID_values")
db.droptable("old_ID_values")
endif
db.executesql("create table :ubertools:old_ID_va
lues(;
table_name char(128),;
old_ID_num int,;
new_ID_num int;
)") // This Works AOK
i.indexName :="old_ID_idx"
i.fields :=" table_name;old_ID_nu
m"
i.unique := true
db.createIndex("old_ID_values",i) //This is the line that is giving me an
error
Cheers
matt
--
Matthew James BLACK
M.Inf.Tech.(Data Comms), MBA, B.Sc
Grad.Dip.Inf.Tech
Grad.Cert.Inf.Tech.(Security)
Grad.Cert.Inf.Tech.(Management)
ITIL Certified
Cert II Stock Market Trading & Investment Strategies
MCSE+I, MCSE, MCDBA, CCNA, MCP+I, MCP
Senior Member - Australian Computer Society
| |
| Lysander 2006-12-07, 5:20 am |
| Dulux schrieb:
> db.createIndex("old_ID_values",i) //This is the line that is giving me an
Now, if we would also know the text of this error message, the
solution could be found faster, I guess :)
| |
| Roland Wingerter 2006-12-07, 5:20 am |
| "Dulux" wrote
>
> I'm having trouble getting the following to work. Its probably a silly
> mistake, but if someone can have a look and point out where I'm going
> wrong I'd be greatful
-----
> i.fields :=" table_name;old_ID_nu
m"
Try
i.fields :="table_name, old_ID_num"
Roland
| |
| Ken Mayer [dBVIPS] 2006-12-07, 7:12 pm |
| Dulux wrote:
> Hi All,
>
> I'm having trouble getting the following to work. Its probably a silly
> mistake, but if someone can have a look and point out where I'm going wrong
> I'd be greatful
>
> <db is a database reference which is working properly>
>
> i = new index()
>
> if db.tableexists("old_ID_values")
> db.droptable("old_ID_values")
> endif
> db.executesql("create table :ubertools:old_ID_va
lues(;
> table_name char(128),;
> old_ID_num int,;
> new_ID_num int;
> )") // This Works AOK
>
> i.indexName :="old_ID_idx"
> i.fields :=" table_name;old_ID_nu
m"
> i.unique := true
> db.createIndex("old_ID_values",i) //This is the line that is giving me an
> error
If you're using a DBF, then don't use i.fields. Instead, use the
DBFIndex object, and i.expression:
i = new DBFIndex()
i.indexName := "old_id_idx"
i.expression := " table_name+old_ID_Nu
m"
db.createIndex ....
Ken
--
/(Opinions expressed are purely my own, not those of dataBased
Intelligence, Inc.)/
*Ken Mayer* [dBVIPS]
/Golden Stag Productions/
dBASE at goldenstag dot net
http://www.goldenstag.net/dbase/dBASEBook.htm
http://www.goldenstag.net/GSP
http://www.goldenstag.net/dbase
| |
|
| Hi Ken,
Unfortunately, I'm using both MS-SQL and DBF, so I can't use DBFindex
Next... <grin>
Thanks for trying - I do appreciate it.
matt
"Ken Mayer [dBVIPS]" < dbase@_nospam_golden
stag.net> wrote in message
news:hIISQfgGHHA.328@news-server...
> Dulux wrote:
>
> If you're using a DBF, then don't use i.fields. Instead, use the DBFIndex
> object, and i.expression:
>
> i = new DBFIndex()
> i.indexName := "old_id_idx"
> i.expression := " table_name+old_ID_Nu
m"
> db.createIndex ....
>
> Ken
>
> --
> /(Opinions expressed are purely my own, not those of dataBased
> Intelligence, Inc.)/
>
> *Ken Mayer* [dBVIPS]
> /Golden Stag Productions/
> dBASE at goldenstag dot net
> http://www.goldenstag.net/dbase/dBASEBook.htm
> http://www.goldenstag.net/GSP
> http://www.goldenstag.net/dbase
| |
| Roland Wingerter 2006-12-07, 7:12 pm |
| I assume db and :ubertools: are different databases.
1. You drop a table in the db
2. create a table in :ubertools:
3. you try to create an index in db for the table you dropped in step 1
Roland
"Dulux" wrote
>
> I'm having trouble getting the following to work. Its probably a silly
> mistake, but if someone can have a look and point out where I'm going
> wrong I'd be greatful
| |
|
|
| Dulux 2006-12-08, 12:12 am |
| So if I'm reading you correctly, I'm gonna have to have something like this:
If Is_DBF_File
i=new dbfindex()
etc...
else
i=new index()
etc...
endif
Actually, I'm beginning to suspect I might have to take that route with a
few other situations I'm working on as well.
OK, so is there some way of programmatically detecting if the BDEAliase is
pointing to a DBF file or an MS-SQL Database (or for that matter, any other
sort of database) so I can set Is_DBF_File, or am I gonna have to set
Is_DBF_File manually via an INI or Registry entry?
Cheers
matt
"Ken Mayer [dBVIPS]" < dbase@_nospam_golden
stag.net> wrote in message
news:KSuyDiiGHHA.328@news-server...
> Dulux wrote:
>
> For DBFs you need to use DBFIndex, though.
>
> Ken
>
> --
> /(Opinions expressed are purely my own, not those of dataBased
> Intelligence, Inc.)/
>
> *Ken Mayer* [dBVIPS]
> /Golden Stag Productions/
> dBASE at goldenstag dot net
> http://www.goldenstag.net/dbase/dBASEBook.htm
> http://www.goldenstag.net/GSP
> http://www.goldenstag.net/dbase
| |
| Michael Nuwer 2006-12-08, 12:12 am |
|
You might look at BDEIndex.cc in the dUFLP. It should handle all that
you need automatically.
Dulux wrote:
> So if I'm reading you correctly, I'm gonna have to have something like this:
>
> If Is_DBF_File
> i=new dbfindex()
> etc...
> else
> i=new index()
> etc...
> endif
>
> Actually, I'm beginning to suspect I might have to take that route with a
> few other situations I'm working on as well.
>
> OK, so is there some way of programmatically detecting if the BDEAliase is
> pointing to a DBF file or an MS-SQL Database (or for that matter, any other
> sort of database) so I can set Is_DBF_File, or am I gonna have to set
> Is_DBF_File manually via an INI or Registry entry?
>
> Cheers
>
> matt
| |
| Dulux 2006-12-08, 12:12 am |
| Cheers
"Michael Nuwer" <michael@forget.it> wrote in message
news:8a4ua8nGHHA.1524@news-server...[color=darkred]
>
> You might look at BDEIndex.cc in the dUFLP. It should handle all that you
> need automatically.
>
> Dulux wrote:
|
|
|
|
|