You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jena.apache.org by rv...@apache.org on 2013/04/24 02:22:28 UTC
svn commit: r1471213 - in /jena/Experimental/jena-jdbc: ./ jena-jdbc-core/
jena-jdbc-core/src/main/java/org/apache/jena/jdbc/logging/
jena-jdbc-core/src/main/java/org/apache/jena/jdbc/metadata/
jena-jdbc-core/src/main/java/org/apache/jena/jdbc/metadata...
Author: rvesse
Date: Wed Apr 24 00:22:26 2013
New Revision: 1471213
URL: http://svn.apache.org/r1471213
Log:
Lots more metadata reporting, use AspectJ to add method level trace logging to aid debugging against JDBC tooling
Added:
jena/Experimental/jena-jdbc/jena-jdbc-core/src/main/java/org/apache/jena/jdbc/logging/
jena/Experimental/jena-jdbc/jena-jdbc-core/src/main/java/org/apache/jena/jdbc/logging/MethodTraceLogger.aj
Modified:
jena/Experimental/jena-jdbc/jena-jdbc-core/pom.xml
jena/Experimental/jena-jdbc/jena-jdbc-core/src/main/java/org/apache/jena/jdbc/metadata/JenaMetadata.java
jena/Experimental/jena-jdbc/jena-jdbc-core/src/main/java/org/apache/jena/jdbc/metadata/MetadataSchema.java
jena/Experimental/jena-jdbc/jena-jdbc-core/src/main/java/org/apache/jena/jdbc/metadata/results/MetaResultSet.java
jena/Experimental/jena-jdbc/jena-jdbc-driver-remote/src/main/java/org/apache/jena/jdbc/remote/connections/RemoteEndpointConnection.java
jena/Experimental/jena-jdbc/jena-jdbc-driver-remote/src/main/java/org/apache/jena/jdbc/remote/metadata/RemoteEndpointMetadata.java
jena/Experimental/jena-jdbc/jena-jdbc-driver-tdb/src/main/java/org/apache/jena/jdbc/tdb/metadata/TDBDatasetMetadata.java
jena/Experimental/jena-jdbc/pom.xml
Modified: jena/Experimental/jena-jdbc/jena-jdbc-core/pom.xml
URL: http://svn.apache.org/viewvc/jena/Experimental/jena-jdbc/jena-jdbc-core/pom.xml?rev=1471213&r1=1471212&r2=1471213&view=diff
==============================================================================
--- jena/Experimental/jena-jdbc/jena-jdbc-core/pom.xml (original)
+++ jena/Experimental/jena-jdbc/jena-jdbc-core/pom.xml Wed Apr 24 00:22:26 2013
@@ -41,6 +41,7 @@
</resource>
</resources>
<plugins>
+ <!-- JAR plugin so we build tests JAR -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
Added: jena/Experimental/jena-jdbc/jena-jdbc-core/src/main/java/org/apache/jena/jdbc/logging/MethodTraceLogger.aj
URL: http://svn.apache.org/viewvc/jena/Experimental/jena-jdbc/jena-jdbc-core/src/main/java/org/apache/jena/jdbc/logging/MethodTraceLogger.aj?rev=1471213&view=auto
==============================================================================
--- jena/Experimental/jena-jdbc/jena-jdbc-core/src/main/java/org/apache/jena/jdbc/logging/MethodTraceLogger.aj (added)
+++ jena/Experimental/jena-jdbc/jena-jdbc-core/src/main/java/org/apache/jena/jdbc/logging/MethodTraceLogger.aj Wed Apr 24 00:22:26 2013
@@ -0,0 +1,85 @@
+/**
+ * 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.jena.jdbc.logging;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * This AspectJ aspect is responsible for telling us when our methods are
+ * entered and exit. It is used to log trace level events on method entry and
+ * exit which are useful when debugging JDBC drivers to see why some
+ * functionality does not work as expected
+ *
+ */
+public aspect MethodTraceLogger {
+ private static final Logger LOGGER = LoggerFactory.getLogger(MethodTraceLogger.class);
+
+ private static final int CLIENT_CODE_STACK_INDEX;
+
+ static {
+ // Finds out the index of "this code" in the returned stack trace -
+ // funny but it differs in JDK 1.5 and 1.6
+ int i = 0;
+ for (StackTraceElement ste : Thread.currentThread().getStackTrace()) {
+ i++;
+ if (ste.getClassName().equals(MethodTraceLogger.class.getName())) {
+ break;
+ }
+ }
+ CLIENT_CODE_STACK_INDEX = i;
+ }
+
+ /**
+ * Select all packages whose correctness is not impacted by the advice.
+ * Determined empirically
+ */
+ pointcut safePkg() :
+ execution( * org.apache.jena.jdbc..*(..))
+;
+
+ before(): safePkg() {
+ if (LOGGER.isTraceEnabled())
+ LOGGER.trace("Jena JDBC Method Entry: {} ", MethodTraceLogger.fullyQualifiedMethodName());
+ } // end Advice
+
+ after(): safePkg() {
+ if (LOGGER.isTraceEnabled())
+ LOGGER.trace("Jena JDBC Method Exit: {} ", MethodTraceLogger.fullyQualifiedMethodName());
+ }
+
+ /**
+ * Gets the fully qualified method name of the calling method via inspection
+ * of the current threads stack
+ *
+ * @return Method Name or null if not determinable
+ */
+ public static String fullyQualifiedMethodName() {
+ StackTraceElement[] stack = Thread.currentThread().getStackTrace();
+ if (stack.length <= CLIENT_CODE_STACK_INDEX + 1) {
+ // If the stack is this length then we have been called directly not
+ // from another method so can't return anything
+ return null;
+ }
+ // The current method will be at element 0 so our calling method will be
+ // at element 1
+ StackTraceElement element = stack[CLIENT_CODE_STACK_INDEX + 1];
+ return element.getClassName() + "." + element.getMethodName() + "() from " + element.getFileName() + " Line " + element.getLineNumber();
+ }
+}
Modified: jena/Experimental/jena-jdbc/jena-jdbc-core/src/main/java/org/apache/jena/jdbc/metadata/JenaMetadata.java
URL: http://svn.apache.org/viewvc/jena/Experimental/jena-jdbc/jena-jdbc-core/src/main/java/org/apache/jena/jdbc/metadata/JenaMetadata.java?rev=1471213&r1=1471212&r2=1471213&view=diff
==============================================================================
--- jena/Experimental/jena-jdbc/jena-jdbc-core/src/main/java/org/apache/jena/jdbc/metadata/JenaMetadata.java (original)
+++ jena/Experimental/jena-jdbc/jena-jdbc-core/src/main/java/org/apache/jena/jdbc/metadata/JenaMetadata.java Wed Apr 24 00:22:26 2013
@@ -20,11 +20,16 @@ package org.apache.jena.jdbc.metadata;
import java.sql.Connection;
import java.sql.DatabaseMetaData;
+import java.sql.Date;
import java.sql.ResultSet;
import java.sql.RowIdLifetime;
import java.sql.SQLException;
import java.sql.SQLFeatureNotSupportedException;
+import java.sql.Types;
+import java.util.ArrayList;
+import java.util.List;
+import org.apache.jena.atlas.lib.StrUtils;
import org.apache.jena.jdbc.connections.JenaConnection;
import org.apache.jena.jdbc.metadata.results.MetaResultSet;
@@ -59,6 +64,35 @@ public abstract class JenaMetadata imple
protected static final int UNKNOWN_LIMIT = 0;
+ /**
+ * Constants for SPARQL Keywords
+ */
+ protected static final String[] SPARQL_KEYWORDS = new String[] { "BASE", "PREFIX", "SELECT", "DISTINCT", "REDUCED", "AS",
+ "CONSTRUCT", "DESCRIBE", "ASK", "FROM", "NAMED", "WHERE", "GROUP", "BY", "HAVING", "ORDER", "ASC", "DESC", "LIMIT",
+ "OFFSET", "VALUES", "LOAD", "SILENT", "INTO", "GRAPH", "CLEAR", "DROP", "CREATE", "ADD", "MOVE", "COPY",
+ "INSERT DATA", "DELETE DATA", "DELETE WHERE", "WITH", "INSERT", "USING", "DEFAULT", "ALL", "OPTIONAL", "SERVICE",
+ "BIND", "UNION", "UNDEF", "MINUS", "EXISTS", "NOT EXISTS", "FILTER", "a", "IN", "NOT IN", "STR", "LANG",
+ "LANGMATCHES", "DATATYPE", "BOUND", "IRI", "URI", "BNODE", "RAND", "ABS", "CEIL", "FLOOR", "ROUND", "CONCAT",
+ "STRLEN", "UCASE", "LCASE", "ENCODE_FOR_URI", "CONTAINS", "STRSTARTS", "STRENDS", "STRBEFORE", "STRAFTER", "YEAR",
+ "MONTH", "DAY", "HOURS", "MINUTES", "SECONDS", "TIMEZONE", "TZ", "NOW", "UUID", "STRUUID", "MD5", "SHA1", "SHA256",
+ "SHA384", "SHA512", "COALESCE", "IF", "STRLANG", "STRDT", "SAMETERM", "ISIRI", "ISURI", "ISBLANK", "REGEX", "SUBSTR",
+ "REPLACE", "COUNT", "SUM", "MIN", "MAX", "AVG", "SAMPLE", "GROUP_CONCAT", "SEPARATOR", "true", "false" };
+
+ /**
+ * Constants for SPARQL numeric functions
+ */
+ protected static final String[] SPARQL_NUMERIC_FUNCTIONS = new String[] { "ABS", "CEIL", "FLOOR", "RAND", "ROUND" };
+
+ /**
+ * Constants for SPARQL string functions
+ */
+ protected static final String[] SPARQL_STR_FUNCTIONS = new String[] { "STR", "LANG", "LANGMATCHES", "CONCAT", "STRLEN",
+ "UCASE", "LCASE", "ENCODE_FOR_URI", "CONTAINS", "STRSTARTS", "STRENDS", "STRBEFORE", "STRAFTER", "REGEX", "SUBSTR",
+ "REPLACE" };
+
+ protected static final String[] SPARQL_DATETIME_FUNCTIONS = new String[] { "YEAR", "MONTH", "DAY", "HOURS", "MINUTES",
+ "SECONDS", "TIMEZONE", "TZ", "NOW" };
+
private JenaConnection connection;
/**
@@ -74,6 +108,10 @@ public abstract class JenaMetadata imple
this.connection = connection;
}
+ public JenaConnection getJenaConnection() {
+ return this.connection;
+ }
+
@Override
public boolean isWrapperFor(Class<?> arg0) throws SQLException {
throw new SQLFeatureNotSupportedException();
@@ -177,8 +215,7 @@ public abstract class JenaMetadata imple
@Override
public ResultSet getCrossReference(String arg0, String arg1, String arg2, String arg3, String arg4, String arg5)
throws SQLException {
- // TODO Auto-generated method stub
- return null;
+ return new MetaResultSet(MetadataSchema.getCrossReferenceColumns());
}
@Override
@@ -212,28 +249,24 @@ public abstract class JenaMetadata imple
@Override
public ResultSet getExportedKeys(String arg0, String arg1, String arg2) throws SQLException {
- // TODO Auto-generated method stub
- return null;
+ return new MetaResultSet(MetadataSchema.getExportedKeyColumns());
}
@Override
public String getExtraNameCharacters() throws SQLException {
// Since SPARQL doesn't really have a notion of identifiers like SQL
- // does
- // we return that there are no extra name characters
+ // does we return that there are no extra name characters
return "";
}
@Override
public ResultSet getFunctionColumns(String arg0, String arg1, String arg2, String arg3) throws SQLException {
- // TODO Auto-generated method stub
- return null;
+ return new MetaResultSet(MetadataSchema.getFunctionColumnColumns());
}
@Override
public ResultSet getFunctions(String arg0, String arg1, String arg2) throws SQLException {
- // TODO Auto-generated method stub
- return null;
+ return new MetaResultSet(MetadataSchema.getFunctionColumns());
}
@Override
@@ -244,14 +277,12 @@ public abstract class JenaMetadata imple
@Override
public ResultSet getImportedKeys(String arg0, String arg1, String arg2) throws SQLException {
- // TODO Auto-generated method stub
- return null;
+ return new MetaResultSet(MetadataSchema.getImportedKeyColumns());
}
@Override
public ResultSet getIndexInfo(String arg0, String arg1, String arg2, boolean arg3, boolean arg4) throws SQLException {
- // TODO Auto-generated method stub
- return null;
+ return new MetaResultSet(MetadataSchema.getIndexInfoColumns());
}
@Override
@@ -297,9 +328,9 @@ public abstract class JenaMetadata imple
@Override
public int getMaxColumnsInIndex() throws SQLException {
- // RDF stores typically index on up to 3 columns since there are only 4
- // columns
- return 3;
+ // RDF stores typically index on up to 4 columns since that is all we
+ // have
+ return 4;
}
@Override
@@ -389,20 +420,17 @@ public abstract class JenaMetadata imple
@Override
public String getNumericFunctions() throws SQLException {
- // TODO Auto-generated method stub
- return null;
+ return StrUtils.strjoin(",", SPARQL_NUMERIC_FUNCTIONS);
}
@Override
public ResultSet getPrimaryKeys(String arg0, String arg1, String arg2) throws SQLException {
- // TODO Auto-generated method stub
- return null;
+ return new MetaResultSet(MetadataSchema.getPrimaryKeyColumns());
}
@Override
public ResultSet getProcedureColumns(String arg0, String arg1, String arg2, String arg3) throws SQLException {
- // TODO Auto-generated method stub
- return null;
+ return new MetaResultSet(MetadataSchema.getProcedureColumnColumns());
}
@Override
@@ -413,8 +441,7 @@ public abstract class JenaMetadata imple
@Override
public ResultSet getProcedures(String arg0, String arg1, String arg2) throws SQLException {
- // TODO Auto-generated method stub
- return null;
+ return new MetaResultSet(MetadataSchema.getProcedureColumns());
}
@Override
@@ -431,8 +458,8 @@ public abstract class JenaMetadata imple
@Override
public String getSQLKeywords() throws SQLException {
// TODO Use http://developer.mimer.com/validator/sql-reserved-words.tml
- // as a reference to implement this
- return null;
+ // as a reference to remove those that also count as SQL Keywords
+ return StrUtils.strjoin(",", SPARQL_KEYWORDS);
}
@Override
@@ -447,14 +474,20 @@ public abstract class JenaMetadata imple
@Override
public ResultSet getSchemas() throws SQLException {
- // TODO Auto-generated method stub
- return null;
+ return new MetaResultSet(MetadataSchema.getSchemaColumns(), new Object[][] { { DEFAULT_SCHEMA, DEFAULT_CATALOG } });
}
@Override
- public ResultSet getSchemas(String arg0, String arg1) throws SQLException {
- // TODO Auto-generated method stub
- return null;
+ public ResultSet getSchemas(String catalog, String schemaPattern) throws SQLException {
+ if (DEFAULT_CATALOG.equals(catalog)) {
+ if (schemaPattern == null || DEFAULT_SCHEMA.equals(schemaPattern)) {
+ return this.getSchemas();
+ } else {
+ return new MetaResultSet(MetadataSchema.getSchemaColumns());
+ }
+ } else {
+ return new MetaResultSet(MetadataSchema.getSchemaColumns());
+ }
}
@Override
@@ -465,26 +498,23 @@ public abstract class JenaMetadata imple
@Override
public String getStringFunctions() throws SQLException {
- // TODO Auto-generated method stub
- return null;
+ return StrUtils.strjoin(",", SPARQL_STR_FUNCTIONS);
}
@Override
public ResultSet getSuperTables(String arg0, String arg1, String arg2) throws SQLException {
- // TODO Auto-generated method stub
- return null;
+ return new MetaResultSet(MetadataSchema.getSuperTableColumns());
}
@Override
public ResultSet getSuperTypes(String arg0, String arg1, String arg2) throws SQLException {
- // TODO Auto-generated method stub
- return null;
+ return new MetaResultSet(MetadataSchema.getSuperTypeColumns());
}
@Override
public String getSystemFunctions() throws SQLException {
- // TODO Auto-generated method stub
- return null;
+ // No system functions supported
+ return "";
}
@Override
@@ -507,14 +537,47 @@ public abstract class JenaMetadata imple
@Override
public String getTimeDateFunctions() throws SQLException {
- // TODO Auto-generated method stub
- return null;
+ return StrUtils.strjoin(",", SPARQL_DATETIME_FUNCTIONS);
}
@Override
public ResultSet getTypeInfo() throws SQLException {
- // TODO Auto-generated method stub
- return null;
+ // TYPE_NAME String => Type name
+ // DATA_TYPE int => SQL data type from java.sql.Types
+ // PRECISION int => maximum precision
+ // LITERAL_PREFIX String => prefix used to quote a literal (may be null)
+ // LITERAL_SUFFIX String => suffix used to quote a literal (may be null)
+ // CREATE_PARAMS String => parameters used in creating the type (may be
+ // null)
+ // NULLABLE short => can you use NULL for this type.
+ // typeNoNulls - does not allow NULL values
+ // typeNullable - allows NULL values
+ // typeNullableUnknown - nullability unknown
+ // CASE_SENSITIVE boolean=> is it case sensitive.
+ // SEARCHABLE short => can you use "WHERE" based on this type:
+ // typePredNone - No support
+ // typePredChar - Only supported with WHERE .. LIKE
+ // typePredBasic - Supported except for WHERE .. LIKE
+ // typeSearchable - Supported for all WHERE ..
+ // UNSIGNED_ATTRIBUTE boolean => is it unsigned.
+ // FIXED_PREC_SCALE boolean => can it be a money value.
+ // AUTO_INCREMENT boolean => can it be used for an auto-increment value.
+ // LOCAL_TYPE_NAME String => localized version of type name (may be
+ // null)
+ // MINIMUM_SCALE short => minimum scale supported
+ // MAXIMUM_SCALE short => maximum scale supported
+ // SQL_DATA_TYPE int => unused
+ // SQL_DATETIME_SUB int => unused
+ // NUM_PREC_RADIX int => usually 2 or 10
+
+ //TODO: Report types we can marshal as appropriate
+ return new MetaResultSet(MetadataSchema.getTypeInfoColumns(),
+ new Object[][] {
+ { Boolean.class.getName(), Types.BOOLEAN, 0, null, null, null, (short)typeNullable, false, (short)typeSearchable, false, false, false, null, (short)0, (short)0, 0, 0, 0 },
+ { Byte.class.getName(), Types.TINYINT, 0, "\"", "\"", null, (short)typeNullable, false, (short)typeSearchable, false, false, false, null, (short)0, (short)0, 0, 0, 0 },
+ { Date.class.getName(), Types.DATE, 0, "\"", "\"", null, (short)typeNullable, false, (short)typeSearchable, false, false, false, null, (short)0, (short)0, 0, 0, 0 },
+ { String.class.getName(), Types.NVARCHAR, 0, "\"", "\"", null, (short)typeNullable, true, (short)typeSearchable, false, false, false, null, (short)0, (short)0, 0, 0, 0 }
+ });
}
@Override
Modified: jena/Experimental/jena-jdbc/jena-jdbc-core/src/main/java/org/apache/jena/jdbc/metadata/MetadataSchema.java
URL: http://svn.apache.org/viewvc/jena/Experimental/jena-jdbc/jena-jdbc-core/src/main/java/org/apache/jena/jdbc/metadata/MetadataSchema.java?rev=1471213&r1=1471212&r2=1471213&view=diff
==============================================================================
--- jena/Experimental/jena-jdbc/jena-jdbc-core/src/main/java/org/apache/jena/jdbc/metadata/MetadataSchema.java (original)
+++ jena/Experimental/jena-jdbc/jena-jdbc-core/src/main/java/org/apache/jena/jdbc/metadata/MetadataSchema.java Wed Apr 24 00:22:26 2013
@@ -23,6 +23,8 @@ import static java.sql.ResultSetMetaData
import java.sql.DatabaseMetaData;
import java.sql.SQLException;
+import org.apache.http.TruncatedChunkException;
+import org.apache.jena.jdbc.results.metadata.columns.BooleanColumn;
import org.apache.jena.jdbc.results.metadata.columns.ColumnInfo;
import org.apache.jena.jdbc.results.metadata.columns.IntegerColumn;
import org.apache.jena.jdbc.results.metadata.columns.ShortIntegerColumn;
@@ -46,7 +48,9 @@ public class MetadataSchema {
private static boolean init = false;
private static ColumnInfo[] ATTRIBUTE_COLUMNS, BEST_ROW_IDENTIFIER_COLUMNS, CATALOG_COLUMNS, CLIENT_INFO_PROPERTY_COLUMNS,
- COLUMN_COLUMNS, COLUMN_PRIVILEGE_COLUMNS, UDT_COLUMNS;
+ COLUMN_COLUMNS, COLUMN_PRIVILEGE_COLUMNS, CROSS_REFERENCE_COLUMNS, EXPORTED_KEY_COLUMNS, FUNCTION_COLUMN_COLUMNS,
+ FUNCTION_COLUMNS, IMPORTED_KEY_COLUMNS, INDEX_INFO_COLUMNS, PRIMARY_KEY_COLUMNS, PROCEDURE_COLUMN_COLUMNS,
+ PROCEDURE_COLUMNS, SCHEMA_COLUMNS, SUPER_TABLE_COLUMNS, SUPER_TYPE_COLUMNS, TYPE_INFO_COLUMNS, UDT_COLUMNS;
/**
* Gets the columns for the
@@ -89,7 +93,7 @@ public class MetadataSchema {
public static ColumnInfo[] getClientInfoPropertyColumns() {
return CLIENT_INFO_PROPERTY_COLUMNS;
}
-
+
public static ColumnInfo[] getColumnColumns() {
return COLUMN_COLUMNS;
}
@@ -98,6 +102,58 @@ public class MetadataSchema {
return COLUMN_PRIVILEGE_COLUMNS;
}
+ public static ColumnInfo[] getCrossReferenceColumns() {
+ return CROSS_REFERENCE_COLUMNS;
+ }
+
+ public static ColumnInfo[] getExportedKeyColumns() {
+ return EXPORTED_KEY_COLUMNS;
+ }
+
+ public static ColumnInfo[] getFunctionColumnColumns() {
+ return FUNCTION_COLUMN_COLUMNS;
+ }
+
+ public static ColumnInfo[] getFunctionColumns() {
+ return FUNCTION_COLUMNS;
+ }
+
+ public static ColumnInfo[] getImportedKeyColumns() {
+ return IMPORTED_KEY_COLUMNS;
+ }
+
+ public static ColumnInfo[] getIndexInfoColumns() {
+ return INDEX_INFO_COLUMNS;
+ }
+
+ public static ColumnInfo[] getPrimaryKeyColumns() {
+ return PRIMARY_KEY_COLUMNS;
+ }
+
+ public static ColumnInfo[] getProcedureColumnColumns() {
+ return PROCEDURE_COLUMN_COLUMNS;
+ }
+
+ public static ColumnInfo[] getProcedureColumns() {
+ return PROCEDURE_COLUMNS;
+ }
+
+ public static ColumnInfo[] getSchemaColumns() {
+ return SCHEMA_COLUMNS;
+ }
+
+ public static ColumnInfo[] getSuperTableColumns() {
+ return SUPER_TABLE_COLUMNS;
+ }
+
+ public static ColumnInfo[] getSuperTypeColumns() {
+ return SUPER_TYPE_COLUMNS;
+ }
+
+ public static ColumnInfo[] getTypeInfoColumns() {
+ return TYPE_INFO_COLUMNS;
+ }
+
public static ColumnInfo[] getUdtColumns() {
return UDT_COLUMNS;
}
@@ -121,6 +177,7 @@ public class MetadataSchema {
try {
// Define all the columns we are going to use since some of these
// appear in multiple schema
+ ColumnInfo empty = new StringColumn("", columnNullable);
ColumnInfo typeCat = new StringColumn("TYPE_CATA", columnNullable);
ColumnInfo typeSchema = new StringColumn("TYPE_SCHEM", columnNullable);
ColumnInfo typeName = new StringColumn("TYPE_NAME", columnNoNulls);
@@ -149,6 +206,7 @@ public class MetadataSchema {
ColumnInfo bufferLength = new IntegerColumn("BUFFER_LENGTH", columnNoNulls, true);
ColumnInfo psuedoColumn = new ShortIntegerColumn("PSUEDO_COLUMN", columnNoNulls, true);
ColumnInfo tableCat = new StringColumn("TABLE_CAT", columnNullable);
+ ColumnInfo tableCatalog = new StringColumn("TABLE_CATALOG", columnNullable);
ColumnInfo tableSchema = new StringColumn("TABLE_SCHEM", columnNullable);
ColumnInfo tableName = new StringColumn("TABLE_NAME", columnNoNulls);
ColumnInfo name = new StringColumn("NAME", columnNoNulls);
@@ -162,6 +220,57 @@ public class MetadataSchema {
ColumnInfo grantee = new StringColumn("GRANTEE", columnNullable);
ColumnInfo privilege = new StringColumn("PRIVILEGE", columnNoNulls);
ColumnInfo isGrantable = new StringColumn("IS_GRANTABLE", columnNoNulls);
+ ColumnInfo pkTableCat = new StringColumn("PKTABLE_CAT", columnNullable);
+ ColumnInfo pkTableSchema = new StringColumn("PKTABLE_SCHEM", columnNullable);
+ ColumnInfo pkTableName = new StringColumn("PKTABLE_NAME", columnNoNulls);
+ ColumnInfo pkColumnName = new StringColumn("PKCOLUMN_NAME", columnNoNulls);
+ ColumnInfo fkTableCat = new StringColumn("FKTABLE_CAT", columnNullable);
+ ColumnInfo fkTableSchema = new StringColumn("FKTABLE_SCHEM", columnNullable);
+ ColumnInfo fkTableName = new StringColumn("FKTABLE_NAME", columnNoNulls);
+ ColumnInfo fkColumnName = new StringColumn("FKCOLUMN_NAME", columnNoNulls);
+ ColumnInfo keySeq = new ShortIntegerColumn("KEY_SEQ", columnNoNulls, true);
+ ColumnInfo updateRule = new ShortIntegerColumn("UPDATE_RULE", columnNoNulls, true);
+ ColumnInfo deleteRule = new ShortIntegerColumn("DELETE_RULE", columnNoNulls, true);
+ ColumnInfo fkName = new StringColumn("FK_NAME", columnNullable);
+ ColumnInfo pkName = new StringColumn("PK_NAME", columnNullable);
+ ColumnInfo deferrability = new ShortIntegerColumn("DEFERRABILITY", columnNoNulls, true);
+ ColumnInfo functionCat = new StringColumn("FUNCTION_CAT", columnNullable);
+ ColumnInfo functionSchema = new StringColumn("FUNCTION_SCHEM", columnNullable);
+ ColumnInfo functionName = new StringColumn("FUNCTION_NAME", columnNoNulls);
+ ColumnInfo columnType = new ShortIntegerColumn("COLUMN_TYPE", columnNoNulls, true);
+ ColumnInfo precision = new IntegerColumn("PRECISION", columnNoNulls, true);
+ ColumnInfo length = new IntegerColumn("LENGTH", columnNoNulls, true);
+ ColumnInfo scale = new ShortIntegerColumn("SCALE", columnNoNulls, true);
+ ColumnInfo radix = new ShortIntegerColumn("RADIX", columnNoNulls, true);
+ ColumnInfo specificName = new StringColumn("SPECIFIC_NAME", columnNoNulls);
+ ColumnInfo functionType = new ShortIntegerColumn("FUNCTION_TYPE", columnNoNulls, true);
+ ColumnInfo nonUnique = new BooleanColumn("NON_UNIQUE", columnNoNulls);
+ ColumnInfo indexQualifier = new StringColumn("INDEX_QUALIFIER", columnNullable);
+ ColumnInfo indexName = new StringColumn("INDEX_NAME", columnNullable);
+ ColumnInfo type = new ShortIntegerColumn("TYPE", columnNoNulls, true);
+ ColumnInfo ascOrDesc = new StringColumn("ASC_OR_DESC", columnNullable);
+ ColumnInfo cardinality = new IntegerColumn("CARDINALITY", columnNoNulls, true);
+ ColumnInfo pages = new IntegerColumn("PAGES", columnNoNulls, true);
+ ColumnInfo filterCondition = new StringColumn("FILTER_CONDITION", columnNullable);
+ ColumnInfo procedureCat = new StringColumn("PROCEDURE_CAT", columnNullable);
+ ColumnInfo procedureSchema = new StringColumn("PROCEDURE_SCHEM", columnNullable);
+ ColumnInfo procedureName = new StringColumn("PROCEDURE_NAME", columnNoNulls);
+ ColumnInfo procedureType = new ShortIntegerColumn("PROCEDURE_TYPE", columnNoNulls, true);
+ ColumnInfo superTableName = new StringColumn("SUPERTABLE_NAME", columnNoNulls);
+ ColumnInfo superTypeCat = new StringColumn("SUPERTYPE_CAT", columnNullable);
+ ColumnInfo superTypeSchema = new StringColumn("SUPERTYPE_SCHEM", columnNullable);
+ ColumnInfo superTypeName = new StringColumn("SUPERTYPE_NAME", columnNoNulls);
+ ColumnInfo litPrefix = new StringColumn("LITERAL_PREFIX", columnNullable);
+ ColumnInfo litSuffix = new StringColumn("LITERAL_SUFFIX", columnNullable);
+ ColumnInfo createParams = new StringColumn("CREATE_PARAMS", columnNullable);
+ ColumnInfo caseSensitive = new BooleanColumn("CASE_SENSITIVE", columnNoNulls);
+ ColumnInfo searchable = new ShortIntegerColumn("SEARCHABLE", columnNoNulls, true);
+ ColumnInfo unsignedAttr = new BooleanColumn("UNSIGNED_ATTRIBUTE", columnNoNulls);
+ ColumnInfo fixedPrecScale = new BooleanColumn("FIXED_PREC_SCALE", columnNoNulls);
+ ColumnInfo autoIncrement = new BooleanColumn("AUTO_INCREMENT", columnNoNulls);
+ ColumnInfo localTypeName = new StringColumn("LOCAL_TYPE_NAME", columnNullable);
+ ColumnInfo minScale = new ShortIntegerColumn("MINIMUM_SCALE", columnNoNulls, true);
+ ColumnInfo maxScale = new ShortIntegerColumn("MAXIMUM_SCALE", columnNullable, true);
ATTRIBUTE_COLUMNS = new ColumnInfo[] {
// TYPE_CAT String => type catalog (may be null)
@@ -381,6 +490,537 @@ public class MetadataSchema {
// grant to others; "NO" if not; null if unknown
isGrantable };
+ CROSS_REFERENCE_COLUMNS = new ColumnInfo[] {
+ // PKTABLE_CAT String => parent key table catalog (may be
+ // null)
+ pkTableCat,
+ // PKTABLE_SCHEM String => parent key table schema (may be
+ // null)
+ pkTableSchema,
+ // PKTABLE_NAME String => parent key table name
+ pkTableName,
+ // PKCOLUMN_NAME String => parent key column name
+ pkColumnName,
+ // FKTABLE_CAT String => foreign key table catalog (may be
+ // null)
+ // being exported (may be null)
+ fkTableCat,
+ // FKTABLE_SCHEM String => foreign key table schema (may be
+ // null) being exported (may be null)
+ fkTableSchema,
+ // FKTABLE_NAME String => foreign key table name being
+ // exported
+ fkTableName,
+ // FKCOLUMN_NAME String => foreign key column name being
+ // exported
+ fkColumnName,
+ // KEY_SEQ short => sequence number within foreign key( a
+ // value of 1 represents the first column of the foreign
+ // key, a value of 2 would represent the second column
+ // within the foreign key).
+ keySeq,
+ // UPDATE_RULE short => What happens to foreign key when
+ // parent key is updated:
+ // importedNoAction - do not allow update of parent key if
+ // it has been imported
+ // importedKeyCascade - change imported key to agree with
+ // parent key update
+ // importedKeySetNull - change imported key to NULL if its
+ // parent key has been updated
+ // importedKeySetDefault - change imported key to default
+ // values if its parent key has been updated
+ // importedKeyRestrict - same as importedKeyNoAction (for
+ // ODBC 2.x compatibility)
+ updateRule,
+ // DELETE_RULE short => What happens to the foreign key when
+ // parent key is deleted.
+ // importedKeyNoAction - do not allow delete of parent key
+ // if it has been imported
+ // importedKeyCascade - delete rows that import a deleted
+ // key
+ // importedKeySetNull - change imported key to NULL if its
+ // primary key has been deleted
+ // importedKeyRestrict - same as importedKeyNoAction (for
+ // ODBC 2.x compatibility)
+ // importedKeySetDefault - change imported key to default if
+ // its parent key has been deleted
+ deleteRule,
+ // FK_NAME String => foreign key name (may be null)
+ fkName,
+ // PK_NAME String => parent key name (may be null)
+ pkName,
+ // DEFERRABILITY short => can the evaluation of foreign key
+ // constraints be deferred until commit
+ // importedKeyInitiallyDeferred - see SQL92 for definition
+ // importedKeyInitiallyImmediate - see SQL92 for definition
+ // importedKeyNotDeferrable - see SQL92 for definition
+ deferrability };
+
+ EXPORTED_KEY_COLUMNS = new ColumnInfo[] {
+ // PKTABLE_CAT String => primary key table catalog (may be
+ // null)
+ pkTableCat,
+ // PKTABLE_SCHEM String => primary key table schema (may be
+ // null)
+ pkTableSchema,
+ // PKTABLE_NAME String => primary key table name
+ pkTableName,
+ // PKCOLUMN_NAME String => primary key column name
+ pkColumnName,
+ // FKTABLE_CAT String => foreign key table catalog (may be
+ // null) being exported (may be null)
+ fkTableCat,
+ // FKTABLE_SCHEM String => foreign key table schema (may be
+ // null) being exported (may be null)
+ fkTableSchema,
+ // FKTABLE_NAME String => foreign key table name being
+ // exported
+ fkTableName,
+ // FKCOLUMN_NAME String => foreign key column name being
+ // exported
+ fkColumnName,
+ // KEY_SEQ short => sequence number within foreign key( a
+ // value of 1 represents the first column of the foreign
+ // key, a value of 2 would represent the second column
+ // within the foreign key).
+ keySeq,
+ // UPDATE_RULE short => What happens to foreign key when
+ // primary is updated:
+ // importedNoAction - do not allow update of primary key if
+ // it has been imported
+ // importedKeyCascade - change imported key to agree with
+ // primary key update
+ // importedKeySetNull - change imported key to NULL if its
+ // primary key has been updated
+ // importedKeySetDefault - change imported key to default
+ // values if its primary key has been updated
+ // importedKeyRestrict - same as importedKeyNoAction (for
+ // ODBC 2.x compatibility)
+ updateRule,
+ // DELETE_RULE short => What happens to the foreign key when
+ // primary is deleted.
+ // importedKeyNoAction - do not allow delete of primary key
+ // if it has been imported
+ // importedKeyCascade - delete rows that import a deleted
+ // key
+ // importedKeySetNull - change imported key to NULL if its
+ // primary key has been deleted
+ // importedKeyRestrict - same as importedKeyNoAction (for
+ // ODBC 2.x compatibility)
+ // importedKeySetDefault - change imported key to default if
+ // its primary key has been deleted
+ deleteRule,
+ // FK_NAME String => foreign key name (may be null)
+ fkName,
+ // PK_NAME String => primary key name (may be null)
+ pkName,
+ // DEFERRABILITY short => can the evaluation of foreign key
+ // constraints be deferred until commit
+ // importedKeyInitiallyDeferred - see SQL92 for definition
+ // importedKeyInitiallyImmediate - see SQL92 for definition
+ // importedKeyNotDeferrable - see SQL92 for definition
+ deferrability };
+
+ FUNCTION_COLUMN_COLUMNS = new ColumnInfo[] {
+ // FUNCTION_CAT String => function catalog (may be null)
+ functionCat,
+ // FUNCTION_SCHEM String => function schema (may be null)
+ functionSchema,
+ // FUNCTION_NAME String => function name. This is the name
+ // used to invoke the function
+ functionName,
+ // COLUMN_NAME String => column/parameter name
+ columnName,
+ // COLUMN_TYPE Short => kind of column/parameter:
+ // functionColumnUnknown - nobody knows
+ // functionColumnIn - IN parameter
+ // functionColumnInOut - INOUT parameter
+ // functionColumnOut - OUT parameter
+ // functionColumnReturn - function return value
+ // functionColumnResult - Indicates that the parameter or
+ // column is a column in the ResultSet
+ columnType,
+ // DATA_TYPE int => SQL type from java.sql.Types
+ dataType,
+ // TYPE_NAME String => SQL type name, for a UDT type the
+ // type name is fully qualified
+ typeName,
+ // PRECISION int => precision
+ precision,
+ // LENGTH int => length in bytes of data
+ length,
+ // SCALE short => scale - null is returned for data types
+ // where SCALE is not applicable.
+ scale,
+ // RADIX short => radix
+ radix,
+ // NULLABLE short => can it contain NULL.
+ // functionNoNulls - does not allow NULL values
+ // functionNullable - allows NULL values
+ // functionNullableUnknown - nullability unknown
+ nullable,
+ // REMARKS String => comment describing column/parameter
+ remarks,
+ // CHAR_OCTET_LENGTH int => the maximum length of binary and
+ // character based parameters or columns. For any other
+ // datatype the returned value is a NULL
+ charOctetLength,
+ // ORDINAL_POSITION int => the ordinal position, starting
+ // from 1, for the input and output parameters. A value of 0
+ // is returned if this row describes the function's return
+ // value. For result set columns, it is the ordinal position
+ // of the column in the result set starting from 1.
+ ordinalPosition,
+ // IS_NULLABLE String => ISO rules are used to determine the
+ // nullability for a parameter or column.
+ // YES --- if the parameter or column can include NULLs
+ // NO --- if the parameter or column cannot include NULLs
+ // empty string --- if the nullability for the parameter or
+ // column is unknown
+ isNullable,
+ // SPECIFIC_NAME String => the name which uniquely
+ // identifies this function within its schema. This is a
+ // user specified, or DBMS generated, name that may be
+ // different then the FUNCTION_NAME for example with
+ // overload functions
+ specificName };
+
+ FUNCTION_COLUMNS = new ColumnInfo[] {
+ // FUNCTION_CAT String => function catalog (may be null)
+ functionCat,
+ // FUNCTION_SCHEM String => function schema (may be null)
+ functionSchema,
+ // FUNCTION_NAME String => function name. This is the name
+ // used to invoke the function
+ functionName,
+ // REMARKS String => explanatory comment on the function
+ remarks,
+ // FUNCTION_TYPE short => kind of function:
+ // functionResultUnknown - Cannot determine if a return
+ // value or table will be returned
+ // functionNoTable- Does not return a table
+ // functionReturnsTable - Returns a table
+ functionType,
+ // SPECIFIC_NAME String => the name which uniquely
+ // identifies this function within its schema. This is a
+ // user specified, or DBMS generated, name that may be
+ // different then the FUNCTION_NAME for example with
+ // overload functions
+ specificName };
+
+ IMPORTED_KEY_COLUMNS = new ColumnInfo[] {
+ // PKTABLE_CAT String => primary key table catalog being
+ // imported (may be null)
+ pkTableCat,
+ // PKTABLE_SCHEM String => primary key table schema being
+ // imported (may be null)
+ pkTableSchema,
+ // PKTABLE_NAME String => primary key table name being
+ // imported
+ pkTableName,
+ // PKCOLUMN_NAME String => primary key column name being
+ // imported
+ pkColumnName,
+ // FKTABLE_CAT String => foreign key table catalog (may be
+ // null)
+ fkTableCat,
+ // FKTABLE_SCHEM String => foreign key table schema (may be
+ // null)
+ fkTableSchema,
+ // FKTABLE_NAME String => foreign key table name
+ fkTableName,
+ // FKCOLUMN_NAME String => foreign key column name
+ fkColumnName,
+ // KEY_SEQ short => sequence number within a foreign key( a
+ // value of 1 represents the first column of the foreign
+ // key, a value of 2 would represent the second column
+ // within the foreign key).
+ keySeq,
+ // UPDATE_RULE short => What happens to a foreign key when
+ // the primary key is updated:
+ // importedNoAction - do not allow update of primary key if
+ // it has been imported
+ // importedKeyCascade - change imported key to agree with
+ // primary key update
+ // importedKeySetNull - change imported key to NULL if its
+ // primary key has been updated
+ // importedKeySetDefault - change imported key to default
+ // values if its primary key has been updated
+ // importedKeyRestrict - same as importedKeyNoAction (for
+ // ODBC 2.x compatibility)
+ updateRule,
+ // DELETE_RULE short => What happens to the foreign key when
+ // primary is deleted.
+ // importedKeyNoAction - do not allow delete of primary key
+ // if it has been imported
+ // importedKeyCascade - delete rows that import a deleted
+ // key
+ // importedKeySetNull - change imported key to NULL if its
+ // primary key has been deleted
+ // importedKeyRestrict - same as importedKeyNoAction (for
+ // ODBC 2.x compatibility)
+ // importedKeySetDefault - change imported key to default if
+ // its primary key has been deleted
+ deleteRule,
+ // FK_NAME String => foreign key name (may be null)
+ fkName,
+ // PK_NAME String => primary key name (may be null)
+ pkName,
+ // DEFERRABILITY short => can the evaluation of foreign key
+ // constraints be deferred until commit
+ // importedKeyInitiallyDeferred - see SQL92 for definition
+ // importedKeyInitiallyImmediate - see SQL92 for definition
+ // importedKeyNotDeferrable - see SQL92 for definition
+ deferrability };
+
+ INDEX_INFO_COLUMNS = new ColumnInfo[] {
+ // TABLE_CAT String => table catalog (may be null)
+ tableCat,
+ // TABLE_SCHEM String => table schema (may be null)
+ tableSchema,
+ // TABLE_NAME String => table name
+ tableName,
+ // NON_UNIQUE boolean => Can index values be non-unique.
+ // false when TYPE is tableIndexStatistic
+ nonUnique,
+ // INDEX_QUALIFIER String => index catalog (may be null);
+ // null when TYPE is tableIndexStatistic
+ indexQualifier,
+ // INDEX_NAME String => index name; null when TYPE is
+ // tableIndexStatistic
+ indexName,
+ // TYPE short => index type:
+ // tableIndexStatistic - this identifies table statistics
+ // that are returned in conjuction with a table's index
+ // descriptions
+ // tableIndexClustered - this is a clustered index
+ // tableIndexHashed - this is a hashed index
+ // tableIndexOther - this is some other style of index
+ type,
+ // ORDINAL_POSITION short => column sequence number within
+ // index; zero when TYPE is tableIndexStatistic
+ ordinalPosition,
+ // COLUMN_NAME String => column name; null when TYPE is
+ // tableIndexStatistic
+ columnName,
+ // ASC_OR_DESC String => column sort sequence, "A" =>
+ // ascending, "D" => descending, may be null if sort
+ // sequence is not supported; null when TYPE is
+ // tableIndexStatistic
+ ascOrDesc,
+ // CARDINALITY int => When TYPE is tableIndexStatistic, then
+ // this is the number of rows in the table; otherwise, it is
+ // the number of unique values in the index.
+ cardinality,
+ // PAGES int => When TYPE is tableIndexStatisic then this is
+ // the number of pages used for the table, otherwise it is
+ // the number of pages used for the current index.
+ pages,
+ // FILTER_CONDITION String => Filter condition, if any. (may
+ // be null)
+ filterCondition };
+
+ PRIMARY_KEY_COLUMNS = new ColumnInfo[] {
+ // TABLE_CAT String => table catalog (may be null)
+ tableCat,
+ // TABLE_SCHEM String => table schema (may be null)
+ tableSchema,
+ // TABLE_NAME String => table name
+ tableName,
+ // COLUMN_NAME String => column name
+ columnName,
+ // KEY_SEQ short => sequence number within primary key( a
+ // value of 1 represents the first column of the primary
+ // key, a value of 2 would represent the second column
+ // within the primary key).
+ keySeq,
+ // PK_NAME String => primary key name (may be null)
+ pkName };
+
+ PROCEDURE_COLUMN_COLUMNS = new ColumnInfo[] {
+ // PROCEDURE_CAT String => procedure catalog (may be null)
+ procedureCat,
+ // PROCEDURE_SCHEM String => procedure schema (may be null)
+ procedureSchema,
+ // PROCEDURE_NAME String => procedure name
+ procedureName,
+ // COLUMN_NAME String => column/parameter name
+ columnName,
+ // COLUMN_TYPE Short => kind of column/parameter:
+ // procedureColumnUnknown - nobody knows
+ // procedureColumnIn - IN parameter
+ // procedureColumnInOut - INOUT parameter
+ // procedureColumnOut - OUT parameter
+ // procedureColumnReturn - procedure return value
+ // procedureColumnResult - result column in ResultSet
+ columnType,
+ // DATA_TYPE int => SQL type from java.sql.Types
+ dataType,
+ // TYPE_NAME String => SQL type name, for a UDT type the
+ // type name is fully qualified
+ typeName,
+ // PRECISION int => precision
+ precision,
+ // LENGTH int => length in bytes of data
+ length,
+ // SCALE short => scale - null is returned for data types
+ // where SCALE is not applicable.
+ scale,
+ // RADIX short => radix
+ radix,
+ // NULLABLE short => can it contain NULL.
+ // procedureNoNulls - does not allow NULL values
+ // procedureNullable - allows NULL values
+ // procedureNullableUnknown - nullability unknown
+ nullable,
+ // REMARKS String => comment describing parameter/column
+ remarks,
+ // COLUMN_DEF String => default value for the column, which
+ // should be interpreted as a string when the value is
+ // enclosed in single quotes (may be null)
+ // The string NULL (not enclosed in quotes) - if NULL was
+ // specified as the default value
+ // TRUNCATE (not enclosed in quotes) - if the specified
+ // default value cannot be represented without truncation
+ // NULL - if a default value was not specified
+ columnDef,
+ // SQL_DATA_TYPE int => reserved for future use
+ sqlDataType,
+ // SQL_DATETIME_SUB int => reserved for future use
+ sqlDateTimeSub,
+ // CHAR_OCTET_LENGTH int => the maximum length of binary and
+ // character based columns. For any other datatype the
+ // returned value is a NULL
+ charOctetLength,
+ // ORDINAL_POSITION int => the ordinal position, starting
+ // from 1, for the input and output parameters for a
+ // procedure. A value of 0 is returned if this row describes
+ // the procedure's return value. For result set columns, it
+ // is the ordinal position of the column in the result set
+ // starting from 1. If there are multiple result sets, the
+ // column ordinal positions are implementation defined.
+ ordinalPosition,
+ // IS_NULLABLE String => ISO rules are used to determine the
+ // nullability for a column.
+ // YES --- if the parameter can include NULLs
+ // NO --- if the parameter cannot include NULLs
+ // empty string --- if the nullability for the parameter is
+ // unknown
+ isNullable,
+ // SPECIFIC_NAME String => the name which uniquely
+ // identifies this procedure within its schema.
+ specificName };
+
+ PROCEDURE_COLUMNS = new ColumnInfo[] {
+ // PROCEDURE_CAT String => procedure catalog (may be null)
+ procedureCat,
+ // PROCEDURE_SCHEM String => procedure schema (may be null)
+ procedureSchema,
+ // PROCEDURE_NAME String => procedure name
+ procedureName,
+ // reserved for future use
+ empty,
+ // reserved for future use
+ empty,
+ // reserved for future use
+ empty,
+ // REMARKS String => explanatory comment on the procedure
+ remarks,
+ // PROCEDURE_TYPE short => kind of procedure:
+ // procedureResultUnknown - Cannot determine if a return
+ // value will be returned
+ // procedureNoResult - Does not return a return value
+ // procedureReturnsResult - Returns a return value
+ procedureType,
+ // SPECIFIC_NAME String => The name which uniquely
+ // identifies this procedure within its schema.
+ specificName };
+
+ // NB - For some reason JDBC suddenly uses TABLE_CATALOG instead of
+ // TABLE_CAT here?
+ SCHEMA_COLUMNS = new ColumnInfo[] {
+ // TABLE_SCHEM String => schema name
+ tableSchema,
+ // TABLE_CATALOG String => catalog name (may be null)
+ tableCatalog };
+
+ SUPER_TABLE_COLUMNS = new ColumnInfo[] {
+ // TABLE_CAT String => the type's catalog (may be null)
+ tableCat,
+ // TABLE_SCHEM String => type's schema (may be null)
+ tableSchema,
+ // TABLE_NAME String => type name
+ tableName,
+ // SUPERTABLE_NAME String => the direct super type's name
+ superTableName };
+
+ SUPER_TYPE_COLUMNS = new ColumnInfo[] {
+ // TYPE_CAT String => the UDT's catalog (may be null)
+ typeCat,
+ // TYPE_SCHEM String => UDT's schema (may be null)
+ typeSchema,
+ // TYPE_NAME String => type name of the UDT
+ typeName,
+ // SUPERTYPE_CAT String => the direct super type's catalog
+ // (may be null)
+ superTypeCat,
+ // SUPERTYPE_SCHEM String => the direct super type's schema
+ // (may be null)
+ superTypeSchema,
+ // SUPERTYPE_NAME String => the direct super type's name
+ superTypeName };
+
+ TYPE_INFO_COLUMNS = new ColumnInfo[] {
+ // TYPE_NAME String => Type name
+ typeName,
+ // DATA_TYPE int => SQL data type from java.sql.Types
+ dataType,
+ // PRECISION int => maximum precision
+ precision,
+ // LITERAL_PREFIX String => prefix used to quote a literal
+ // (may be null)
+ litPrefix,
+ // LITERAL_SUFFIX String => suffix used to quote a literal
+ // (may be null)
+ litSuffix,
+ // CREATE_PARAMS String => parameters used in creating the
+ // type (may be null)
+ createParams,
+ // NULLABLE short => can you use NULL for this type.
+ // typeNoNulls - does not allow NULL values
+ // typeNullable - allows NULL values
+ // typeNullableUnknown - nullability unknown
+ nullable,
+ // CASE_SENSITIVE boolean=> is it case sensitive.
+ caseSensitive,
+ // SEARCHABLE short => can you use "WHERE" based on this
+ // type:
+ // typePredNone - No support
+ // typePredChar - Only supported with WHERE .. LIKE
+ // typePredBasic - Supported except for WHERE .. LIKE
+ // typeSearchable - Supported for all WHERE ..
+ searchable,
+ // UNSIGNED_ATTRIBUTE boolean => is it unsigned.
+ unsignedAttr,
+ // FIXED_PREC_SCALE boolean => can it be a money value.
+ fixedPrecScale,
+ // AUTO_INCREMENT boolean => can it be used for an
+ // auto-increment value.
+ autoIncrement,
+ // LOCAL_TYPE_NAME String => localized version of type name
+ // (may be null)
+ localTypeName,
+ // MINIMUM_SCALE short => minimum scale supported
+ minScale,
+ // MAXIMUM_SCALE short => maximum scale supported
+ maxScale,
+ // SQL_DATA_TYPE int => unused
+ sqlDataType,
+ // SQL_DATETIME_SUB int => unused
+ sqlDateTimeSub,
+ // NUM_PREC_RADIX int => usually 2 or 10
+ numPrecRadix };
+
UDT_COLUMNS = new ColumnInfo[] {
// TYPE_CAT String => the type's catalog (may be null)
typeCat,
Modified: jena/Experimental/jena-jdbc/jena-jdbc-core/src/main/java/org/apache/jena/jdbc/metadata/results/MetaResultSet.java
URL: http://svn.apache.org/viewvc/jena/Experimental/jena-jdbc/jena-jdbc-core/src/main/java/org/apache/jena/jdbc/metadata/results/MetaResultSet.java?rev=1471213&r1=1471212&r2=1471213&view=diff
==============================================================================
--- jena/Experimental/jena-jdbc/jena-jdbc-core/src/main/java/org/apache/jena/jdbc/metadata/results/MetaResultSet.java (original)
+++ jena/Experimental/jena-jdbc/jena-jdbc-core/src/main/java/org/apache/jena/jdbc/metadata/results/MetaResultSet.java Wed Apr 24 00:22:26 2013
@@ -223,13 +223,13 @@ public class MetaResultSet implements Re
try {
return targetType.cast(obj);
} catch (ClassCastException e) {
- throw new SQLException("Value for this column in the current row is not valid for the column type");
+ throw new SQLException("Value for this column (Index " + columnIndex + ") in the current row is not valid for the column type");
}
} else {
- throw new SQLException("Value for this column in the current row is not valid for the column type");
+ throw new SQLException("Value for this column (Index " + columnIndex + ") in the current row is not valid for the column type");
}
} else {
- throw new SQLException("Given column does not contain decimal values");
+ throw new SQLException("Given column (Index " + columnIndex + ") does not contain appropriately typed values");
}
} else {
throw new SQLException("Column index is out of bounds");
Modified: jena/Experimental/jena-jdbc/jena-jdbc-driver-remote/src/main/java/org/apache/jena/jdbc/remote/connections/RemoteEndpointConnection.java
URL: http://svn.apache.org/viewvc/jena/Experimental/jena-jdbc/jena-jdbc-driver-remote/src/main/java/org/apache/jena/jdbc/remote/connections/RemoteEndpointConnection.java?rev=1471213&r1=1471212&r2=1471213&view=diff
==============================================================================
--- jena/Experimental/jena-jdbc/jena-jdbc-driver-remote/src/main/java/org/apache/jena/jdbc/remote/connections/RemoteEndpointConnection.java (original)
+++ jena/Experimental/jena-jdbc/jena-jdbc-driver-remote/src/main/java/org/apache/jena/jdbc/remote/connections/RemoteEndpointConnection.java Wed Apr 24 00:22:26 2013
@@ -264,4 +264,12 @@ public class RemoteEndpointConnection ex
throw new SQLFeatureNotSupportedException("Transactions are not supported for remote endpoint backed connections");
}
}
+
+ /**
+ * Gets the username used for HTTP authentication (if any)
+ * @return Username
+ */
+ public String getUserName() {
+ return this.username;
+ }
}
Modified: jena/Experimental/jena-jdbc/jena-jdbc-driver-remote/src/main/java/org/apache/jena/jdbc/remote/metadata/RemoteEndpointMetadata.java
URL: http://svn.apache.org/viewvc/jena/Experimental/jena-jdbc/jena-jdbc-driver-remote/src/main/java/org/apache/jena/jdbc/remote/metadata/RemoteEndpointMetadata.java?rev=1471213&r1=1471212&r2=1471213&view=diff
==============================================================================
--- jena/Experimental/jena-jdbc/jena-jdbc-driver-remote/src/main/java/org/apache/jena/jdbc/remote/metadata/RemoteEndpointMetadata.java (original)
+++ jena/Experimental/jena-jdbc/jena-jdbc-driver-remote/src/main/java/org/apache/jena/jdbc/remote/metadata/RemoteEndpointMetadata.java Wed Apr 24 00:22:26 2013
@@ -34,6 +34,7 @@ import com.hp.hpl.jena.sparql.util.Versi
public class RemoteEndpointMetadata extends JenaMetadata {
private Version jdbc;
+ private RemoteEndpointConnection remoteConn;
/**
* Creates new metadata
@@ -44,6 +45,7 @@ public class RemoteEndpointMetadata exte
super(connection);
this.jdbc = new Version();
this.jdbc.addClass(JenaJDBC.class);
+ this.remoteConn = connection;
}
@Override
@@ -105,6 +107,11 @@ public class RemoteEndpointMetadata exte
// Underlying database is unknown
return null;
}
+
+ @Override
+ public String getUserName() throws SQLException {
+ return this.remoteConn.getUserName();
+ }
@Override
public boolean usesLocalFilePerTable() throws SQLException {
Modified: jena/Experimental/jena-jdbc/jena-jdbc-driver-tdb/src/main/java/org/apache/jena/jdbc/tdb/metadata/TDBDatasetMetadata.java
URL: http://svn.apache.org/viewvc/jena/Experimental/jena-jdbc/jena-jdbc-driver-tdb/src/main/java/org/apache/jena/jdbc/tdb/metadata/TDBDatasetMetadata.java?rev=1471213&r1=1471212&r2=1471213&view=diff
==============================================================================
--- jena/Experimental/jena-jdbc/jena-jdbc-driver-tdb/src/main/java/org/apache/jena/jdbc/tdb/metadata/TDBDatasetMetadata.java (original)
+++ jena/Experimental/jena-jdbc/jena-jdbc-driver-tdb/src/main/java/org/apache/jena/jdbc/tdb/metadata/TDBDatasetMetadata.java Wed Apr 24 00:22:26 2013
@@ -29,7 +29,7 @@ import com.hp.hpl.jena.sparql.util.Versi
import com.hp.hpl.jena.tdb.TDB;
/**
- * Connection metadata for in-memory datasets
+ * Connection metadata for TDB datasets
*
*/
public class TDBDatasetMetadata extends DatasetMetadata {
@@ -69,6 +69,11 @@ public class TDBDatasetMetadata extends
public String getDatabaseProductVersion() throws SQLException {
return tdb.toString(true);
}
+
+ @Override
+ public int getDefaultTransactionIsolation() throws SQLException {
+ return Connection.TRANSACTION_SERIALIZABLE;
+ }
@Override
public int getDriverMajorVersion() {
Modified: jena/Experimental/jena-jdbc/pom.xml
URL: http://svn.apache.org/viewvc/jena/Experimental/jena-jdbc/pom.xml?rev=1471213&r1=1471212&r2=1471213&view=diff
==============================================================================
--- jena/Experimental/jena-jdbc/pom.xml (original)
+++ jena/Experimental/jena-jdbc/pom.xml Wed Apr 24 00:22:26 2013
@@ -20,6 +20,14 @@
<plugin.license.headerPath>${project.basedir}</plugin.license.headerPath>
</properties>
+ <dependencies>
+ <dependency>
+ <groupId>org.aspectj</groupId>
+ <artifactId>aspectjrt</artifactId>
+ <version>1.6.12</version>
+ </dependency>
+ </dependencies>
+
<build>
<plugins>
<!-- Compiler Plugin -->
@@ -56,6 +64,33 @@
<strictCheck>true</strictCheck>
</configuration>
</plugin>
+ <!-- AspectJ Plugin - Used to support method entry and exit trace logging
+ for debugging purposes -->
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>aspectj-maven-plugin</artifactId>
+ <version>1.4</version>
+ <configuration>
+ <source>1.6</source>
+ </configuration>
+ <executions>
+ <execution>
+ <goals>
+ <goal>compile</goal> <!-- use this goal to weave all your main classes -->
+ <goal>test-compile</goal> <!-- use this goal to weave all your test classes -->
+ </goals>
+ </execution>
+ </executions>
+ <dependencies>
+ <!-- Ensure aspectj tools version used by compiler is the same version
+ used as dependency. Avoids warning. https://bugs.eclipse.org/bugs/show_bug.cgi?id=368190 -->
+ <dependency>
+ <groupId>org.aspectj</groupId>
+ <artifactId>aspectjtools</artifactId>
+ <version>1.6.12</version>
+ </dependency>
+ </dependencies>
+ </plugin>
</plugins>
</build>
</project>
\ No newline at end of file