RE: EUSQL

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

> From: sixs at ida.net [mailto:sixs at ida.net]

<snip>

>  if db_open("sqla22", DB_LOCK_NO) != DB_OK then

If you're using EuSQL to manipulate a EuSQL database, then you should open
the database with EuSQL's open_db().  EuSQL keeps a list of the databases it
has opened.  If you use db_open(), EuSQL will not work properly with the
database.  Also, EuSQL opens databases with DB_LOCK_EXCLUSIVE.

<snip>

>  create_table ( sequence sqla22, sequence People )
> ****** this statement ges an error that say it is looking for 
> possibly 'end'
> , not a function. a caret points o the last letter in 'create_table.
> Previously I had tried to use the database I created using 
> EUSQL and tried
> to enter data using typical EDB commands. I couldn't find the dataI hd
> entered in a viewing the database.

create_table() is actually a function (most EuSQL routines are).  Also, you
shouldn't have "sequence sqla22, sequence People" here.  The "sequence"'s
will cause another error.  If it succeeds, the return is a sequence.  It
will be an atom if it fails.  There is additional error messages that can be
gotten.  Here is how I tend to use it:

object ok
ok = create_table( sqla22, People ) 
if atom(ok) then
	warnErr( get_sql_err(ok) )
end if

 
>  if db_select_table("PEOPLE") != DB_OK then

<snip>

You should use select_table() and other EuSQL routines when working with a
EuSQL database.  You can use the direct EDS commands, but you lose the
functionality of EuSQL, including type checking of fields, and so forth.

> create database and PEOPLE Table
> constant sqlarchive = "sqla22.edb"
> trace(1)
> ok = create_db( sqlarchive )
...
<snip>
... 
> ok = run_sql( "CREATE TABLE PEOPLE " &
>               "KEYID AS INTEGER, LNAME AS TEXT," &
>      " FNAME AS TEXT, ADDRESS AS TEXT," &
>    " STREET AS TEXT, CITY AS TEXT," &
>    " STATE AS TEXT, ZIP AS TEXT," &
>    " PHONE AS TEXT" )
> ok = run_sql( "CREATE TABLE KEYRECORDS " &
>               "KEID AS TEXT, KEYNAME AS INTEGER" )
> Is this the correct way to identify fields that can be used 
> by EDB commands,
> or should they be EUSQL commands to access the database

This all looks correct.  You could also use the EuSQL commands to create the
tables and fields.  I'll try to get a version of my db browser out tonight
or tomorrow, and you'll be able to see very easily what's been done inside
the database (whether EuSQL or not).  The main hold up right now is that I
haven't got wxEuphoria working for Linux yet--maybe soon, though.

Matt Lewis

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

Search



Quick Links

User menu

Not signed in.

Misc Menu