server/test/unittest_rql2sql.py
branchstable
changeset 5010 b2c5aee8ca3f
parent 4998 924f8274a264
child 5013 ad91f93bbb93
equal deleted inserted replaced
5009:2ac04bc976c3 5010:b2c5aee8ca3f
  1100     schema = schema
  1100     schema = schema
  1101 
  1101 
  1102     #capture = True
  1102     #capture = True
  1103     def setUp(self):
  1103     def setUp(self):
  1104         RQLGeneratorTC.setUp(self)
  1104         RQLGeneratorTC.setUp(self)
  1105         dbms_helper = get_db_helper('postgres')
  1105         dbhelper = get_db_helper('postgres')
  1106         self.o = SQLGenerator(schema, dbms_helper)
  1106         self.o = SQLGenerator(schema, dbhelper)
  1107 
  1107 
  1108     def _norm_sql(self, sql):
  1108     def _norm_sql(self, sql):
  1109         return sql.strip()
  1109         return sql.strip()
  1110 
  1110 
  1111     def _check(self, rql, sql, varmap=None, args=None):
  1111     def _check(self, rql, sql, varmap=None, args=None):
  1405 
  1405 
  1406 class SqliteSQLGeneratorTC(PostgresSQLGeneratorTC):
  1406 class SqliteSQLGeneratorTC(PostgresSQLGeneratorTC):
  1407 
  1407 
  1408     def setUp(self):
  1408     def setUp(self):
  1409         RQLGeneratorTC.setUp(self)
  1409         RQLGeneratorTC.setUp(self)
  1410         dbms_helper = get_db_helper('sqlite')
  1410         dbhelper = get_db_helper('sqlite')
  1411         self.o = SQLGenerator(schema, dbms_helper)
  1411         self.o = SQLGenerator(schema, dbhelper)
  1412 
  1412 
  1413     def _norm_sql(self, sql):
  1413     def _norm_sql(self, sql):
  1414         return sql.strip().replace(' ILIKE ', ' LIKE ').replace('\nINTERSECT ALL\n', '\nINTERSECT\n')
  1414         return sql.strip().replace(' ILIKE ', ' LIKE ').replace('\nINTERSECT ALL\n', '\nINTERSECT\n')
  1415 
  1415 
  1416     def test_date_extraction(self):
  1416     def test_date_extraction(self):
  1513 
  1513 
  1514 class MySQLGenerator(PostgresSQLGeneratorTC):
  1514 class MySQLGenerator(PostgresSQLGeneratorTC):
  1515 
  1515 
  1516     def setUp(self):
  1516     def setUp(self):
  1517         RQLGeneratorTC.setUp(self)
  1517         RQLGeneratorTC.setUp(self)
  1518         dbms_helper = get_db_helper('mysql')
  1518         dbhelper = get_db_helper('mysql')
  1519         self.o = SQLGenerator(schema, dbms_helper)
  1519         self.o = SQLGenerator(schema, dbhelper)
  1520 
  1520 
  1521     def _norm_sql(self, sql):
  1521     def _norm_sql(self, sql):
  1522         sql = sql.strip().replace(' ILIKE ', ' LIKE ').replace('TRUE', '1').replace('FALSE', '0')
  1522         sql = sql.strip().replace(' ILIKE ', ' LIKE ').replace('TRUE', '1').replace('FALSE', '0')
  1523         newsql = []
  1523         newsql = []
  1524         latest = None
  1524         latest = None