databasemetadata.java

来自「SearchPathServer」· Java 代码 · 共 2,665 行 · 第 1/5 页

JAVA
2,665
字号
	 *
	 * A JDBC compliant driver always returns true.
	 *
	 * @return true if so
	 */

	public boolean nullPlusNonNullIsNull() throws java.sql.SQLException
	{
		return true;
	}

	/**
	 * Is the CONVERT function between SQL types supported?
	 *
	 * @return true if so
	 */

	public boolean supportsConvert() throws java.sql.SQLException
	{
		return false;
	}

	/**
	 * Is CONVERT between the given SQL types supported?
	 *
	 * @param fromType the type to convert from
	 * @param toType the type to convert to
	 * @return true if so
	 * @see Types
	 */

	public boolean supportsConvert(int fromType, int toType)
		throws java.sql.SQLException
	{
		switch (fromType)
		{

			/* The char/binary types can be converted
			 * to pretty much anything.
			 */

			case java.sql.Types.CHAR :
			case java.sql.Types.VARCHAR :
			case java.sql.Types.LONGVARCHAR :
			case java.sql.Types.BINARY :
			case java.sql.Types.VARBINARY :
			case java.sql.Types.LONGVARBINARY :
				switch (toType)
				{
					case java.sql.Types.DECIMAL :
					case java.sql.Types.NUMERIC :
					case java.sql.Types.REAL :
					case java.sql.Types.TINYINT :
					case java.sql.Types.SMALLINT :
					case java.sql.Types.INTEGER :
					case java.sql.Types.BIGINT :
					case java.sql.Types.FLOAT :
					case java.sql.Types.DOUBLE :
					case java.sql.Types.CHAR :
					case java.sql.Types.VARCHAR :
					case java.sql.Types.LONGVARCHAR :
					case java.sql.Types.BINARY :
					case java.sql.Types.VARBINARY :
					case java.sql.Types.LONGVARBINARY :
					case java.sql.Types.OTHER :
					case java.sql.Types.DATE :
					case java.sql.Types.TIME :
					case java.sql.Types.TIMESTAMP :
						return true;
					default :
						return false;
				}

				/* We don't handle the BIT type
				 * yet.
				 */

			case java.sql.Types.BIT :
				return false;

				/* The numeric types. Basically they can convert
				 * among themselves, and with char/binary types.
				 */

			case java.sql.Types.DECIMAL :
			case java.sql.Types.NUMERIC :
			case java.sql.Types.REAL :
			case java.sql.Types.TINYINT :
			case java.sql.Types.SMALLINT :
			case java.sql.Types.INTEGER :
			case java.sql.Types.BIGINT :
			case java.sql.Types.FLOAT :
			case java.sql.Types.DOUBLE :
				switch (toType)
				{
					case java.sql.Types.DECIMAL :
					case java.sql.Types.NUMERIC :
					case java.sql.Types.REAL :
					case java.sql.Types.TINYINT :
					case java.sql.Types.SMALLINT :
					case java.sql.Types.INTEGER :
					case java.sql.Types.BIGINT :
					case java.sql.Types.FLOAT :
					case java.sql.Types.DOUBLE :
					case java.sql.Types.CHAR :
					case java.sql.Types.VARCHAR :
					case java.sql.Types.LONGVARCHAR :
					case java.sql.Types.BINARY :
					case java.sql.Types.VARBINARY :
					case java.sql.Types.LONGVARBINARY :
						return true;
					default :
						return false;
				}

				/* MySQL doesn't support a NULL type. */

			case java.sql.Types.NULL :
				return false;

				/* With this driver, this will always be a serialized
				 * object, so the char/binary types will work.
				 */

			case java.sql.Types.OTHER :
				switch (toType)
				{
					case java.sql.Types.CHAR :
					case java.sql.Types.VARCHAR :
					case java.sql.Types.LONGVARCHAR :
					case java.sql.Types.BINARY :
					case java.sql.Types.VARBINARY :
					case java.sql.Types.LONGVARBINARY :
						return true;
					default :
						return false;
				}

				/* Dates can be converted to char/binary types. */

			case java.sql.Types.DATE :
				switch (toType)
				{
					case java.sql.Types.CHAR :
					case java.sql.Types.VARCHAR :
					case java.sql.Types.LONGVARCHAR :
					case java.sql.Types.BINARY :
					case java.sql.Types.VARBINARY :
					case java.sql.Types.LONGVARBINARY :
						return true;
					default :
						return false;
				}

				/* Time can be converted to char/binary types */

			case java.sql.Types.TIME :
				switch (toType)
				{
					case java.sql.Types.CHAR :
					case java.sql.Types.VARCHAR :
					case java.sql.Types.LONGVARCHAR :
					case java.sql.Types.BINARY :
					case java.sql.Types.VARBINARY :
					case java.sql.Types.LONGVARBINARY :
						return true;
					default :
						return false;
				}

				/* Timestamp can be converted to char/binary types
				 * and date/time types (with loss of precision).
				 */

			case java.sql.Types.TIMESTAMP :
				switch (toType)
				{
					case java.sql.Types.CHAR :
					case java.sql.Types.VARCHAR :
					case java.sql.Types.LONGVARCHAR :
					case java.sql.Types.BINARY :
					case java.sql.Types.VARBINARY :
					case java.sql.Types.LONGVARBINARY :
					case java.sql.Types.TIME :
					case java.sql.Types.DATE :
						return true;
					default :
						return false;
				}

				/* We shouldn't get here! */

			default :
				return false; // not sure
		}
	}

	/**
	 * Are table correlation names supported?
	 *
	 * A JDBC compliant driver always returns true.
	 *
	 * @return true if so
	 */

	public boolean supportsTableCorrelationNames() throws java.sql.SQLException
	{
		return true; // not sure
	}

	/**
	 * If table correlation names are supported, are they restricted
	 * to be different from the names of the tables?
	 *
	 * A JDBC compliant driver always returns true.
	 *
	 * @return true if so
	 */

	public boolean supportsDifferentTableCorrelationNames()
		throws java.sql.SQLException
	{
		return true; // not sure
	}

	/**
	 * Are expressions in "ORDER BY" lists supported?
	 *
	 * @return true if so
	 */

	public boolean supportsExpressionsInOrderBy() throws java.sql.SQLException
	{
		return true;
	}

	/**
	 * Can an "ORDER BY" clause use columns not in the SELECT?
	 *
	 * @return true if so
	 */

	public boolean supportsOrderByUnrelated() throws java.sql.SQLException
	{
		return false; // not sure
	}

	/**
	 * Is some form of "GROUP BY" clause supported?
	 *
	 * @return true if so
	 */

	public boolean supportsGroupBy() throws java.sql.SQLException
	{
		return true;
	}

	/**
	 * Can a "GROUP BY" clause use columns not in the SELECT?
	 *
	 * @return true if so
	 */

	public boolean supportsGroupByUnrelated() throws java.sql.SQLException
	{
		return false; // not sure
	}

	/**
	 * Can a "GROUP BY" clause add columns not in the SELECT
	 * provided it specifies all the columns in the SELECT?
	 *
	 * @return true if so
	 */

	public boolean supportsGroupByBeyondSelect() throws java.sql.SQLException
	{
		return true; // not sure
	}

	/**
	 * Is the escape character in "LIKE" clauses supported?
	 *
	 * A JDBC compliant driver always returns true.
	 *
	 * @return true if so
	 */

	public boolean supportsLikeEscapeClause() throws java.sql.SQLException
	{
		return true;
	}

	/**
	 * Are multiple ResultSets from a single execute supported?
	 *
	 * @return true if so
	 */

	public boolean supportsMultipleResultSets() throws java.sql.SQLException
	{
		return false; // not sure
	}

	/**
	 * Can we have multiple transactions open at once (on different
	 * connections)?
	 *
	 * @return true if so
	 */

	public boolean supportsMultipleTransactions() throws java.sql.SQLException
	{
		return true;
	}

	/**
	 * Can columns be defined as non-nullable?
	 *
	 * A JDBC compliant driver always returns true.
	 *
	 * @return true if so
	 */

	public boolean supportsNonNullableColumns() throws java.sql.SQLException
	{
		return true;
	}

	/**
	 * Is the ODBC Minimum SQL grammar supported?
	 *
	 * All JDBC compliant drivers must return true.
	 *
	 * @return true if so
	 */

	public boolean supportsMinimumSQLGrammar() throws java.sql.SQLException
	{
		return true;
	}

	/**
	 * Is the ODBC Core SQL grammar supported?
	 *
	 * @return true if so
	 */

	public boolean supportsCoreSQLGrammar() throws java.sql.SQLException
	{
		return true;
	}

	/**
	 * Is the ODBC Extended SQL grammar supported?
	 *
	 * @return true if so
	 */

	public boolean supportsExtendedSQLGrammar() throws java.sql.SQLException
	{
		return false; // not sure at all
	}

	/**
	 * Is the ANSI92 entry level SQL grammar supported?
	 *
	 * All JDBC compliant drivers must return true.
	 *
	 * @return true if so
	 */

	public boolean supportsANSI92EntryLevelSQL() throws java.sql.SQLException
	{
		return true;
	}

	/**
	 * Is the ANSI92 intermediate SQL grammar supported?
	 *
	 * @return true if so
	 */

	public boolean supportsANSI92IntermediateSQL() throws java.sql.SQLException
	{
		return false; // not sure
	}

	/**
	 * Is the ANSI92 full SQL grammar supported?
	 *
	 * @return true if so
	 */

	public boolean supportsANSI92FullSQL() throws java.sql.SQLException
	{
		return false; // not sure
	}

	/**
	 * Is the SQL Integrity Enhancement Facility supported?
	 *
	 * @return true if so
	 */

	public boolean supportsIntegrityEnhancementFacility()
		throws java.sql.SQLException
	{
		return false; // not sure
	}

	/**
	 * Is some form of outer join supported?
	 *
	 * @return true if so
	 */

	public boolean supportsOuterJoins() throws java.sql.SQLException
	{
		return true;
	}

	/**
	 * Are full nested outer joins supported?
	 *
	 * @return true if so
	 */

	public boolean supportsFullOuterJoins() throws java.sql.SQLException
	{
		return false; // not sure
	}

	/**
	 * Is there limited support for outer joins?  (This will be true
	 * if supportFullOuterJoins is true.)
	 *
	 * @return true if so
	 */

	public boolean supportsLimitedOuterJoins() throws java.sql.SQLException
	{
		return true;
	}

	/**
	 * What's the database vendor's preferred term for "schema"?
	 *
	 * @return the vendor term
	 */

	public String getSchemaTerm() throws java.sql.SQLException
	{
		return "";
	}

	/**
	 * What's the database vendor's preferred term for "procedure"?
	 *
	 * @return the vendor term
	 */

	public String getProcedureTerm() throws java.sql.SQLException
	{
		return "";
	}

	/**
	 * What's the database vendor's preferred term for "catalog"?
	 *
	 * @return the vendor term
	 */

	public String getCatalogTerm() throws java.sql.SQLException
	{
		return "database";
	}

	/**
	 * Does a catalog appear at the start of a qualified table name?
	 * (Otherwise it appears at the end)
	 *
	 * @return true if it appears at the start
	 */

	public boolean isCatalogAtStart() throws java.sql.SQLException
	{
		return true;
	}

	/**
	 * What's the separator between catalog and table name?
	 *
	 * @return the separator string
	 */

	public String getCatalogSeparator() throws java.sql.SQLException
	{
		return ".";
	}

	/**
	 * Can a schema name be used in a data manipulation statement?
	 *
	 * @return true if so
	 */

	public boolean supportsSchemasInDataManipulation() throws java.sql.SQLException
	{
		return false;
	}

	/**
	 * Can a schema name be used in a procedure call statement?
	 *
	 * @return true if so
	 */

	public boolean supportsSchemasInProcedureCalls() throws java.sql.SQLException
	{
		return false;
	}

	/**
	 * Can a schema name be used in a table definition statement?
	 *
	 * @return true if so
	 */

	public boolean supportsSchemasInTableDefinitions() throws java.sql.SQLException
	{
		return false;

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?