提交 a77601c8 authored 作者: Thomas Mueller's avatar Thomas Mueller

--no commit message

--no commit message
上级 8613b4bc
...@@ -18,7 +18,10 @@ Change Log ...@@ -18,7 +18,10 @@ Change Log
<h1>Change Log</h1> <h1>Change Log</h1>
<h2>Next Version (unreleased)</h2> <h2>Next Version (unreleased)</h2>
<ul><li>The H2 Console web application (war file) did only support ASCII characters. <ul><li>JdbcConnectionPool: it was possible to set a negative connection pool size.
</li><li>Fulltext search did not support table names with a backslash.
</li><li>The internal IntArray class did not work correctly when initialized with a zero length array.
</li><li>The H2 Console web application (war file) did only support ASCII characters.
Now UTF-8 is supported. Now UTF-8 is supported.
</li><li>DATEADD does no longer require that the argument is a timestamp. </li><li>DATEADD does no longer require that the argument is a timestamp.
</li><li>The database file locking mechanism didn't work correctly on Mac OS. </li><li>The database file locking mechanism didn't work correctly on Mac OS.
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -419,12 +419,12 @@ public abstract class Prepared { ...@@ -419,12 +419,12 @@ public abstract class Prepared {
protected SQLException setRow(SQLException ex, int rowId, String values) { protected SQLException setRow(SQLException ex, int rowId, String values) {
if (ex instanceof JdbcSQLException) { if (ex instanceof JdbcSQLException) {
JdbcSQLException e = (JdbcSQLException) ex; JdbcSQLException e = (JdbcSQLException) ex;
StringBuffer buff = new StringBuffer("VALUES("); StringBuffer buff = new StringBuffer(sqlStatement);
buff.append(values).append(")"); buff.append(" -- ");
if (rowId > 0) { if (rowId > 0) {
buff.append(" -- row #"); buff.append("row #").append(rowId + 1).append(" ");
buff.append(rowId + 1);
} }
buff.append("(").append(values).append(")");
e.setSQL(buff.toString()); e.setSQL(buff.toString());
} }
return ex; return ex;
......
...@@ -109,7 +109,7 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat ...@@ -109,7 +109,7 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat
* </li> * </li>
* </ul> * </ul>
* *
* @param catalog null (to get all objects) or the catalog name * @param catalogPattern null (to get all objects) or the catalog name
* @param schemaPattern null (to get all objects) or a schema name * @param schemaPattern null (to get all objects) or a schema name
* (uppercase for unquoted names) * (uppercase for unquoted names)
* @param tableNamePattern null (to get all objects) or a table name * @param tableNamePattern null (to get all objects) or a table name
...@@ -118,10 +118,10 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat ...@@ -118,10 +118,10 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat
* @return the list of columns * @return the list of columns
* @throws SQLException if the connection is closed * @throws SQLException if the connection is closed
*/ */
public ResultSet getTables(String catalog, String schemaPattern, String tableNamePattern, String[] types) throws SQLException { public ResultSet getTables(String catalogPattern, String schemaPattern, String tableNamePattern, String[] types) throws SQLException {
try { try {
if (isDebugEnabled()) { if (isDebugEnabled()) {
debugCode("getTables(" + quote(catalog) + ", " + quote(schemaPattern) + ", " + quote(tableNamePattern) debugCode("getTables(" + quote(catalogPattern) + ", " + quote(schemaPattern) + ", " + quote(tableNamePattern)
+ ", " + quoteArray(types) + ");"); + ", " + quoteArray(types) + ");");
} }
checkClosed(); checkClosed();
...@@ -152,7 +152,7 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat ...@@ -152,7 +152,7 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat
+ "AND TABLE_NAME LIKE ? " + "AND TABLE_NAME LIKE ? "
+ "AND (" + tableType + ") " + "AND (" + tableType + ") "
+ "ORDER BY TABLE_TYPE, TABLE_SCHEMA, TABLE_NAME"); + "ORDER BY TABLE_TYPE, TABLE_SCHEMA, TABLE_NAME");
prep.setString(1, getCatalogPattern(catalog)); prep.setString(1, getCatalogPattern(catalogPattern));
prep.setString(2, getSchemaPattern(schemaPattern)); prep.setString(2, getSchemaPattern(schemaPattern));
prep.setString(3, getPattern(tableNamePattern)); prep.setString(3, getPattern(tableNamePattern));
for (int i = 0; types != null && i < types.length; i++) { for (int i = 0; types != null && i < types.length; i++) {
...@@ -190,7 +190,7 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat ...@@ -190,7 +190,7 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat
* <li>18 IS_NULLABLE (String) "NO" or "YES" </li> * <li>18 IS_NULLABLE (String) "NO" or "YES" </li>
* </ul> * </ul>
* *
* @param catalog null (to get all objects) or the catalog name * @param catalogPattern null (to get all objects) or the catalog name
* @param schemaPattern null (to get all objects) or a schema name * @param schemaPattern null (to get all objects) or a schema name
* (uppercase for unquoted names) * (uppercase for unquoted names)
* @param tableNamePattern null (to get all objects) or a table name * @param tableNamePattern null (to get all objects) or a table name
...@@ -200,12 +200,12 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat ...@@ -200,12 +200,12 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat
* @return the list of columns * @return the list of columns
* @throws SQLException if the connection is closed * @throws SQLException if the connection is closed
*/ */
public ResultSet getColumns(String catalog, String schemaPattern, public ResultSet getColumns(String catalogPattern, String schemaPattern,
String tableNamePattern, String columnNamePattern) String tableNamePattern, String columnNamePattern)
throws SQLException { throws SQLException {
try { try {
if (isDebugEnabled()) { if (isDebugEnabled()) {
debugCode("getColumns(" + quote(catalog)+", " debugCode("getColumns(" + quote(catalogPattern)+", "
+quote(schemaPattern)+", " +quote(schemaPattern)+", "
+quote(tableNamePattern)+", " +quote(tableNamePattern)+", "
+quote(columnNamePattern)+");"); +quote(columnNamePattern)+");");
...@@ -236,7 +236,7 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat ...@@ -236,7 +236,7 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat
+ "AND TABLE_NAME LIKE ? " + "AND TABLE_NAME LIKE ? "
+ "AND COLUMN_NAME LIKE ? " + "AND COLUMN_NAME LIKE ? "
+ "ORDER BY TABLE_SCHEM, TABLE_NAME, ORDINAL_POSITION"); + "ORDER BY TABLE_SCHEM, TABLE_NAME, ORDINAL_POSITION");
prep.setString(1, getCatalogPattern(catalog)); prep.setString(1, getCatalogPattern(catalogPattern));
prep.setString(2, getSchemaPattern(schemaPattern)); prep.setString(2, getSchemaPattern(schemaPattern));
prep.setString(3, getPattern(tableNamePattern)); prep.setString(3, getPattern(tableNamePattern));
prep.setString(4, getPattern(columnNamePattern)); prep.setString(4, getPattern(columnNamePattern));
...@@ -271,19 +271,19 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat ...@@ -271,19 +271,19 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat
* 2=NULLS_FIRST, 4=NULLS_LAST </li> * 2=NULLS_FIRST, 4=NULLS_LAST </li>
* </ul> * </ul>
* *
* @param catalog null (to get all objects) or the catalog name * @param catalogPattern null or the catalog name
* @param schema schema name (must be specified) * @param schemaPattern schema name (must be specified)
* @param tableName table name (must be specified) * @param tableName table name (must be specified)
* @param unique only unique indexes * @param unique only unique indexes
* @param approximate is ignored * @param approximate is ignored
* @return the list of indexes and columns * @return the list of indexes and columns
* @throws SQLException if the connection is closed * @throws SQLException if the connection is closed
*/ */
public ResultSet getIndexInfo(String catalog, String schema, String tableName, boolean unique, boolean approximate) public ResultSet getIndexInfo(String catalogPattern, String schemaPattern, String tableName, boolean unique, boolean approximate)
throws SQLException { throws SQLException {
try { try {
if (isDebugEnabled()) { if (isDebugEnabled()) {
debugCode("getIndexInfo(" + quote(catalog) + ", " + quote(schema) + ", " + quote(tableName) + ", " debugCode("getIndexInfo(" + quote(catalogPattern) + ", " + quote(schemaPattern) + ", " + quote(tableName) + ", "
+ unique + ", " + approximate + ");"); + unique + ", " + approximate + ");");
} }
String uniqueCondition; String uniqueCondition;
...@@ -315,8 +315,8 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat ...@@ -315,8 +315,8 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat
+ "AND (" + uniqueCondition + ") " + "AND (" + uniqueCondition + ") "
+ "AND TABLE_NAME = ? " + "AND TABLE_NAME = ? "
+ "ORDER BY NON_UNIQUE, TYPE, TABLE_SCHEM, INDEX_NAME, ORDINAL_POSITION"); + "ORDER BY NON_UNIQUE, TYPE, TABLE_SCHEM, INDEX_NAME, ORDINAL_POSITION");
prep.setString(1, getCatalogPattern(catalog)); prep.setString(1, getCatalogPattern(catalogPattern));
prep.setString(2, getSchemaPattern(schema)); prep.setString(2, getSchemaPattern(schemaPattern));
prep.setString(3, tableName); prep.setString(3, tableName);
return prep.executeQuery(); return prep.executeQuery();
} catch (Exception e) { } catch (Exception e) {
...@@ -337,18 +337,18 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat ...@@ -337,18 +337,18 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat
* <li>6 PK_NAME (String) the name of the primary key index</li> * <li>6 PK_NAME (String) the name of the primary key index</li>
* </ul> * </ul>
* *
* @param catalog null (to get all objects) or the catalog name * @param catalogPattern null or the catalog name
* @param schema schema name (must be specified) * @param schemaPattern schema name (must be specified)
* @param tableName table name (must be specified) * @param tableName table name (must be specified)
* @return the list of primary key columns * @return the list of primary key columns
* @throws SQLException if the connection is closed * @throws SQLException if the connection is closed
*/ */
public ResultSet getPrimaryKeys(String catalog, String schema, String tableName) throws SQLException { public ResultSet getPrimaryKeys(String catalogPattern, String schemaPattern, String tableName) throws SQLException {
try { try {
if (isDebugEnabled()) { if (isDebugEnabled()) {
debugCode("getPrimaryKeys(" debugCode("getPrimaryKeys("
+quote(catalog)+", " +quote(catalogPattern)+", "
+quote(schema)+", " +quote(schemaPattern)+", "
+quote(tableName)+");"); +quote(tableName)+");");
} }
checkClosed(); checkClosed();
...@@ -365,8 +365,8 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat ...@@ -365,8 +365,8 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat
+ "AND TABLE_NAME = ? " + "AND TABLE_NAME = ? "
+ "AND PRIMARY_KEY = TRUE " + "AND PRIMARY_KEY = TRUE "
+ "ORDER BY COLUMN_NAME"); + "ORDER BY COLUMN_NAME");
prep.setString(1, getCatalogPattern(catalog)); prep.setString(1, getCatalogPattern(catalogPattern));
prep.setString(2, getSchemaPattern(schema)); prep.setString(2, getSchemaPattern(schemaPattern));
prep.setString(3, tableName); prep.setString(3, tableName);
return prep.executeQuery(); return prep.executeQuery();
} catch (Exception e) { } catch (Exception e) {
...@@ -509,6 +509,9 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat ...@@ -509,6 +509,9 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat
* (procedureNoResult or procedureReturnsResult) </li> * (procedureNoResult or procedureReturnsResult) </li>
* </ul> * </ul>
* *
* @param catalogPattern null or the catalog name
* @param schemaPattern schema name (must be specified)
* @param procedureNamePattern the procedure name pattern
* @return the procedures * @return the procedures
* @throws SQLException if the connection is closed * @throws SQLException if the connection is closed
*/ */
...@@ -569,16 +572,20 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat ...@@ -569,16 +572,20 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat
* <li>15 POS (int) the parameter index </li> * <li>15 POS (int) the parameter index </li>
* </ul> * </ul>
* *
* @param catalogPattern null or the catalog name
* @param schemaPattern schema name (must be specified)
* @param procedureNamePattern the procedure name pattern
* @param columnNamePattern the procedure name pattern
* @return the procedure columns * @return the procedure columns
* @throws SQLException if the connection is closed * @throws SQLException if the connection is closed
*/ */
public ResultSet getProcedureColumns(String catalog, String schemaPattern, public ResultSet getProcedureColumns(String catalogPattern, String schemaPattern,
String procedureNamePattern, String columnNamePattern) String procedureNamePattern, String columnNamePattern)
throws SQLException { throws SQLException {
try { try {
if (isDebugEnabled()) { if (isDebugEnabled()) {
debugCode("getProcedureColumns(" debugCode("getProcedureColumns("
+quote(catalog)+", " +quote(catalogPattern)+", "
+quote(schemaPattern)+", " +quote(schemaPattern)+", "
+quote(procedureNamePattern)+", " +quote(procedureNamePattern)+", "
+quote(columnNamePattern)+");"); +quote(columnNamePattern)+");");
...@@ -606,7 +613,7 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat ...@@ -606,7 +613,7 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat
+ "AND ALIAS_NAME LIKE ? " + "AND ALIAS_NAME LIKE ? "
+ "AND COLUMN_NAME LIKE ? " + "AND COLUMN_NAME LIKE ? "
+ "ORDER BY PROCEDURE_SCHEM, PROCEDURE_NAME, NUM_INPUT_PARAMS, POS"); + "ORDER BY PROCEDURE_SCHEM, PROCEDURE_NAME, NUM_INPUT_PARAMS, POS");
prep.setString(1, getCatalogPattern(catalog)); prep.setString(1, getCatalogPattern(catalogPattern));
prep.setString(2, getSchemaPattern(schemaPattern)); prep.setString(2, getSchemaPattern(schemaPattern));
prep.setString(3, getPattern(procedureNamePattern)); prep.setString(3, getPattern(procedureNamePattern));
prep.setString(4, getPattern(columnNamePattern)); prep.setString(4, getPattern(columnNamePattern));
...@@ -713,8 +720,8 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat ...@@ -713,8 +720,8 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat
* others </li> * others </li>
* </ul> * </ul>
* *
* @param catalog null (to get all objects) or the catalog name * @param catalogPattern null (to get all objects) or the catalog name
* @param schema null (to get all objects) or a schema name (uppercase for * @param schemaPattern null (to get all objects) or a schema name (uppercase for
* unquoted names) * unquoted names)
* @param table a table name (uppercase for unquoted names) * @param table a table name (uppercase for unquoted names)
* @param columnNamePattern null (to get all objects) or a column name * @param columnNamePattern null (to get all objects) or a column name
...@@ -722,13 +729,13 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat ...@@ -722,13 +729,13 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat
* @return the list of privileges * @return the list of privileges
* @throws SQLException if the connection is closed * @throws SQLException if the connection is closed
*/ */
public ResultSet getColumnPrivileges(String catalog, String schema, public ResultSet getColumnPrivileges(String catalogPattern, String schemaPattern,
String table, String columnNamePattern) throws SQLException { String table, String columnNamePattern) throws SQLException {
try { try {
if (isDebugEnabled()) { if (isDebugEnabled()) {
debugCode("getColumnPrivileges(" debugCode("getColumnPrivileges("
+quote(catalog)+", " +quote(catalogPattern)+", "
+quote(schema)+", " +quote(schemaPattern)+", "
+quote(table)+", " +quote(table)+", "
+quote(columnNamePattern)+");"); +quote(columnNamePattern)+");");
} }
...@@ -748,8 +755,8 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat ...@@ -748,8 +755,8 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat
+ "AND TABLE_NAME = ? " + "AND TABLE_NAME = ? "
+ "AND COLUMN_NAME LIKE ? " + "AND COLUMN_NAME LIKE ? "
+ "ORDER BY COLUMN_NAME, PRIVILEGE"); + "ORDER BY COLUMN_NAME, PRIVILEGE");
prep.setString(1, getCatalogPattern(catalog)); prep.setString(1, getCatalogPattern(catalogPattern));
prep.setString(2, getSchemaPattern(schema)); prep.setString(2, getSchemaPattern(schemaPattern));
prep.setString(3, table); prep.setString(3, table);
prep.setString(4, getPattern(columnNamePattern)); prep.setString(4, getPattern(columnNamePattern));
return prep.executeQuery(); return prep.executeQuery();
...@@ -774,7 +781,7 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat ...@@ -774,7 +781,7 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat
* others </li> * others </li>
* </ul> * </ul>
* *
* @param catalog null (to get all objects) or the catalog name * @param catalogPattern null (to get all objects) or the catalog name
* @param schemaPattern null (to get all objects) or a schema name * @param schemaPattern null (to get all objects) or a schema name
* (uppercase for unquoted names) * (uppercase for unquoted names)
* @param tableNamePattern null (to get all objects) or a table name * @param tableNamePattern null (to get all objects) or a table name
...@@ -782,11 +789,11 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat ...@@ -782,11 +789,11 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat
* @return the list of privileges * @return the list of privileges
* @throws SQLException if the connection is closed * @throws SQLException if the connection is closed
*/ */
public ResultSet getTablePrivileges(String catalog, String schemaPattern, String tableNamePattern) throws SQLException { public ResultSet getTablePrivileges(String catalogPattern, String schemaPattern, String tableNamePattern) throws SQLException {
try { try {
if (isDebugEnabled()) { if (isDebugEnabled()) {
debugCode("getTablePrivileges(" debugCode("getTablePrivileges("
+quote(catalog)+", " +quote(catalogPattern)+", "
+quote(schemaPattern)+", " +quote(schemaPattern)+", "
+quote(tableNamePattern)+");"); +quote(tableNamePattern)+");");
} }
...@@ -804,7 +811,7 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat ...@@ -804,7 +811,7 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat
+ "AND TABLE_SCHEMA LIKE ? " + "AND TABLE_SCHEMA LIKE ? "
+ "AND TABLE_NAME LIKE ? " + "AND TABLE_NAME LIKE ? "
+ "ORDER BY TABLE_SCHEM, TABLE_NAME, PRIVILEGE"); + "ORDER BY TABLE_SCHEM, TABLE_NAME, PRIVILEGE");
prep.setString(1, getCatalogPattern(catalog)); prep.setString(1, getCatalogPattern(catalogPattern));
prep.setString(2, getSchemaPattern(schemaPattern)); prep.setString(2, getSchemaPattern(schemaPattern));
prep.setString(3, getPattern(tableNamePattern)); prep.setString(3, getPattern(tableNamePattern));
return prep.executeQuery(); return prep.executeQuery();
...@@ -828,21 +835,21 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat ...@@ -828,21 +835,21 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat
* </li><li>8 PSEUDO_COLUMN (short) (always bestRowNotPseudo) * </li><li>8 PSEUDO_COLUMN (short) (always bestRowNotPseudo)
* </li></ul> * </li></ul>
* *
* @param catalog null (to get all objects) or the catalog name * @param catalogPattern null (to get all objects) or the catalog name
* @param schema schema name (must be specified) * @param schemaPattern schema name (must be specified)
* @param tableName table name (must be specified) * @param tableName table name (must be specified)
* @param scope ignored * @param scope ignored
* @param nullable ignored * @param nullable ignored
* @return the primary key index * @return the primary key index
* @throws SQLException if the connection is closed * @throws SQLException if the connection is closed
*/ */
public ResultSet getBestRowIdentifier(String catalog, String schema, public ResultSet getBestRowIdentifier(String catalogPattern, String schemaPattern,
String tableName, int scope, boolean nullable) throws SQLException { String tableName, int scope, boolean nullable) throws SQLException {
try { try {
if (isDebugEnabled()) { if (isDebugEnabled()) {
debugCode("getBestRowIdentifier(" debugCode("getBestRowIdentifier("
+quote(catalog)+", " +quote(catalogPattern)+", "
+quote(schema)+", " +quote(schemaPattern)+", "
+quote(tableName)+", " +quote(tableName)+", "
+scope+", "+nullable+");"); +scope+", "+nullable+");");
} }
...@@ -869,8 +876,8 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat ...@@ -869,8 +876,8 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat
prep.setInt(1, DatabaseMetaData.bestRowSession); prep.setInt(1, DatabaseMetaData.bestRowSession);
// PSEUDO_COLUMN // PSEUDO_COLUMN
prep.setInt(2, DatabaseMetaData.bestRowNotPseudo); prep.setInt(2, DatabaseMetaData.bestRowNotPseudo);
prep.setString(3, getCatalogPattern(catalog)); prep.setString(3, getCatalogPattern(catalogPattern));
prep.setString(4, getSchemaPattern(schema)); prep.setString(4, getSchemaPattern(schemaPattern));
prep.setString(5, tableName); prep.setString(5, tableName);
return prep.executeQuery(); return prep.executeQuery();
} catch (Exception e) { } catch (Exception e) {
...@@ -880,6 +887,7 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat ...@@ -880,6 +887,7 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat
/** /**
* Get the list of columns that are update when any value is updated. * Get the list of columns that are update when any value is updated.
* The result set is always empty.
* *
* <ul> * <ul>
* <li>1 SCOPE (int) not used * <li>1 SCOPE (int) not used
...@@ -950,18 +958,18 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat ...@@ -950,18 +958,18 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat
* importedKeyNotDeferrable) </li> * importedKeyNotDeferrable) </li>
* </ul> * </ul>
* *
* @param catalog null (to get all objects) or the catalog name * @param catalogPattern null (to get all objects) or the catalog name
* @param schema the schema name of the foreign table * @param schemaPattern the schema name of the foreign table
* @param tableName the name of the foreign table * @param tableName the name of the foreign table
* @return the result set * @return the result set
* @throws SQLException if the connection is closed * @throws SQLException if the connection is closed
*/ */
public ResultSet getImportedKeys(String catalog, String schema, String tableName) throws SQLException { public ResultSet getImportedKeys(String catalogPattern, String schemaPattern, String tableName) throws SQLException {
try { try {
if (isDebugEnabled()) { if (isDebugEnabled()) {
debugCode("getImportedKeys(" debugCode("getImportedKeys("
+quote(catalog)+", " +quote(catalogPattern)+", "
+quote(schema)+", " +quote(schemaPattern)+", "
+quote(tableName)+");"); +quote(tableName)+");");
} }
checkClosed(); checkClosed();
...@@ -985,8 +993,8 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat ...@@ -985,8 +993,8 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat
+ "AND FKTABLE_SCHEMA LIKE ? " + "AND FKTABLE_SCHEMA LIKE ? "
+ "AND FKTABLE_NAME = ? " + "AND FKTABLE_NAME = ? "
+ "ORDER BY PKTABLE_CAT, PKTABLE_SCHEM, PKTABLE_NAME, FK_NAME, KEY_SEQ"); + "ORDER BY PKTABLE_CAT, PKTABLE_SCHEM, PKTABLE_NAME, FK_NAME, KEY_SEQ");
prep.setString(1, getCatalogPattern(catalog)); prep.setString(1, getCatalogPattern(catalogPattern));
prep.setString(2, getSchemaPattern(schema)); prep.setString(2, getSchemaPattern(schemaPattern));
prep.setString(3, tableName); prep.setString(3, tableName);
return prep.executeQuery(); return prep.executeQuery();
} catch (Exception e) { } catch (Exception e) {
...@@ -1019,19 +1027,19 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat ...@@ -1019,19 +1027,19 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat
* importedKeyNotDeferrable) </li> * importedKeyNotDeferrable) </li>
* </ul> * </ul>
* *
* @param catalog null (to get all objects) or the catalog name * @param catalogPattern null or the catalog name
* @param schema the schema name of the primary table * @param schemaPattern the schema name of the primary table
* @param tableName the name of the primary table * @param tableName the name of the primary table
* @return the result set * @return the result set
* @throws SQLException if the connection is closed * @throws SQLException if the connection is closed
*/ */
public ResultSet getExportedKeys(String catalog, String schema, String tableName) public ResultSet getExportedKeys(String catalogPattern, String schemaPattern, String tableName)
throws SQLException { throws SQLException {
try { try {
if (isDebugEnabled()) { if (isDebugEnabled()) {
debugCode("getExportedKeys(" debugCode("getExportedKeys("
+quote(catalog)+", " +quote(catalogPattern)+", "
+quote(schema)+", " +quote(schemaPattern)+", "
+quote(tableName)+");"); +quote(tableName)+");");
} }
checkClosed(); checkClosed();
...@@ -1055,8 +1063,8 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat ...@@ -1055,8 +1063,8 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat
+ "AND PKTABLE_SCHEMA LIKE ? " + "AND PKTABLE_SCHEMA LIKE ? "
+ "AND PKTABLE_NAME = ? " + "AND PKTABLE_NAME = ? "
+ "ORDER BY FKTABLE_CAT, FKTABLE_SCHEM, FKTABLE_NAME, FK_NAME, KEY_SEQ"); + "ORDER BY FKTABLE_CAT, FKTABLE_SCHEM, FKTABLE_NAME, FK_NAME, KEY_SEQ");
prep.setString(1, getCatalogPattern(catalog)); prep.setString(1, getCatalogPattern(catalogPattern));
prep.setString(2, getSchemaPattern(schema)); prep.setString(2, getSchemaPattern(schemaPattern));
prep.setString(3, tableName); prep.setString(3, tableName);
return prep.executeQuery(); return prep.executeQuery();
} catch (Exception e) { } catch (Exception e) {
...@@ -1090,28 +1098,28 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat ...@@ -1090,28 +1098,28 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat
* importedKeyNotDeferrable) </li> * importedKeyNotDeferrable) </li>
* </ul> * </ul>
* *
* @param primaryCatalog ignored * @param primaryCatalogPattern null or the catalog name
* @param primarySchema the schema name of the primary table (must be * @param primarySchemaPattern the schema name of the primary table (must be
* specified) * specified)
* @param primaryTable the name of the primary table (must be specified) * @param primaryTable the name of the primary table (must be specified)
* @param foreignCatalog ignored * @param foreignCatalogPattern null or the catalog name
* @param foreignSchema the schema name of the foreign table (must be * @param foreignSchemaPattern the schema name of the foreign table (must be
* specified) * specified)
* @param foreignTable the name of the foreign table (must be specified) * @param foreignTable the name of the foreign table (must be specified)
* @return the result set * @return the result set
* @throws SQLException if the connection is closed * @throws SQLException if the connection is closed
*/ */
public ResultSet getCrossReference(String primaryCatalog, public ResultSet getCrossReference(String primaryCatalogPattern,
String primarySchema, String primaryTable, String foreignCatalog, String primarySchemaPattern, String primaryTable, String foreignCatalogPattern,
String foreignSchema, String foreignTable) throws SQLException { String foreignSchemaPattern, String foreignTable) throws SQLException {
try { try {
if (isDebugEnabled()) { if (isDebugEnabled()) {
debugCode("getCrossReference(" debugCode("getCrossReference("
+quote(primaryCatalog)+", " +quote(primaryCatalogPattern)+", "
+quote(primarySchema)+", " +quote(primarySchemaPattern)+", "
+quote(primaryTable)+", " +quote(primaryTable)+", "
+quote(foreignCatalog)+", " +quote(foreignCatalogPattern)+", "
+quote(foreignSchema)+", " +quote(foreignSchemaPattern)+", "
+quote(foreignTable)+");"); +quote(foreignTable)+");");
} }
checkClosed(); checkClosed();
...@@ -1138,11 +1146,11 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat ...@@ -1138,11 +1146,11 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat
+ "AND FKTABLE_SCHEMA LIKE ? " + "AND FKTABLE_SCHEMA LIKE ? "
+ "AND FKTABLE_NAME = ? " + "AND FKTABLE_NAME = ? "
+ "ORDER BY FKTABLE_CAT, FKTABLE_SCHEM, FKTABLE_NAME, FK_NAME, KEY_SEQ"); + "ORDER BY FKTABLE_CAT, FKTABLE_SCHEM, FKTABLE_NAME, FK_NAME, KEY_SEQ");
prep.setString(1, getCatalogPattern(primaryCatalog)); prep.setString(1, getCatalogPattern(primaryCatalogPattern));
prep.setString(2, getSchemaPattern(primarySchema)); prep.setString(2, getSchemaPattern(primarySchemaPattern));
prep.setString(3, primaryTable); prep.setString(3, primaryTable);
prep.setString(4, getCatalogPattern(foreignCatalog)); prep.setString(4, getCatalogPattern(foreignCatalogPattern));
prep.setString(5, getSchemaPattern(foreignSchema)); prep.setString(5, getSchemaPattern(foreignSchemaPattern));
prep.setString(6, foreignTable); prep.setString(6, foreignTable);
return prep.executeQuery(); return prep.executeQuery();
} catch (Exception e) { } catch (Exception e) {
......
...@@ -15,6 +15,7 @@ import java.sql.SQLException; ...@@ -15,6 +15,7 @@ import java.sql.SQLException;
import org.h2.constant.ErrorCode; import org.h2.constant.ErrorCode;
import org.h2.engine.SessionInterface; import org.h2.engine.SessionInterface;
import org.h2.message.Message; import org.h2.message.Message;
import org.h2.util.JdbcUtils;
import org.h2.util.ObjectArray; import org.h2.util.ObjectArray;
import org.h2.util.StringUtils; import org.h2.util.StringUtils;
import org.h2.value.DataType; import org.h2.value.DataType;
...@@ -68,7 +69,10 @@ public class UpdatableRow { ...@@ -68,7 +69,10 @@ public class UpdatableRow {
return; return;
} }
} }
ResultSet rs = meta.getTables(null, schemaName, tableName, new String[] { "TABLE" }); ResultSet rs = meta.getTables(null,
JdbcUtils.escapeMetaDataPattern(schemaName),
JdbcUtils.escapeMetaDataPattern(tableName),
new String[] { "TABLE" });
if (!rs.next()) { if (!rs.next()) {
return; return;
} }
...@@ -77,12 +81,16 @@ public class UpdatableRow { ...@@ -77,12 +81,16 @@ public class UpdatableRow {
return; return;
} }
key = new ObjectArray(); key = new ObjectArray();
rs = meta.getPrimaryKeys(null, schemaName, tableName); rs = meta.getPrimaryKeys(null,
JdbcUtils.escapeMetaDataPattern(schemaName),
tableName);
while (rs.next()) { while (rs.next()) {
key.add(rs.getString("COLUMN_NAME")); key.add(rs.getString("COLUMN_NAME"));
} }
if (key.size() == 0) { if (key.size() == 0) {
rs = meta.getIndexInfo(null, schemaName, tableName, true, true); rs = meta.getIndexInfo(null,
JdbcUtils.escapeMetaDataPattern(schemaName),
tableName, true, true);
while (rs.next()) { while (rs.next()) {
key.add(rs.getString("COLUMN_NAME")); key.add(rs.getString("COLUMN_NAME"));
} }
......
...@@ -283,8 +283,6 @@ java org.h2.test.TestAll timer ...@@ -283,8 +283,6 @@ java org.h2.test.TestAll timer
/* /*
line breaks in grammar (specially select)
test performance with log=2 test performance with log=2
maybe make log=2 the default option maybe make log=2 the default option
...@@ -293,8 +291,6 @@ TRANSACTION_ID() ...@@ -293,8 +291,6 @@ TRANSACTION_ID()
select 1 from dual a where 1 in(select 1 from dual b select 1 from dual a where 1 in(select 1 from dual b
where 1 in(select 1 from dual c where a.x=1)); where 1 in(select 1 from dual c where a.x=1));
error message on insert / merge: include SQL statement (at least table name)
use 127.0.0.1 if other addresses don't work use 127.0.0.1 if other addresses don't work
select for update in mvcc mode: only lock the selected records? select for update in mvcc mode: only lock the selected records?
......
...@@ -16,10 +16,25 @@ import org.h2.util.IntArray; ...@@ -16,10 +16,25 @@ import org.h2.util.IntArray;
*/ */
public class TestIntArray extends TestBase { public class TestIntArray extends TestBase {
/**
* Run just this test.
*
* @param a ignored
*/
public static void main(String[] a) throws Exception {
TestBase.createCaller().init().test();
}
public void test() { public void test() {
testInit();
testRandom(); testRandom();
} }
private void testInit() {
IntArray array = new IntArray(new int[0]);
array.add(10);
}
private void testRandom() { private void testRandom() {
IntArray array = new IntArray(); IntArray array = new IntArray();
int[] test = new int[0]; int[] test = new int[0];
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论