[Zope] Is there a <dtml-comma> for SQL UPDATEs?
Chris McDonough
chrism@digicool.com
Fri, 14 Jan 2000 03:45:25 -0500
Hmmm.... AFAIK, there's no such animal as <dtml-comma>. But without
much research on the matter, I'd say that this'd do it:
UPDATE
users
SET
<dtml-sqlgroup>
<dtml-sqltest login type=nb optional>
<dtml-if email>,<dtml-sqltest email type=nb optional></dtml-if>
</dtml-sqlgroup>
WHERE
<dtml-sqltest userid type=int>
Guy Davis wrote:
>
> I now have all my insert and select queries working, but am having
> trouble with an UPDATE.
> For the query:
> UPDATE users
> SET
> <dtml-sqlgroup>
> <dtml-sqltest login type=nb optional>
> <dtml-sqltest email type=nb optional>
> </dtml-sqlgroup>
> WHERE <dtml-sqltest userid type=int>
>
> This works perfectly except when both login and email are provided
> because the query becomes:
> UPDATE users
> SET login='a_login'
> email='an_email'
> WHERE id=1
>
> Without the comma between the login and email, it doesn't work. I loved
> the <dtml-and> and <dtml-or> tags for SELECT statements. I tried a
> <dtml-comma> but no such luck. Does this exist or do I need to use
> separate UPDATE statements for each column, each wrapped in a
> <dtml-if>?
>
--
Chris McDonough
Digital Creations, Inc.
Zope - http://www.zope.org