Project

General

Profile

« Previous | Next » 

Revision 2418

db_xml.py: put_table(): Subset in_table if limit != None or start != 0. start param defaults to 0 again to avoid subsetting the table when starting from row 0 (with no limit).

View differences:

db_xml.py
1 1
# XML-database conversion
2 2

  
3
import copy
3 4
import re
4
import traceback
5 5
from xml.dom import Node
6 6

  
7 7
import exc
......
129 129
input_col_prefix = '$'
130 130

  
131 131
def put_table(db, node, in_table, commit=False, row_ct_ref=None, limit=None,
132
    start=None, parent_ids_loc=None):
132
    start=0, parent_ids_loc=None):
133 133
    '''
134 134
    @param node The XML tree that transforms the input to the output. Similar to
135 135
        put()'s node param, but with the input column name prefixed by
......
138 138
    @return (table, col) Where the pkeys (from INSERT RETURNING) are made
139 139
        available
140 140
    '''
141
    in_table = sql_gen.as_Table(in_table)
142
    
143
    if limit != None or start != 0:
144
        in_table = copy.copy(in_table) # don't modify input!
145
        sql.run_query_into(db, *sql.mk_select(db, in_table, limit=limit,
146
            start=start, order_by=None), into=in_table)
147
            # in_table won't be overwritten because of automatic versioning
148
    
141 149
    def pkey(table): return sql.pkey(db, table, True)
142 150
    
143
    in_table = sql_gen.as_Table(in_table)
144
    
145 151
    def put_table_(node, parent_ids_loc=None):
146 152
        return put_table(db, node, in_table, commit, row_ct_ref,
147 153
            parent_ids_loc=parent_ids_loc)

Also available in: Unified diff