@@ -10,30 +10,30 @@ function nest(sql_expression)
1010 SQLExpression (:AS , SQLExpression (:FROM , sql_expression), :__TABLE__ )
1111end
1212
13- function translate (something:: Union{Char,AbstractString} ; _primary = true )
13+ function translate (something:: Union{Char,AbstractString} ; _primary= true )
1414 repr (something)
1515end
1616
17- function translate (something; _primary = true )
17+ function translate (something; _primary= true )
1818 something
1919end
20- function translate (source_row:: SourceRow ; _primary = true )
20+ function translate (source_row:: SourceRow ; _primary= true )
2121 source_row. table_name
2222end
23- function translate (call:: Expr ; _primary = true )
23+ function translate (call:: Expr ; _primary= true )
2424 arguments, keywords = split_call (call)
25- translate_call (arguments... ; _primary = _primary, keywords... )
25+ translate_call (arguments... ; _primary= _primary, keywords... )
2626end
2727
2828# A 1-1 mapping between Julia functions and SQL functions
2929function translate_default (location, function_type, SQL_call)
3030 result = :(
31- function translate_call ($ function_type, arguments... ; _primary = true )
32- $ SQLExpression ($ SQL_call, $ map (
33- argument-> $ translate (argument; _primary = _primary),
31+ function translate_call ($ function_type, arguments... ; _primary= true )
32+ $ SQLExpression ($ SQL_call, $ map (
33+ argument -> $ translate (argument; _primary= _primary),
3434 arguments
3535 )... )
36- end
36+ end
3737 )
3838 result. args[2 ]. args[1 ] = location
3939 result
6565
6666@translate_default :: typeof (abs) :ABS
6767
68- function as (pair; _primary = true )
68+ function as (pair; _primary= true )
6969 SQLExpression (:AS ,
70- translate (pair. second. code; _primary = _primary),
70+ translate (pair. second. code; _primary= _primary),
7171 pair. first
7272 )
7373end
7676
7777@translate_default :: typeof (char) :CHAR
7878
79- function translate_call (:: typeof (convert), :: Type{Int} , it; _primary = true )
79+ function translate_call (:: typeof (convert), :: Type{Int} , it; _primary= true )
8080 SQLExpression (:UNICODE , translate (it))
8181end
8282
8383@translate_default :: typeof (hex) :HEX
8484
8585@translate_default :: typeof (QueryOperators. drop) :OFFSET
8686
87- function translate_call (:: typeof (QueryOperators. filter), iterator, call, call_expression; _primary = true )
87+ function translate_call (:: typeof (QueryOperators. filter), iterator, call, call_expression; _primary= true )
8888 SQLExpression (:WHERE ,
89- translate (iterator; _primary = _primary),
90- translate (call (model_row (iterator)). code; _primary = _primary)
89+ translate (iterator; _primary= _primary),
90+ translate (call (model_row (iterator)). code; _primary= _primary)
9191 )
9292end
9393
94- function translate_call (:: typeof (format), time_type, format_string; _primary = true )
94+ function translate_call (:: typeof (format), time_type, format_string; _primary= true )
9595 SQLExpression (
9696 :STRFTIME ,
97- translate (format_string; _primary = _primary),
98- translate (time_type; _primary = _primary)
97+ translate (format_string; _primary= _primary),
98+ translate (time_type; _primary= _primary)
9999 )
100100end
101101
102- function translate_call (:: typeof (getproperty), source_tables:: Database , table_name; _primary = true )
103- translated = translate (table_name; _primary = _primary)
102+ function translate_call (:: typeof (getproperty), source_tables:: Database , table_name; _primary= true )
103+ translated = translate (table_name; _primary= _primary)
104104 if _primary
105105 SQLExpression (:FROM , translated)
106106 else
107107 translated
108108 end
109109end
110- function translate_call (:: typeof (getproperty), source_row:: SourceRow , column_name; _primary = true )
111- translated = translate (column_name; _primary = _primary)
110+ function translate_call (:: typeof (getproperty), source_row:: SourceRow , column_name; _primary= true )
111+ translated = translate (column_name; _primary= _primary)
112112 if _primary
113113 translated
114114 else
115115 SQLExpression (:., source_row. table_name, translated)
116116 end
117117end
118118
119- function translate_call (:: typeof (QueryOperators. groupby), ungrouped, group_function, group_function_expression, map_selector, map_function_expression; _primary = true )
119+ function translate_call (:: typeof (QueryOperators. groupby), ungrouped, group_function, group_function_expression, map_selector, map_function_expression; _primary= true )
120120 model = model_row (ungrouped)
121121 SQLExpression (Symbol (" GROUP BY" ),
122122 nest (translate_call (
123123 QueryOperators. map,
124124 ungrouped,
125125 map_selector, map_function_expression,
126- _primary = _primary
126+ _primary= _primary
127127 )),
128- translate (group_function (model). code; _primary = _primary)
128+ translate (group_function (model). code; _primary= _primary)
129129 )
130130end
131131
@@ -143,25 +143,25 @@ end
143143
144144@translate_default :: typeof (join) :GROUP_CONCAT
145145
146- function translate_call (:: typeof (QueryOperators. join), source1, source2, key1, key1_expression, key2, key2_expression, combine, combine_expression; _primary = true )
146+ function translate_call (:: typeof (QueryOperators. join), source1, source2, key1, key1_expression, key2, key2_expression, combine, combine_expression; _primary= true )
147147 model_row_1 = model_row (source1)
148148 model_row_2 = model_row (source2)
149149 SQLExpression (:SELECT ,
150150 SQLExpression (:ON ,
151151 SQLExpression (Symbol (" INNER JOIN" ),
152152 translate (source1),
153153 # mark as not _primary to suppress FROM
154- translate (source2; _primary = false )
154+ translate (source2; _primary= false )
155155 ),
156156 # mark both as not _primary to always be explicit about table
157157 SQLExpression (:(= ),
158- translate (key1 (model_row_1). code; _primary = false ),
159- translate (key2 (model_row_2). code; _primary = false )
158+ translate (key1 (model_row_1). code; _primary= false ),
159+ translate (key2 (model_row_2). code; _primary= false )
160160 )
161161 ),
162162 # mark both as not _primary to always be explicit about table
163163 Generator (
164- pair-> as (pair; _primary = false ),
164+ pair -> as (pair; _primary= false ),
165165 pairs (combine (model_row_1, model_row_2))
166166 )...
167167 )
@@ -171,15 +171,15 @@ end
171171
172172@translate_default :: typeof (lowercase) :LOWER
173173
174- function translate_call (:: typeof (QueryOperators. map), select_table, call, call_expression; _primary = true )
175- inner = translate (select_table; _primary = _primary)
174+ function translate_call (:: typeof (QueryOperators. map), select_table, call, call_expression; _primary= true )
175+ inner = translate (select_table; _primary= _primary)
176176 if inner. call == :SELECT
177177 inner = nest (inner)
178178 end
179179 SQLExpression (
180180 :SELECT , inner,
181181 Generator (
182- pair-> as (pair; _primary = _primary),
182+ pair -> as (pair; _primary= _primary),
183183 pairs (call (model_row (select_table)))
184184 )...
185185 )
@@ -193,49 +193,49 @@ end
193193@translate_default :: typeof (min) :min
194194@translate_default :: typeof (minimum) :min
195195
196- translate_call (:: typeof (occursin), needle, haystack; _primary = true ) =
196+ translate_call (:: typeof (occursin), needle, haystack; _primary= true ) =
197197 SQLExpression (
198198 :LIKE ,
199- translate (haystack; _primary = _primary),
200- translate (needle; _primary = _primary)
199+ translate (haystack; _primary= _primary),
200+ translate (needle; _primary= _primary)
201201 )
202202
203- function translate_call (:: typeof (QueryOperators. orderby), unordered, key_function, key_function_expression; _primary = true )
203+ function translate_call (:: typeof (QueryOperators. orderby), unordered, key_function, key_function_expression; _primary= true )
204204 SQLExpression (Symbol (" ORDER BY" ),
205- translate (unordered; _primary = _primary),
206- translate (key_function (model_row (unordered)). code; _primary = _primary)
205+ translate (unordered; _primary= _primary),
206+ translate (key_function (model_row (unordered)). code; _primary= _primary)
207207 )
208208end
209209
210- function translate_call (:: typeof (QueryOperators. orderby_descending), unordered, key_function, key_function_expression; _primary = true )
210+ function translate_call (:: typeof (QueryOperators. orderby_descending), unordered, key_function, key_function_expression; _primary= true )
211211 SQLExpression (Symbol (" ORDER BY" ),
212- translate (unordered; _primary = _primary),
212+ translate (unordered; _primary= _primary),
213213 SQLExpression (:DESC ,
214- translate (key_function (model_row (unordered)). code; _primary = _primary)
214+ translate (key_function (model_row (unordered)). code; _primary= _primary)
215215 )
216216 )
217217end
218218
219219@translate_default :: typeof (repr) :QUOTE
220220
221- function translate_call (:: typeof (rand), :: Type{Int} ; _primary = true )
221+ function translate_call (:: typeof (rand), :: Type{Int} ; _primary= true )
222222 SQLExpression (:RANDOM )
223223end
224224
225225@translate_default :: typeof (randstring) :RANDOMBLOB
226226
227- function translate_call (:: typeof (replace), it, pair; _primary = true )
227+ function translate_call (:: typeof (replace), it, pair; _primary= true )
228228 SQLExpression (:REPLACE ,
229- translate (it; _primary = _primary),
230- translate (pair. first; _primary = _primary),
231- translate (pair. second; _primary = _primary)
229+ translate (it; _primary= _primary),
230+ translate (pair. first; _primary= _primary),
231+ translate (pair. second; _primary= _primary)
232232 )
233233end
234234
235- function translate_call (:: typeof (round), it; _primary = true , digits = 0 )
235+ function translate_call (:: typeof (round), it; _primary= true , digits= 0 )
236236 SQLExpression (:ROUND ,
237- translate (it; _primary = _primary),
238- translate (digits; _primary = _primary)
237+ translate (it; _primary= _primary),
238+ translate (digits; _primary= _primary)
239239 )
240240end
241241
@@ -249,26 +249,26 @@ end
249249
250250@translate_default :: typeof (QueryOperators. take) :LIMIT
251251
252- function translate_call (:: typeof (QueryOperators. thenby), unordered, key_function, key_function_expression; _primary = true )
253- original = translate (unordered; _primary = _primary)
252+ function translate_call (:: typeof (QueryOperators. thenby), unordered, key_function, key_function_expression; _primary= true )
253+ original = translate (unordered; _primary= _primary)
254254 SQLExpression (original. call, original. arguments... ,
255- translate (key_function (model_row (unordered)). code; _primary = _primary)
255+ translate (key_function (model_row (unordered)). code; _primary= _primary)
256256 )
257257end
258258
259- function translate_call (:: typeof (QueryOperators. thenby_descending), unordered, key_function, key_function_expression; _primary = true )
260- original = translate (unordered; _primary = _primary)
259+ function translate_call (:: typeof (QueryOperators. thenby_descending), unordered, key_function, key_function_expression; _primary= true )
260+ original = translate (unordered; _primary= _primary)
261261 SQLExpression (original. call, original. arguments... ,
262262 SQLExpression (:DESC ,
263- translate (key_function (model_row (unordered)). code; _primary = _primary)
263+ translate (key_function (model_row (unordered)). code; _primary= _primary)
264264 )
265265 )
266266end
267267
268268@translate_default :: typeof (type_of) :TYPEOF
269269
270- function translate_call (:: typeof (QueryOperators. unique), repeated, key_function, key_function_expression; _primary = true )
271- result = translate (repeated; _primary = _primary)
270+ function translate_call (:: typeof (QueryOperators. unique), repeated, key_function, key_function_expression; _primary= true )
271+ result = translate (repeated; _primary= _primary)
272272 SQLExpression (Symbol (string (result. call, " DISTINCT" )), result. arguments... )
273273end
274274
0 commit comments