Revision 3298
Added by Aaron Marcuse-Kubitza over 12 years ago
lib/sql.py | ||
---|---|---|
822 | 822 |
if returning != None: cols = [returning] |
823 | 823 |
func_table = sql_gen.NamedTable('f', sql_gen.FunctionCall(function), |
824 | 824 |
cols) # AS clause requires function alias |
825 |
return mk_select(db, func_table, start=0, order_by=None)
|
|
825 |
return mk_select(db, func_table, order_by=None) |
|
826 | 826 |
|
827 | 827 |
return query |
828 | 828 |
|
... | ... | |
1008 | 1008 |
|
1009 | 1009 |
def table_row_count(db, table, recover=None): |
1010 | 1010 |
return value(run_query(db, mk_select(db, table, [sql_gen.row_count], |
1011 |
order_by=None, start=0), recover=recover, log_level=3))
|
|
1011 |
order_by=None), recover=recover, log_level=3)) |
|
1012 | 1012 |
|
1013 | 1013 |
def table_cols(db, table, recover=None): |
1014 | 1014 |
return list(col_names(select(db, table, limit=0, order_by=None, |
... | ... | |
1322 | 1322 |
add_index(db, distinct_on, new_table, unique=True) |
1323 | 1323 |
add_index(db, distinct_on, table) # for join optimization |
1324 | 1324 |
|
1325 |
insert_select(db, new_table, None, mk_select(db, table, start=0,
|
|
1326 |
limit=limit), ignore=True)
|
|
1325 |
insert_select(db, new_table, None, mk_select(db, table, limit=limit),
|
|
1326 |
ignore=True) |
|
1327 | 1327 |
analyze(db, new_table) |
1328 | 1328 |
|
1329 | 1329 |
return new_table |
lib/sql_io.py | ||
---|---|---|
91 | 91 |
-- Insert the value and error for *each* source column. |
92 | 92 |
FOR "column" IN |
93 | 93 |
'''+sql.mk_select(db, sql_gen.NamedValues('c', None, [[c.name] for c in srcs]), |
94 |
order_by=None, start=0)+'''
|
|
94 |
order_by=None)+''' |
|
95 | 95 |
LOOP |
96 | 96 |
BEGIN |
97 | 97 |
'''+sql.mk_insert_select(db, errors_table, errors_table_cols, |
... | ... | |
276 | 276 |
# Place in new table for speed and so don't modify input if values edited |
277 | 277 |
in_table = sql_gen.Table('in') |
278 | 278 |
mapping = dicts.join(mapping, sql.flatten(db, in_table, input_joins, |
279 |
in_cols, preserve=[in_pkey_col], start=0))
|
|
279 |
in_cols, preserve=[in_pkey_col])) |
|
280 | 280 |
input_joins = [in_table] |
281 | 281 |
db.log_debug('Temp table: '+strings.as_tt(in_table.to_str(db)), level=2) |
282 | 282 |
|
... | ... | |
299 | 299 |
full_in_table_cols.append(default) |
300 | 300 |
default = sql_gen.with_table(default, full_in_table) |
301 | 301 |
sql.run_query_into(db, sql.mk_select(db, in_table, full_in_table_cols, |
302 |
order_by=None, start=0), into=full_in_table)
|
|
302 |
order_by=None), into=full_in_table) |
|
303 | 303 |
sql.add_pkey(db, full_in_table) |
304 | 304 |
|
305 | 305 |
pkeys_names = [in_pkey, out_pkey] |
... | ... | |
310 | 310 |
distinct_on = [] |
311 | 311 |
if distinct: distinct_on=[in_pkey_col] |
312 | 312 |
query = sql.mk_select(db, joins, cols, distinct_on=distinct_on, |
313 |
order_by=None, start=0)
|
|
313 |
order_by=None) |
|
314 | 314 |
|
315 | 315 |
if pkeys_table_exists_ref[0]: |
316 | 316 |
sql.insert_select(db, into, pkeys_names, query, **kw_args) |
... | ... | |
326 | 326 |
def mk_main_select(joins, cols): |
327 | 327 |
conds_ = [(sql_gen.with_table(k, insert_in_table), v) for k, v in conds] |
328 | 328 |
return sql.mk_select(db, joins, cols, conds_, limit=limit_ref[0], |
329 |
order_by=None, start=0)
|
|
329 |
order_by=None) |
|
330 | 330 |
|
331 | 331 |
exc_strs = set() |
332 | 332 |
def log_exc(e): |
Also available in: Unified diff
sql.mk_select() calls: Removed no longer needed start=0 to turn off missing WHERE, LIMIT, or OFFSET clause warning