48 |
48 |
import java.math.BigInteger;
|
49 |
49 |
import java.nio.ByteBuffer;
|
50 |
50 |
import java.sql.Connection;
|
51 |
|
import java.sql.Date;
|
52 |
51 |
import java.sql.PreparedStatement;
|
53 |
52 |
import java.sql.ResultSet;
|
54 |
53 |
import java.sql.ResultSetMetaData;
|
... | ... | |
57 |
56 |
import java.sql.Timestamp;
|
58 |
57 |
import java.sql.Types;
|
59 |
58 |
import java.util.ArrayList;
|
|
59 |
import java.util.Calendar;
|
|
60 |
import java.util.GregorianCalendar;
|
60 |
61 |
import java.util.HashMap;
|
61 |
62 |
import java.util.Hashtable;
|
62 |
63 |
import java.util.Map;
|
63 |
64 |
|
64 |
65 |
import org.apache.log4j.Logger;
|
|
66 |
import org.joda.time.DateTime;
|
65 |
67 |
import org.postgis.PGbox2d;
|
66 |
68 |
import org.postgis.PGbox3d;
|
67 |
69 |
import org.postgresql.util.PSQLException;
|
... | ... | |
84 |
86 |
import com.iver.cit.gvsig.fmap.drivers.FieldDescription;
|
85 |
87 |
import com.iver.cit.gvsig.fmap.drivers.IConnection;
|
86 |
88 |
import com.iver.cit.gvsig.fmap.drivers.IFeatureIterator;
|
87 |
|
import com.iver.cit.gvsig.fmap.drivers.WKBParser2;
|
88 |
89 |
import com.iver.cit.gvsig.fmap.drivers.WKBParser3;
|
89 |
90 |
import com.iver.cit.gvsig.fmap.drivers.XTypes;
|
90 |
91 |
import com.iver.cit.gvsig.fmap.edition.IWriteable;
|
... | ... | |
98 |
99 |
*/
|
99 |
100 |
public class PostGisDriver extends DefaultJDBCDriver implements ICanReproject,
|
100 |
101 |
IWriteable {
|
|
102 |
|
|
103 |
|
101 |
104 |
private static Logger logger = Logger.getLogger(PostGisDriver.class
|
102 |
105 |
.getName());
|
103 |
106 |
|
... | ... | |
543 |
546 |
if (metaData.getColumnType(fieldId) == Types.BOOLEAN)
|
544 |
547 |
return ValueFactory.createValue(aRs.getBoolean(fieldId));
|
545 |
548 |
if (metaData.getColumnType(fieldId) == Types.DATE) {
|
546 |
|
long daysAfter2000 = buf.getInt() + 1;
|
547 |
|
long msecs = daysAfter2000 * 24 * 60 * 60 * 1000;
|
548 |
|
long real_msecs_date1 = (long) (XTypes.NUM_msSecs2000 + msecs);
|
549 |
|
Date realDate1 = new Date(real_msecs_date1);
|
550 |
|
return ValueFactory.createValue(realDate1);
|
|
549 |
long daysAfter2000 = buf.getInt();
|
|
550 |
DateTime year2000 = new DateTime(2000, 1,1,0,0,0);
|
|
551 |
DateTime dt = year2000.plusDays((int)daysAfter2000);
|
|
552 |
Calendar cal = GregorianCalendar.getInstance();
|
|
553 |
cal.set(dt.getYear(), dt.getMonthOfYear()-1, dt.getDayOfMonth());
|
|
554 |
// System.out.println(dt + " convertido:" + cal.getTime());
|
|
555 |
return ValueFactory.createValue(cal.getTime());
|
551 |
556 |
}
|
552 |
557 |
if (metaData.getColumnType(fieldId) == Types.TIME) {
|
553 |
558 |
// TODO:
|