[ ]library(mysql)
Interface to MySQL database
Predicates
- sql_commit
- Commit transaction (not implemented)
- sql_delete(+Table, +Where, ++Attributelist, ++Valuelist, -RowsDeleted)
- Delete tuple(s) from database
- sql_desc(++Table)
- Display the schema of the given relation
- sql_exec(+Statement, -ReturnCode, -ReturnString, -RowsProcessed)
- Execute an SQL statement
- sql_external(++Table, ++CacheMode)
- Make a database relation available as a predicate
- sql_insert(+Table, ++Attributelist, ++Valuelist)
- Insert tuple into database
- sql_lastmsg(?ReturnCode, ?ReturnString, ?RowsProcessed)
- Get the status of the last MySQL operation
- sql_login(+Database, +Username, +Password)
- Connect to a database
- sql_login(+Database, +Username, +Password, +Serverhost)
- Connect to a database
- sql_logout
- Disconnect from the database
- sql_query(++Attributelist, ++Tables, +Where, +MoreOptions, ?Valuelist)
- Query the database
- sql_querydistinct(++Attributelist, ++Tables, +Where, +MoreOptions, ?Valuelist)
- Query the database without duplicates
- sql_rollback
- Roll back a transaction (not implemented)
- sql_select(++StatementList, +Valuelist)
- Query the database using SQL SELECT statement
- sql_showdb
- Display all relations defined by the currently logged in user
Description
History
This library has been written by
Thomas H. Kolbe, Universitaet Bonn
with modifications by
Horst Samulowitz, Aachen
The documentation was translated by
Joachim Schimpf, Imperial College London
Licence
This code may be freely copied and used. It may be used in commercial
applications, but cannot be sold for a profit. If used within a
commercial application, this code must be distributed for free along
with the application. The same applies for any work derived by
modifying this code.
General Hints
- Like in ECLiPSe, names (e.g. relation names) in MySQL are case
sensitive.
- For all selection predicates, values of SQL type Char are returned
as ECLiPSe atoms. If necessary, atom_string/2 can be used to convert
them into ECLiPSe strings.
- For all selection predicates, null values of attributes are returned
as the empty atom ''.
- External fact sets created via sql_external/2 do not honour schema
modifications that are done while the database is connected.
In particular, this can cause problems when attributes of the
underlying relation are removed or renamed, or when the whole relation
is removed or renamed. Since these actions can be performed from
outside ECLiPSe, and since there is no notification mechanism,
no automatic update is possible.
- In addition, cached relations exhibit a version problem, since the
cached facts are no longer up to date after database manipulations.
In this case, the cached relation must either be recomputed by
invoking sql_external(Name, cache) again, or the relation should
be left uncached, using sql_external(Name, nocache).
Error Messages
- type error in ...
-
This is an Eclipse error message indicating a type conflict.
It can have several causes. Usually, some argument of an interface
predicate has the wrong type.
- instantiation fault in ...
-
This is an Eclipse error message indicating a missing instantiation.
It can have several causes. Usually, some argument of an interface
predicate is uninstantiated, or not sufficiently instantiated.
E.g. sql_select/2 requires a list skeleton of fixed length.
- Error: varlist too short!
-
The variable list and the attribute list in sql_query/5 or
sql_querydistinct/5 have different lengths.
- Error: attributelist too short!
-
The variable list and the attribute list in sql_query/5 or
sql_querydistinct/5 have different lengths.
- Error: attributelist must not be empty!
-
An empty attribute list was supplied, at least one is required.
- Error: varlist must not be empty!
-
An empty variable list was supplied, at least one element is required.
- Error: Cursor limit exhausted (max. no. is XX)!
-
The maximum number XX of open concurrently open cursors was exceeded.
The first possibility to get around this problem is to rearrange the
queries such that fewer open cursors are required, and make sure that
resatisfiable selection predicates are cut or failed over.
Another possible solution is to a priori retrieve all tuples into
a list (using findall/3), and then process the list using member/2.
After findall/3, the cursor is closed and can be reused.
The maimum number of cursors can be increased by modifying the
interface source (mysql.c) and recompile.
- Error: too many columns selected!
-
The maximum number of columns in a projection was exceeded in
sql_query/5, sql_querydistinct/5 or sql_select/2.
- Error: select statement must not be empty!
-
An empty list was given to sql_select/2.
- Error: attributelist and variablelist must have the same length!
-
In sql_select/2, the number of projected attributes in the selection
command must correspond to the length of the result variable list.
- Error: cursor# too big (range is 0-XX)!
-
This error should never occur and would indicate an internal
problem in the interface code.
- MySQL-Fehler: ...
-
This is an error message from MySQL. Refer to the MySQL documentation.
About
- Author: Thomas H Kolbe, Universitaet Bonn
- Date: $Date$
Generated from mysql.eci on Wed Apr 23 20:15:29 2003