1. RE: Simple eusql prog now works - kinda

Pete Lomax wrote:
> 
> 
> 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?

Pete,  
I am sure that there is a comma after tname.  The error occurs on the 
line that calls the routine.

Rick,
I thought this routine was suppose to take the field from the database 
and put it in the variable, data.  Here is the syntax from the 
documentation:

[func]
get_record (sequence db_name,sequence table_name,object key,sequence 
field, sequence index).

originally I tried:
data = get_record (dbname,tname,"V44.1","DESCRIPTION",{"")) Thinking 
that it would put the information from the description field of the 
database into variable data.  That seems more logical and closer to the 
documentation, but it didn't work either.

NEWS FLASH!  I tried it again using the example above and discovered the 
error was in the puts(1,data) statement.  I changed it to print(1,data) 
and now it is printing the data sequence.  Now I just have to get it to 
print in english.  I've tried puts, print, and printf.  I gues I got to 
go hit the documenation again.  Also, so far I can only do a find on the 
primary index.
> 
>

new topic     » topic index » view message » categorize

2. RE: Simple eusql prog now works - kinda

ronaustin at alltel.net wrote:
> 
> 
> NEWS FLASH!  I tried it again using the example above and 
> discovered the error was in the puts(1,data) statement.  I changed 
> it to print(1,data) and now it is printing the data sequence.  Now 
> I just have to get it to print in english.  I've tried puts, print, 
> and printf.  I gues I got to go hit the documenation again.  Also, 
> so far I can only do a find on the primary index.

There is no way to programmatically do a find on anything other than the 
primary key.  You can execute a SQL statement for this.

A big priority is for me to improve the documentation for EuSQL.  
Assuming that DESCRIPTION is just text,

puts(1, data[1]) -- data = {"some text"}

should work.  EuSQL returns your data in an extra layer of sequence in 
order to flag errors with an atom as a return value.

Matt Lewis

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

3. RE: Simple eusql prog now works - kinda

Matt Lewis wrote:
> 
> 
> ronaustin at alltel.net wrote:
> > 
> > 
> > NEWS FLASH!  I tried it again using the example above and 
> > discovered the error was in the puts(1,data) statement.  I changed 
> > it to print(1,data) and now it is printing the data sequence.  Now 
> > I just have to get it to print in english.  I've tried puts, print, 
> > and printf.  I gues I got to go hit the documenation again.  Also, 
> > so far I can only do a find on the primary index.
> 
> There is no way to programmatically do a find on anything other than the 
> 
> primary key.  You can execute a SQL statement for this.
> 
> A big priority is for me to improve the documentation for EuSQL.  
> Assuming that DESCRIPTION is just text,
> 
> puts(1, data[1]) -- data = {"some text"}
> 
> should work.  EuSQL returns your data in an extra layer of sequence in 
> order to flag errors with an atom as a return value.
> 
> Matt Lewis

Thanks for your help and everyone's patience.  It now works and looks 
like this:

include database.e
include eusql.e

object data

sequence dbname,
	 tname,
	 fn
	 
    dbname = "TEST.EDB"
    tname  = "DIAG"

    fn = open_db(dbname)
    data = get_record(dbname,tname,"V43.1","code",{})
    
    if atom(data) then
       puts(1,"record not found")
    else
    puts(1,data[1])
    end if

    close_db (dbname)

>

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

Search



Quick Links

User menu

Not signed in.

Misc Menu