Revision 9040
branches/v10/libraries/libGDBMS/src/main/java/com/hardcode/gdbms/driver/csvstring/CSVStringDriver.java | ||
---|---|---|
57 | 57 |
public Value getFieldValue(long rowIndex, int fieldId) |
58 | 58 |
throws DriverException { |
59 | 59 |
String[] campos = (String[]) lineas.get((int) (rowIndex + 1)); |
60 |
|
|
61 |
if (campos[fieldId].equals("null")) { |
|
60 |
if (campos.length<fieldId+1 || campos[fieldId].equals("null")) { |
|
62 | 61 |
return null; |
63 | 62 |
} |
64 | 63 |
|
... | ... | |
172 | 171 |
|
173 | 172 |
public void createSource(String path, String[] fieldNames, int[] fieldTypes) throws IOException { |
174 | 173 |
File file = new File(path); |
175 |
|
|
174 |
|
|
176 | 175 |
file.getParentFile().mkdirs(); |
177 | 176 |
file.createNewFile(); |
178 |
|
|
177 |
|
|
179 | 178 |
PrintWriter out = new PrintWriter(new FileOutputStream(file)); |
180 |
|
|
179 |
|
|
181 | 180 |
String header = fieldNames[0]; |
182 | 181 |
for (int i = 1; i < fieldNames.length; i++) { |
183 | 182 |
header += ";" + fieldNames[i]; |
184 | 183 |
} |
185 | 184 |
out.println(header); |
186 |
|
|
185 |
|
|
187 | 186 |
out.close(); |
188 | 187 |
} |
189 | 188 |
|
Also available in: Unified diff