mirror of
https://github.com/dimitri/pgloader.git
synced 2026-05-04 10:31:02 +02:00
FIX fixed reader: it now know about -C
This commit is contained in:
parent
094313d7ff
commit
5f335eda28
@ -65,10 +65,34 @@ class FixedReader(DataReader):
|
||||
start = self.start,
|
||||
end = self.end)
|
||||
|
||||
# don't forget COUNT and FROM_COUNT option
|
||||
nb_lines = 0
|
||||
begin_linenb = None
|
||||
|
||||
##
|
||||
# if -F was not used, we can state that begin = 0
|
||||
#
|
||||
# warning: FROM_ID is ignored
|
||||
if FROM_COUNT == 0:
|
||||
self.log.debug('beginning on first line')
|
||||
begin_linenb = 1
|
||||
|
||||
for line in self.fd:
|
||||
line = line.strip("\n")
|
||||
llen = len(line)
|
||||
columns = []
|
||||
line = line.strip("\n")
|
||||
llen = len(line)
|
||||
columns = []
|
||||
offsets = [self.fd.line_nb]
|
||||
nb_lines += 1
|
||||
|
||||
##
|
||||
# if -F is used, count lines to skip, and skip them
|
||||
if FROM_COUNT > 0:
|
||||
if nb_lines < FROM_COUNT:
|
||||
continue
|
||||
|
||||
if nb_lines == FROM_COUNT:
|
||||
begin_linenb = nb_lines
|
||||
self.log.info('reached beginning on line %d', nb_lines)
|
||||
|
||||
for cname, cpos in self.columns:
|
||||
start, length = self.positions[cname]
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user