Simple eusql prog don't work

new topic     » topic index » view thread      » older message » newer message

I tried a simple program to write to a eusql database that I created 
using edb:


include database.e
include eusql.e

sequence dbname,
	 tname,
	 ok,
	 code,    -- code (record key)
	 desc,    -- descripton
	 cat,     -- category
	 idx      -- index
	 


    dbname = open_db("TEST.EDB")
    tname  = "DIAG"
    code   = "V43.1"
    desc   = "Psudoaphakia"
    cat    = "Surgery"
    idx    = "LOOKUP"

    ok =    insert_record(dbname,tname,code,{desc,cat},idx)

    close_db

This is a partial dump of ex.err:
E:\EUPHORIA\E24\include\eusql.e:1821 in function seq_store() 
subscript value 76 is out of bounds, assigning to a sequence of length 5 

    a = 
{80'P',115's',117'u',100'd',111'o',97'a',112'p',104'h',97'a',107'k',
105'i',97'a'}
    b = {86'V',52'4',51'3',46'.',49'1'}
    c = 76'L'
    len = 1

... called from E:\EUPHORIA\E24\include\eusql.e:5213 in function 
map_field()  
    field = {86'V',52'4',51'3',46'.',49'1'}
    data = {
             {
               
{80'P',115's',117'u',100'd',111'o',97'a',112'p',104'h',97'a',
107'k',105'i',97'a'},
               {83'S',117'u',114'r',103'g',101'e',114'r',121'y'}
             }
           }
    index = {76'L',79'O',79'O',75'K',85'U',80'P'}
    i = 1
    j = 1

... called from E:\EUPHORIA\E24\include\eusql.e:5641 in function 
insert_record()  
    db_name = {84'T',69'E',83'S',84'T',46'.',69'E',68'D',66'B'}
    table_name = {68'D',73'I',65'A',71'G'}
    record = {86'V',52'4',51'3',46'.',49'1'}
    data = {
             
{80'P',115's',117'u',100'd',111'o',97'a',112'p',104'h',97'a',
107'k',105'i',97'a'},
             {83'S',117'u',114'r',103'g',101'e',114'r',121'y'}
           }
    field_index = {76'L',79'O',79'O',75'K',85'U',80'P'}
    ok = {
           {
             {1},
             {2},
             {3}
           }
         }
    datatypes = {45'-',45'-',45'-'}
    ix = {
           {1},
           {2},
           {3}
         }
    list = <no value>
    mapped = <no value>
    auto = {0,0,0}
    auto_data = {}
    auto_fi = {}
    jx = <no value>
    kx = <no value>
    indexdef = <no value>
    i = 3

... called from test.ex:22 

I have the database, TEST created with one table, DIAG with the 
following definition:
FIELD       TYPE       INDEX
============================
CODE        TEXT       LOOKUP     PRIM KEY
DESCRIPTION TEXT       DESCDIAG
CATEGORY    TEXT   

Can someone tell me what's wrong?

By the way it might be nice to be able to print out the database 
definition.  I didn't see any way to do it, but maybe I missed it.

My great master plan is to create a database table so that I can look 
something up by the code and get the description and category or by the 
description and get the code and category.

new topic     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu