Sergey Kolos | 7 Sep 2008 01:53
Picon
Favicon

bug in mysql module

Description: When I tried to load clsql-mysql module on WindowsXP I've got error: cannot load clsql_mysql library.

How to reproduce: Put clsql folder to d:\libs folder and try to compile clsql-mysql package.

Result: compilation fails with error: cannot load clsql_mysql library, with side effect of creating
c:\libs\clsql\db-mysql folder.

Workaround: Put clsql_mysql.dll into c:\libs\clsql\db-mysql folder or copy whole library to c: drive
and compile from there.

Thanks
Thijs Oppermann | 15 Sep 2008 23:38
Picon

RFC/patch: normalised object oriented clsql?

As a for-play hobby project I started porting/rewriting a perl web
framework I like to common lisp. Mostly to learn the language. Fairly
quickly I needed a place to put my data, and I ended up choosing
clsql, and started off using the object oriented parts of it.
Immediately I ran into something I thought a bit weird: subclassed
views did not re-use the database fields from the superclass, but
flatly included them within. At first I thought I must be doing
something wrong, so I started digging into the docs, but soon I found
that nowhere this issue was mentioned. Now, maybe I want something
stupid, or maybe I'm using or doing it wrong, but I thought it was
obvious that a subclassed view would be linked to it's parent view
through primary/foreign key pairs. A 'normalised' view, if I may abuse
that term here. Finding that clsql did nothing of the sort I thought I
would quickly add that functionality to it and move on. Famous last
words and all that...

Anyway, I've been working away at this for a while now, on and off.
Finding out that it entailed entirely a lot more changes than I had
anticipated, of course. Maybe this is why it wasn't there in the first
place... It's not really as trivial as I thought. Although, now, I'm
getting somewhere. I've actually added a bunch of tests that I now
also manage to pass. So it seems as I'm getting close to a working
system. An ideal time to throw it out there, and be pointed at an
existing implementatoin, or a better way to do it or whatever... ;)

I would very much like to hear thoughts, rants, pointers, anything
about this. I'm gonna go on with my original project now, and use this
stuff there. But maybe someone else likes this and wants to use it.
Maybe it's something that was planned all along and I've saved someone
some work (or done the work twice). Maybe this is something no-one
(Continue reading)

Thijs Oppermann | 16 Sep 2008 18:37
Picon

Re: RFC/patch: normalised object oriented clsql?

Replying to the list, because I guess my answer covers some stuff I
forgot to cover in my first post. But thanks for your input, Vsevoiod.

First, my changes do *nothing* unless you explicitly *use* it (at
least, that was my intention, so barring bugs, that is how it should
work). So old code works as it always has. No need to change a thing.
And if you run into anything that shows otherwise I very much want to
know, because that's a bug and I'd like to squash those...

And yes, I see exactly what you mean with your example, and in that
case I would use it as it is now, too. But my case is a little bit
different, as the different view-classes have a very clear hierarchy
themselves. And having this mirrored in the database cleans it up. An
example may help:

Basically, in the framework everything is a node (wonder how many of
you know now what framework I'm working off of... ;)
So you have a view class 'node', defined as (this is actually taken
verbatim from the tests I added):

(def-view-class node ()
  ((node-id :accessor node-id :initarg :node-id
            :type integer :db-kind :key
            :db-constraints (:not-null :auto-increment))
   (title :accessor title :initarg :title :type (varchar 240))
   (createtime :accessor createtime :initarg :createtime :type wall-time
               :db-constraints (:not-null) :initform (get-time))
   (modifiedtime :accessor modifiedtime :initarg :modifiedtime :type wall-time
                 :initform (make-time :year 1900 :month 1 :day 1))))

(Continue reading)

Andrea Chiumenti | 26 Sep 2008 09:39
Picon
Gravatar

added join support

Hello lisper,
if you are interested I've just extended CLSQL to support left, right,
inner joins

(in-package #:clsql-sys)

(defclass sql-join-exp (sql-ident)
  ((components :initarg :components)
   (modifier :initarg :modifier)
   (name :initarg :name)
   (on :initarg :on)))

(defmethod initialize-instance :after ((sql sql-join-exp) &rest rest)
  (let ((name (first (last (getf rest :components)))))
    (when (typep name 'sql-ident)
      (setf name (slot-value name 'name)))
    (setf (slot-value sql 'name) name)))

(defmethod make-load-form ((sql sql-join-exp) &optional environment)
  (declare (ignore environment))
  (with-slots (components modifier on)
      sql
    `(make-instance 'sql-join-exp :components ',components :modifier
',modifier :on ',on)))

(defmethod output-sql ((expr sql-join-exp) database)
  (with-slots (modifier components on)
      expr
    (output-sql (first components) database)
    (write-string " " *sql-stream*)
(Continue reading)


Gmane