1. database questions...

Two questions about database:

1- It's allways necessary to use db_close() when you are working with only 
one eds database ? What exactly db_close() does ? Not using this command 
could cause errors ?


2- It's possible do make queries to a sql database using euphoria and 
extract the results ? What information I need from de sql database to do 
this ?(I never work with sql !).

Many Thanks,

Rubens

new topic     » topic index » view message » categorize

2. Re: database questions...

Rubens writes:
> 1- It's allways necessary to use db_close() when you 
> are working with only one eds database ? What exactly 
> db_close() does ? Not using this command could cause errors ?

See database.e.
db_close() calls close() to close the database file.
In any case, Euphoria closes all files at the end of execution,
but you have a limit on how many files can be open at one time.
db_close() also calls unlock_file() if the database was opened with
a lock on it, but I think on all systems the lock will be removed
automatically when the file is closed. db_close() also removes
the database from the list of open databases.
 
If you call db_close() again, when the database is 
already closed, it does nothing.

I think it's good form to call db_close() when you are
finished using the database, especially if you have a lock on it,
and other processes might want to use it. Also, there could be
some unflushed data in memory that you will lose if your 
program has a severe machine-level (not Euphoria-level)
crash before you call db_close(). Calling db_close() ensures
that this data will be written out, even if you get a machine-level
exception (poking into a bad memory location for example.)

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

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

Search



Quick Links

User menu

Not signed in.

Misc Menu