1. 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)

new topic     » topic index » view message » categorize

2. Re: Simple eusql prog now works - kinda

ronaustin at alltel.net wrote:

>
>
>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 code you posted, data has not been defined (or given a value)
when you first use it.

new topic     » goto parent     » topic index » view message » categorize

3. Re: Simple eusql prog now works - kinda

On Thu, 23 Oct 2003 00:33:16 +0000, ronaustin at alltel.net wrote:

>sequence ok,
>	 dbname,
>	 tname,
>	 data

>I get an error that says,"variable data not defined".  Can someone tell 
>me why?
You quite sure there was a comma after tname?
What line does the error occur on?

new topic     » goto parent     » topic index » view message » categorize

4. Re: Simple eusql prog now works - kinda

I hadn=B4t been following this thread but you create a variable named data=
=20
  and you don=B4t assing anything to it, and then pass it in the=20
get_record function. What are u passing if data contains nothing? :)
That=B4s the error.

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

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu