Revision 2335
Added by Aaron Marcuse-Kubitza over 12 years ago
sql_gen.py | ||
---|---|---|
16 | 16 |
|
17 | 17 |
def to_str(self, db): return self.str_ |
18 | 18 |
|
19 |
##### Literal values |
|
20 |
|
|
19 | 21 |
class Literal(Code): |
20 | 22 |
def __init__(self, value): self.value = value |
21 | 23 |
|
... | ... | |
23 | 25 |
|
24 | 26 |
def is_null(value): return isinstance(value, Literal) and value.value == None |
25 | 27 |
|
28 |
##### Tables |
|
29 |
|
|
26 | 30 |
class Table(Code): |
27 | 31 |
def __init__(self, name, schema=None): |
28 | 32 |
''' |
... | ... | |
37 | 41 |
if table == None or isinstance(table, Code): return table |
38 | 42 |
else: return Table(table) |
39 | 43 |
|
44 |
##### Columns |
|
45 |
|
|
40 | 46 |
class Col(Code): |
41 | 47 |
def __init__(self, name, table=None): |
42 | 48 |
''' |
... | ... | |
75 | 81 |
|
76 | 82 |
def to_Col(self): return Col(self.name) |
77 | 83 |
|
78 |
##### Parameterized SQL code objects
|
|
84 |
##### Conditions
|
|
79 | 85 |
|
80 | 86 |
class ValueCond: |
81 | 87 |
def __init__(self, value): |
... | ... | |
134 | 140 |
return CompareCond(value) |
135 | 141 |
else: return value |
136 | 142 |
|
143 |
##### Joins |
|
144 |
|
|
137 | 145 |
join_using = object() # tells Join to join the column with USING |
138 | 146 |
|
139 | 147 |
filter_out = object() # tells Join to filter out rows that match the join |
Also available in: Unified diff
sql_gen.py: Added section labels for each type of SQL code object