1.1 --- a/sqlliterals/regexp.py Sat Jun 02 20:36:06 2007 +0200
1.2 +++ b/sqlliterals/regexp.py Sun Aug 12 20:31:11 2007 +0200
1.3 @@ -20,6 +20,7 @@
1.4 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
1.5 """
1.6
1.7 +import sqlliterals.common
1.8 import re
1.9
1.10 region_expr = re.compile("(?P<non_literal>[^']+)|(?P<literal>'(?:[^']|(?:''))*')")
1.11 @@ -47,4 +48,16 @@
1.12
1.13 return regions
1.14
1.15 +# NOTE: Duplicated across implementations.
1.16 +
1.17 +def replace(fromstyle, tostyle, s):
1.18 +
1.19 + """
1.20 + Return a new string, where the paramstyle 'fromstyle' is
1.21 + replaced with 'tostyle' in the appropriate regions of 's'.
1.22 + """
1.23 +
1.24 + regions = parseString(s)
1.25 + return "".join(sqlliterals.common.replace(fromstyle, tostyle, regions))
1.26 +
1.27 # vim: tabstop=4 expandtab shiftwidth=4