CLSQL実験(2)

Permalink: 2008-05-28 10:16:00+09:00 by tu1978 in tags: CLSQL

CLSQLを使って、Webアプリを作るという計画。hunchentoot, common-coldというライブラリを使ってみる。

何となくできそうだが、うまく動かない。コードは次のような感じ。

-----top.lisp-----
(require :asdf)
(push #P"/home/aaaa/bin/" asdf:*central-registry*)
(asdf:oos 'asdf:load-op 'common-cold)
(asdf:operate 'asdf:load-op 'clsql)
(asdf:operate 'asdf:load-op 'clsql-mysql)
(asdf:operate 'asdf:load-op 'clsql-sqlite3)
(load "kaimonoweb.lisp")
(hunchentoot:start-server :port 9877)

-----------kaimonoweb.lisp----------
(cl:in-package "COMMON-COLD ...
more…

CLSQL実験(1)

SQLite3を使ったCLSQLの実験。買い物を整理するデータベースのつもり。クラスを定義する



(clsql:def-view-class Kaimono ()
((id :accessor id-of :db-kind :key :db-constraints :not-null :type integer :initarg :id)
(cost :accessor cost-of :type integer :initarg :cost)
;; (date :accessor date-of :type clsql:date :initarg :date) ;; SQLite3 はDATE型がない!!
(date :accessor date-of :type clsql:date :db-type "integer" :initarg :date ;; INTEGERで保存して、DATE(MJD)に変換する
:db-writer clsql ...

more…