- Which features are missing from HaskellDB ?
Currently, HaskellDB is not finished. Documentation should be written and the
implementation is not yet complete. The following features are currently lacking.
- Errors during the (lazy) reading of records are not reported; the list of
returned records is simply incomplete. I consider this as a serious flaw but
it can easily fixed with exception handling (now implemented by GHC).
- There is no operator yet for transforming lists of Rows back to a relation
again (i.e. [Row r] -> Query (Rel r)).
- There is no support yet for table expressions inside expressions. This prevents
for example the comparison of relations which are very usefull but extremely
hard to express at the moment.
- The list of possible relational functions is not complete.
- ...
- How can I create a database definition in Haskell ?
Before a database can be used in Haskell, a definition of this database
is needed. The DB/Direct utility can be used to generate a
database definition automatically. DB/Direct is itself a HaskellDB
program which queries the system catalog to retrieve information about
a database. The program is located in the haskellDB\dbdirect
directory. The program can be run as:
E:\haskellDB\dbdirect> runhugs dbdirect [name] [filename] [database]
where name is the name of the resulting haskell module,
filename is the name of the generated file (default extension is .hs)
and database is an ADO connection string (see the next question).
For example, I used the following command to generate the definition of
the Pubs database:
E:\haskellDB\dbdirect> runhugs dbdirect "pubs" "pubs" "dsn=pubs"
The Northwind database is shipped with MS Sql Server and I used
the following command to generate a Haskell definition:
> runhugs dbdirect "Northwind" "..\demos\NorthWind.hs"
"driver=SQL Server;server="\\AJAM";database="northwind"
- What is ADO ?
ADO (active data objects) is a COM framework for interaction with
databases. It extends and simplifies the ODBC protocol. Almost any database
on a Windows platform can be accessed using ADO. The Ado module
implements a driver for the ADO framework.
To connect to a database, a connection string is used. A connection
string consists of option=value pairs seperated by semicolons.
Some options are:
- driver, the database driver ("SQL Server").
- server, the database server ("(local)", "\\PUBSOL").
- database, the actual database.
- pwd, a password.
- uid, user name.
For example to connect to the local MS Sql Server database,
the following connection string can be used:
driver=SQL Server;server=(local);database=pubs.
The Ado module provides the adoPrimConnect function to
connect to a database using a raw ADO connection string. The adoConnect
function uses a structured option data type to specify the connection. For example:
adoPrimConnect "driver=SQL Server;server=(local);database=pubs"
adoConnect (adoOptions{driver="SQL Server"
,server="(local)",
,dbase="pubs"})
adoConnect (adoDSN "pubs")
The easiest way to connect to a database is with data source names (DSN)
The connection string is than simply: dsn=pubs.
Before DSN works, you need to give the information about the database using
the ODBC manager.
- How can I set the DSN information ?
Click
on start/settings/control panel/odbc to run the ODBC manager.
Click Add to add a new DSN. If you want to use the MS Access
database (pubs.mdb) choose the MS Access 97 driver. Choose a
new DSN name (pubs) and choose Select to add the path
to the database. On my system this looks like:
- When I try to run the samples I get the following error:
User error: Com error: method 'Open': Microsoft OLE DB Provider for ODBC
Drivers
.: [Microsoft][ODBC Driver Manager] Data source name not found and no
default driver specified
.
You have forgotten to set the DSN information. See the previous question.
- How is the site written ?
This site has been created using MS Interdev, a text editor and
the Visual C preprocessor. It has been designed to be viewable across
many different browsers (it doesn't use frames for example), but looks best with
Internet Explorer.