Simple eusql prog now works - kinda
Thanks to Matt I saw the error of my way and now have a new simple
program that does write records to the eusql database.
include database.e
include eusql.e
sequence dbname,
tname,
ok,
code, -- code
descrip, -- descripton
categ -- category
dbname = open_db("TEST.EDB")
tname = "DIAG"
code = "V43.1"
descrip = "Psudoaphakia"
categ = "Surg"
ok = insert_record(dbname,tname,blank_record(dbname,tname),
{code,descrip,categ},{{1},{2},{3}})
close_db (dbname)
Before I started dancing around and throwing my hat in the air I thought
I should try to read a record out of the database. Alas, this program
don't work.
include database.e
include eusql.e
sequence ok,
dbname,
tname,
data
integer key
key = 1
dbname = "TEST.EDB"
tname = "DIAG"
ok = open_db(dbname)
ok = get_record(dbname,tname,"V43.1",data,key)
puts(1,data)
close_db (dbname)
I get an error that says,"variable data not defined". Can someone tell
me why?
In the database I have an index for all three fields. I'm trying to use
the code for the key and I have the key set to 1.
If I wanted to find by diagnosis do I replace the "V43.1" with what I'm
looking for and change the key to 3?
(Since the index table is sorted in alph order, the indexes are 1 =
code, 2 = category and 3 = Description)
|
Not Categorized, Please Help
|
|