Re: [Zope-DB] Please help me about driver adapter

2007-02-15 Thread garry saddington
On Fri, 2007-02-16 at 07:38 +0100, robert rottermann wrote:
 I do not think any one of us can help you unless you tell us what
 exactly your problem with installing pymssql ist.
 by the way: do you mean MySQLdb?
 
 there is very good  documentation on using Z SQL in the zope book:
 http://www.plope.com/Books/2_7Edition/RelationalDatabases.stx
 
 there you find examples how to use a query with like.
 robert
Here's an example of how to use like and wildcards in sqlvar's

select * from students
where surname ilike dtml-sqlvar expr='%'+surname+'%' type=string

Regards
Garry

___
Zope-DB mailing list
Zope-DB@zope.org
http://mail.zope.org/mailman/listinfo/zope-db


Re: [Zope-DB] case insensitive ZSQL queries

2007-09-06 Thread garry saddington


On Wed, 2007-09-05 at 16:16 -0700, onsombal wrote:
 is there an easy way to make the following ZSQL query case-insensitive?
 
 select * from clients
 dtml-sqlgroup where
 dtml-sqltest firstname op=like type=string optional
   dtml-or
 dtml-sqltest lastname op=like type=string optional
   dtml-or
 dtml-sqltest client op=like type=string optional
   /dtml-sqlgroup
 
 Thanks... Jim
 
 
If you use Postgresql then change the 'like' to 'ilike'.
Regards
Garry

___
Zope-DB mailing list
Zope-DB@zope.org
http://mail.zope.org/mailman/listinfo/zope-db


Re: [Zope-DB] Calling SQL Query in DTML Method with a string argument

2008-07-28 Thread Garry Saddington
On Monday 28 July 2008 15:59, Matylda Sawicka wrote:
 Hello,
 I am a fresh Zope Explorer. I was trying to call an SQL Query that requires
 an argument in a DTML Method that would be called with an argument passed
 in the URL. The Query looks more or less like this:

 SELECT Uni_Name,
Uni_Latitude,
Uni_Longitude
 FROM universities
 WHERE Uni_Code = dtml-sqlvar givenCode type=string AND
   Uni_Latitude != NULL

 whilst the DTML Method consists of:
TRY:
 markers
 dtml-in expr=uniSingleByCode(givenCode=_['uni_id'])
 mrk nm=dtml-var Uni_Name lat=dtml-var Uni_Latitude lng=dtml-var
 Uni_Longitude/
 /dtml-in
 /markers
or just let the ZSQL get the argument from the REQUEST:
 markers
 dtml-in uniSingleByCode
 mrk nm=dtml-var Uni_Name lat=dtml-var Uni_Latitude lng=dtml-var
 Uni_Longitude/
 /dtml-in
 /markers
HTH
regards
Garry
___
Zope-DB mailing list
Zope-DB@zope.org
http://mail.zope.org/mailman/listinfo/zope-db


Re: [Zope-DB] ZSQL Question - Insert multiple rows in one statement?

2010-08-24 Thread Garry Saddington
Garry Saddington wrote:
 Andreas Jung wrote:
 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1

 I would assume that you can use DTML-IN for looping and generating
 multiple SQL statements of the same kind. You have to ensure that
 the statements having a proper delimiter (there was something in DTML?!
 DTML-SQLDELIMITER?...no idea, you need to checks the docs of this
 ancient technology).
 
oops:
dtml-var sql_delimiter
code in snippets is correct though.
sorry
Garry

 Andreas is correct but the delimiter is dtml-sql_delimiter.
 Probably better to do this in python script, but here are some code 
 snippets to help you:
 In the form:
 
 select name=seasons:list multiple=multiple
 
 In the ZSQL method:
 
 dtml-in seasons
 dtml-var sql_delimiter
 
 insert statement goes here, don't forget the ; at the end.
 
 /dtml-in
 
 Hope this is of some help, others may want to chip in with other 
 suggestions, such as doing the same in python. Anyway good luck.
 Garry
 ___
 Zope-DB mailing list
 Zope-DB@zope.org
 https://mail.zope.org/mailman/listinfo/zope-db
 

___
Zope-DB mailing list
Zope-DB@zope.org
https://mail.zope.org/mailman/listinfo/zope-db