forked from FerreroJeremy/ln2sql
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathGenerator.py
executable file
·112 lines (86 loc) · 2.54 KB
/
Generator.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
# -*- coding: utf-8 -*
import re
import sys
import unicodedata
from threading import Thread
from Exception import ParsingException
from Query import *
reload(sys)
sys.setdefaultencoding("utf-8")
class SelectGenerator(Thread):
def __init__(self):
Thread.__init__(self)
def run(self):
return
def join(self):
Thread.join(self)
return
class FromGenerator(Thread):
def __init__(self):
Thread.__init__(self)
def run(self):
return
def join(self):
Thread.join(self)
return self.queries
class WhereGenerator(Thread):
def __init__(self):
Thread.__init__(self)
def run(self):
return
def join(self):
Thread.join(self)
return
class JoinGenerator(Thread):
def __init__(self):
Thread.__init__(self)
def run(self):
return
def join(self):
Thread.join(self)
return
class GroupByGenerator(Thread):
def __init__(self):
Thread.__init__(self)
def run(self):
return
def join(self):
Thread.join(self)
return
class OrderByGenerator(Thread):
def __init__(self):
Thread.__init__(self)
def run(self):
return
def join(self):
Thread.join(self)
return
class Generator:
def __init__(self):
return
def generate(self, queries):
for query in queries:
select_object = query.get_select()
from_object = query.get_from()
where_object = query.get_where()
join_object = query.get_join()
group_by_object = query.get_group_by()
order_by_object = query.get_order_by()
select_generator = SelectGenerator(select_object)
from_generator = FromGenerator(from_object)
where_generator = WhereGenerator(where_object)
join_generator = JoinGenerator(join_object)
group_by_generator = GroupByGenerator(group_by_object)
order_by_generator = OrderByGenerator(order_by_object)
select_generator.start()
from_generator.start()
where_generator.start()
join_generator.start()
group_by_generator.start()
order_by_generator.start()
select_phrase = select_generator.join()
from_phrase = from_generator.join()
where_phrase = where_generator.join()
join_phrase = join_generator.join()
group_by_phrase = group_by_generator.join()
order_by_phrase = order_by_generator.join()