2009年7月26日日曜日

Haskellはじめました -その2-

Cabalの基本的な使い方が解ったので、Haskellでデータベース接続をするべくHDBCのインストールに挑戦。
DBはお手軽なSQLiteで試したい。



C:\Users\Dog\Downloads\Hackage\HDBC-sqlite3-2.1.0.2>runghc setup configure
Configuring HDBC-sqlite3-2.1.0.2...
setup: Missing dependency on a foreign library:
* Missing C library: sqlite3
This problem can usually be solved by installing the system package that
provides this library (you may need the "-dev" version). If the library is
already installed but in a non-standard location then you can use the flags
--extra-include-dirs= and --extra-lib-dirs= to specify where it is.



あらら早速エラーです。
なにやら依存するファイルが足りないとか。「--extra-include-dirs」とか「--extra-include-dirs」オプションを指定しろって?
SQLiteのサイトからsourceとDLLを拾ってくる。それらを解凍し、「--extra-include-dirs」と「--extra-include-dirs」にフォルダを指定してみる。



C:\Users\Dog\Downloads\Hackage\HDBC-sqlite3-2.1.0.2>runghc setup configure -
-extra-lib-dirs=C:\Users\suzuken\Downloads\sqlitedll-3_6_16 --extra-include-dirs
=C:\Users\suzuken\Downloads\sqlite-amalgamation-3_6_16
Configuring HDBC-sqlite3-2.1.0.2...



あ、今度は通った。
installまで実行して、GHCiで



Prelude> :module Database.HDBC Database.HDBC.Sqlite3
Prelude Database.HDBC Database.HDBC.Sqlite3> conn <- connectSqlite3 "test"



あれ?エラーになるぞ?
まだなにか足りないらしい。。。

0 件のコメント: