Revision 9734
trunk/extensions/extJDBC/src/com/iver/cit/gvsig/fmap/drivers/jdbc/mysql/MySQLDriver.java | ||
---|---|---|
55 | 55 |
import com.iver.andami.messages.NotificationManager; |
56 | 56 |
import com.iver.cit.gvsig.fmap.DriverException; |
57 | 57 |
import com.iver.cit.gvsig.fmap.SqlDriveExceptionType; |
58 |
import com.iver.cit.gvsig.fmap.core.ICanReproject; |
|
58 | 59 |
import com.iver.cit.gvsig.fmap.core.IGeometry; |
59 | 60 |
import com.iver.cit.gvsig.fmap.drivers.DBLayerDefinition; |
60 | 61 |
import com.iver.cit.gvsig.fmap.drivers.DefaultDBDriver; |
61 | 62 |
import com.iver.cit.gvsig.fmap.drivers.DriverAttributes; |
62 | 63 |
import com.iver.cit.gvsig.fmap.drivers.IFeatureIterator; |
63 | 64 |
import com.iver.cit.gvsig.fmap.drivers.WKBParser2; |
65 |
import com.iver.cit.gvsig.fmap.edition.EditionException; |
|
66 |
import com.iver.cit.gvsig.fmap.edition.IWriteable; |
|
67 |
import com.iver.cit.gvsig.fmap.edition.IWriter; |
|
64 | 68 |
|
65 | 69 |
/** |
66 | 70 |
* @author FJP |
... | ... | |
68 | 72 |
* TODO To change the template for this generated type comment go to Window - |
69 | 73 |
* Preferences - Java - Code Generation - Code and Comments |
70 | 74 |
*/ |
71 |
public class MySQLDriver extends DefaultDBDriver { |
|
75 |
public class MySQLDriver extends DefaultDBDriver |
|
76 |
implements IWriteable { |
|
77 |
|
|
72 | 78 |
private static Logger logger = Logger |
73 | 79 |
.getLogger(MySQLDriver.class.getName()); |
74 | 80 |
|
75 | 81 |
private WKBParser2 parser = new WKBParser2(); |
76 | 82 |
|
77 |
// private WKTParser wktParser = new WKTParser();
|
|
78 |
|
|
83 |
private MySqlWriter writer = new MySqlWriter();
|
|
84 |
|
|
79 | 85 |
/* |
80 | 86 |
* private int fetch_min=-1; private int fetch_max=-1; |
81 | 87 |
*/ |
... | ... | |
154 | 160 |
*/ |
155 | 161 |
public void setData(Connection conn, DBLayerDefinition lyrDef) { |
156 | 162 |
this.conn = conn; |
163 |
lyrDef.setConnection(conn); |
|
157 | 164 |
setLyrDef(lyrDef); |
158 | 165 |
try { |
159 | 166 |
|
... | ... | |
179 | 186 |
// Esto cuando haya ediciones, no es v?lido, y hay |
180 | 187 |
// que refrescarlo. |
181 | 188 |
doRelateID_FID(); |
189 |
|
|
190 |
writer.setCreateTable(false); |
|
191 |
writer.setWriteAll(false); |
|
192 |
writer.initialize(lyrDef); |
|
182 | 193 |
|
194 |
|
|
183 | 195 |
} catch (SQLException e) { |
184 | 196 |
NotificationManager.addError( |
185 | 197 |
"Error al conectar a la base de datos.", e); |
186 | 198 |
e.printStackTrace(); |
199 |
} catch (EditionException e) { |
|
200 |
e.printStackTrace(); |
|
201 |
NotificationManager.addError( |
|
202 |
"Error inicializando MySQL Writer.", e); |
|
187 | 203 |
} |
188 | 204 |
} |
189 | 205 |
|
... | ... | |
377 | 393 |
} |
378 | 394 |
|
379 | 395 |
public boolean isWritable() { |
380 |
// TODO Auto-generated method stub |
|
381 | 396 |
return true; |
382 | 397 |
} |
383 | 398 |
|
399 |
public IWriter getWriter() { |
|
400 |
return writer; |
|
401 |
} |
|
384 | 402 |
|
403 |
|
|
385 | 404 |
} |
Also available in: Unified diff