/*
* Create a qualified table name with current user's name and the name of the table
* to be created, "EXAMPLE".
*/
final String tableName = (connection.getUser() + ".NOTENDSWITHGEOM");
final SeTable table = new SeTable(connection, tableName);
try {
layer.setTableName("NOTENDSWITHGEOM");
try {
table.delete();
} catch (Exception e) {
// intentionally blank
}
/*
* Create the table using the DBMS default configuration keyword. Valid keywords
* are defined in the dbtune table.
*/
if (LOGGER.isLoggable(Level.FINE)) {
System.out.println("\n--> Creating a table using DBMS Default Keyword");
}
SeColumnDefinition[] tmpCols = new SeColumnDefinition[] { new SeColumnDefinition(
"tmp", SeColumnDefinition.TYPE_STRING, 5, 0, true) };
table.create(tmpCols, testData.getConfigKeyword());
if (LOGGER.isLoggable(Level.FINE)) {
System.out.println(" - Done.");
}
SeColumnDefinition[] colDefs = new SeColumnDefinition[7];
/*
* Define the columns and their attributes for the table to be created. NOTE:
* The valid range/values of size and scale parameters vary from one database to
* another.
*/
boolean isNullable = true;
colDefs[0] = new SeColumnDefinition("INT32_COL",
SeColumnDefinition.TYPE_INTEGER, 10, 0, isNullable);
colDefs[1] = new SeColumnDefinition("INT16_COL",
SeColumnDefinition.TYPE_SMALLINT, 4, 0, isNullable);
colDefs[2] = new SeColumnDefinition("FLOAT32_COL",
SeColumnDefinition.TYPE_FLOAT, 5, 2, isNullable);
colDefs[3] = new SeColumnDefinition("FLOAT64_COL",
SeColumnDefinition.TYPE_DOUBLE, 15, 4, isNullable);
colDefs[4] = new SeColumnDefinition("STRING_COL",
SeColumnDefinition.TYPE_STRING, 25, 0, isNullable);
colDefs[5] = new SeColumnDefinition("DATE_COL", SeColumnDefinition.TYPE_DATE,
1, 0, isNullable);
colDefs[6] = new SeColumnDefinition("INT64_COL",
SeColumnDefinition.TYPE_INTEGER, 10, 0, isNullable);
table.addColumn(colDefs[0]);
table.addColumn(colDefs[1]);
table.addColumn(colDefs[2]);
table.addColumn(colDefs[3]);
table.dropColumn(tmpCols[0].getName());
/*
* Define the attributes of the spatial column
*/
layer.setSpatialColumnName("SHAPE");
/*
* Set the type of shapes that can be inserted into the layer. Shape type can be
* just one or many. NOTE: Layers that contain more than one shape type can only
* be accessed through the C and Java APIs and Arc Explorer Java 3.x. They
* cannot be seen from ArcGIS desktop applications.
*/
layer.setShapeTypes(SeLayer.SE_NIL_TYPE_MASK | SeLayer.SE_POINT_TYPE_MASK
| SeLayer.SE_LINE_TYPE_MASK | SeLayer.SE_SIMPLE_LINE_TYPE_MASK
| SeLayer.SE_AREA_TYPE_MASK | SeLayer.SE_MULTIPART_TYPE_MASK);
layer.setGridSizes(1100.0, 0.0, 0.0);
layer.setDescription("Layer Example");
SeExtent ext = new SeExtent(0.0, 0.0, 10000.0, 10000.0);
layer.setExtent(ext);
/*
* Define the layer's Coordinate Reference
*/
SeCoordinateReference coordref = new SeCoordinateReference();
coordref.setXY(0D, 0D, 100D);
layer.setCoordRef(coordref);
/*
* Spatially enable the new table...
*/
if (LOGGER.isLoggable(Level.FINE)) {
LOGGER.fine("\n--> Adding spatial column \"SHAPE\"...");
}
layer.setCreationKeyword(testData.getConfigKeyword());
layer.create(3, 4);
if (LOGGER.isLoggable(Level.FINE)) {
LOGGER.fine(" - Done.");
}
table.addColumn(colDefs[4]);
table.addColumn(colDefs[5]);
table.addColumn(colDefs[6]);
// } catch (SeException e) {
// LOGGER.throwing(this.getClass().getName(),
// "testCreateNonStandardSchema", e);
// throw e;
} finally {
try {
table.delete();
} catch (Exception e) {
// intentionally blank
}
try {