def parse(self, source):
r = Result('SELECT')
if isinstance(source.read(0), py3compat.bytestype):
# if reading from source returns bytes do utf-8 decoding
source = codecs.getreader('utf-8')(source)
reader = csv.reader(source, delimiter=self.delim)
r.vars = [Variable(x) for x in reader.next()]
r.bindings = []
for row in reader:
r.bindings.append(self.parseRow(row, r.vars))
return r
评论列表
文章目录