Re: db_insert/db_create_table/db_select_table

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

Rubens writes:
> I just discovered that the command (db_create_table) didn't
> set the current
> table in a euphoria database as it says in the database.htm document. It
> needs the command db_select_table before any db_insert, or else I will get
> a missing variable key_pointer.
> ...
> db=db_create("banana.edb",DB_LOCK_NO)
> db= db_open("banana.edb",DB_LOCK_NO)
> db_create_table("table")
> db_insert(x1,x2)

Most of the db_ routines return an error code that you are not checking.
I suspect that the table "table" already existed when you called
db_create_table.
In this case db_create_table will return the code DB_EXISTS_ALREADY,
and it will not change the current table.

Also, I think it's better if you try db_open() before you try db_create().
If the database already exists, you just want to open it, not create it
again.  Furthermore, after successfully creating a database,
you needn't (and shouldn't) open it.

Regards,
   Rob Craig
   Rapid Deployment Software
   http://www.RapidEuphoria.com

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

Search



Quick Links

User menu

Not signed in.

Misc Menu