use of com.teradata.jaqy.resultset.FileClob in project jaqy by Teradata.
the class CSVImporter method getObject.
@Override
public Object getObject(int index, ParameterInfo paramInfo, JaqyInterpreter interpreter) throws Exception {
try {
String value = m_record.get(index);
if (m_naFilter) {
for (String f : m_naValues) if (value.equals(f))
return null;
}
CSVImportInfo importInfo = m_importInfoMap.get(index);
if (importInfo != null) {
if (value.length() == 0)
return null;
Path file = m_file.getRelativePath(value);
if (!file.isFile())
throw new FileNotFoundException("External file " + file.getPath() + " is not found.");
if (importInfo.charset == null)
return new FileBlob(file);
else
return new FileClob(file, importInfo.charset);
}
if (TypesUtils.isBinary(paramInfo.type))
return StringUtils.getBytesFromHexString(value);
return value;
} catch (ArrayIndexOutOfBoundsException ex) {
throw new IOException("Column " + (index + 1) + " is not found.");
}
}
Aggregations