[cl-rdbms-devel] Convenience over extensibility? Or: How to build on top of hu.dwim.rdbms?

Marshall McLuhan marshall.mcluhan at gmx.net
Fri Nov 5 12:29:37 UTC 2010


While the sql reader syntax e.g. [select * table] is convenient for humans
it doesn't allow for being used by other functions or does it?

In my opinion such a sql reader syntax is nice to have but not being able to extend the software
through the use of functions is disastrous in my eyes. I have the feeling that we create two camps here, one the developers
and the other the users. Personally I don't like that distinction and would much prefer to make the possibility of extending
the software through the use of functions as easy as possible for the so called "user".

With that in mind I find myself using internal function and classes from the hu.dwim.rdbms package
( e.g. sql-and, sql-sequence-nextval-column, sql-identifier, sql-all-columns, sql-= )
and writing wrapper functions for it e.g.

(defun sqlid (name)
  (hu.dwim.rdbms::sql-identifier :name (string-upcase name)))

(defun sqleq (left right)
  (hu.dwim.rdbms::sql-= left right))

(defun sqlallcol ()
  (lst (hu.dwim.rdbms::sql-all-columns)))

(defun sqlselect-single (tbl keycol-id keycol-val)
  (select (sqlallcol) (lst tbl)
      :where (sqleq (sqlid keycol-id) keycol-val)))
(defun seqnext-literal (name)
   :name (string-upcase name)))

What do you think about what I just said. Did I go wrong somewhere?
And if the above is really an issue, any ideas as how to handle it?

Right now I did create another system and package called hu.dwim.rdbms.oracle.ext for things like the above.
(The names above are not carved into stone tablets. I often change my mind before I settle for certain names and yes,
 often the wrappers seem unnecessary but I don't want to change the package definition of hu.dwim.rdbms
 and/or prefer shorter names.)


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/cl-rdbms-devel/attachments/20101105/b5b2e9e2/attachment.html>

More information about the cl-rdbms-devel mailing list