mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-10-02 23:16:54 +02:00
Bring DatabaseMetaData feature tests up to date:
* NULLs are sorted differently in 7.2 * table correlation names are supported * GROUP BY, ORDER BY unrelated is supported since 6.4 * ESCAPE/LIKE only supported since 7.1 * outer joins only since 7.1 * preferred term for procedure is "function" * preferred term for catalog is "database" * supports SELECT for UPDATE since 6.5 * supports subqueries * supports UNION; supports UNION ALL since 7.1 * update some of the max lengths to match reality * rearrange some functions to match the order in the spec for easier maintenance
This commit is contained in:
parent
ea88062c29
commit
2d9ee0fc55
@ -46,6 +46,16 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
|
|||||||
// This is a default value for remarks
|
// This is a default value for remarks
|
||||||
private static final byte defaultRemarks[]="no remarks".getBytes();
|
private static final byte defaultRemarks[]="no remarks".getBytes();
|
||||||
|
|
||||||
|
|
||||||
|
private boolean haveMinimumServerVersion(String ver) throws SQLException
|
||||||
|
{
|
||||||
|
if (getDatabaseProductVersion().compareTo(ver)>=0)
|
||||||
|
return true;
|
||||||
|
else
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public DatabaseMetaData(Connection conn)
|
public DatabaseMetaData(Connection conn)
|
||||||
{
|
{
|
||||||
this.connection = conn;
|
this.connection = conn;
|
||||||
@ -116,7 +126,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
|
|||||||
*/
|
*/
|
||||||
public boolean nullsAreSortedHigh() throws SQLException
|
public boolean nullsAreSortedHigh() throws SQLException
|
||||||
{
|
{
|
||||||
return false;
|
return haveMinimumServerVersion("7.2");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -149,7 +159,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
|
|||||||
*/
|
*/
|
||||||
public boolean nullsAreSortedAtEnd() throws SQLException
|
public boolean nullsAreSortedAtEnd() throws SQLException
|
||||||
{
|
{
|
||||||
return true;
|
return ! haveMinimumServerVersion("7.2");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -305,10 +315,6 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
|
|||||||
* case sensitive and as a result store them in mixed case? A
|
* case sensitive and as a result store them in mixed case? A
|
||||||
* JDBC compliant driver will always return true.
|
* JDBC compliant driver will always return true.
|
||||||
*
|
*
|
||||||
* <p>Predicament - what do they mean by "SQL identifiers" - if it
|
|
||||||
* means the names of the tables and columns, then the answers
|
|
||||||
* given below are correct - otherwise I don't know.
|
|
||||||
*
|
|
||||||
* @return true if so
|
* @return true if so
|
||||||
* @exception SQLException if a database access error occurs
|
* @exception SQLException if a database access error occurs
|
||||||
*/
|
*/
|
||||||
@ -355,9 +361,6 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
|
|||||||
* a space if identifier quoting isn't supported. A JDBC Compliant
|
* a space if identifier quoting isn't supported. A JDBC Compliant
|
||||||
* driver will always use a double quote character.
|
* driver will always use a double quote character.
|
||||||
*
|
*
|
||||||
* <p>If an SQL identifier is a table name, column name, etc. then
|
|
||||||
* we do not support it.
|
|
||||||
*
|
|
||||||
* @return the quoting string
|
* @return the quoting string
|
||||||
* @exception SQLException if a database access error occurs
|
* @exception SQLException if a database access error occurs
|
||||||
*/
|
*/
|
||||||
@ -510,15 +513,27 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Are table correlation names supported? A JDBC Compliant
|
||||||
|
* driver always returns true.
|
||||||
|
*
|
||||||
|
* @return true if so; false otherwise
|
||||||
|
* @exception SQLException - if a database access error occurs
|
||||||
|
*/
|
||||||
public boolean supportsTableCorrelationNames() throws SQLException
|
public boolean supportsTableCorrelationNames() throws SQLException
|
||||||
{
|
{
|
||||||
// XXX-Not Implemented
|
return true;
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If table correlation names are supported, are they restricted to
|
||||||
|
* be different from the names of the tables?
|
||||||
|
*
|
||||||
|
* @return true if so; false otherwise
|
||||||
|
* @exception SQLException - if a database access error occurs
|
||||||
|
*/
|
||||||
public boolean supportsDifferentTableCorrelationNames() throws SQLException
|
public boolean supportsDifferentTableCorrelationNames() throws SQLException
|
||||||
{
|
{
|
||||||
// XXX-Not Implemented
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -537,14 +552,13 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Can an "ORDER BY" clause use columns not in the SELECT?
|
* Can an "ORDER BY" clause use columns not in the SELECT?
|
||||||
* I checked it, and you can't.
|
|
||||||
*
|
*
|
||||||
* @return true if so
|
* @return true if so
|
||||||
* @exception SQLException if a database access error occurs
|
* @exception SQLException if a database access error occurs
|
||||||
*/
|
*/
|
||||||
public boolean supportsOrderByUnrelated() throws SQLException
|
public boolean supportsOrderByUnrelated() throws SQLException
|
||||||
{
|
{
|
||||||
return false;
|
return haveMinimumServerVersion("6.4");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -561,14 +575,13 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Can a "GROUP BY" clause use columns not in the SELECT?
|
* Can a "GROUP BY" clause use columns not in the SELECT?
|
||||||
* I checked it - it seems to allow it
|
|
||||||
*
|
*
|
||||||
* @return true if so
|
* @return true if so
|
||||||
* @exception SQLException if a database access error occurs
|
* @exception SQLException if a database access error occurs
|
||||||
*/
|
*/
|
||||||
public boolean supportsGroupByUnrelated() throws SQLException
|
public boolean supportsGroupByUnrelated() throws SQLException
|
||||||
{
|
{
|
||||||
return true;
|
return haveMinimumServerVersion("6.4");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -576,12 +589,14 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
|
|||||||
* it specifies all the columns in the SELECT? Does anyone actually
|
* it specifies all the columns in the SELECT? Does anyone actually
|
||||||
* understand what they mean here?
|
* understand what they mean here?
|
||||||
*
|
*
|
||||||
|
* (I think this is a subset of the previous function. -- petere)
|
||||||
|
*
|
||||||
* @return true if so
|
* @return true if so
|
||||||
* @exception SQLException if a database access error occurs
|
* @exception SQLException if a database access error occurs
|
||||||
*/
|
*/
|
||||||
public boolean supportsGroupByBeyondSelect() throws SQLException
|
public boolean supportsGroupByBeyondSelect() throws SQLException
|
||||||
{
|
{
|
||||||
return true; // For now...
|
return supportsGroupByUnrelated();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -593,7 +608,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
|
|||||||
*/
|
*/
|
||||||
public boolean supportsLikeEscapeClause() throws SQLException
|
public boolean supportsLikeEscapeClause() throws SQLException
|
||||||
{
|
{
|
||||||
return true;
|
return haveMinimumServerVersion("7.1");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -681,8 +696,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Does this driver support the ANSI-92 entry level SQL grammar?
|
* Does this driver support the ANSI-92 entry level SQL grammar?
|
||||||
* All JDBC Compliant drivers must return true. I think we have
|
* All JDBC Compliant drivers must return true.
|
||||||
* to support outer joins for this to be true.
|
|
||||||
*
|
*
|
||||||
* @return true if so
|
* @return true if so
|
||||||
* @exception SQLException if a database access error occurs
|
* @exception SQLException if a database access error occurs
|
||||||
@ -694,8 +708,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Does this driver support the ANSI-92 intermediate level SQL
|
* Does this driver support the ANSI-92 intermediate level SQL
|
||||||
* grammar? Anyone who does not support Entry level cannot support
|
* grammar?
|
||||||
* Intermediate level.
|
|
||||||
*
|
*
|
||||||
* @return true if so
|
* @return true if so
|
||||||
* @exception SQLException if a database access error occurs
|
* @exception SQLException if a database access error occurs
|
||||||
@ -736,7 +749,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
|
|||||||
*/
|
*/
|
||||||
public boolean supportsOuterJoins() throws SQLException
|
public boolean supportsOuterJoins() throws SQLException
|
||||||
{
|
{
|
||||||
return true; // yes 7.1 does
|
return haveMinimumServerVersion("7.1");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -748,7 +761,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
|
|||||||
*/
|
*/
|
||||||
public boolean supportsFullOuterJoins() throws SQLException
|
public boolean supportsFullOuterJoins() throws SQLException
|
||||||
{
|
{
|
||||||
return true; // yes in 7.1
|
return haveMinimumServerVersion("7.1");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -760,44 +773,43 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
|
|||||||
*/
|
*/
|
||||||
public boolean supportsLimitedOuterJoins() throws SQLException
|
public boolean supportsLimitedOuterJoins() throws SQLException
|
||||||
{
|
{
|
||||||
return true; // yes in 7.1
|
return supportsFullOuterJoins();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* What is the database vendor's preferred term for "schema" - well,
|
* What is the database vendor's preferred term for "schema"?
|
||||||
* we do not provide support for schemas, so lets just use that
|
* PostgreSQL doesn't have schemas, but when it does, we'll use the
|
||||||
* term.
|
* term "schema".
|
||||||
*
|
*
|
||||||
* @return the vendor term
|
* @return the vendor term
|
||||||
* @exception SQLException if a database access error occurs
|
* @exception SQLException if a database access error occurs
|
||||||
*/
|
*/
|
||||||
public String getSchemaTerm() throws SQLException
|
public String getSchemaTerm() throws SQLException
|
||||||
{
|
{
|
||||||
return "Schema";
|
return "schema";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* What is the database vendor's preferred term for "procedure" -
|
* What is the database vendor's preferred term for "procedure"?
|
||||||
* I kind of like "Procedure" myself.
|
* Traditionally, "function" has been used.
|
||||||
*
|
*
|
||||||
* @return the vendor term
|
* @return the vendor term
|
||||||
* @exception SQLException if a database access error occurs
|
* @exception SQLException if a database access error occurs
|
||||||
*/
|
*/
|
||||||
public String getProcedureTerm() throws SQLException
|
public String getProcedureTerm() throws SQLException
|
||||||
{
|
{
|
||||||
return "Procedure";
|
return "function";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* What is the database vendor's preferred term for "catalog"? -
|
* What is the database vendor's preferred term for "catalog"?
|
||||||
* we dont have a preferred term, so just use Catalog
|
|
||||||
*
|
*
|
||||||
* @return the vendor term
|
* @return the vendor term
|
||||||
* @exception SQLException if a database access error occurs
|
* @exception SQLException if a database access error occurs
|
||||||
*/
|
*/
|
||||||
public String getCatalogTerm() throws SQLException
|
public String getCatalogTerm() throws SQLException
|
||||||
{
|
{
|
||||||
return "Catalog";
|
return "database";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -809,21 +821,18 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
|
|||||||
*/
|
*/
|
||||||
public boolean isCatalogAtStart() throws SQLException
|
public boolean isCatalogAtStart() throws SQLException
|
||||||
{
|
{
|
||||||
return false;
|
throw org.postgresql.Driver.notImplemented();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* What is the Catalog separator. Hmmm....well, I kind of like
|
* What is the Catalog separator.
|
||||||
* a period (so we get catalog.table definitions). - I don't think
|
|
||||||
* PostgreSQL supports catalogs anyhow, so it makes no difference.
|
|
||||||
*
|
*
|
||||||
* @return the catalog separator string
|
* @return the catalog separator string
|
||||||
* @exception SQLException if a database access error occurs
|
* @exception SQLException if a database access error occurs
|
||||||
*/
|
*/
|
||||||
public String getCatalogSeparator() throws SQLException
|
public String getCatalogSeparator() throws SQLException
|
||||||
{
|
{
|
||||||
// PM Sep 29 97 - changed from "." as we don't support catalogs.
|
throw org.postgresql.Driver.notImplemented();
|
||||||
return "";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -959,68 +968,114 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
|
|||||||
return false; // For now...
|
return false; // For now...
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Is SELECT for UPDATE supported?
|
||||||
|
*
|
||||||
|
* @return true if so; false otherwise
|
||||||
|
* @exception SQLException - if a database access error occurs
|
||||||
|
*/
|
||||||
public boolean supportsSelectForUpdate() throws SQLException
|
public boolean supportsSelectForUpdate() throws SQLException
|
||||||
{
|
{
|
||||||
// XXX-Not Implemented
|
return haveMinimumServerVersion("6.5");
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Are stored procedure calls using the stored procedure escape
|
||||||
|
* syntax supported?
|
||||||
|
*
|
||||||
|
* @return true if so; false otherwise
|
||||||
|
* @exception SQLException - if a database access error occurs
|
||||||
|
*/
|
||||||
public boolean supportsStoredProcedures() throws SQLException
|
public boolean supportsStoredProcedures() throws SQLException
|
||||||
{
|
{
|
||||||
// XXX-Not Implemented
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean supportsSubqueriesInComparisons() throws SQLException
|
|
||||||
{
|
|
||||||
// XXX-Not Implemented
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean supportsSubqueriesInExists() throws SQLException
|
|
||||||
{
|
|
||||||
// XXX-Not Implemented
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean supportsSubqueriesInIns() throws SQLException
|
|
||||||
{
|
|
||||||
// XXX-Not Implemented
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean supportsSubqueriesInQuantifieds() throws SQLException
|
|
||||||
{
|
|
||||||
// XXX-Not Implemented
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean supportsCorrelatedSubqueries() throws SQLException
|
|
||||||
{
|
|
||||||
// XXX-Not Implemented
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Is SQL UNION supported? Nope.
|
* Are subqueries in comparison expressions supported? A JDBC
|
||||||
|
* Compliant driver always returns true.
|
||||||
|
*
|
||||||
|
* @return true if so; false otherwise
|
||||||
|
* @exception SQLException - if a database access error occurs
|
||||||
|
*/
|
||||||
|
public boolean supportsSubqueriesInComparisons() throws SQLException
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Are subqueries in 'exists' expressions supported? A JDBC
|
||||||
|
* Compliant driver always returns true.
|
||||||
|
*
|
||||||
|
* @return true if so; false otherwise
|
||||||
|
* @exception SQLException - if a database access error occurs
|
||||||
|
*/
|
||||||
|
public boolean supportsSubqueriesInExists() throws SQLException
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Are subqueries in 'in' statements supported? A JDBC
|
||||||
|
* Compliant driver always returns true.
|
||||||
|
*
|
||||||
|
* @return true if so; false otherwise
|
||||||
|
* @exception SQLException - if a database access error occurs
|
||||||
|
*/
|
||||||
|
public boolean supportsSubqueriesInIns() throws SQLException
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Are subqueries in quantified expressions supported? A JDBC
|
||||||
|
* Compliant driver always returns true.
|
||||||
|
*
|
||||||
|
* (No idea what this is, but we support a good deal of
|
||||||
|
* subquerying.)
|
||||||
|
*
|
||||||
|
* @return true if so; false otherwise
|
||||||
|
* @exception SQLException - if a database access error occurs
|
||||||
|
*/
|
||||||
|
public boolean supportsSubqueriesInQuantifieds() throws SQLException
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Are correlated subqueries supported? A JDBC Compliant driver
|
||||||
|
* always returns true.
|
||||||
|
*
|
||||||
|
* (a.k.a. subselect in from?)
|
||||||
|
*
|
||||||
|
* @return true if so; false otherwise
|
||||||
|
* @exception SQLException - if a database access error occurs
|
||||||
|
*/
|
||||||
|
public boolean supportsCorrelatedSubqueries() throws SQLException
|
||||||
|
{
|
||||||
|
return haveMinimumServerVersion("7.1");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Is SQL UNION supported?
|
||||||
*
|
*
|
||||||
* @return true if so
|
* @return true if so
|
||||||
* @exception SQLException if a database access error occurs
|
* @exception SQLException if a database access error occurs
|
||||||
*/
|
*/
|
||||||
public boolean supportsUnion() throws SQLException
|
public boolean supportsUnion() throws SQLException
|
||||||
{
|
{
|
||||||
return true; // 7.0?
|
return true; // since 6.3
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Is SQL UNION ALL supported? Nope.
|
* Is SQL UNION ALL supported?
|
||||||
*
|
*
|
||||||
* @return true if so
|
* @return true if so
|
||||||
* @exception SQLException if a database access error occurs
|
* @exception SQLException if a database access error occurs
|
||||||
*/
|
*/
|
||||||
public boolean supportsUnionAll() throws SQLException
|
public boolean supportsUnionAll() throws SQLException
|
||||||
{
|
{
|
||||||
return false;
|
return haveMinimumServerVersion("7.1");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1081,7 +1136,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
|
|||||||
*/
|
*/
|
||||||
public int getMaxBinaryLiteralLength() throws SQLException
|
public int getMaxBinaryLiteralLength() throws SQLException
|
||||||
{
|
{
|
||||||
return 0; // For now...
|
return 0; // no limit
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1093,7 +1148,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
|
|||||||
*/
|
*/
|
||||||
public int getMaxCharLiteralLength() throws SQLException
|
public int getMaxCharLiteralLength() throws SQLException
|
||||||
{
|
{
|
||||||
return 65535;
|
return 0; // no limit
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1117,7 +1172,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
|
|||||||
*/
|
*/
|
||||||
public int getMaxColumnsInGroupBy() throws SQLException
|
public int getMaxColumnsInGroupBy() throws SQLException
|
||||||
{
|
{
|
||||||
return getMaxColumnsInTable();
|
return 0; // no limit
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1135,26 +1190,24 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* What's the maximum number of columns in an "ORDER BY clause?
|
* What's the maximum number of columns in an "ORDER BY clause?
|
||||||
* Theoretically, all of them!
|
|
||||||
*
|
*
|
||||||
* @return the max columns
|
* @return the max columns
|
||||||
* @exception SQLException if a database access error occurs
|
* @exception SQLException if a database access error occurs
|
||||||
*/
|
*/
|
||||||
public int getMaxColumnsInOrderBy() throws SQLException
|
public int getMaxColumnsInOrderBy() throws SQLException
|
||||||
{
|
{
|
||||||
return getMaxColumnsInTable();
|
return 0; // no limit
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* What is the maximum number of columns in a "SELECT" list?
|
* What is the maximum number of columns in a "SELECT" list?
|
||||||
* Theoretically, all of them!
|
|
||||||
*
|
*
|
||||||
* @return the max columns
|
* @return the max columns
|
||||||
* @exception SQLException if a database access error occurs
|
* @exception SQLException if a database access error occurs
|
||||||
*/
|
*/
|
||||||
public int getMaxColumnsInSelect() throws SQLException
|
public int getMaxColumnsInSelect() throws SQLException
|
||||||
{
|
{
|
||||||
return getMaxColumnsInTable();
|
return 0; // no limit
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1204,20 +1257,17 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* What is the maximum length of an index (in bytes)? Now, does
|
* Retrieves the maximum number of bytes for an index, including all
|
||||||
* the spec. mean name of an index (in which case its 32, the
|
* of the parts of the index.
|
||||||
* same as a table) or does it mean length of an index element
|
|
||||||
* (in which case its 8192, the size of a row) or does it mean
|
|
||||||
* the number of rows it can access (in which case it 2^32 -
|
|
||||||
* a 4 byte OID number)? I think its the length of an index
|
|
||||||
* element, personally, so Im setting it to 65535.
|
|
||||||
*
|
*
|
||||||
* @return max index length in bytes
|
* @return max index length in bytes, which includes the composite
|
||||||
|
* of all the constituent parts of the index; a result of zero means
|
||||||
|
* that there is no limit or the limit is not known
|
||||||
* @exception SQLException if a database access error occurs
|
* @exception SQLException if a database access error occurs
|
||||||
*/
|
*/
|
||||||
public int getMaxIndexLength() throws SQLException
|
public int getMaxIndexLength() throws SQLException
|
||||||
{
|
{
|
||||||
return 65535;
|
return 0; // no limit (larger than an int anyway)
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getMaxSchemaNameLength() throws SQLException
|
public int getMaxSchemaNameLength() throws SQLException
|
||||||
@ -1246,15 +1296,17 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* What is the maximum length of a single row? (not including
|
* What is the maximum length of a single row?
|
||||||
* blobs). 65535 is defined in PostgreSQL.
|
|
||||||
*
|
*
|
||||||
* @return max row size in bytes
|
* @return max row size in bytes
|
||||||
* @exception SQLException if a database access error occurs
|
* @exception SQLException if a database access error occurs
|
||||||
*/
|
*/
|
||||||
public int getMaxRowSize() throws SQLException
|
public int getMaxRowSize() throws SQLException
|
||||||
{
|
{
|
||||||
return 65535;
|
if (haveMinimumServerVersion("7.1"))
|
||||||
|
return 1073741824; // 1 GB
|
||||||
|
else
|
||||||
|
return 8192; // XXX could be altered
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1277,7 +1329,10 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
|
|||||||
*/
|
*/
|
||||||
public int getMaxStatementLength() throws SQLException
|
public int getMaxStatementLength() throws SQLException
|
||||||
{
|
{
|
||||||
return 65535;
|
if (haveMinimumServerVersion("7.0"))
|
||||||
|
return 0; // actually whatever fits in size_t
|
||||||
|
else
|
||||||
|
return 16384;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1310,19 +1365,14 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* What is the maximum number of tables that can be specified
|
* What is the maximum number of tables that can be specified
|
||||||
* in a SELECT? Theoretically, this is the same number as the
|
* in a SELECT?
|
||||||
* number of tables allowable. In practice tho, it is much smaller
|
|
||||||
* since the number of tables is limited by the statement, we
|
|
||||||
* return 1024 here - this is just a number I came up with (being
|
|
||||||
* the number of tables roughly of three characters each that you
|
|
||||||
* can fit inside a 65535 character buffer with comma separators).
|
|
||||||
*
|
*
|
||||||
* @return the maximum
|
* @return the maximum
|
||||||
* @exception SQLException if a database access error occurs
|
* @exception SQLException if a database access error occurs
|
||||||
*/
|
*/
|
||||||
public int getMaxTablesInSelect() throws SQLException
|
public int getMaxTablesInSelect() throws SQLException
|
||||||
{
|
{
|
||||||
return 1024;
|
return 0; // no limit
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1386,15 +1436,14 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Are both data definition and data manipulation transactions
|
* Are both data definition and data manipulation transactions
|
||||||
* supported? I checked it, and could not do a CREATE TABLE
|
* supported?
|
||||||
* within a transaction, so I am assuming that we don't
|
|
||||||
*
|
*
|
||||||
* @return true if so
|
* @return true if so
|
||||||
* @exception SQLException if a database access error occurs
|
* @exception SQLException if a database access error occurs
|
||||||
*/
|
*/
|
||||||
public boolean supportsDataDefinitionAndDataManipulationTransactions() throws SQLException
|
public boolean supportsDataDefinitionAndDataManipulationTransactions() throws SQLException
|
||||||
{
|
{
|
||||||
return false;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1406,7 +1455,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
|
|||||||
*/
|
*/
|
||||||
public boolean supportsDataManipulationTransactionsOnly() throws SQLException
|
public boolean supportsDataManipulationTransactionsOnly() throws SQLException
|
||||||
{
|
{
|
||||||
return true;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -46,6 +46,16 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
|
|||||||
// This is a default value for remarks
|
// This is a default value for remarks
|
||||||
private static final byte defaultRemarks[]="no remarks".getBytes();
|
private static final byte defaultRemarks[]="no remarks".getBytes();
|
||||||
|
|
||||||
|
|
||||||
|
private boolean haveMinimumServerVersion(String ver) throws SQLException
|
||||||
|
{
|
||||||
|
if (getDatabaseProductVersion().compareTo(ver)>=0)
|
||||||
|
return true;
|
||||||
|
else
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public DatabaseMetaData(Connection conn)
|
public DatabaseMetaData(Connection conn)
|
||||||
{
|
{
|
||||||
this.connection = conn;
|
this.connection = conn;
|
||||||
@ -116,7 +126,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
|
|||||||
*/
|
*/
|
||||||
public boolean nullsAreSortedHigh() throws SQLException
|
public boolean nullsAreSortedHigh() throws SQLException
|
||||||
{
|
{
|
||||||
return false;
|
return haveMinimumServerVersion("7.2");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -149,7 +159,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
|
|||||||
*/
|
*/
|
||||||
public boolean nullsAreSortedAtEnd() throws SQLException
|
public boolean nullsAreSortedAtEnd() throws SQLException
|
||||||
{
|
{
|
||||||
return true;
|
return ! haveMinimumServerVersion("7.2");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -305,10 +315,6 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
|
|||||||
* case sensitive and as a result store them in mixed case? A
|
* case sensitive and as a result store them in mixed case? A
|
||||||
* JDBC compliant driver will always return true.
|
* JDBC compliant driver will always return true.
|
||||||
*
|
*
|
||||||
* <p>Predicament - what do they mean by "SQL identifiers" - if it
|
|
||||||
* means the names of the tables and columns, then the answers
|
|
||||||
* given below are correct - otherwise I don't know.
|
|
||||||
*
|
|
||||||
* @return true if so
|
* @return true if so
|
||||||
* @exception SQLException if a database access error occurs
|
* @exception SQLException if a database access error occurs
|
||||||
*/
|
*/
|
||||||
@ -355,9 +361,6 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
|
|||||||
* a space if identifier quoting isn't supported. A JDBC Compliant
|
* a space if identifier quoting isn't supported. A JDBC Compliant
|
||||||
* driver will always use a double quote character.
|
* driver will always use a double quote character.
|
||||||
*
|
*
|
||||||
* <p>If an SQL identifier is a table name, column name, etc. then
|
|
||||||
* we do not support it.
|
|
||||||
*
|
|
||||||
* @return the quoting string
|
* @return the quoting string
|
||||||
* @exception SQLException if a database access error occurs
|
* @exception SQLException if a database access error occurs
|
||||||
*/
|
*/
|
||||||
@ -510,15 +513,27 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Are table correlation names supported? A JDBC Compliant
|
||||||
|
* driver always returns true.
|
||||||
|
*
|
||||||
|
* @return true if so; false otherwise
|
||||||
|
* @exception SQLException - if a database access error occurs
|
||||||
|
*/
|
||||||
public boolean supportsTableCorrelationNames() throws SQLException
|
public boolean supportsTableCorrelationNames() throws SQLException
|
||||||
{
|
{
|
||||||
// XXX-Not Implemented
|
return true;
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If table correlation names are supported, are they restricted to
|
||||||
|
* be different from the names of the tables?
|
||||||
|
*
|
||||||
|
* @return true if so; false otherwise
|
||||||
|
* @exception SQLException - if a database access error occurs
|
||||||
|
*/
|
||||||
public boolean supportsDifferentTableCorrelationNames() throws SQLException
|
public boolean supportsDifferentTableCorrelationNames() throws SQLException
|
||||||
{
|
{
|
||||||
// XXX-Not Implemented
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -537,14 +552,13 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Can an "ORDER BY" clause use columns not in the SELECT?
|
* Can an "ORDER BY" clause use columns not in the SELECT?
|
||||||
* I checked it, and you can't.
|
|
||||||
*
|
*
|
||||||
* @return true if so
|
* @return true if so
|
||||||
* @exception SQLException if a database access error occurs
|
* @exception SQLException if a database access error occurs
|
||||||
*/
|
*/
|
||||||
public boolean supportsOrderByUnrelated() throws SQLException
|
public boolean supportsOrderByUnrelated() throws SQLException
|
||||||
{
|
{
|
||||||
return false;
|
return haveMinimumServerVersion("6.4");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -561,14 +575,13 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Can a "GROUP BY" clause use columns not in the SELECT?
|
* Can a "GROUP BY" clause use columns not in the SELECT?
|
||||||
* I checked it - it seems to allow it
|
|
||||||
*
|
*
|
||||||
* @return true if so
|
* @return true if so
|
||||||
* @exception SQLException if a database access error occurs
|
* @exception SQLException if a database access error occurs
|
||||||
*/
|
*/
|
||||||
public boolean supportsGroupByUnrelated() throws SQLException
|
public boolean supportsGroupByUnrelated() throws SQLException
|
||||||
{
|
{
|
||||||
return true;
|
return haveMinimumServerVersion("6.4");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -576,12 +589,14 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
|
|||||||
* it specifies all the columns in the SELECT? Does anyone actually
|
* it specifies all the columns in the SELECT? Does anyone actually
|
||||||
* understand what they mean here?
|
* understand what they mean here?
|
||||||
*
|
*
|
||||||
|
* (I think this is a subset of the previous function. -- petere)
|
||||||
|
*
|
||||||
* @return true if so
|
* @return true if so
|
||||||
* @exception SQLException if a database access error occurs
|
* @exception SQLException if a database access error occurs
|
||||||
*/
|
*/
|
||||||
public boolean supportsGroupByBeyondSelect() throws SQLException
|
public boolean supportsGroupByBeyondSelect() throws SQLException
|
||||||
{
|
{
|
||||||
return true; // For now...
|
return supportsGroupByUnrelated();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -593,7 +608,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
|
|||||||
*/
|
*/
|
||||||
public boolean supportsLikeEscapeClause() throws SQLException
|
public boolean supportsLikeEscapeClause() throws SQLException
|
||||||
{
|
{
|
||||||
return true;
|
return haveMinimumServerVersion("7.1");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -681,8 +696,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Does this driver support the ANSI-92 entry level SQL grammar?
|
* Does this driver support the ANSI-92 entry level SQL grammar?
|
||||||
* All JDBC Compliant drivers must return true. I think we have
|
* All JDBC Compliant drivers must return true.
|
||||||
* to support outer joins for this to be true.
|
|
||||||
*
|
*
|
||||||
* @return true if so
|
* @return true if so
|
||||||
* @exception SQLException if a database access error occurs
|
* @exception SQLException if a database access error occurs
|
||||||
@ -694,8 +708,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Does this driver support the ANSI-92 intermediate level SQL
|
* Does this driver support the ANSI-92 intermediate level SQL
|
||||||
* grammar? Anyone who does not support Entry level cannot support
|
* grammar?
|
||||||
* Intermediate level.
|
|
||||||
*
|
*
|
||||||
* @return true if so
|
* @return true if so
|
||||||
* @exception SQLException if a database access error occurs
|
* @exception SQLException if a database access error occurs
|
||||||
@ -736,7 +749,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
|
|||||||
*/
|
*/
|
||||||
public boolean supportsOuterJoins() throws SQLException
|
public boolean supportsOuterJoins() throws SQLException
|
||||||
{
|
{
|
||||||
return true; // yes 7.1 does
|
return haveMinimumServerVersion("7.1");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -748,7 +761,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
|
|||||||
*/
|
*/
|
||||||
public boolean supportsFullOuterJoins() throws SQLException
|
public boolean supportsFullOuterJoins() throws SQLException
|
||||||
{
|
{
|
||||||
return true; // yes in 7.1
|
return haveMinimumServerVersion("7.1");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -760,44 +773,43 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
|
|||||||
*/
|
*/
|
||||||
public boolean supportsLimitedOuterJoins() throws SQLException
|
public boolean supportsLimitedOuterJoins() throws SQLException
|
||||||
{
|
{
|
||||||
return true; // yes in 7.1
|
return supportsFullOuterJoins();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* What is the database vendor's preferred term for "schema" - well,
|
* What is the database vendor's preferred term for "schema"?
|
||||||
* we do not provide support for schemas, so lets just use that
|
* PostgreSQL doesn't have schemas, but when it does, we'll use the
|
||||||
* term.
|
* term "schema".
|
||||||
*
|
*
|
||||||
* @return the vendor term
|
* @return the vendor term
|
||||||
* @exception SQLException if a database access error occurs
|
* @exception SQLException if a database access error occurs
|
||||||
*/
|
*/
|
||||||
public String getSchemaTerm() throws SQLException
|
public String getSchemaTerm() throws SQLException
|
||||||
{
|
{
|
||||||
return "Schema";
|
return "schema";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* What is the database vendor's preferred term for "procedure" -
|
* What is the database vendor's preferred term for "procedure"?
|
||||||
* I kind of like "Procedure" myself.
|
* Traditionally, "function" has been used.
|
||||||
*
|
*
|
||||||
* @return the vendor term
|
* @return the vendor term
|
||||||
* @exception SQLException if a database access error occurs
|
* @exception SQLException if a database access error occurs
|
||||||
*/
|
*/
|
||||||
public String getProcedureTerm() throws SQLException
|
public String getProcedureTerm() throws SQLException
|
||||||
{
|
{
|
||||||
return "Procedure";
|
return "function";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* What is the database vendor's preferred term for "catalog"? -
|
* What is the database vendor's preferred term for "catalog"?
|
||||||
* we dont have a preferred term, so just use Catalog
|
|
||||||
*
|
*
|
||||||
* @return the vendor term
|
* @return the vendor term
|
||||||
* @exception SQLException if a database access error occurs
|
* @exception SQLException if a database access error occurs
|
||||||
*/
|
*/
|
||||||
public String getCatalogTerm() throws SQLException
|
public String getCatalogTerm() throws SQLException
|
||||||
{
|
{
|
||||||
return "Catalog";
|
return "database";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -809,21 +821,18 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
|
|||||||
*/
|
*/
|
||||||
public boolean isCatalogAtStart() throws SQLException
|
public boolean isCatalogAtStart() throws SQLException
|
||||||
{
|
{
|
||||||
return false;
|
throw org.postgresql.Driver.notImplemented();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* What is the Catalog separator. Hmmm....well, I kind of like
|
* What is the Catalog separator.
|
||||||
* a period (so we get catalog.table definitions). - I don't think
|
|
||||||
* PostgreSQL supports catalogs anyhow, so it makes no difference.
|
|
||||||
*
|
*
|
||||||
* @return the catalog separator string
|
* @return the catalog separator string
|
||||||
* @exception SQLException if a database access error occurs
|
* @exception SQLException if a database access error occurs
|
||||||
*/
|
*/
|
||||||
public String getCatalogSeparator() throws SQLException
|
public String getCatalogSeparator() throws SQLException
|
||||||
{
|
{
|
||||||
// PM Sep 29 97 - changed from "." as we don't support catalogs.
|
throw org.postgresql.Driver.notImplemented();
|
||||||
return "";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -959,68 +968,114 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
|
|||||||
return false; // For now...
|
return false; // For now...
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Is SELECT for UPDATE supported?
|
||||||
|
*
|
||||||
|
* @return true if so; false otherwise
|
||||||
|
* @exception SQLException - if a database access error occurs
|
||||||
|
*/
|
||||||
public boolean supportsSelectForUpdate() throws SQLException
|
public boolean supportsSelectForUpdate() throws SQLException
|
||||||
{
|
{
|
||||||
// XXX-Not Implemented
|
return haveMinimumServerVersion("6.5");
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Are stored procedure calls using the stored procedure escape
|
||||||
|
* syntax supported?
|
||||||
|
*
|
||||||
|
* @return true if so; false otherwise
|
||||||
|
* @exception SQLException - if a database access error occurs
|
||||||
|
*/
|
||||||
public boolean supportsStoredProcedures() throws SQLException
|
public boolean supportsStoredProcedures() throws SQLException
|
||||||
{
|
{
|
||||||
// XXX-Not Implemented
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean supportsSubqueriesInComparisons() throws SQLException
|
|
||||||
{
|
|
||||||
// XXX-Not Implemented
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean supportsSubqueriesInExists() throws SQLException
|
|
||||||
{
|
|
||||||
// XXX-Not Implemented
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean supportsSubqueriesInIns() throws SQLException
|
|
||||||
{
|
|
||||||
// XXX-Not Implemented
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean supportsSubqueriesInQuantifieds() throws SQLException
|
|
||||||
{
|
|
||||||
// XXX-Not Implemented
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean supportsCorrelatedSubqueries() throws SQLException
|
|
||||||
{
|
|
||||||
// XXX-Not Implemented
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Is SQL UNION supported? Nope.
|
* Are subqueries in comparison expressions supported? A JDBC
|
||||||
|
* Compliant driver always returns true.
|
||||||
|
*
|
||||||
|
* @return true if so; false otherwise
|
||||||
|
* @exception SQLException - if a database access error occurs
|
||||||
|
*/
|
||||||
|
public boolean supportsSubqueriesInComparisons() throws SQLException
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Are subqueries in 'exists' expressions supported? A JDBC
|
||||||
|
* Compliant driver always returns true.
|
||||||
|
*
|
||||||
|
* @return true if so; false otherwise
|
||||||
|
* @exception SQLException - if a database access error occurs
|
||||||
|
*/
|
||||||
|
public boolean supportsSubqueriesInExists() throws SQLException
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Are subqueries in 'in' statements supported? A JDBC
|
||||||
|
* Compliant driver always returns true.
|
||||||
|
*
|
||||||
|
* @return true if so; false otherwise
|
||||||
|
* @exception SQLException - if a database access error occurs
|
||||||
|
*/
|
||||||
|
public boolean supportsSubqueriesInIns() throws SQLException
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Are subqueries in quantified expressions supported? A JDBC
|
||||||
|
* Compliant driver always returns true.
|
||||||
|
*
|
||||||
|
* (No idea what this is, but we support a good deal of
|
||||||
|
* subquerying.)
|
||||||
|
*
|
||||||
|
* @return true if so; false otherwise
|
||||||
|
* @exception SQLException - if a database access error occurs
|
||||||
|
*/
|
||||||
|
public boolean supportsSubqueriesInQuantifieds() throws SQLException
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Are correlated subqueries supported? A JDBC Compliant driver
|
||||||
|
* always returns true.
|
||||||
|
*
|
||||||
|
* (a.k.a. subselect in from?)
|
||||||
|
*
|
||||||
|
* @return true if so; false otherwise
|
||||||
|
* @exception SQLException - if a database access error occurs
|
||||||
|
*/
|
||||||
|
public boolean supportsCorrelatedSubqueries() throws SQLException
|
||||||
|
{
|
||||||
|
return haveMinimumServerVersion("7.1");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Is SQL UNION supported?
|
||||||
*
|
*
|
||||||
* @return true if so
|
* @return true if so
|
||||||
* @exception SQLException if a database access error occurs
|
* @exception SQLException if a database access error occurs
|
||||||
*/
|
*/
|
||||||
public boolean supportsUnion() throws SQLException
|
public boolean supportsUnion() throws SQLException
|
||||||
{
|
{
|
||||||
return true; // 7.0?
|
return true; // since 6.3
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Is SQL UNION ALL supported? Nope.
|
* Is SQL UNION ALL supported?
|
||||||
*
|
*
|
||||||
* @return true if so
|
* @return true if so
|
||||||
* @exception SQLException if a database access error occurs
|
* @exception SQLException if a database access error occurs
|
||||||
*/
|
*/
|
||||||
public boolean supportsUnionAll() throws SQLException
|
public boolean supportsUnionAll() throws SQLException
|
||||||
{
|
{
|
||||||
return false;
|
return haveMinimumServerVersion("7.1");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1081,7 +1136,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
|
|||||||
*/
|
*/
|
||||||
public int getMaxBinaryLiteralLength() throws SQLException
|
public int getMaxBinaryLiteralLength() throws SQLException
|
||||||
{
|
{
|
||||||
return 0; // For now...
|
return 0; // no limit
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1093,7 +1148,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
|
|||||||
*/
|
*/
|
||||||
public int getMaxCharLiteralLength() throws SQLException
|
public int getMaxCharLiteralLength() throws SQLException
|
||||||
{
|
{
|
||||||
return 65535;
|
return 0; // no limit
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1117,7 +1172,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
|
|||||||
*/
|
*/
|
||||||
public int getMaxColumnsInGroupBy() throws SQLException
|
public int getMaxColumnsInGroupBy() throws SQLException
|
||||||
{
|
{
|
||||||
return getMaxColumnsInTable();
|
return 0; // no limit
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1135,26 +1190,24 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* What's the maximum number of columns in an "ORDER BY clause?
|
* What's the maximum number of columns in an "ORDER BY clause?
|
||||||
* Theoretically, all of them!
|
|
||||||
*
|
*
|
||||||
* @return the max columns
|
* @return the max columns
|
||||||
* @exception SQLException if a database access error occurs
|
* @exception SQLException if a database access error occurs
|
||||||
*/
|
*/
|
||||||
public int getMaxColumnsInOrderBy() throws SQLException
|
public int getMaxColumnsInOrderBy() throws SQLException
|
||||||
{
|
{
|
||||||
return getMaxColumnsInTable();
|
return 0; // no limit
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* What is the maximum number of columns in a "SELECT" list?
|
* What is the maximum number of columns in a "SELECT" list?
|
||||||
* Theoretically, all of them!
|
|
||||||
*
|
*
|
||||||
* @return the max columns
|
* @return the max columns
|
||||||
* @exception SQLException if a database access error occurs
|
* @exception SQLException if a database access error occurs
|
||||||
*/
|
*/
|
||||||
public int getMaxColumnsInSelect() throws SQLException
|
public int getMaxColumnsInSelect() throws SQLException
|
||||||
{
|
{
|
||||||
return getMaxColumnsInTable();
|
return 0; // no limit
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1204,20 +1257,17 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* What is the maximum length of an index (in bytes)? Now, does
|
* Retrieves the maximum number of bytes for an index, including all
|
||||||
* the spec. mean name of an index (in which case its 32, the
|
* of the parts of the index.
|
||||||
* same as a table) or does it mean length of an index element
|
|
||||||
* (in which case its 8192, the size of a row) or does it mean
|
|
||||||
* the number of rows it can access (in which case it 2^32 -
|
|
||||||
* a 4 byte OID number)? I think its the length of an index
|
|
||||||
* element, personally, so Im setting it to 8192.
|
|
||||||
*
|
*
|
||||||
* @return max index length in bytes
|
* @return max index length in bytes, which includes the composite
|
||||||
|
* of all the constituent parts of the index; a result of zero means
|
||||||
|
* that there is no limit or the limit is not known
|
||||||
* @exception SQLException if a database access error occurs
|
* @exception SQLException if a database access error occurs
|
||||||
*/
|
*/
|
||||||
public int getMaxIndexLength() throws SQLException
|
public int getMaxIndexLength() throws SQLException
|
||||||
{
|
{
|
||||||
return 65535;
|
return 0; // no limit (larger than an int anyway)
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getMaxSchemaNameLength() throws SQLException
|
public int getMaxSchemaNameLength() throws SQLException
|
||||||
@ -1246,15 +1296,17 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* What is the maximum length of a single row? (not including
|
* What is the maximum length of a single row?
|
||||||
* blobs). 65535 is defined in PostgreSQL.
|
|
||||||
*
|
*
|
||||||
* @return max row size in bytes
|
* @return max row size in bytes
|
||||||
* @exception SQLException if a database access error occurs
|
* @exception SQLException if a database access error occurs
|
||||||
*/
|
*/
|
||||||
public int getMaxRowSize() throws SQLException
|
public int getMaxRowSize() throws SQLException
|
||||||
{
|
{
|
||||||
return 65535;
|
if (haveMinimumServerVersion("7.1"))
|
||||||
|
return 1073741824; // 1 GB
|
||||||
|
else
|
||||||
|
return 8192; // XXX could be altered
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1277,7 +1329,10 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
|
|||||||
*/
|
*/
|
||||||
public int getMaxStatementLength() throws SQLException
|
public int getMaxStatementLength() throws SQLException
|
||||||
{
|
{
|
||||||
return 65535;
|
if (haveMinimumServerVersion("7.0"))
|
||||||
|
return 0; // actually whatever fits in size_t
|
||||||
|
else
|
||||||
|
return 16384;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1310,19 +1365,14 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* What is the maximum number of tables that can be specified
|
* What is the maximum number of tables that can be specified
|
||||||
* in a SELECT? Theoretically, this is the same number as the
|
* in a SELECT?
|
||||||
* number of tables allowable. In practice tho, it is much smaller
|
|
||||||
* since the number of tables is limited by the statement, we
|
|
||||||
* return 1024 here - this is just a number I came up with (being
|
|
||||||
* the number of tables roughly of three characters each that you
|
|
||||||
* can fit inside a 8192 character buffer with comma separators).
|
|
||||||
*
|
*
|
||||||
* @return the maximum
|
* @return the maximum
|
||||||
* @exception SQLException if a database access error occurs
|
* @exception SQLException if a database access error occurs
|
||||||
*/
|
*/
|
||||||
public int getMaxTablesInSelect() throws SQLException
|
public int getMaxTablesInSelect() throws SQLException
|
||||||
{
|
{
|
||||||
return 1024;
|
return 0; // no limit
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1386,15 +1436,14 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Are both data definition and data manipulation transactions
|
* Are both data definition and data manipulation transactions
|
||||||
* supported? I checked it, and could not do a CREATE TABLE
|
* supported?
|
||||||
* within a transaction, so I am assuming that we don't
|
|
||||||
*
|
*
|
||||||
* @return true if so
|
* @return true if so
|
||||||
* @exception SQLException if a database access error occurs
|
* @exception SQLException if a database access error occurs
|
||||||
*/
|
*/
|
||||||
public boolean supportsDataDefinitionAndDataManipulationTransactions() throws SQLException
|
public boolean supportsDataDefinitionAndDataManipulationTransactions() throws SQLException
|
||||||
{
|
{
|
||||||
return false;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1406,7 +1455,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
|
|||||||
*/
|
*/
|
||||||
public boolean supportsDataManipulationTransactionsOnly() throws SQLException
|
public boolean supportsDataManipulationTransactionsOnly() throws SQLException
|
||||||
{
|
{
|
||||||
return true;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -2699,105 +2748,31 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
|
|||||||
return new ResultSet(connection, f, v, "OK", 1);
|
return new ResultSet(connection, f, v, "OK", 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// ** JDBC 2 Extensions **
|
// ** JDBC 2 Extensions **
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* New in 7.1 - we don't support deletes so this must be false!
|
* Does the database support the given result set type?
|
||||||
|
*
|
||||||
|
* @param type - defined in java.sql.ResultSet
|
||||||
|
* @return true if so; false otherwise
|
||||||
|
* @exception SQLException - if a database access error occurs
|
||||||
*/
|
*/
|
||||||
public boolean deletesAreDetected(int i) throws SQLException
|
public boolean supportsResultSetType(int type) throws SQLException
|
||||||
{
|
{
|
||||||
return false;
|
// The only type we don't support
|
||||||
|
return type != java.sql.ResultSet.TYPE_SCROLL_SENSITIVE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* New in 7.1 - we don't support deletes so this must be false!
|
* Does the database support the concurrency type in combination
|
||||||
*/
|
* with the given result set type?
|
||||||
public boolean othersDeletesAreVisible(int i) throws SQLException
|
*
|
||||||
{
|
* @param type - defined in java.sql.ResultSet
|
||||||
return false;
|
* @param concurrency - type defined in java.sql.ResultSet
|
||||||
}
|
* @return true if so; false otherwise
|
||||||
|
* @exception SQLException - if a database access error occurs
|
||||||
public java.sql.Connection getConnection() throws SQLException
|
|
||||||
{
|
|
||||||
return (java.sql.Connection)connection;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return user defined types in a schema
|
|
||||||
*/
|
|
||||||
public java.sql.ResultSet getUDTs(String catalog,
|
|
||||||
String schemaPattern,
|
|
||||||
String typeNamePattern,
|
|
||||||
int[] types
|
|
||||||
) throws SQLException
|
|
||||||
{
|
|
||||||
throw org.postgresql.Driver.notImplemented();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* New in 7.1 - we don't support visible inserts so this must be false!
|
|
||||||
*/
|
|
||||||
public boolean othersInsertsAreVisible(int type) throws SQLException
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* New in 7.1 - we don't support visible updates so this must be false!
|
|
||||||
*/
|
|
||||||
public boolean updatesAreDetected(int type) throws SQLException
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* New in 7.1 - we don't support visible updates so this must be false!
|
|
||||||
*/
|
|
||||||
public boolean othersUpdatesAreVisible(int type) throws SQLException
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean ownUpdatesAreVisible(int type) throws SQLException
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean ownInsertsAreVisible(int type) throws SQLException
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean insertsAreDetected(int type) throws SQLException
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean ownDeletesAreVisible(int type) throws SQLException
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean rowChangesAreDetected(int type) throws SQLException
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean rowChangesAreVisible(int type) throws SQLException
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* New in 7.1 - If this is for PreparedStatement yes, ResultSet no
|
|
||||||
*/
|
|
||||||
public boolean supportsBatchUpdates() throws SQLException
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* New in 7.1
|
|
||||||
*/
|
*/
|
||||||
public boolean supportsResultSetConcurrency(int type,int concurrency) throws SQLException
|
public boolean supportsResultSetConcurrency(int type,int concurrency) throws SQLException
|
||||||
{
|
{
|
||||||
@ -2813,10 +2788,93 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean supportsResultSetType(int type) throws SQLException
|
|
||||||
|
/* lots of unsupported stuff... */
|
||||||
|
public boolean ownUpdatesAreVisible(int type) throws SQLException
|
||||||
{
|
{
|
||||||
// The only type we don't support
|
return false;
|
||||||
return type!=java.sql.ResultSet.TYPE_SCROLL_SENSITIVE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean ownDeletesAreVisible(int type) throws SQLException
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean ownInsertsAreVisible(int type) throws SQLException
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean othersUpdatesAreVisible(int type) throws SQLException
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean othersDeletesAreVisible(int i) throws SQLException
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean othersInsertsAreVisible(int type) throws SQLException
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean updatesAreDetected(int type) throws SQLException
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean deletesAreDetected(int i) throws SQLException
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean insertsAreDetected(int type) throws SQLException
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* New in 7.1 - If this is for PreparedStatement yes, ResultSet no
|
||||||
|
*/
|
||||||
|
public boolean supportsBatchUpdates() throws SQLException
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return user defined types in a schema
|
||||||
|
*/
|
||||||
|
public java.sql.ResultSet getUDTs(String catalog,
|
||||||
|
String schemaPattern,
|
||||||
|
String typeNamePattern,
|
||||||
|
int[] types
|
||||||
|
) throws SQLException
|
||||||
|
{
|
||||||
|
throw org.postgresql.Driver.notImplemented();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves the connection that produced this metadata object.
|
||||||
|
*
|
||||||
|
* @return the connection that produced this metadata object
|
||||||
|
*/
|
||||||
|
public java.sql.Connection getConnection() throws SQLException
|
||||||
|
{
|
||||||
|
return (java.sql.Connection)connection;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* I don't find these in the spec!?! */
|
||||||
|
|
||||||
|
public boolean rowChangesAreDetected(int type) throws SQLException
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean rowChangesAreVisible(int type) throws SQLException
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user