From 807443ef3d043565a00ba475aa8d132006304b77 Mon Sep 17 00:00:00 2001 From: Michele Simionato Date: Tue, 29 Jul 2014 11:57:01 +0200 Subject: Removed the old sqlplain code --- sqlplain/tests/test_qmark2pyformat.py | 53 ----------------------------------- 1 file changed, 53 deletions(-) delete mode 100644 sqlplain/tests/test_qmark2pyformat.py (limited to 'sqlplain/tests/test_qmark2pyformat.py') diff --git a/sqlplain/tests/test_qmark2pyformat.py b/sqlplain/tests/test_qmark2pyformat.py deleted file mode 100644 index e535503..0000000 --- a/sqlplain/tests/test_qmark2pyformat.py +++ /dev/null @@ -1,53 +0,0 @@ -from __future__ import with_statement -from sqlplain.sql_support import qmark2pyformat, STRING_OR_COMMENT -from ms.time_utils import Clock - -TEMPL = ''' --- insert into covered -INSERT INTO rhp_covered_product - SELECT p.refdate, c.client_srs, c.client_id, p.pricer, ep.productcode, - ep.clientcode, rmtck.covered_date FROM rhp_exportedproduct AS ep - INNER JOIN customer AS c - ON lower(ep.client) = c.client_srs - INNER JOIN rhp_product AS p - ON ep.productcode = p.productcode - AND ep.refdate = p.refdate - AND p.refdate = ? - INNER JOIN ( - SELECT client_id, productcode, covered_date - FROM covered_by_nonrequested - - UNION - - SELECT client_id, productcode , covered_date FROM - covered_by_rhp_tickerlookup - - ) AS rmtck - ON c.client_id = rmtck.client_id - AND rmtck.productcode = p.productcode -''' - -#TEMPL = 'select * from client where client=?' - -def write(dt): - print "Spent %s ms" % dt - -with Clock(write): - for i in xrange(100000): - qmark2pyformat(TEMPL) - -def qmark2pyformat(templ): # version without cache - qmarks = 0 - out = [] - for i, chunk in enumerate(STRING_OR_COMMENT.split(templ)): - if i % 2 == 0: # real sql code - qmarks += chunk.count('?') - out.append(chunk.replace('?', '%s')) - else: # string or comment - out.append(chunk) - new_templ = ''.join(out) - return qmarks, new_templ - -with Clock(write): - for i in xrange(100000): - qmark2pyformat(TEMPL) -- cgit v1.2.1