dtml-sqlgroup for other SQL actions
I think I've gotten the hang of using the dtml-sqlgroup tags for creating variable queries, so I'm wondering if there are related tags that will work for other SQL functions; specifically, Update. I have a table that can be updated from various forms, and the forms will have different numbers of fields, depending on things like security, etc. I'd like to have a single ZSQL method for this, but since the various fields in an SQL Update command are joined by commas, not ANDs, I'm not sure how this can be done. For example, let's say that the ZSQL method for updating a table called 'People' might have the following arguments: cLast, cFirst, cSSN, cPhoneNum. One form might return just the first name and last name, and the SQL should look like: UPDATE People SET <dtml-sqlvar cLast type="string">, <dtml-sqlvar cFirst type="string"> WHERE <dtml-sqltest cSSN op="eq" type="string"> while a second form might pass just last name and phone number, generating this SQL: UPDATE People SET <dtml-sqlvar cLast type="string">, <dtml-sqlvar cPhoneNum type="string"> WHERE <dtml-sqltest cSSN op="eq" type="string"> and a third might pass 'em all: UPDATE People SET <dtml-sqlvar cLast type="string">, <dtml-sqlvar cFirst type="string">, <dtml-sqlvar cPhoneNum type="string"> WHERE <dtml-sqltest cSSN op="eq" type="string"> So is there something I'm missing? Or do I need to code this myself? ___/ / __/ / ____/ Ed Leafe http://leafe.com/ http://foxcentral.net
Ed Leafe writes:
I think I've gotten the hang of using the dtml-sqlgroup tags for creating variable queries, so I'm wondering if there are related tags that will work for other SQL functions; specifically, Update. Let you SQL command be generated with one (or more) Python scripts. They can easily handle variable sized lists.
Dieter
On Thursday, July 18, 2002, at 02:12 PM, Dieter Maurer wrote:
I think I've gotten the hang of using the dtml-sqlgroup tags for creating variable queries, so I'm wondering if there are related tags that will work for other SQL functions; specifically, Update. Let you SQL command be generated with one (or more) Python scripts. They can easily handle variable sized lists.
Yeah, that's what I figured I'd have to do. I was just checking to make sure that I wasn't overlooking anything obvious. ___/ / __/ / ____/ Ed Leafe http://leafe.com/ http://foxcentral.net
Hello Ed, Thursday, July 18, 2002, 9:53:45 PM, you wrote: DM> Let you SQL command be generated with one (or more) Python scripts. DM> They can easily handle variable sized lists. EL> Yeah, that's what I figured I'd have to do. I was just checking to EL> make sure that I wasn't overlooking anything obvious. Andy Dustman made a small patch to SQLgroup, implementing a <dtml-comma> and a <dtml-set> tag.. look here for details : http://www.zope.org/Members/adustman/Products/SQLBlender -- Geir Bækholt web-developer geirh@funcom.com funcom oslo | webdev-team
participants (3)
-
Dieter Maurer -
Ed Leafe -
Geir Bækholt