Revision 12534
branches/v10/libraries/libGDBMS/src/main/java/com/hardcode/gdbms/driver/dbf/DBFDriver.java | ||
---|---|---|
37 | 37 |
private DbaseFile dbf = new DbaseFile(); |
38 | 38 |
private char[] fieldTypes; |
39 | 39 |
private DataSourceFactory dsf; |
40 |
|
|
41 | 40 |
|
41 |
|
|
42 | 42 |
/** |
43 | 43 |
* @see com.hardcode.driverManager.Driver#getName() |
44 | 44 |
*/ |
... | ... | |
122 | 122 |
throw new DriverException(e1); |
123 | 123 |
} |
124 | 124 |
strValue = strValue.trim(); |
125 |
if (fieldType == Types.BOOLEAN){ |
|
126 |
strValue = strValue.toLowerCase(); |
|
127 |
strValue = Boolean.toString(strValue.equals("t") || strValue.equals("y")); |
|
128 |
} |
|
129 |
|
|
125 | 130 |
try { |
126 | 131 |
return ValueFactory.createValueByType(strValue, fieldType); |
127 | 132 |
} catch (ParseException e) { |
... | ... | |
204 | 209 |
|
205 | 210 |
dbfWrite.write(record); |
206 | 211 |
} |
207 |
|
|
212 |
|
|
208 | 213 |
dbfWrite.close(); |
209 | 214 |
} catch (IOException e) { |
210 | 215 |
throw new DriverException(e); |
211 | 216 |
} |
212 |
|
|
217 |
|
|
213 | 218 |
} |
214 |
|
|
219 |
|
|
215 | 220 |
/** |
216 | 221 |
* @see com.hardcode.gdbms.engine.data.driver.FileDriver#writeFile(com.hardcode.gdbms.engine.data.file.FileDataWare, |
217 | 222 |
* java.io.File) |
218 | 223 |
*/ |
219 | 224 |
public void writeFile(FileDataWare dataWare) |
220 | 225 |
throws DriverException { |
221 |
|
|
226 |
|
|
222 | 227 |
String temp = dsf.getTempFile(); |
223 |
|
|
228 |
|
|
224 | 229 |
writeToTemp(dataWare, new File(temp)); |
225 | 230 |
|
226 | 231 |
try { |
branches/v10/libraries/libFMap/src/com/iver/cit/gvsig/fmap/drivers/XTypes.java | ||
---|---|---|
154 | 154 |
val = ValueFactory.createValue(buf.getShort()); |
155 | 155 |
if (metaData.getColumnType(fieldId) == Types.BIGINT) |
156 | 156 |
val = ValueFactory.createValue(buf.getLong()); |
157 |
if (metaData.getColumnType(fieldId) == Types.BIT) |
|
157 |
if (metaData.getColumnType(fieldId) == Types.BIT || metaData.getColumnType(fieldId) == Types.BOOLEAN )
|
|
158 | 158 |
val = ValueFactory.createValue(rs.getBoolean(fieldId)); |
159 | 159 |
if (metaData.getColumnType(fieldId) == Types.DATE) |
160 | 160 |
val = ValueFactory.createValue(rs.getDate(fieldId)); |
... | ... | |
163 | 163 |
if (metaData.getColumnType(fieldId) == Types.TIMESTAMP) |
164 | 164 |
val = ValueFactory.createValue(rs.getTimestamp(fieldId)); |
165 | 165 |
|
166 |
|
|
167 |
|
|
166 | 168 |
} |
167 | 169 |
return val; |
168 | 170 |
} |
branches/v10/libraries/libFMap/src/com/iver/cit/gvsig/fmap/drivers/dbf/DBFDriver.java | ||
---|---|---|
76 | 76 |
fieldTypes[i] = dbf.getFieldType(i); |
77 | 77 |
} |
78 | 78 |
int aux = (int)(Math.random() * 1000); |
79 |
fTemp = new File(tempDirectoryPath + "/tmpDbf" + aux + ".dbf");
|
|
79 |
fTemp = new File(tempDirectoryPath + "/tmpDbf" + aux + ".dbf"); |
|
80 | 80 |
dbfWriter.setFile(fTemp); |
81 | 81 |
} catch (DriverException e) { |
82 | 82 |
throw new IOException(e.getMessage()); |
... | ... | |
100 | 100 |
// Field Type (C or M) |
101 | 101 |
char cfieldType = fieldTypes[fieldId]; |
102 | 102 |
int fieldType = getFieldType(fieldId); |
103 |
|
|
103 |
|
|
104 | 104 |
String strValue; |
105 | 105 |
|
106 | 106 |
if (cfieldType == 'D') { |
... | ... | |
143 | 143 |
throw new DriverException(e1); |
144 | 144 |
} |
145 | 145 |
strValue = strValue.trim(); |
146 |
if (fieldType == Types.BOOLEAN){ |
|
147 |
strValue = strValue.toLowerCase(); |
|
148 |
strValue = Boolean.toString(strValue.equals("t") || strValue.equals("y")); |
|
149 |
} |
|
150 |
|
|
146 | 151 |
try { |
147 | 152 |
return ValueFactory.createValueByType(strValue, fieldType); |
148 | 153 |
} catch (ParseException e) { |
... | ... | |
369 | 374 |
|
370 | 375 |
public ITableDefinition getTableDefinition() { |
371 | 376 |
tableDef = new TableDefinition(); |
372 |
int numFields;
|
|
377 |
int numFields; |
|
373 | 378 |
try { |
374 | 379 |
numFields = getFieldCount(); |
375 | 380 |
FieldDescription[] fieldsDescrip = new FieldDescription[numFields]; |
... | ... | |
390 | 395 |
// TODO: ?DEFAULTVALUE? |
391 | 396 |
// fieldsDescrip[i].setDefaultValue(get) |
392 | 397 |
} |
393 |
|
|
398 |
|
|
394 | 399 |
tableDef.setFieldsDesc(fieldsDescrip); |
395 | 400 |
return tableDef; |
396 | 401 |
} catch (DriverException e) { |
branches/v10/extensions/extJDBC/src/com/iver/cit/gvsig/fmap/drivers/jdbc/postgis/PostGisDriver.java | ||
---|---|---|
442 | 442 |
if (metaData.getColumnType(fieldId) == Types.BIGINT) |
443 | 443 |
return ValueFactory.createValue(buf.getLong()); |
444 | 444 |
if (metaData.getColumnType(fieldId) == Types.BIT) |
445 |
// TODO |
|
445 |
return ValueFactory.createValue((byteBuf[0] == 1)); |
|
446 |
if (metaData.getColumnType(fieldId) == Types.BOOLEAN) |
|
446 | 447 |
return ValueFactory.createValue(rs.getBoolean(fieldId)); |
447 | 448 |
if (metaData.getColumnType(fieldId) == Types.DATE) |
448 | 449 |
{ |
Also available in: Unified diff