Re: quoting entity and attribute names

Sebastien Bigaret <[email protected]> 23 Jun 2004 19:54:02 +0200
Newsgroups gmane.comp.python.modeling
Message-ID <[email protected]>
John Lenton <[email protected]> wrote:
> In a project I'm currently working on there is a class that we'd like
> to call "User", but we can't call it that and use Modeling in its
> current state: it's not quoting the names of entities (nor
> attributes), and user is a reserved word.
> 
> I looked into it, and I actually got it working, but I then saw that
> in SQLExpression there's a method `externalNameQuoteCharacter'; is the
> purpose of this method to be used (something like) this:
> 
>     [ in _addTableJoinsForAlias ]
> 
>     quoteChar = self.externalNameQuoteCharacter()
>     str += quoteChar + self._internals.entityExternalNameForAlias(alias) + quoteChar + ' ' + alias
> 
> ?

And to answer this very precisely, I do not feel really comfortable with
quoting external names when unneeded; the quoting should IMHO be done
only when a whole SQL statement is returned, not during intermediate
steps. This makes assembleDelete|Select|UpdateStatement() methods good
candidates, doesn't it?

-- Sébastien.



-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training.
Attend Black Hat Briefings & Training, Las Vegas July 24-29 - 
digital self defense, top technical experts, no vendor pitches, 
unmatched networking opportunities. Visit www.blackhat.com