Revision 6220 trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/drivers/dbf/DBFDriver.java

View differences:

DBFDriver.java
48 48
	private File file = null;
49 49
	private static String tempDirectoryPath = System.getProperty("java.io.tmpdir");
50 50
	private File fTemp;
51
	
52 51

  
52

  
53 53
    /**
54 54
     * @see com.hardcode.driverManager.Driver#getName()
55 55
     */
......
74 74
        } catch (DriverException e) {
75 75
            throw new IOException(e.getMessage());
76 76
        }
77
        
77

  
78 78
    }
79 79

  
80 80
    /**
......
144 144
            try {
145 145
                dat = df.parse(strAux);
146 146
            } catch (ParseException e) {
147
                throw new DriverException("Bad Date Format");            
148
            } 
149
            
147
                throw new DriverException("Bad Date Format");
148
            }
149

  
150 150
            // System.out.println("numReg = " + rowIndex + " date:" + dat.getTime());
151 151

  
152 152
            return ValueFactory.createValue(dat);
......
192 192
        if (fieldType == 'L') {
193 193
            return Types.BOOLEAN;
194 194
        } else if ((fieldType == 'F') || (fieldType == 'N')) {
195
            return Types.DOUBLE;
195
        	if (dbf.getFieldDecimalLength(i)>0)
196
        		return Types.DOUBLE;
197
        	else
198
        		return Types.INTEGER;
196 199
        } else if (fieldType == 'C') {
197 200
            return Types.VARCHAR;
198 201
        } else if (fieldType == 'D') {
......
229 232

  
230 233
                dbfWrite.write(record);
231 234
            }
232
            
235

  
233 236
            dbfWrite.close();
234 237
        } catch (IOException e) {
235 238
            throw new DriverException(e);
236 239
        }
237
        
240

  
238 241
    }
239
    
242

  
240 243
    /**
241 244
     * @see com.hardcode.gdbms.engine.data.driver.FileDriver#writeFile(com.hardcode.gdbms.engine.data.file.FileDataWare,
242 245
     *      java.io.File)
243 246
     */
244 247
    public void writeFile(FileDataWare dataWare)
245 248
        throws DriverException {
246
        
249

  
247 250
        String temp = dsf.getTempFile();
248
        
251

  
249 252
        writeToTemp(dataWare, new File(temp));
250 253

  
251 254
        try {
......
312 315

  
313 316
	public void preProcess() throws EditionException {
314 317
		dbfWriter.preProcess();
315
		
318

  
316 319
	}
317 320

  
318 321
	public void process(IRowEdited row) throws EditionException {
319 322
		dbfWriter.process(row);
320
		
323

  
321 324
	}
322 325

  
323 326
	public void postProcess() throws EditionException {
......
331 334

  
332 335
			// Borramos los temporales
333 336
			fTemp.delete();
334
			
337

  
335 338
			// Reload
336 339
			close();
337 340
			open(file);
......
343 346
		} catch (IOException e) {
344 347
			throw new EditionException(e);
345 348
		}
346
		
347
		
349

  
350

  
348 351
	}
349 352

  
350 353
	public String getCapability(String capability) {
......
353 356

  
354 357
	public void setCapabilities(Properties capabilities) {
355 358
		dbfWriter.setCapabilities(capabilities);
356
		
359

  
357 360
	}
358 361

  
359 362
	public boolean canWriteAttribute(int sqlType) {
......
365 368
		fTemp = new File(tempDirectoryPath + "/tmpDbf" + aux + ".dbf");
366 369
		dbfWriter.setFile(fTemp);
367 370
		dbfWriter.initialize(tableDefinition);
368
		
371

  
369 372
	}
370 373

  
371 374
}

Also available in: Unified diff