Esempio n. 1
0
 def test_normal_select_with_where_condition_As_Null(self):
     print('test_normal_select_with_column_simple_where - Begin')
     query = Query('sample-1')
     print('TableName : {}, Query Built:{}'.format(query.table_name, query.query_built))
     query.select().columns('a, b, c').where_null("a")
     print('TableName : {}, Query Built:{}'.format(query.table_name, query.query_built))
     self.assertEqual("Select a, b, c where a is Null".upper().strip(), query.query_built.upper().strip())
     print('test_normal_select_with_column_simple_where - End')
Esempio n. 2
0
 def test_normal_select_with_column(self):
     print('test_normal_select_with_column - Begin')
     query = Query('sample-1')
     print('TableName : {}, Query Built:{}'.format(query.table_name, query.query_built))
     query.select().columns('a, b, c')
     print('TableName : {}, Query Built:{}'.format(query.table_name, query.query_built))
     self.assertEqual("Select a, b, c".upper().strip(), query.query_built.upper().strip())
     print('test_normal_select_with_column - End')
Esempio n. 3
0
 def test_select_where_column_relates_another_column(self):
     print('test_select_where_column_relates_another_column - Begin')
     query = Query('aSample')
     query.select().from_table().alias('a').join('bSample', 'b').on().join_column('bSample', 'field-1').equals() \
         .join_column('aSample', 'field-1').where_column_relates_another_column('a.field2', ' = ', 'b.field2')
     print(query.query_built)
     self.assertEqual("Select From aSample as a join bSample as b on b.field-1 = a.field-1 where a.field2  =  "
                      "b.field2".upper().strip(), query.query_built.upper().strip())
     print('test_select_where_column_relates_another_column - End')
Esempio n. 4
0
 def test_join_select_Without_Condition(self):
     print('test_normal_select_with_column_Join - Begin')
     query = Query('sample-1')
     print('TableName : {}, Query Built:{}'.format(query.table_name, query.query_built))
     query.select().columns('a.sample-1_2, a.sample-1_3, b.sample-1_2, b.sample-1_4').from_table().alias("a") \
         .join("sample-2", "b").on().join_column("sample-1", "sample-1_2").equals() \
         .join_column("sample-2", "sample-1_2")
     print(query.query_built.upper().strip())
     self.assertEqual("Select a.sample-1_2, a.sample-1_3, b.sample-1_2, b.sample-1_4 From sample-1 as a join "
                      "sample-2 as b on a.sample-1_2 = b.sample-1_2".upper().strip(), query.query_built.upper()
                      .strip())
     print('test_normal_select_with_column_Join - End')