Re: [Zope] SQL query in ZSQLMethod

2005-09-25 Thread Peter Bengtsson
Plus, celtek, when you use DTML in ZSQL methods use this:
dtml-sqlvar value1 type=string to automatically quote strings.
Otherwise you'd have to do this:
'dtml-var value.replace('\'','\'\'\'')'
which might not work anyway.

2005/9/25, David H [EMAIL PROTECTED]:
  How do you want to change this notation? What is it you want to do?  Please
 spend as much time writing a question as someone may in answering it!

  You do not want logic in your zsql methods.
  I tend to use python scripts for branching logic, eg

  # python script
  request = context.REQUEST
  if request.get('value1') == someValue:
 do the add zsql
  else:
do the edit zsql.



  [EMAIL PROTECTED] wrote:

 Hi,
 In ZSQLMethod I would have SQL query similar to this logic:

 IF
 value1=dtml-var value1 and value2=dtml-var value2
 THEN
 update table set(
 name='dtml-var name'
 )where value1=dtml-var value1 and value2=dtml-var value2
 ELSE
 insert into table values(
 Id,

 name='dtml-var name',
 value1=dtml-var value1,
 value2=dtml-var value2
 )
 I can't figure out how to change this notation.

 Many greetings and thanks for every answer!




 ___
 Zope maillist  -  Zope@zope.org
 http://mail.zope.org/mailman/listinfo/zope
 **   No cross posts or HTML encoding!  **
 (Related lists -
  http://mail.zope.org/mailman/listinfo/zope-announce
  http://mail.zope.org/mailman/listinfo/zope-dev )





--
Peter Bengtsson,
work www.fry-it.com
home www.peterbe.com
hobby www.issuetrackerproduct.com
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists -
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


[Zope] SQL query in ZSQLMethod

2005-09-24 Thread celtek



Hi, 
In ZSQLMethod I wouldhave SQL 
querysimilar to this logic:

IF
value1=dtml-varvalue1 and 
value2=dtml-var value2
THEN
update table set(
name='dtml-var name'
)wherevalue1=dtml-varvalue1 and value2=dtml-var 
value2
ELSE
insert into table values(
Id,

name='dtml-var name',
value1=dtml-varvalue1,
value2=dtml-var value2
)
Ican't figure out how to change this 
notation.

Many greetings and thanks forevery 
answer!
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] SQL query in ZSQLMethod

2005-09-24 Thread David H




How do you want to change this notation? What is it you want to do? 
Please spend as much time writing a question as someone may in
answering it!

You do not want logic in your zsql methods.
I tend to use python scripts for branching logic, eg

# python script
request = context.REQUEST
if request.get('value1') == someValue:
   do the add zsql
else:
  do the edit zsql.


[EMAIL PROTECTED] wrote:

  
  
  
  Hi, 
  In ZSQLMethod I would have SQL
query similar to this logic:
   
  IF
  value1=dtml-var value1 and
value2=dtml-var value2
  THEN
  update table set(
  name='dtml-var name'
  )where value1=dtml-var value1
and value2=dtml-var value2
  ELSE
  insert into table values(
  Id,
  
  name='dtml-var name',
  
  value1=dtml-var value1, 
  value2=dtml-var value2
  )
  I can't figure out how to change
this notation.
   
  Many greetings and thanks for every
answer!  
 
  
  




___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )