Commit 413d6481 authored by Jim Fulton's avatar Jim Fulton

Now use exported sql_quote__ function to quote strings.

parent ec2687e1
...@@ -11,8 +11,8 @@ ...@@ -11,8 +11,8 @@
__doc__='''Generic Database adapter __doc__='''Generic Database adapter
$Id: DA.py,v 1.43 1998/04/27 18:56:13 jim Exp $''' $Id: DA.py,v 1.44 1998/04/27 18:59:56 jim Exp $'''
__version__='$Revision: 1.43 $'[11:-2] __version__='$Revision: 1.44 $'[11:-2]
import OFS.SimpleItem, Aqueduct.Aqueduct, Aqueduct.RDB import OFS.SimpleItem, Aqueduct.Aqueduct, Aqueduct.RDB
import DocumentTemplate, marshal, md5, base64, DateTime, Acquisition, os import DocumentTemplate, marshal, md5, base64, DateTime, Acquisition, os
...@@ -270,7 +270,7 @@ class DA( ...@@ -270,7 +270,7 @@ class DA(
argdata=self._argdata(REQUEST) argdata=self._argdata(REQUEST)
argdata['sql_delimiter']='\0' argdata['sql_delimiter']='\0'
argdata['sql_quote']=dbc.sql_quote__ argdata['sql_quote__']=dbc.sql_quote__
query=apply(self.template, (p,), argdata) query=apply(self.template, (p,), argdata)
if src__: return query if src__: return query
...@@ -311,7 +311,7 @@ class DA( ...@@ -311,7 +311,7 @@ class DA(
else: p=None else: p=None
argdata['sql_delimiter']='\0' argdata['sql_delimiter']='\0'
argdata['sql_quote']=dbc.sql_quote__ argdata['sql_quote__']=dbc.sql_quote__
query=apply(self.template,(p,),argdata) query=apply(self.template,(p,),argdata)
if self.cache_time_: if self.cache_time_:
...@@ -438,6 +438,9 @@ def getBrain(self, ...@@ -438,6 +438,9 @@ def getBrain(self,
############################################################################## ##############################################################################
# #
# $Log: DA.py,v $ # $Log: DA.py,v $
# Revision 1.44 1998/04/27 18:59:56 jim
# Now use exported sql_quote__ function to quote strings.
#
# Revision 1.43 1998/04/27 18:56:13 jim # Revision 1.43 1998/04/27 18:56:13 jim
# Now export an sql_quote function that is used by sqlvar and sqltest # Now export an sql_quote function that is used by sqlvar and sqltest
# to quote strings. # to quote strings.
......
...@@ -46,7 +46,7 @@ ...@@ -46,7 +46,7 @@
'and' or 'or' tag, otherwise, no text is inserted. 'and' or 'or' tag, otherwise, no text is inserted.
''' '''
__rcs_id__='$Id: sqltest.py,v 1.4 1998/04/27 18:57:23 jim Exp $' __rcs_id__='$Id: sqltest.py,v 1.5 1998/04/27 18:58:39 jim Exp $'
############################################################################ ############################################################################
# Copyright # Copyright
...@@ -56,7 +56,7 @@ __rcs_id__='$Id: sqltest.py,v 1.4 1998/04/27 18:57:23 jim Exp $' ...@@ -56,7 +56,7 @@ __rcs_id__='$Id: sqltest.py,v 1.4 1998/04/27 18:57:23 jim Exp $'
# rights reserved. # rights reserved.
# #
############################################################################ ############################################################################
__version__='$Revision: 1.4 $'[11:-2] __version__='$Revision: 1.5 $'[11:-2]
from DocumentTemplate.DT_Util import * from DocumentTemplate.DT_Util import *
...@@ -118,7 +118,7 @@ class SQLTest: ...@@ -118,7 +118,7 @@ class SQLTest:
'Invalid floating-point value for <em>%s</em>' % name) 'Invalid floating-point value for <em>%s</em>' % name)
else: else:
v=str(v) v=str(v)
v=md.getitem('sql_quote',0)(v) v=md.getitem('sql_quote__',0)(v)
#if find(v,"\'") >= 0: v=join(split(v,"\'"),"''") #if find(v,"\'") >= 0: v=join(split(v,"\'"),"''")
#v="'%s'" % v #v="'%s'" % v
...@@ -140,6 +140,9 @@ valid_type={'int':1, 'float':1, 'string':1, 'nb': 1}.has_key ...@@ -140,6 +140,9 @@ valid_type={'int':1, 'float':1, 'string':1, 'nb': 1}.has_key
############################################################################ ############################################################################
# $Log: sqltest.py,v $ # $Log: sqltest.py,v $
# Revision 1.5 1998/04/27 18:58:39 jim
# Now use exported sql_quote__ function to quote strings.
#
# Revision 1.4 1998/04/27 18:57:23 jim # Revision 1.4 1998/04/27 18:57:23 jim
# Now use exported sql quote function to quote strings. # Now use exported sql quote function to quote strings.
# #
......
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
however, if x is ommitted or an empty string, then the value however, if x is ommitted or an empty string, then the value
inserted is 'null'. inserted is 'null'.
''' '''
__rcs_id__='$Id: sqlvar.py,v 1.1 1998/03/17 19:31:22 jim Exp $' __rcs_id__='$Id: sqlvar.py,v 1.2 1998/04/27 18:58:14 jim Exp $'
############################################################################ ############################################################################
# Copyright # Copyright
...@@ -48,7 +48,7 @@ __rcs_id__='$Id: sqlvar.py,v 1.1 1998/03/17 19:31:22 jim Exp $' ...@@ -48,7 +48,7 @@ __rcs_id__='$Id: sqlvar.py,v 1.1 1998/03/17 19:31:22 jim Exp $'
# rights reserved. # rights reserved.
# #
############################################################################ ############################################################################
__version__='$Revision: 1.1 $'[11:-2] __version__='$Revision: 1.2 $'[11:-2]
from DocumentTemplate.DT_Util import * from DocumentTemplate.DT_Util import *
from string import find, split, join, atoi, atof from string import find, split, join, atoi, atof
...@@ -98,8 +98,10 @@ class SQLVar: ...@@ -98,8 +98,10 @@ class SQLVar:
if not v and t=='nb': if not v and t=='nb':
raise ValueError, ( raise ValueError, (
'Invalid empty string value for <em>%s</em>' % name) 'Invalid empty string value for <em>%s</em>' % name)
if find(v,"\'") >= 0: v=join(split(v,"\'"),"''")
v="'%s'" % v v=md.getitem('sql_quote__',0)(v)
#if find(v,"\'") >= 0: v=join(split(v,"\'"),"''")
#v="'%s'" % v
return v return v
...@@ -109,6 +111,9 @@ valid_type={'int':1, 'float':1, 'string':1, 'nb': 1}.has_key ...@@ -109,6 +111,9 @@ valid_type={'int':1, 'float':1, 'string':1, 'nb': 1}.has_key
############################################################################ ############################################################################
# $Log: sqlvar.py,v $ # $Log: sqlvar.py,v $
# Revision 1.2 1998/04/27 18:58:14 jim
# Now use exported sql_quote__ function to quote strings.
#
# Revision 1.1 1998/03/17 19:31:22 jim # Revision 1.1 1998/03/17 19:31:22 jim
# added new sql tags # added new sql tags
# #
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment