[postmodern-devel] using dao-class on database with column names like "addr:city"

rm at tuxteam.de rm at tuxteam.de
Tue Jun 14 13:45:29 UTC 2011


On Tue, Jun 14, 2011 at 08:33:34AM -0400, John Morrison wrote:
> On Tuesday 14 June 2011, Marijn Haverbeke wrote:
> > If colons are safe in SQL field names, you can change
> > s-sql::to-sql-name to leave them intact (there seems to already by an
> > exception for * characters).
> 
> Thanks, and will do...
> 
> As regards colons in column names: while I am by no means an
> experienced SQL guy, AFAICT the various GIS tools I am using all seem
> (so far) to be functioning correctly on databases with those column
> names.

Sorry, but colons aren't a avalid part of an SQL identifier.

 A <regular identifier> is a character string, up to 128 characters long,
 that consists only of letters, digits, and underscore characters. It
 must begin with a letter.

In standard-conforming SQL 'addr:city' only works as a delimited
identifier:

 A <delimited identifier> is a character string, up to 128 characters
 long, surrounded by a pair of double quote marks. (The delimiting double
 quotes aren't part of the <identifier>, so they're not included in the
 calculation of its size.) Two consecutive double quotes within the
 character string (i.e., "") represent one double quote mark; together,
 they count as one character when calculating the size of the
 <identifier>.

 A <delimited identifier> is case sensitive. That is, uppercase and
 lowercase letters within a <delimited identifier> are not
 interchangeable; 


This smells like open streetmap ... must have been SQL gurus that
designed that schema  :-/


> > Slot names can be locked? I've never heard of that. How?
> 
> IIRC I got a package lock violation when naming the dao-class' slot
> "type" to mirror the SQL column name.  I will go back and look again -
> only spent 2 seconds kludging around it, as I ran into the colon
> problem on the same table....

This seems wrong. The symbol 'type' only causes lock-problems when you
try to bind its function value. Are you shure you didn't:

 (defclass foo ()
  ((type :accessor type)))

??? That _would_ try to create a function '(type instance)' and trigger
the package lock violation error.

 HTH Ralf Mattes

> Thanks again for the help!
> 
> -jm
> 
> > 
> > _______________________________________________
> > postmodern-devel mailing list
> > postmodern-devel at common-lisp.net
> > http://lists.common-lisp.net/cgi-bin/mailman/listinfo/postmodern-devel
> 
> 
> -- 
> --- John Morrison
> --- john.nmi.morrison at gmail.com
> 
> _______________________________________________
> postmodern-devel mailing list
> postmodern-devel at common-lisp.net
> http://lists.common-lisp.net/cgi-bin/mailman/listinfo/postmodern-devel




More information about the postmodern-devel mailing list