Exemplo n.º 1
0
    def test_from_where(self):
        sql_statement = SQLStatement("SELECT id, key3 FROM somewhere WHERE key1==1 or (key2 == 'string value'&&key3>4")

        self.assertEqual("id, key3", sql_statement.get_select_section())
        self.assertEqual("somewhere", sql_statement.get_from_section())
        self.assertEqual("key1==1 or (key2 == 'string value'&&key3>4", sql_statement.get_where_section())
        self.assertEqual(None, sql_statement.get_limit_section())
Exemplo n.º 2
0
    def test_select_from(self):
        sql_statement = SQLStatement("select * from some/path")

        self.assertEqual("*", sql_statement.get_select_section())
        self.assertEqual("some/path", sql_statement.get_from_section())
        self.assertEqual(None, sql_statement.get_where_section())
        self.assertEqual(None, sql_statement.get_limit_section())
Exemplo n.º 3
0
 def test_select(self):
     sql_statement = SQLStatement("select *")
     
     self.assertEqual("*", sql_statement.get_select_section())
     self.assertEqual(None, sql_statement.get_from_section())
     self.assertEqual(None, sql_statement.get_where_section())