[mercury-users] data base interface
Simon Taylor
stayl at cs.mu.oz.au
Sat Oct 4 11:03:23 AEST 1997
Hi,
Tom Howland wrote:
> I wonder if there is a way to get Mercury to treat queries to an external
> database as a nondeterminate predicate, and yet arrange things so that
> cursors get cleaned up.
To treat an SQL database relation as a predicate, you would need to generate
interface (.int) files containing declarations for the predicates you want
to access. You would also need to generate procedures to interface to the
database to send the query and get the results. We're currently working on
an interface to the Aditi deductive database system which will work this way.
Since the C interface does not yet support non-deterministic procedures,
you would need some knowledge about the C code the compiler generates for
non-deterministic procedures to implement the interface.
The Mercury interface to ODBC databases doesn't quite do what you want -
it collects all the results for a query into a list. Non-deterministically
returning the results would require the database state argument to
the query to have a mode of 'ui', which the mode analyser currently
cannot handle.
Simon Taylor.
More information about the users
mailing list