break ;
// escapes??
s.append(ch) ;
}
if ( ch != qCh )
throw new QueryException(String.format("Error Parsing CSV results at Line %d - Unterminated quoted string", this.lineNum));
if ( idx < line.length() )
{
ch = line.charAt(idx) ;
if ( ch != ',' )
throw new QueryException(String.format("Error Parsing CSV results at Line %d - Expected comma after quote", this.lineNum)) ;
}
}
else
{
while(idx < line.length() )
{
ch = line.charAt(idx) ;
if ( ch == ',' )
break ;
idx++ ;
// escapes
s.append(ch) ;
}
}
terms.add(s.toString()) ;
// At end of per-term processing, we are looking at "," or EOL.
// Looking at , or EOL.
if ( ch == ',' && idx==line.length()-1 )
{
//EOL
terms.add("") ;
break ;
}
// Skip ","
idx++ ;
}
if ( terms.size() != vars.size() )
throw new QueryException(String.format("Error Parsing CSV results at Line %d - The result row '%s' has %d items when %d was expected", this.lineNum, line, terms.size(), vars.size())) ;
for ( int i = 0 ; i < vars.size() ; i++ )
binding.add(vars.get(i), Node.createLiteral(terms.get(i))) ;
return binding ;
}