You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sis.apache.org by de...@apache.org on 2015/01/12 12:14:55 UTC
svn commit: r1651061 [3/4] - in
/sis/branches/JDK8/storage/sis-shapefile/src/main:
java/org/apache/sis/internal/shapefile/
java/org/apache/sis/internal/shapefile/jdbc/
java/org/apache/sis/internal/shapefile/jdbc/connection/
java/org/apache/sis/internal...
Modified: sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/resultset/DBFBuiltInMemoryResultSetForColumnsListing.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/resultset/DBFBuiltInMemoryResultSetForColumnsListing.java?rev=1651061&r1=1651060&r2=1651061&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/resultset/DBFBuiltInMemoryResultSetForColumnsListing.java [iso-8859-1] (original)
+++ sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/resultset/DBFBuiltInMemoryResultSetForColumnsListing.java [UTF-8] Mon Jan 12 11:14:54 2015
@@ -1,460 +1,460 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.sis.internal.shapefile.jdbc.resultset;
-
-import java.sql.DatabaseMetaData;
-import java.sql.Types;
-import java.text.MessageFormat;
-import java.util.Iterator;
-import java.util.List;
-import java.util.logging.Level;
-
-import org.apache.sis.internal.shapefile.jdbc.DBase3FieldDescriptor;
-import org.apache.sis.internal.shapefile.jdbc.statement.DBFStatement;
-
-/**
- * Special ResultSet listing columns contained in this DBase 3.
- * @author Marc LE BIHAN
- */
-public class DBFBuiltInMemoryResultSetForColumnsListing extends BuiltInMemoryResultSet {
- /** Current field descriptor. */
- private DBase3FieldDescriptor current;
-
- /** Iterator. */
- private Iterator<DBase3FieldDescriptor> itDescriptor;
-
- /** Column index. */
- private int columnIndex;
-
- /** Indicates if the ResultSet is set after the last record. */
- private boolean afterLast = false;
-
- /**
- * Construct a ResultSet.
- * @param stmt Statement.
- * @param fieldsDescriptors Fields descriptors.
- */
- public DBFBuiltInMemoryResultSetForColumnsListing(DBFStatement stmt, List<DBase3FieldDescriptor> fieldsDescriptors) {
- super(stmt, "driver list columns in this DBase 3 file");
- itDescriptor = fieldsDescriptors.iterator();
- }
-
- /**
- * @see java.sql.ResultSet#getString(java.lang.String)
- * @throws SQLNoSuchFieldException if the column does not exist.
- */
- @Override public String getString(String columnLabel) throws SQLNoSuchFieldException {
- logStep("getString", columnLabel);
-
- switch(columnLabel) {
- // String => table name
- case "TABLE_NAME": {
- String tableName = getTableName();
- wasNull = (tableName == null);
- return tableName;
- }
-
- // String => column name
- case "COLUMN_NAME": {
- String columnName = current.getName();
- wasNull = (columnName == null);
- return columnName;
- }
-
- // String => Data source dependent type name, for a UDT the type name is fully qualified
- case "TYPE_NAME": {
- String typeName = current.getType() != null ? toColumnTypeName() : null;
- wasNull = (typeName == null);
- return typeName;
- }
-
- /**
- * Columns responding to features that aren't handled by DBase 3.
- * and return always a default value NULL or "NO"...
- */
-
- // String => table catalog (may be null)
- case "TABLE_CAT": {
- wasNull = true;
- return null;
- }
-
- // String => table schema (may be null)
- case "TABLE_SCHEM": {
- wasNull = true;
- return null;
- }
-
- // String => comment describing column (may be null)
- case "REMARKS":
- wasNull = true;
- return null;
-
- // String => default value for the column, which should be interpreted as a string when the value is enclosed in single quotes (may be null)
- case "COLUMN_DEF": {
- wasNull = true;
- return null;
- }
-
- // String => catalog of table that is the scope of a reference attribute (null if DATA_TYPE isn't REF)
- case "SCOPE_CATALOG": {
- wasNull = true;
- return null;
- }
-
- // String => schema of table that is the scope of a reference attribute (null if the DATA_TYPE isn't REF)
- case "SCOPE_SCHEMA": {
- wasNull = true;
- return null;
- }
-
- // String => table name that this the scope of a reference attribute (null if the DATA_TYPE isn't REF)
- case "SCOPE_TABLE": {
- wasNull = true;
- return null;
- }
-
- /**
- * String => Indicates whether this column is auto incremented
- * YES --- if the column is auto incremented
- * NO --- if the column is not auto incremented
- * empty string --- if it cannot be determined whether the column is auto incremented
- */
- case "IS_AUTOINCREMENT": {
- wasNull = false;
- return "NO";
- }
-
- /**
- * String => Indicates whether this is a generated column
- * YES --- if this a generated column
- * NO --- if this not a generated column
- * empty string --- if it cannot be determined whether this is a generated column
- */
- case "IS_GENERATEDCOLUMN": {
- wasNull = false;
- return "NO";
- }
-
- default: {
- // Attempt to load it from an Integer column and convert it.
- int value = getInt(columnLabel);
- return MessageFormat.format("{0,number,#0}", value); // Remove decimal separators.
- }
- }
- }
-
- /**
- * @see java.sql.ResultSet#getInt(java.lang.String)
- * @throws SQLNoSuchFieldException if the column does not exist.
- */
- @Override public int getInt(String columnLabel) throws SQLNoSuchFieldException {
- logStep("getInt", columnLabel);
-
- switch(columnLabel) {
- // int => SQL type from java.sql.Types
- case "DATA_TYPE": {
- wasNull = false;
- return toSQLDataType();
- }
-
- // int => column size.
- case "COLUMN_SIZE": {
- wasNull = false;
- return toPrecision();
- }
-
- // int => the number of fractional digits. Null is returned for data types where DECIMAL_DIGITS is not applicable.
- case "DECIMAL_DIGITS": {
- int scale = toScale();
- wasNull = toScale() == -1;
- return scale == -1 ? 0 : scale;
- }
-
- // int => Radix (typically either 10 or 2)
- case "NUM_PREC_RADIX": {
- return 10;
- }
-
- /**
- * int => is NULL allowed.
- * columnNoNulls - might not allow NULL values
- * columnNullable - definitely allows NULL values
- * columnNullableUnknown - nullability unknown
- */
- case "NULLABLE": {
- wasNull = false;
- return DatabaseMetaData.columnNullableUnknown;
- }
-
- // int => unused
- case "SQL_DATA_TYPE": {
- wasNull = false;
- return toSQLDataType();
- }
-
- // int => for char types the maximum number of bytes in the column
- case "CHAR_OCTET_LENGTH": {
- if (toSQLDataType() == Types.CHAR) {
- return toPrecision();
- }
-
- return 0;
- }
-
- // int => index of column in table (starting at 1)
- case "ORDINAL_POSITION": {
- return columnIndex;
- }
-
- /**
- * Columns responding to features that aren't handled by DBase 3.
- * and return always a default value NULL or "NO"...
- */
-
- // short => source type of a distinct type or user-generated Ref type, SQL type from java.sql.Types (null if DATA_TYPE isn't DISTINCT or user-generated REF)
- case "SOURCE_DATA_TYPE": {
- wasNull = true;
- return 0;
- }
-
- // is not used.
- case "BUFFER_LENGTH": {
- wasNull = false;
- return 0;
- }
-
- // int => unused
- case "SQL_DATETIME_SUB": {
- wasNull = false;
- return 0;
- }
-
- default:
- // FIXME : this function is not perfect. It a column label is given that refers to a field described in getString(..) this function
- // will tell that the field doesn't exist. It's not true : the field is not numeric. But as getString(..) defaults to getInt(...),
- // getInt(..) cannot default to getString(..), else the function will run in a cycle.
- String message = format(Level.WARNING, "excp.no_desc_field", columnLabel, getTableName());
- throw new SQLNoSuchFieldException(message, "asking columns desc", getFile(), columnLabel);
- }
- }
-
- /**
- * @see java.sql.ResultSet#next()
- */
- @Override public boolean next() throws SQLNoResultException {
- if (itDescriptor.hasNext()) {
- current = itDescriptor.next();
- columnIndex ++;
- return true;
- }
- else {
- if (afterLast) {
- // The ResultSet has no more records and has been call one time too much.
- afterLast = true;
-
- String message = format(Level.WARNING, "excp.no_more_desc", getTableName());
- throw new SQLNoResultException(message, "asking columns desc", getFile());
- }
- else {
- return false;
- }
- }
- }
-
- /**
- * Returns the SQL Datatype of the DBase 3 type for the current field.
- * @return SQL Datatype.
- */
- private int toSQLDataType() {
- switch(current.getType()) {
- case AutoIncrement:
- return Types.INTEGER;
-
- case Character:
- return Types.CHAR;
-
- case Integer:
- return Types.INTEGER;
-
- case Date:
- return Types.DATE;
-
- case Double:
- return Types.DOUBLE;
-
- case FloatingPoint:
- return Types.FLOAT;
-
- case Number:
- return Types.DECIMAL;
-
- case Logical:
- return Types.BOOLEAN;
-
- case Currency:
- return Types.NUMERIC;
-
- case DateTime:
- return Types.TIMESTAMP; // TODO : I think ?
-
- case TimeStamp:
- return Types.TIMESTAMP;
-
- case Memo:
- return Types.BLOB;
-
- case Picture:
- return Types.BLOB;
-
- case VariField:
- return Types.OTHER;
-
- case Variant:
- return Types.OTHER;
-
- default:
- return Types.OTHER;
- }
- }
-
- /**
- * Returns the column type name of the current field.
- * @return Column type name.
- */
- private String toColumnTypeName() {
- switch(current.getType()) {
- case AutoIncrement:
- return "AUTO_INCREMENT";
-
- case Character:
- return "CHAR";
-
- case Integer:
- return "INTEGER";
-
- case Date:
- return "DATE";
-
- case Double:
- return "DOUBLE";
-
- case FloatingPoint:
- return "FLOAT";
-
- case Number:
- return "DECIMAL";
-
- case Logical:
- return "BOOLEAN";
-
- case Currency:
- return "CURRENCY";
-
- case DateTime:
- return "DATETIME";
-
- case TimeStamp:
- return "TIMESTAMP";
-
- case Memo:
- return "MEMO";
-
- case Picture:
- return "PICTURE";
-
- case VariField:
- return "VARIFIELD";
-
- case Variant:
- return "VARIANT";
-
- default:
- return "UNKNOWN";
- }
- }
-
- /**
- * Returns the precision of the current field.
- * @return Precision of the current field.
- */
- public int toPrecision() {
- switch(current.getType()) {
- case AutoIncrement:
- case Character:
- case Integer:
- return current.getLength();
-
- case Date:
- return 8;
-
- case Double:
- case FloatingPoint:
- case Number:
- return current.getLength();
-
- case Logical:
- return 0;
-
- case Currency:
- case DateTime:
- case TimeStamp:
- return current.getLength();
-
- case Memo:
- case Picture:
- case VariField:
- case Variant:
- return 0;
-
- default:
- return current.getLength();
- }
- }
-
- /**
- * Returns the scale of the current field.
- * @return Scale of the current field, -1 means : this field is not numeric.
- */
- private int toScale() {
- switch(current.getType()) {
- case AutoIncrement:
- case Logical:
- return 0;
-
- case Integer:
- case Double:
- case FloatingPoint:
- case Number:
- case Currency:
- return current.getDecimalCount();
-
- case Character:
- case Date:
- case DateTime:
- case TimeStamp:
- case Memo:
- case Picture:
- case VariField:
- case Variant:
- return -1;
-
- default:
- return -1;
- }
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sis.internal.shapefile.jdbc.resultset;
+
+import java.sql.DatabaseMetaData;
+import java.sql.Types;
+import java.text.MessageFormat;
+import java.util.Iterator;
+import java.util.List;
+import java.util.logging.Level;
+
+import org.apache.sis.internal.shapefile.jdbc.DBase3FieldDescriptor;
+import org.apache.sis.internal.shapefile.jdbc.statement.DBFStatement;
+
+/**
+ * Special ResultSet listing columns contained in this DBase 3.
+ * @author Marc LE BIHAN
+ */
+public class DBFBuiltInMemoryResultSetForColumnsListing extends BuiltInMemoryResultSet {
+ /** Current field descriptor. */
+ private DBase3FieldDescriptor current;
+
+ /** Iterator. */
+ private Iterator<DBase3FieldDescriptor> itDescriptor;
+
+ /** Column index. */
+ private int columnIndex;
+
+ /** Indicates if the ResultSet is set after the last record. */
+ private boolean afterLast = false;
+
+ /**
+ * Construct a ResultSet.
+ * @param stmt Statement.
+ * @param fieldsDescriptors Fields descriptors.
+ */
+ public DBFBuiltInMemoryResultSetForColumnsListing(DBFStatement stmt, List<DBase3FieldDescriptor> fieldsDescriptors) {
+ super(stmt, "driver list columns in this DBase 3 file");
+ itDescriptor = fieldsDescriptors.iterator();
+ }
+
+ /**
+ * @see java.sql.ResultSet#getString(java.lang.String)
+ * @throws SQLNoSuchFieldException if the column does not exist.
+ */
+ @Override public String getString(String columnLabel) throws SQLNoSuchFieldException {
+ logStep("getString", columnLabel);
+
+ switch(columnLabel) {
+ // String => table name
+ case "TABLE_NAME": {
+ String tableName = getTableName();
+ wasNull = (tableName == null);
+ return tableName;
+ }
+
+ // String => column name
+ case "COLUMN_NAME": {
+ String columnName = current.getName();
+ wasNull = (columnName == null);
+ return columnName;
+ }
+
+ // String => Data source dependent type name, for a UDT the type name is fully qualified
+ case "TYPE_NAME": {
+ String typeName = current.getType() != null ? toColumnTypeName() : null;
+ wasNull = (typeName == null);
+ return typeName;
+ }
+
+ /**
+ * Columns responding to features that aren't handled by DBase 3.
+ * and return always a default value NULL or "NO"...
+ */
+
+ // String => table catalog (may be null)
+ case "TABLE_CAT": {
+ wasNull = true;
+ return null;
+ }
+
+ // String => table schema (may be null)
+ case "TABLE_SCHEM": {
+ wasNull = true;
+ return null;
+ }
+
+ // String => comment describing column (may be null)
+ case "REMARKS":
+ wasNull = true;
+ return null;
+
+ // String => default value for the column, which should be interpreted as a string when the value is enclosed in single quotes (may be null)
+ case "COLUMN_DEF": {
+ wasNull = true;
+ return null;
+ }
+
+ // String => catalog of table that is the scope of a reference attribute (null if DATA_TYPE isn't REF)
+ case "SCOPE_CATALOG": {
+ wasNull = true;
+ return null;
+ }
+
+ // String => schema of table that is the scope of a reference attribute (null if the DATA_TYPE isn't REF)
+ case "SCOPE_SCHEMA": {
+ wasNull = true;
+ return null;
+ }
+
+ // String => table name that this the scope of a reference attribute (null if the DATA_TYPE isn't REF)
+ case "SCOPE_TABLE": {
+ wasNull = true;
+ return null;
+ }
+
+ /**
+ * String => Indicates whether this column is auto incremented
+ * YES --- if the column is auto incremented
+ * NO --- if the column is not auto incremented
+ * empty string --- if it cannot be determined whether the column is auto incremented
+ */
+ case "IS_AUTOINCREMENT": {
+ wasNull = false;
+ return "NO";
+ }
+
+ /**
+ * String => Indicates whether this is a generated column
+ * YES --- if this a generated column
+ * NO --- if this not a generated column
+ * empty string --- if it cannot be determined whether this is a generated column
+ */
+ case "IS_GENERATEDCOLUMN": {
+ wasNull = false;
+ return "NO";
+ }
+
+ default: {
+ // Attempt to load it from an Integer column and convert it.
+ int value = getInt(columnLabel);
+ return MessageFormat.format("{0,number,#0}", value); // Remove decimal separators.
+ }
+ }
+ }
+
+ /**
+ * @see java.sql.ResultSet#getInt(java.lang.String)
+ * @throws SQLNoSuchFieldException if the column does not exist.
+ */
+ @Override public int getInt(String columnLabel) throws SQLNoSuchFieldException {
+ logStep("getInt", columnLabel);
+
+ switch(columnLabel) {
+ // int => SQL type from java.sql.Types
+ case "DATA_TYPE": {
+ wasNull = false;
+ return toSQLDataType();
+ }
+
+ // int => column size.
+ case "COLUMN_SIZE": {
+ wasNull = false;
+ return toPrecision();
+ }
+
+ // int => the number of fractional digits. Null is returned for data types where DECIMAL_DIGITS is not applicable.
+ case "DECIMAL_DIGITS": {
+ int scale = toScale();
+ wasNull = toScale() == -1;
+ return scale == -1 ? 0 : scale;
+ }
+
+ // int => Radix (typically either 10 or 2)
+ case "NUM_PREC_RADIX": {
+ return 10;
+ }
+
+ /**
+ * int => is NULL allowed.
+ * columnNoNulls - might not allow NULL values
+ * columnNullable - definitely allows NULL values
+ * columnNullableUnknown - nullability unknown
+ */
+ case "NULLABLE": {
+ wasNull = false;
+ return DatabaseMetaData.columnNullableUnknown;
+ }
+
+ // int => unused
+ case "SQL_DATA_TYPE": {
+ wasNull = false;
+ return toSQLDataType();
+ }
+
+ // int => for char types the maximum number of bytes in the column
+ case "CHAR_OCTET_LENGTH": {
+ if (toSQLDataType() == Types.CHAR) {
+ return toPrecision();
+ }
+
+ return 0;
+ }
+
+ // int => index of column in table (starting at 1)
+ case "ORDINAL_POSITION": {
+ return columnIndex;
+ }
+
+ /**
+ * Columns responding to features that aren't handled by DBase 3.
+ * and return always a default value NULL or "NO"...
+ */
+
+ // short => source type of a distinct type or user-generated Ref type, SQL type from java.sql.Types (null if DATA_TYPE isn't DISTINCT or user-generated REF)
+ case "SOURCE_DATA_TYPE": {
+ wasNull = true;
+ return 0;
+ }
+
+ // is not used.
+ case "BUFFER_LENGTH": {
+ wasNull = false;
+ return 0;
+ }
+
+ // int => unused
+ case "SQL_DATETIME_SUB": {
+ wasNull = false;
+ return 0;
+ }
+
+ default:
+ // FIXME : this function is not perfect. It a column label is given that refers to a field described in getString(..) this function
+ // will tell that the field doesn't exist. It's not true : the field is not numeric. But as getString(..) defaults to getInt(...),
+ // getInt(..) cannot default to getString(..), else the function will run in a cycle.
+ String message = format(Level.WARNING, "excp.no_desc_field", columnLabel, getTableName());
+ throw new SQLNoSuchFieldException(message, "asking columns desc", getFile(), columnLabel);
+ }
+ }
+
+ /**
+ * @see java.sql.ResultSet#next()
+ */
+ @Override public boolean next() throws SQLNoResultException {
+ if (itDescriptor.hasNext()) {
+ current = itDescriptor.next();
+ columnIndex ++;
+ return true;
+ }
+ else {
+ if (afterLast) {
+ // The ResultSet has no more records and has been call one time too much.
+ afterLast = true;
+
+ String message = format(Level.WARNING, "excp.no_more_desc", getTableName());
+ throw new SQLNoResultException(message, "asking columns desc", getFile());
+ }
+ else {
+ return false;
+ }
+ }
+ }
+
+ /**
+ * Returns the SQL Datatype of the DBase 3 type for the current field.
+ * @return SQL Datatype.
+ */
+ private int toSQLDataType() {
+ switch(current.getType()) {
+ case AutoIncrement:
+ return Types.INTEGER;
+
+ case Character:
+ return Types.CHAR;
+
+ case Integer:
+ return Types.INTEGER;
+
+ case Date:
+ return Types.DATE;
+
+ case Double:
+ return Types.DOUBLE;
+
+ case FloatingPoint:
+ return Types.FLOAT;
+
+ case Number:
+ return Types.DECIMAL;
+
+ case Logical:
+ return Types.BOOLEAN;
+
+ case Currency:
+ return Types.NUMERIC;
+
+ case DateTime:
+ return Types.TIMESTAMP; // TODO : I think ?
+
+ case TimeStamp:
+ return Types.TIMESTAMP;
+
+ case Memo:
+ return Types.BLOB;
+
+ case Picture:
+ return Types.BLOB;
+
+ case VariField:
+ return Types.OTHER;
+
+ case Variant:
+ return Types.OTHER;
+
+ default:
+ return Types.OTHER;
+ }
+ }
+
+ /**
+ * Returns the column type name of the current field.
+ * @return Column type name.
+ */
+ private String toColumnTypeName() {
+ switch(current.getType()) {
+ case AutoIncrement:
+ return "AUTO_INCREMENT";
+
+ case Character:
+ return "CHAR";
+
+ case Integer:
+ return "INTEGER";
+
+ case Date:
+ return "DATE";
+
+ case Double:
+ return "DOUBLE";
+
+ case FloatingPoint:
+ return "FLOAT";
+
+ case Number:
+ return "DECIMAL";
+
+ case Logical:
+ return "BOOLEAN";
+
+ case Currency:
+ return "CURRENCY";
+
+ case DateTime:
+ return "DATETIME";
+
+ case TimeStamp:
+ return "TIMESTAMP";
+
+ case Memo:
+ return "MEMO";
+
+ case Picture:
+ return "PICTURE";
+
+ case VariField:
+ return "VARIFIELD";
+
+ case Variant:
+ return "VARIANT";
+
+ default:
+ return "UNKNOWN";
+ }
+ }
+
+ /**
+ * Returns the precision of the current field.
+ * @return Precision of the current field.
+ */
+ public int toPrecision() {
+ switch(current.getType()) {
+ case AutoIncrement:
+ case Character:
+ case Integer:
+ return current.getLength();
+
+ case Date:
+ return 8;
+
+ case Double:
+ case FloatingPoint:
+ case Number:
+ return current.getLength();
+
+ case Logical:
+ return 0;
+
+ case Currency:
+ case DateTime:
+ case TimeStamp:
+ return current.getLength();
+
+ case Memo:
+ case Picture:
+ case VariField:
+ case Variant:
+ return 0;
+
+ default:
+ return current.getLength();
+ }
+ }
+
+ /**
+ * Returns the scale of the current field.
+ * @return Scale of the current field, -1 means : this field is not numeric.
+ */
+ private int toScale() {
+ switch(current.getType()) {
+ case AutoIncrement:
+ case Logical:
+ return 0;
+
+ case Integer:
+ case Double:
+ case FloatingPoint:
+ case Number:
+ case Currency:
+ return current.getDecimalCount();
+
+ case Character:
+ case Date:
+ case DateTime:
+ case TimeStamp:
+ case Memo:
+ case Picture:
+ case VariField:
+ case Variant:
+ return -1;
+
+ default:
+ return -1;
+ }
+ }
+}
Propchange: sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/resultset/DBFBuiltInMemoryResultSetForColumnsListing.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/resultset/DBFBuiltInMemoryResultSetForColumnsListing.java
------------------------------------------------------------------------------
svn:mime-type = text/plain;charset=UTF-8
Modified: sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/resultset/DBFBuiltInMemoryResultSetForTablesListing.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/resultset/DBFBuiltInMemoryResultSetForTablesListing.java?rev=1651061&r1=1651060&r2=1651061&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/resultset/DBFBuiltInMemoryResultSetForTablesListing.java [UTF-8] (original)
+++ sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/resultset/DBFBuiltInMemoryResultSetForTablesListing.java [UTF-8] Mon Jan 12 11:14:54 2015
@@ -27,7 +27,7 @@ import org.apache.sis.internal.shapefile
public class DBFBuiltInMemoryResultSetForTablesListing extends BuiltInMemoryResultSet {
/** There's only one result in this ResultSet. */
private int index = 0;
-
+
/**
* Construct a ResultSet.
* @param stmt Statement.
@@ -41,7 +41,7 @@ public class DBFBuiltInMemoryResultSetFo
*/
@Override public String getString(String columnLabel) {
logStep("getString", columnLabel);
-
+
switch(columnLabel) {
case "TABLE_NAME": // String => table name.
{
@@ -49,17 +49,17 @@ public class DBFBuiltInMemoryResultSetFo
wasNull = (tableName == null);
return tableName;
}
-
+
case "TABLE_TYPE": // String => table type. Typical types are "TABLE", "VIEW", "SYSTEM TABLE", "GLOBAL TEMPORARY", "LOCAL TEMPORARY", "ALIAS", "SYNONYM".
wasNull = false;
return "TABLE";
-
- case "TYPE_NAME": // String => type name (may be null)
- case "TABLE_CAT": // String => table catalog (may be null)
- case "TABLE_SCHEM": // String => table schema (may be null)
- case "REMARKS": // String => explanatory comment on the table
- case "TYPE_CAT": // String => the types catalog (may be null)
- case "TYPE_SCHEM": // String => the types schema (may be null)
+
+ case "TYPE_NAME": // String => type name (may be null)
+ case "TABLE_CAT": // String => table catalog (may be null)
+ case "TABLE_SCHEM": // String => table schema (may be null)
+ case "REMARKS": // String => explanatory comment on the table
+ case "TYPE_CAT": // String => the types catalog (may be null)
+ case "TYPE_SCHEM": // String => the types schema (may be null)
case "SELF_REFERENCING_COL_NAME": // String => name of the designated "identifier" column of a typed table (may be null)
case "REF_GENERATION": // String => specifies how values in SELF_REFERENCING_COL_NAME are created. Values are "SYSTEM", "USER", "DERIVED". (may be null)
wasNull = true;
@@ -74,10 +74,10 @@ public class DBFBuiltInMemoryResultSetFo
/**
* @see java.sql.ResultSet#next()
*/
- @Override public boolean next() throws SQLNoResultException
+ @Override public boolean next() throws SQLNoResultException
{
logStep("next");
-
+
if (index > 1) {
throw new SQLNoResultException(format(Level.WARNING, "excp.only_one_table_per_dbf"), "Driver manager asks for table listing", getFile());
}
Modified: sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/resultset/DBFBuiltInMemoryResultSetForTablesTypesListing.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/resultset/DBFBuiltInMemoryResultSetForTablesTypesListing.java?rev=1651061&r1=1651060&r2=1651061&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/resultset/DBFBuiltInMemoryResultSetForTablesTypesListing.java [UTF-8] (original)
+++ sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/resultset/DBFBuiltInMemoryResultSetForTablesTypesListing.java [UTF-8] Mon Jan 12 11:14:54 2015
@@ -27,7 +27,7 @@ import org.apache.sis.internal.shapefile
public class DBFBuiltInMemoryResultSetForTablesTypesListing extends BuiltInMemoryResultSet {
/** There's only one result in this ResultSet. */
private int index = 0;
-
+
/**
* Construct a ResultSet listing the tables types of a database.
* @param stmt Statement.
@@ -41,15 +41,15 @@ public class DBFBuiltInMemoryResultSetFo
*/
@Override public String getString(String columnLabel) {
logStep("getString", columnLabel);
-
+
switch(columnLabel) {
- case "OBJECTID": // FIXME Documentation of ObjectId for geTabletTypes() has not been found. What are the rules about this field ?
+ case "OBJECTID": // FIXME Documentation of ObjectId for geTabletTypes() has not been found. What are the rules about this field ?
wasNull = false;
return "1";
-
+
case "TABLE_TYPE": // String => table type. Typical types are "TABLE", "VIEW", "SYSTEM TABLE", "GLOBAL TEMPORARY", "LOCAL TEMPORARY", "ALIAS", "SYNONYM".
wasNull = false;
- return "TABLE"; // and DBase 3 only knows tables.
+ return "TABLE"; // and DBase 3 only knows tables.
default:
wasNull = true;
@@ -60,10 +60,10 @@ public class DBFBuiltInMemoryResultSetFo
/**
* @see java.sql.ResultSet#next()
*/
- @Override public boolean next() throws SQLNoResultException
+ @Override public boolean next() throws SQLNoResultException
{
- logStep("next");
-
+ logStep("next");
+
if (index > 1) {
throw new SQLNoResultException(format(Level.WARNING, "excp.only_one_table_type_handled"), "Driver manager asks for table types listing", getFile());
}
Modified: sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/resultset/DBFRecordBasedResultSet.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/resultset/DBFRecordBasedResultSet.java?rev=1651061&r1=1651060&r2=1651061&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/resultset/DBFRecordBasedResultSet.java [UTF-8] (original)
+++ sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/resultset/DBFRecordBasedResultSet.java [UTF-8] Mon Jan 12 11:14:54 2015
@@ -26,13 +26,13 @@ import org.apache.sis.internal.shapefile
public class DBFRecordBasedResultSet extends DBFResultSet {
/** The current record. */
private Map<String, Object> record;
-
+
/** Condition of where clause (currently, only one is handled). */
private ConditionalClauseResolver singleConditionOfWhereClause;
/** UTF-8 charset. */
private static Charset UTF8 = Charset.forName("UTF-8");
-
+
/**
* Constructs a result set.
* @param stmt Parent statement.
@@ -43,7 +43,7 @@ public class DBFRecordBasedResultSet ext
super(stmt, sqlQuery);
singleConditionOfWhereClause = new CrudeSQLParser(this).parse();
}
-
+
/**
* @see org.apache.sis.internal.shapefile.jdbc.resultset.AbstractResultSet#getBigDecimal(java.lang.String)
* @throws SQLConnectionClosedException if the connection is closed.
@@ -53,14 +53,14 @@ public class DBFRecordBasedResultSet ext
@Override
public BigDecimal getBigDecimal(String columnLabel) throws SQLConnectionClosedException, SQLNoSuchFieldException, SQLNotNumericException {
logStep("getBigDecimal", columnLabel);
-
+
assertNotClosed();
-
+
// Act as if we were a double, but store the result in a pre-created BigDecimal at the end.
try(DBFBuiltInMemoryResultSetForColumnsListing field = (DBFBuiltInMemoryResultSetForColumnsListing)getFieldDesc(columnLabel, sql)) {
MathContext mc = new MathContext(field.getInt("DECIMAL_DIGITS"), RoundingMode.HALF_EVEN);
Double doubleValue = getDouble(columnLabel);
-
+
if (doubleValue != null) {
BigDecimal number = new BigDecimal(doubleValue, mc);
wasNull = false;
@@ -72,7 +72,7 @@ public class DBFRecordBasedResultSet ext
}
}
}
-
+
/**
* @see java.sql.ResultSet#getBigDecimal(int)
* @throws SQLConnectionClosedException if the connection is closed.
@@ -97,11 +97,11 @@ public class DBFRecordBasedResultSet ext
public BigDecimal getBigDecimal(String columnLabel, int scale) throws SQLConnectionClosedException, SQLNoSuchFieldException, SQLNotNumericException {
logStep("getBigDecimal", columnLabel, scale);
assertNotClosed();
-
+
// Act as if we were a double, but store the result in a pre-created BigDecimal at the end.
MathContext mc = new MathContext(scale, RoundingMode.HALF_EVEN);
Double doubleValue = getDouble(columnLabel);
-
+
if (doubleValue != null) {
BigDecimal number = new BigDecimal(getDouble(columnLabel), mc);
wasNull = false;
@@ -117,15 +117,15 @@ public class DBFRecordBasedResultSet ext
* @see java.sql.ResultSet#getDate(java.lang.String)
* @throws SQLConnectionClosedException if the connection is closed.
* @throws SQLNoSuchFieldException if the field looked for doesn't exist.
- * @throws SQLNotDateException if the field is not a date.
+ * @throws SQLNotDateException if the field is not a date.
*/
@Override
public Date getDate(String columnLabel) throws SQLConnectionClosedException, SQLNoSuchFieldException, SQLNotDateException {
logStep("getDate", columnLabel);
assertNotClosed();
-
+
String value = getString(columnLabel);
-
+
if (value == null || value.equals("00000000")) { // "00000000" is stored in Database to represent a null value too.
wasNull = true;
return null; // The ResultSet:getDate() contract is to return null when a null date is encountered.
@@ -133,7 +133,7 @@ public class DBFRecordBasedResultSet ext
else {
wasNull = false;
}
-
+
// The DBase 3 date format is "YYYYMMDD".
// if the length of the string isn't eight characters, the field format is incorrect.
if (value.length() != 8) {
@@ -143,7 +143,7 @@ public class DBFRecordBasedResultSet ext
// Extract the date parts.
int year, month, dayOfMonth;
-
+
try {
year = Integer.parseInt(value.substring(0, 4));
month = Integer.parseInt(value.substring(5, 7));
@@ -153,7 +153,7 @@ public class DBFRecordBasedResultSet ext
String message = format(Level.WARNING, "excp.field_is_not_a_date", columnLabel, sql, value);
throw new SQLNotDateException(message, sql, getFile(), columnLabel, value);
}
-
+
// Create a date.
Calendar calendar = new GregorianCalendar(year, month-1, dayOfMonth, 0, 0, 0);
Date sqlDate = new Date(calendar.getTimeInMillis());
@@ -164,7 +164,7 @@ public class DBFRecordBasedResultSet ext
* @see java.sql.ResultSet#getDate(int)
* @throws SQLConnectionClosedException if the connection is closed.
* @throws SQLNoSuchFieldException if the field looked for doesn't exist.
- * @throws SQLNotDateException if the field is not a date.
+ * @throws SQLNotDateException if the field is not a date.
* @throws SQLIllegalColumnIndexException if the column index has an illegal value.
*/
@Override
@@ -182,7 +182,7 @@ public class DBFRecordBasedResultSet ext
@Override
public double getDouble(String columnLabel) throws SQLConnectionClosedException, SQLNoSuchFieldException, SQLNotNumericException {
logStep("getDouble", columnLabel);
-
+
Double value = getNumeric(columnLabel, Double::parseDouble);
wasNull = (value == null);
return value != null ? value : 0.0; // The ResultSet contract for numbers is to return 0 when a null value is encountered.
@@ -210,7 +210,7 @@ public class DBFRecordBasedResultSet ext
@Override
public float getFloat(String columnLabel) throws SQLConnectionClosedException, SQLNoSuchFieldException, SQLNotNumericException {
logStep("getFloat", columnLabel);
-
+
Float value = getNumeric(columnLabel, Float::parseFloat);
wasNull = (value == null);
return value != null ? value : 0; // The ResultSet contract for numbers is to return 0 when a null value is encountered.
@@ -238,7 +238,7 @@ public class DBFRecordBasedResultSet ext
@Override
public int getInt(String columnLabel) throws SQLConnectionClosedException, SQLNoSuchFieldException, SQLNotNumericException {
logStep("getInt", columnLabel);
-
+
Integer value = getNumeric(columnLabel, Integer::parseInt);
wasNull = (value == null);
return value != null ? value : 0; // The ResultSet contract for numbers is to return 0 when a null value is encountered.
@@ -266,7 +266,7 @@ public class DBFRecordBasedResultSet ext
@Override
public long getLong(String columnLabel) throws SQLConnectionClosedException, SQLNoSuchFieldException, SQLNotNumericException {
logStep("getLong", columnLabel);
-
+
Long value = getNumeric(columnLabel, Long::parseLong);
wasNull = (value == null);
return value != null ? value : 0; // The ResultSet contract for numbers is to return 0 when a null value is encountered.
@@ -283,26 +283,26 @@ public class DBFRecordBasedResultSet ext
logStep("getLong", columnIndex);
return getLong(getFieldName(columnIndex, sql));
}
-
+
/**
* @see java.sql.ResultSet#getMetaData()
*/
@Override
public ResultSetMetaData getMetaData() {
logStep("getMetaData");
-
- DBFResultSetMataData meta = new DBFResultSetMataData(this);
+
+ DBFResultSetMataData meta = new DBFResultSetMataData(this);
return meta;
}
-
+
/**
* @see org.apache.sis.internal.shapefile.jdbc.resultset.AbstractResultSet#getObject(int)
*/
- @Override
+ @Override
public Object getObject(int column) throws SQLConnectionClosedException, SQLIllegalColumnIndexException, SQLFeatureNotSupportedException, SQLNoSuchFieldException, SQLNotNumericException, SQLNotDateException {
try(DBFBuiltInMemoryResultSetForColumnsListing field = (DBFBuiltInMemoryResultSetForColumnsListing)getFieldDesc(column, sql)) {
String fieldType;
-
+
try {
fieldType = field.getString("TYPE_NAME");
}
@@ -310,18 +310,18 @@ public class DBFRecordBasedResultSet ext
// This is an internal trouble because the field type must be found.
throw new RuntimeException(e.getMessage(), e);
}
-
+
switch(fieldType) {
case "AUTO_INCREMENT":
case "INTEGER":
return getInt(column);
-
+
case "CHAR":
return getString(column);
-
+
case "DATE":
return getDate(column);
-
+
case "DECIMAL": {
// Choose Integer or Long type, if no decimal and that the field is not to big.
if (field.getInt("DECIMAL_DIGITS") == 0 && field.getInt("COLUMN_SIZE") <= 18) {
@@ -330,55 +330,55 @@ public class DBFRecordBasedResultSet ext
else
return getLong(column);
}
-
+
return getDouble(column);
}
-
+
case "DOUBLE":
case "CURRENCY":
return getDouble(column);
-
+
case "FLOAT":
return getFloat(column);
-
+
case "BOOLEAN":
throw unsupportedOperation("ResultSetMetaData.getColumnClassName(..) on Boolean");
-
+
case "DATETIME":
throw unsupportedOperation("ResultSetMetaData.getColumnClassName(..) on DateTime");
-
+
case "TIMESTAMP":
throw unsupportedOperation("ResultSetMetaData.getColumnClassName(..) on TimeStamp");
-
+
case "MEMO":
throw unsupportedOperation("ResultSetMetaData.getColumnClassName(..) on Memo");
-
+
case "PICTURE":
throw unsupportedOperation("ResultSetMetaData.getColumnClassName(..) on Picture");
-
+
case "VARIFIELD":
throw unsupportedOperation("ResultSetMetaData.getColumnClassName(..) on VariField");
-
+
case "VARIANT":
throw unsupportedOperation("ResultSetMetaData.getColumnClassName(..) on Variant");
-
+
case "UNKNOWN":
throw unsupportedOperation("ResultSetMetaData.getColumnClassName(..) on " + fieldType);
-
+
default:
throw unsupportedOperation("ResultSetMetaData.getColumnClassName(..) on " + fieldType);
- }
+ }
}
}
/**
* @see org.apache.sis.internal.shapefile.jdbc.resultset.DBFResultSet#getObject(java.lang.String)
*/
- @Override
+ @Override
public Object getObject(String columnLabel) throws SQLConnectionClosedException, SQLIllegalColumnIndexException, SQLFeatureNotSupportedException, SQLNoSuchFieldException, SQLNotNumericException, SQLNotDateException {
return getObject(findColumn(columnLabel));
}
-
+
/**
* @see java.sql.ResultSet#getShort(java.lang.String)
* @throws SQLConnectionClosedException if the connection is closed.
@@ -388,7 +388,7 @@ public class DBFRecordBasedResultSet ext
@Override
public short getShort(String columnLabel) throws SQLConnectionClosedException, SQLNoSuchFieldException, SQLNotNumericException {
logStep("getShort", columnLabel);
-
+
Short value = getNumeric(columnLabel, Short::parseShort);
wasNull = (value == null);
return value != null ? value : 0; // The ResultSet contract for numbers is to return 0 when a null value is encountered.
@@ -418,23 +418,23 @@ public class DBFRecordBasedResultSet ext
public String getString(String columnLabel) throws SQLConnectionClosedException, SQLNoSuchFieldException {
logStep("getString", columnLabel);
assertNotClosed();
-
+
getFieldDesc(columnLabel, sql); // Ensure that the field queried exists, else a null value here can be interpreted as "not existing" or "has a null value".
String withoutCharset = (String)record.get(columnLabel);
-
+
if (withoutCharset == null) {
wasNull = true;
return withoutCharset;
- }
+ }
else {
wasNull = false;
}
-
+
// If a non null value has been readed, convert it to the wished Charset.
DBFConnection cnt = (DBFConnection)((DBFStatement)getStatement()).getConnection();
- String withDatabaseCharset = new String(withoutCharset.getBytes(), cnt.getCharset());
+ String withDatabaseCharset = new String(withoutCharset.getBytes(), cnt.getCharset());
log(Level.FINER, "log.string_field_charset", columnLabel, withoutCharset, withDatabaseCharset, cnt.getCharset());
-
+
// Because the Database is old (end of 1980's), it has not been made to support UTF-8 encoding.
// But must users of DBase 3 don't know this, and sometimes a String field may carry such characters.
// Attempt to determine if the string could be an UTF-8 String instead.
@@ -443,7 +443,7 @@ public class DBFRecordBasedResultSet ext
// If conversion contains a not convertible character, it's not an UTF-8 string.
// If the UTF-8 string is shorter than the one that would have given the database charset, it's a good sign : it has chances to be better.
boolean unsureResult = withUtf8Encoding.indexOf('\ufffd') != -1 || withUtf8Encoding.length() >= withDatabaseCharset.length();
-
+
if (unsureResult)
return withDatabaseCharset;
else {
@@ -451,7 +451,7 @@ public class DBFRecordBasedResultSet ext
return withUtf8Encoding;
}
}
-
+
/**
* @see java.sql.ResultSet#getString(int)
* @throws SQLConnectionClosedException if the connection is closed.
@@ -489,7 +489,7 @@ public class DBFRecordBasedResultSet ext
return nextRecordMatchingConditions();
}
-
+
/**
* Find the next record that match the where condition.
* @return true if a record has been found.
@@ -505,15 +505,15 @@ public class DBFRecordBasedResultSet ext
private boolean nextRecordMatchingConditions() throws SQLInvalidStatementException, SQLIllegalParameterException, SQLNoSuchFieldException, SQLUnsupportedParsingFeatureException, SQLConnectionClosedException, SQLNotNumericException, SQLNotDateException {
boolean recordMatchesConditions = false;
DBFConnection cnt = (DBFConnection)((DBFStatement)getStatement()).getConnection();
-
+
while(cnt.nextRowAvailable() && recordMatchesConditions == false) {
record = cnt.readNextRowAsObjects();
recordMatchesConditions = singleConditionOfWhereClause == null || singleConditionOfWhereClause.isVerified(this);
}
-
+
return recordMatchesConditions && cnt.nextRowAvailable(); // Beware of the end of database !
}
-
+
/**
* @see java.sql.Wrapper#isWrapperFor(java.lang.Class)
*/
@@ -544,19 +544,19 @@ public class DBFRecordBasedResultSet ext
*/
private <T extends Number> T getNumeric(String columnLabel, Function<String, T> parse) throws SQLConnectionClosedException, SQLNoSuchFieldException, SQLNotNumericException {
assertNotClosed();
-
+
try(DBFBuiltInMemoryResultSetForColumnsListing rs = (DBFBuiltInMemoryResultSetForColumnsListing)getFieldDesc(columnLabel, sql)) {
- String textValue = (String)record.get(columnLabel);
-
+ String textValue = (String)record.get(columnLabel);
+
if (textValue == null) {
return null;
}
-
+
try {
textValue = textValue.trim(); // Field must be trimed before being converted.
T value = parse.apply(textValue);
return(value);
- }
+ }
catch(NumberFormatException e) {
String message = format(Level.WARNING, "excp.field_is_not_numeric", columnLabel, rs.getString("TYPE_NAME"), sql, textValue);
throw new SQLNotNumericException(message, sql, getFile(), columnLabel, textValue);
Modified: sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/resultset/DBFResultSet.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/resultset/DBFResultSet.java?rev=1651061&r1=1651060&r2=1651061&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/resultset/DBFResultSet.java [UTF-8] (original)
+++ sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/resultset/DBFResultSet.java [UTF-8] Mon Jan 12 11:14:54 2015
@@ -32,16 +32,16 @@ import org.apache.sis.internal.shapefile
import org.apache.sis.internal.shapefile.jdbc.statement.DBFStatement;
/**
- * Common implemented features of all ResultSets : those based on a record, but also those returning results forged in memory.
+ * Common implemented features of all ResultSets : those based on a record, but also those returning results forged in memory.
* @author Marc LE BIHAN
*/
public abstract class DBFResultSet extends AbstractResultSet {
/** Indicates if the ResultSet is closed. */
protected boolean isClosed;
-
+
/** SQL Statement. */
protected String sql;
-
+
/** true, if the last column had the SQL NULL value (for the ResultSet.wasNull() method). */
protected boolean wasNull;
@@ -55,7 +55,7 @@ public abstract class DBFResultSet exten
*/
public DBFResultSet(final DBFStatement stmt, String sqlQuery) {
Objects.requireNonNull(stmt, "the statement referred by the ResultSet cannot be null.");
-
+
statement = stmt;
sql = sqlQuery;
}
@@ -74,7 +74,7 @@ public abstract class DBFResultSet exten
*/
protected void assertNotClosed() throws SQLConnectionClosedException {
statement.assertNotClosed();
-
+
if (isClosed) {
throw new SQLConnectionClosedException(format(Level.WARNING, "excp.closed_resultset", sql, getFile().getName()), sql, getFile());
}
@@ -95,20 +95,20 @@ public abstract class DBFResultSet exten
public void close() {
if (isClosed())
return;
-
+
statement.notifyCloseResultSet(this);
isClosed = true;
}
-
+
/**
* Returns the column index for the given column name.
* The default implementation of all methods expecting a column label will invoke this method.
* @param columnLabel The name of the column.
* @return The index of the given column name : first column is 1.
* @throws SQLNoSuchFieldException if there is no field with this name in the query.
- * @throws SQLConnectionClosedException if the connection is closed.
+ * @throws SQLConnectionClosedException if the connection is closed.
*/
- @Override
+ @Override
@SuppressWarnings("resource") // The connection is only used to get the column index.
public int findColumn(String columnLabel) throws SQLNoSuchFieldException, SQLConnectionClosedException {
DBFConnection cnt = (DBFConnection)statement.getConnection();
@@ -229,7 +229,7 @@ public abstract class DBFResultSet exten
* @throws SQLIllegalColumnIndexException if the index is out of bounds.
* @throws SQLConnectionClosedException if the connection is closed.
*/
- @SuppressWarnings("resource") // Only use the current connection to get the field name.
+ @SuppressWarnings("resource") // Only use the current connection to get the field name.
public String getFieldName(int columnIndex, String sqlStatement) throws SQLIllegalColumnIndexException, SQLConnectionClosedException {
DBFConnection cnt = (DBFConnection)statement.getConnection();
return cnt.getFieldName(columnIndex, sqlStatement);
@@ -239,7 +239,7 @@ public abstract class DBFResultSet exten
* Returns the Database File.
* @return Database File.
*/
- @Override
+ @Override
public File getFile() {
return statement.getFile();
}
@@ -349,7 +349,7 @@ public abstract class DBFResultSet exten
public boolean isWrapperFor(Class<?> iface) {
return iface.isAssignableFrom(getInterface());
}
-
+
/**
* Defaults to the index-based version of this method.
* The given column name is mapped to a column index by {@link #findColumn(String)}.
@@ -565,7 +565,7 @@ public abstract class DBFResultSet exten
public void updateBinaryStream(String columnLabel, InputStream x, long length) throws SQLException {
updateBinaryStream(findColumn(columnLabel), x, length);
}
-
+
/**
* Defaults to the index-based version of this method.
* The given column name is mapped to a column index by {@link #findColumn(String)}.
@@ -769,7 +769,7 @@ public abstract class DBFResultSet exten
public void updateNClob(String columnLabel, Reader reader) throws SQLException {
updateClob(columnLabel, reader);
}
-
+
/**
* Defaults to the index-based version of this method.
* The given column name is mapped to a column index by {@link #findColumn(String)}.
@@ -930,7 +930,7 @@ public abstract class DBFResultSet exten
public boolean wasNull() {
return wasNull;
}
-
+
/**
* Get a field description.
* @param columnLabel Column label.
Modified: sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/resultset/SQLIllegalColumnIndexException.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/resultset/SQLIllegalColumnIndexException.java?rev=1651061&r1=1651060&r2=1651061&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/resultset/SQLIllegalColumnIndexException.java [UTF-8] (original)
+++ sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/resultset/SQLIllegalColumnIndexException.java [UTF-8] Mon Jan 12 11:14:54 2015
@@ -13,13 +13,13 @@ public class SQLIllegalColumnIndexExcept
/** The SQL Statement (if known). */
private String sql;
-
+
/** The database file. */
private File database;
-
+
/** Column Index that is invalid. */
private int columnIndex;
-
+
/**
* Build the exception.
* @param message Exception message.
@@ -33,7 +33,7 @@ public class SQLIllegalColumnIndexExcept
database = dbf;
columnIndex = colIndex;
}
-
+
/**
* Returns the SQL statement.
* @return SQL statement or null.
@@ -41,7 +41,7 @@ public class SQLIllegalColumnIndexExcept
public String getSQL() {
return sql;
}
-
+
/**
* Returns the column index.
* @return Column index.
@@ -49,7 +49,7 @@ public class SQLIllegalColumnIndexExcept
public int getColumnIndex() {
return columnIndex;
}
-
+
/**
* Returns the database file.
* @return Database file.
Modified: sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/resultset/SQLNoResultException.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/resultset/SQLNoResultException.java?rev=1651061&r1=1651060&r2=1651061&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/resultset/SQLNoResultException.java [UTF-8] (original)
+++ sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/resultset/SQLNoResultException.java [UTF-8] Mon Jan 12 11:14:54 2015
@@ -29,10 +29,10 @@ public class SQLNoResultException extend
/** The SQL Statement that whas attempted. */
private String sql;
-
+
/** The database that was queried. */
private File database;
-
+
/**
* Build the exception.
* @param message Exception message.
@@ -44,7 +44,7 @@ public class SQLNoResultException extend
sql = sqlStatement;
database = dbf;
}
-
+
/**
* Returns the SQL statement who encountered the "end of data" alert.
* @return SQL statement.
@@ -52,7 +52,7 @@ public class SQLNoResultException extend
public String getSQL() {
return sql;
}
-
+
/**
* Returns the database file that was queried.
* @return The database that was queried.
Modified: sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/resultset/SQLNoSuchFieldException.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/resultset/SQLNoSuchFieldException.java?rev=1651061&r1=1651060&r2=1651061&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/resultset/SQLNoSuchFieldException.java [UTF-8] (original)
+++ sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/resultset/SQLNoSuchFieldException.java [UTF-8] Mon Jan 12 11:14:54 2015
@@ -29,13 +29,13 @@ public class SQLNoSuchFieldException ext
/** The SQL Statement (if known). */
private String sql;
-
+
/** The database file. */
private File database;
-
+
/** Column name that doesn't exist. */
private String columnName;
-
+
/**
* Build the exception.
* @param message Exception message.
@@ -49,7 +49,7 @@ public class SQLNoSuchFieldException ext
database = dbf;
columnName = colName;
}
-
+
/**
* Returns the SQL statement.
* @return SQL statement or null.
@@ -57,7 +57,7 @@ public class SQLNoSuchFieldException ext
public String getSQL() {
return sql;
}
-
+
/**
* Returns the column name that doesn't exist.
* @return Column name.
@@ -65,7 +65,7 @@ public class SQLNoSuchFieldException ext
public String getColumnName() {
return columnName;
}
-
+
/**
* Returns the database file.
* @return Database file.
Modified: sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/resultset/SQLNotDateException.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/resultset/SQLNotDateException.java?rev=1651061&r1=1651060&r2=1651061&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/resultset/SQLNotDateException.java [UTF-8] (original)
+++ sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/resultset/SQLNotDateException.java [UTF-8] Mon Jan 12 11:14:54 2015
@@ -29,16 +29,16 @@ public class SQLNotDateException extends
/** The SQL Statement (if known). */
private String sql;
-
+
/** The database file. */
private File database;
-
+
/** Column name. */
private String columnName;
-
+
/** The value that is not numeric. */
private String value;
-
+
/**
* Build the exception.
* @param message Exception message.
@@ -54,7 +54,7 @@ public class SQLNotDateException extends
columnName = colName;
value = wrongValue;
}
-
+
/**
* Returns the SQL statement.
* @return SQL statement or null.
@@ -62,7 +62,7 @@ public class SQLNotDateException extends
public String getSQL() {
return sql;
}
-
+
/**
* Returns the column name.
* @return Column name.
@@ -70,7 +70,7 @@ public class SQLNotDateException extends
public String getColumnName() {
return columnName;
}
-
+
/**
* Returns the value that is not numeric.
* @return Value.
@@ -78,7 +78,7 @@ public class SQLNotDateException extends
public String getValue() {
return value;
}
-
+
/**
* Returns the database file.
* @return Database file.
Modified: sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/resultset/SQLNotNumericException.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/resultset/SQLNotNumericException.java?rev=1651061&r1=1651060&r2=1651061&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/resultset/SQLNotNumericException.java [UTF-8] (original)
+++ sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/resultset/SQLNotNumericException.java [UTF-8] Mon Jan 12 11:14:54 2015
@@ -29,16 +29,16 @@ public class SQLNotNumericException exte
/** The SQL Statement (if known). */
private String sql;
-
+
/** The database file. */
private File database;
-
+
/** Column name. */
private String columnName;
-
+
/** The value that is not numeric. */
private String value;
-
+
/**
* Build the exception.
* @param message Exception message.
@@ -54,7 +54,7 @@ public class SQLNotNumericException exte
columnName = colName;
value = wrongValue;
}
-
+
/**
* Returns the SQL statement.
* @return SQL statement or null.
@@ -62,7 +62,7 @@ public class SQLNotNumericException exte
public String getSQL() {
return sql;
}
-
+
/**
* Returns the column name.
* @return Column name.
@@ -70,7 +70,7 @@ public class SQLNotNumericException exte
public String getColumnName() {
return columnName;
}
-
+
/**
* Returns the value that is not numeric.
* @return Value.
@@ -78,7 +78,7 @@ public class SQLNotNumericException exte
public String getValue() {
return value;
}
-
+
/**
* Returns the database file.
* @return Database file.
Modified: sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/resultset/package-info.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/resultset/package-info.java?rev=1651061&r1=1651060&r2=1651061&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/resultset/package-info.java [UTF-8] (original)
+++ sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/resultset/package-info.java [UTF-8] Mon Jan 12 11:14:54 2015
@@ -16,6 +16,6 @@
*/
/**
- * Result sets for SQL statements and DB Metadata querying.
+ * Result sets for SQL statements and DB Metadata querying.
*/
-package org.apache.sis.internal.shapefile.jdbc.resultset;
\ No newline at end of file
+package org.apache.sis.internal.shapefile.jdbc.resultset;
Modified: sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/sql/ClauseResolver.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/sql/ClauseResolver.java?rev=1651061&r1=1651060&r2=1651061&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/sql/ClauseResolver.java [UTF-8] (original)
+++ sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/sql/ClauseResolver.java [UTF-8] Mon Jan 12 11:14:54 2015
@@ -31,13 +31,13 @@ import org.apache.sis.internal.shapefile
public abstract class ClauseResolver extends AutoChecker {
/** First comparand. */
private Object comparand1;
-
+
/** Second comparand. */
private Object comparand2;
-
+
/** Operator. */
private String operator;
-
+
/**
* Construct a where clause resolver.
* @param cmp1 The first comparand that might be a primitive or a Field.
@@ -97,11 +97,11 @@ public abstract class ClauseResolver ext
public void setOperator(String op) {
operator = op;
}
-
+
/**
* Check if a condition is verified.
* @param rs ResultSet where the value shall be taken.
- * @return true if the current record of the ResultSet matches this condition.
+ * @return true if the current record of the ResultSet matches this condition.
* @throws SQLInvalidStatementException if the operator is not valid.
* @throws SQLIllegalParameterException if a parameter has a value that is not parsable.
* @throws SQLNoSuchFieldException if a field name doesn't exist in the query.
@@ -115,25 +115,25 @@ public abstract class ClauseResolver ext
switch(getOperator()) {
case "=" :
return compare(rs) == 0;
-
+
case ">" :
return compare(rs) > 0;
-
+
case ">=" :
return compare(rs) >= 0;
-
+
case "<" :
return compare(rs) < 0;
-
+
case "<=" :
return compare(rs) <= 0;
-
+
default :
String message = format(Level.WARNING, "excp.invalid_statement_operator", getOperator(), rs.getSQL());
throw new SQLInvalidStatementException(message, rs.getSQL(), rs.getFile());
}
}
-
+
/**
* Returns true if this condition is verified.
* @param rs The record containing the values to extract, if needed.
@@ -149,7 +149,7 @@ public abstract class ClauseResolver ext
private int compare(DBFRecordBasedResultSet rs) throws SQLIllegalParameterException, SQLNoSuchFieldException, SQLUnsupportedParsingFeatureException, SQLConnectionClosedException, SQLNotNumericException, SQLNotDateException {
Object value1 = valueOf(rs, getComparand1());
Object value2 = valueOf(rs, getComparand2());
-
+
// Handle NULL value cases.
if (value1 == null && value2 == null)
return 0;
@@ -163,9 +163,9 @@ public abstract class ClauseResolver ext
return 1;
}
}
-
+
assert(value1 != null && value2 != null) : "Null values should have been handled in comparison.";
-
+
// If comparands have already the same type, compare them immediately.
if (value1.getClass().equals(value2.getClass())) {
return compare(rs, value1, value2);
@@ -178,16 +178,16 @@ public abstract class ClauseResolver ext
compare = compare != null ? compare : compareIfPromoted(rs, value1, value2, Short.class, Long.class, Long::valueOf);
compare = compare != null ? compare : compareIfPromoted(rs, value1, value2, Short.class, Float.class, Float::valueOf);
compare = compare != null ? compare : compareIfPromoted(rs, value1, value2, Short.class, Double.class, Double::valueOf);
-
+
// Promote Integer to Long, Float or Double.
compare = compare != null ? compare : compareIfPromoted(rs, value1, value2, Integer.class, Long.class, Long::valueOf);
compare = compare != null ? compare : compareIfPromoted(rs, value1, value2, Integer.class, Float.class, Float::valueOf);
compare = compare != null ? compare : compareIfPromoted(rs, value1, value2, Integer.class, Double.class, Double::valueOf);
-
+
// Promote Long to Float or Double.
compare = compare != null ? compare : compareIfPromoted(rs, value1, value2, Long.class, Float.class, Float::valueOf);
compare = compare != null ? compare : compareIfPromoted(rs, value1, value2, Long.class, Double.class, Double::valueOf);
-
+
// Promote Float to Double.
compare = compare != null ? compare : compareIfPromoted(rs, value1, value2, Float.class, Double.class, Double::valueOf);
@@ -202,7 +202,7 @@ public abstract class ClauseResolver ext
return compare;
}
}
-
+
/**
* Perform a comparison after having attempted to promote compared types : one of the parameter must belongs to one class and the other
* one to the second one to allow the conversion and comparison to be done, else a null value will be returned, meaning that no promotion were possible.
@@ -220,9 +220,9 @@ public abstract class ClauseResolver ext
private <W, B> Integer compareIfPromoted(DBFRecordBasedResultSet rs, Object value1, Object value2, Class<W> worstHas, Class<B> bestHas, Function<W, B> promoter) throws SQLUnsupportedParsingFeatureException {
boolean w1 = value1.getClass().equals(worstHas);
boolean b1 = value1.getClass().equals(bestHas);
- boolean w2 = value2.getClass().equals(worstHas);
+ boolean w2 = value2.getClass().equals(worstHas);
boolean b2 = value2.getClass().equals(bestHas);
-
+
// if the values has the same class, they should have been already compared. But let's to it.
if ((w1 && w2) || (b1 && b2))
return compare(rs, value1, value2);
@@ -233,7 +233,7 @@ public abstract class ClauseResolver ext
return null;
else {
assert((w1 != b1 && w2 != b2) && (w1 != w2 && b1 != b2)) : "Parameters are not of different types.";
-
+
// Suppress the warnings because we have done the checkings before.
@SuppressWarnings("unchecked") B sameType1 = w1 ? promoter.apply((W)value1) : (B)value1;
@SuppressWarnings("unchecked") B sameType2 = w2 ? promoter.apply((W)value2) : (B)value2;
@@ -241,7 +241,7 @@ public abstract class ClauseResolver ext
}
}
}
-
+
/**
* Compare two values of the same type.
* @param <T> Class of their type.
@@ -249,27 +249,27 @@ public abstract class ClauseResolver ext
* @param value1 First comparand.
* @param value2 Second comparand.
* @return Result of the comparison.
- * @throws SQLUnsupportedParsingFeatureException if this type doesn't implements {link #java.lang.Comparable} and cannot be handled by this driver.
+ * @throws SQLUnsupportedParsingFeatureException if this type doesn't implements {link #java.lang.Comparable} and cannot be handled by this driver.
*/
@SuppressWarnings({"rawtypes", "unchecked"}) // Wished : Types are checked by the caller.
private <T> int compare(DBFRecordBasedResultSet rs, T value1, T value2) throws SQLUnsupportedParsingFeatureException {
Comparable comparable1 = null;
Comparable comparable2 = null;
-
+
if (value1 instanceof Comparable<?>) {
comparable1 = (Comparable)value1;
}
-
+
if (value2 instanceof Comparable<?>) {
comparable2 = (Comparable)value2;
}
-
+
// If one of the comparands doesn't belong to java.lang.Comparable, our driver is taken short.
if (comparable1 == null) {
String message = format(Level.WARNING, "excp.uncomparable_type", value1, value1.getClass().getName(), rs.getSQL());
throw new SQLUnsupportedParsingFeatureException(message, rs.getSQL(), rs.getFile());
}
-
+
if (comparable2 == null) {
String message = format(Level.WARNING, "excp.uncomparable_type", value2, value2.getClass().getName(), rs.getSQL());
throw new SQLUnsupportedParsingFeatureException(message, rs.getSQL(), rs.getFile());
@@ -277,15 +277,15 @@ public abstract class ClauseResolver ext
return comparable1.compareTo(comparable2);
}
-
+
/**
* Returns the value of a comparand.
* @param rs ResultSet.
* @param comparand Comparand.
- * @return Value of that comparand :
+ * @return Value of that comparand :
* <br>- itself, it is a primitive type or an enclosed string.
* <br>-a field value if the given string is not enclosed by ' characters : the parser see it a field name, then.
- * @throws SQLIllegalParameterException if a literal string value is not well enclosed by '...'.
+ * @throws SQLIllegalParameterException if a literal string value is not well enclosed by '...'.
* @throws SQLNoSuchFieldException if the comparand designs a field name that doesn't exist.
* @throws SQLNotDateException if a field announced being a date isn't.
* @throws SQLUnsupportedParsingFeatureException if the driver encounter a type it cannot handle.
@@ -295,7 +295,7 @@ public abstract class ClauseResolver ext
private Object valueOf(DBFRecordBasedResultSet rs, Object comparand) throws SQLIllegalParameterException, SQLNoSuchFieldException, SQLConnectionClosedException, SQLNotNumericException, SQLUnsupportedParsingFeatureException, SQLNotDateException {
Objects.requireNonNull(rs, "ResultSet cannot be null when taking the value of a ResultSet comparand.");
Objects.requireNonNull(comparand, "Comparand cannot be null.");
-
+
// All comparands that are litterals are returned as they are.
if (comparand instanceof String == false)
return comparand;
@@ -305,16 +305,16 @@ public abstract class ClauseResolver ext
// If the field is enclosed by ' characters, it is considered a litteral too, but these ' are removed before returning the string.
boolean wannaBeLiteral = text.startsWith("'") || text.endsWith("'"); // A ' at the beginning or the end.
- boolean uncompleteLiteral = text.startsWith("'") == false || text.endsWith("'") == false || text.length() < 2; // But not at the two sides, or a string made of a single one.
-
+ boolean uncompleteLiteral = text.startsWith("'") == false || text.endsWith("'") == false || text.length() < 2; // But not at the two sides, or a string made of a single one.
+
if (wannaBeLiteral) {
if (wannaBeLiteral && uncompleteLiteral) {
String message = format(Level.WARNING, "excp.illegal_parameter_where", text, rs.getSQL());
throw new SQLIllegalParameterException(message, rs.getSQL(), rs.getFile(), "literal", text);
}
-
- assert(text.indexOf("'") == 0 && text.indexOf("'") < text.lastIndexOf("'") && text.lastIndexOf("'") == text.length()-1 && text.length() >= 2) : "The litteral string is not enclosed into '...'";
-
+
+ assert(text.indexOf("'") == 0 && text.indexOf("'") < text.lastIndexOf("'") && text.lastIndexOf("'") == text.length()-1 && text.length() >= 2) : "The litteral string is not enclosed into '...'";
+
String literal = text.substring(1, text.length()-1);
return literal;
}
@@ -325,7 +325,7 @@ public abstract class ClauseResolver ext
}
}
}
-
+
/**
* Returns the field value in a ResultSet.
* @param rs ResultSet.
@@ -339,27 +339,27 @@ public abstract class ClauseResolver ext
*/
private Object valueOf(DBFRecordBasedResultSet rs, DBFBuiltInMemoryResultSetForColumnsListing field) throws SQLConnectionClosedException, SQLNoSuchFieldException, SQLNotNumericException, SQLUnsupportedParsingFeatureException, SQLNotDateException {
String columnName = field.getString("COLUMN_NAME");
-
+
switch(field.getString("TYPE_NAME")) {
case "AUTO_INCREMENT":
return rs.getInt(columnName);
-
+
case "CHAR":
return rs.getString(columnName);
-
+
case "INTEGER":
return rs.getInt(columnName);
-
+
case "DATE":
return rs.getDate(columnName);
-
+
case "DOUBLE":
return rs.getDouble(columnName);
-
+
case "FLOAT":
return rs.getFloat(columnName);
-
-
+
+
case "DECIMAL": {
// Choose Integer or Long type, if no decimal and that the field is not to big.
if (field.getInt("DECIMAL_DIGITS") == 0 && field.getInt("COLUMN_SIZE") <= 18) {
@@ -368,10 +368,10 @@ public abstract class ClauseResolver ext
else
return rs.getLong(columnName);
}
-
+
return rs.getDouble(columnName);
}
-
+
case "BOOLEAN":
case "CURRENCY":
case "DATETIME":
@@ -383,7 +383,7 @@ public abstract class ClauseResolver ext
case "UNKNOWN":
String message = format(Level.WARNING, "excp.unparsable_field_type", columnName, field.getString("TYPE_NAME"), rs.getSQL());
throw new SQLUnsupportedParsingFeatureException(message, rs.getSQL(), rs.getFile());
-
+
default:
throw new RuntimeException(format(Level.WARNING, "assert.unknown_field_type", field.getString("TYPE_NAME")));
}
Modified: sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/sql/ConditionalClauseResolver.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/sql/ConditionalClauseResolver.java?rev=1651061&r1=1651060&r2=1651061&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/sql/ConditionalClauseResolver.java [UTF-8] (original)
+++ sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/sql/ConditionalClauseResolver.java [UTF-8] Mon Jan 12 11:14:54 2015
@@ -21,7 +21,7 @@ package org.apache.sis.internal.shapefil
* <br>- Only resolve comparison of simple statements like F = 2, not those involving intermediate calculations (F + 4 = 6).
* <br>- Only resolve a part of an expression : in "A = 5 and (B = 3 or C = 6)" will treat A = 5, for example.
* <br>- If many clauseResolvers are chained, operator precedence checking has to be done by the caller.
- * <br>- This class is only here temporary, and will be replaced by a good SQL parser as soon as possible.
+ * <br>- This class is only here temporary, and will be replaced by a good SQL parser as soon as possible.
* @author Marc LE BIHAN
*/
public class ConditionalClauseResolver extends ClauseResolver