⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 systemprocedures.java

📁 derby database source code.good for you.
💻 JAVA
📖 第 1 页 / 共 3 页
字号:
		else			return options.substring(valueStart + 1, valueEnd);	}		/**	 *  Map SQLProcedureCols to EmbedDatabaseMetaData.getProcedureColumns	 *	 *  @param catalogName SYSIBM.SQLProcedureCols CatalogName varchar(128),	 *  @param schemaName  SYSIBM.SQLProcedureCols SchemaName  varchar(128),	 *  @param procName    SYSIBM.SQLProcedureCols ProcName    varchar(128),	 *  @param paramName   SYSIBM.SQLProcedureCols ParamName   varchar(128),	 *  @param options     SYSIBM.SQLProcedureCols Options     varchar(4000))	 *  @param rs          output parameter, the resultset object containing 	 *			           the result of getProcedureColumns	 *  	If options contains the string 'DATATYPE='ODBC'', call the ODBC	 *  	version of this procedure.	 */	public static void SQLPROCEDURECOLS (String catalogName, String schemaName, String procName,										String paramName, String options, ResultSet[] rs)		throws SQLException	{		rs[0] = isForODBC(options)			? ((EmbedDatabaseMetaData)getDMD()).getProcedureColumnsForODBC(				catalogName, schemaName, procName, paramName)			: getDMD().getProcedureColumns(catalogName, schemaName, procName, paramName);	}	/**	 *  Map SQLColumns to EmbedDatabaseMetaData.getColumns	 *	 *  @param catalogName SYSIBM.SQLColumns CatalogName varchar(128),	 *  @param schemaName  SYSIBM.SQLColumns SchemaName  varchar(128),	 *  @param tableName   SYSIBM.SQLColumns TableName   varchar(128),	 *  @param columnName  SYSIBM.SQLColumns ColumnName  varchar(128),	 *  @param options     SYSIBM.SQLColumns Options     varchar(4000))	 *  	If options contains the string 'DATATYPE='ODBC'', call the ODBC	 *  	version of this procedure.	 *  @param rs          output parameter, the resultset object containing      *                     the result of getProcedures	 */	public static void SQLCOLUMNS (String catalogName, String schemaName, String tableName,										String columnName, String options, ResultSet[] rs)		throws SQLException	{		rs[0] = isForODBC(options)			? ((EmbedDatabaseMetaData)getDMD()).getColumnsForODBC(				catalogName, schemaName, tableName, columnName)			: getDMD().getColumns(catalogName, schemaName, tableName, columnName);	}	/**	 *  Map SQLColPrivileges to EmbedDatabaseMetaData.getColumnPrivileges	 *	 *  @param catalogName SYSIBM.SQLColPrivileges CatalogName varchar(128),	 *  @param schemaName  SYSIBM.SQLColPrivileges SchemaName  varchar(128),	 *  @param tableName   SYSIBM.SQLColPrivileges ProcName    varchar(128),	 *  @param columnName  SYSIBM.SQLColPrivileges ColumnName  varchar(128),	 *  @param options     SYSIBM.SQLColPrivileges Options     varchar(4000))	 *  @param rs          output parameter, the resultset object containing      *                     the result of getColumnPrivileges	 */	public static void SQLCOLPRIVILEGES (String catalogName, String schemaName, String tableName,										String columnName, String options, ResultSet[] rs)		throws SQLException	{		rs[0] = getDMD().getColumnPrivileges(catalogName, schemaName, tableName, columnName);	}	/**	 *  Map SQLTablePrivileges to EmbedDatabaseMetaData.getTablePrivileges	 *	 *  @param catalogName SYSIBM.SQLTablePrivileges CatalogName varchar(128),	 *  @param schemaName  SYSIBM.SQLTablePrivileges SchemaName  varchar(128),	 *  @param tableName   SYSIBM.SQLTablePrivileges ProcName    varchar(128),	 *  @param options     SYSIBM.SQLTablePrivileges Options     varchar(4000))	 *  @param rs          output parameter, the resultset object containing      *                     the result of getTablePrivileges	 */	public static void SQLTABLEPRIVILEGES (String catalogName, String schemaName, String tableName,										String options, ResultSet[] rs)		throws SQLException	{		rs[0] = getDMD().getTablePrivileges(catalogName, schemaName, tableName);	}	/**	 *  Map SQLPrimaryKeys to EmbedDatabaseMetaData.getPrimaryKeys	 *	 *  @param catalogName SYSIBM.SQLPrimaryKeys CatalogName varchar(128),	 *  @param schemaName  SYSIBM.SQLPrimaryKeys SchemaName  varchar(128),	 *  @param tableName   SYSIBM.SQLPrimaryKeys TableName   varchar(128),	 *  @param options     SYSIBM.SQLPrimaryKeys Options     varchar(4000))	 *  	If options contains the string 'DATATYPE='ODBC'', call the ODBC	 *  	version of this procedure.	 *  @param rs          output parameter, the resultset object containing      *                     the result of getPrimaryKeys	 */	public static void SQLPRIMARYKEYS (String catalogName, String schemaName, String tableName, String options, ResultSet[] rs)		throws SQLException	{		rs[0] = isForODBC(options)			? ((EmbedDatabaseMetaData)getDMD()).getPrimaryKeysForODBC(				catalogName, schemaName, tableName)			: getDMD().getPrimaryKeys(catalogName, schemaName, tableName);	}	/**	 *  Map SQLGetTypeInfo to EmbedDatabaseMetaData.getTypeInfo	 *	 *  @param dataType  SYSIBM.SQLGetTypeInfo DataType smallint,	 *  @param options   SYSIBM.SQLGetTypeInfo Options  varchar(4000))	 *  	If options contains the string 'DATATYPE='ODBC'', call the ODBC	 *  	version of this procedure.	 *  @param rs        output parameter, the resultset object containing the     *                   result of getTypeInfo	 */	public static void SQLGETTYPEINFO (short dataType, String options, ResultSet[] rs)		throws SQLException	{		rs[0] = isForODBC(options)			? ((EmbedDatabaseMetaData)getDMD()).getTypeInfoForODBC()			: getDMD().getTypeInfo();	}	/**	 *  Map SQLStatistics to EmbedDatabaseMetaData.getIndexInfo	 *	 *  @param catalogName SYSIBM.SQLStatistics CatalogName varchar(128),	 *  @param schemaName  SYSIBM.SQLStatistics SchemaName  varchar(128),	 *  @param tableName   SYSIBM.SQLStatistics TableName   varchar(128),	 *  @param unique      SYSIBM.SQLStatistics Unique      smallint; 0=SQL_INDEX_UNIQUE(0); 1=SQL_INDEX_ALL(1),	 *  @param approximate SYSIBM.SQLStatistics Approximate smallint; 1=true; 0=false,	 *  @param options     SYSIBM.SQLStatistics Options     varchar(4000))	 *  	If options contains the string 'DATATYPE='ODBC'', call the ODBC	 *  	version of this procedure.	 *  @param rs          output parameter, the resultset object containing      *                     the result of getIndexInfo	 */	public static void SQLSTATISTICS (String catalogName, String schemaName, String tableName,										short unique, short approximate, String options, ResultSet[] rs)		throws SQLException	{		boolean boolUnique = (unique == 0) ? true: false;		boolean boolApproximate = (approximate == 1) ? true: false;					rs[0] = isForODBC(options)			? ((EmbedDatabaseMetaData)getDMD()).getIndexInfoForODBC(				catalogName, schemaName, tableName, boolUnique, boolApproximate)			: getDMD().getIndexInfo(catalogName, schemaName, tableName, boolUnique, boolApproximate);	}	/**	 *  Map SQLSpecialColumns to EmbedDatabaseMetaData.getBestRowIdentifier and getVersionColumns	 *	 *  @param colType     SYSIBM.SQLSpecialColumns ColType     smallint,	 *			where 1 means getBestRowIdentifier and 2 getVersionColumns was called.	 *  @param catalogName SYSIBM.SQLSpecialColumns CatalogName varchar(128),	 *  @param schemaName  SYSIBM.SQLSpecialColumns SchemaName  varchar(128),	 *  @param tableName   SYSIBM.SQLSpecialColumns TableName   varchar(128),	 *  @param scope       SYSIBM.SQLSpecialColumns Scope       smallint,	 *  @param nullable    SYSIBM.SQLSpecialColumns Nullable    smallint; 0=false, 1=true,	 *  @param options     SYSIBM.SQLSpecialColumns Options     varchar(4000))	 *  	If options contains the string 'DATATYPE='ODBC'', call the ODBC	 *  	version of this procedure.	 *  @param rs          output parameter, the resultset object containing      *                     the result of the DatabaseMetaData call	 */	public static void SQLSPECIALCOLUMNS (short colType, String catalogName, String schemaName, String tableName,										short scope, short nullable, String options, ResultSet[] rs)		throws SQLException	{		boolean boolNullable = (nullable == 1) ? true: false;		if (colType == SQL_BEST_ROWID)		{			rs[0] = isForODBC(options)				? ((EmbedDatabaseMetaData)getDMD()).getBestRowIdentifierForODBC(					catalogName, schemaName, tableName, scope, boolNullable)				: getDMD().getBestRowIdentifier(catalogName, schemaName, tableName, scope, boolNullable);		}		else // colType must be SQL_ROWVER		{			rs[0] = isForODBC(options)				? ((EmbedDatabaseMetaData)getDMD()).getVersionColumnsForODBC(					catalogName, schemaName, tableName)				: getDMD().getVersionColumns(catalogName, schemaName, tableName);		}	}	/**	 *  Map SQLUDTS to EmbedDatabaseMetaData.getUDTs	 *	 *  @param catalogName     SYSIBM.SQLUDTS CatalogName          varchar(128),	 *  @param schemaPattern   SYSIBM.SQLUDTS Schema_Name_Pattern  varchar(128),	 *  @param typeNamePattern SYSIBM.SQLUDTS Type_Name_Pattern    varchar(128),	 *  @param udtTypes        SYSIBM.SQLUDTS UDTTypes             varchar(128),	 *  @param options         SYSIBM.SQLUDTS Options              varchar(4000))	 *  @param rs              output parameter, the resultset object containing     *                         the result of getUDTs, which will be empty	 */	public static void SQLUDTS (String catalogName, String schemaPattern, String typeNamePattern,										String udtTypes, String options, ResultSet[] rs)		throws SQLException	{		int[] types = null;				if( udtTypes != null && udtTypes.length() > 0)		{			StringTokenizer tokenizer = new StringTokenizer( udtTypes, " \t\n\t,");			int udtTypeCount = tokenizer.countTokens();			types = new int[ udtTypeCount];			String udtType = "";			try			{				for( int i = 0; i < udtTypeCount; i++)				{					udtType = tokenizer.nextToken();					types[i] = Integer.parseInt( udtType);				}			}			catch( NumberFormatException nfe)			{				throw new SQLException( "Invalid type, " + udtType + ", passed to getUDTs.");			}			catch( NoSuchElementException nsee)			{				throw new SQLException( "Internal failure: NoSuchElementException in getUDTs.");			}		}		rs[0] = getDMD().getUDTs(catalogName, schemaPattern, typeNamePattern, types);	}	/*	 *  Map SYSIBM.METADATA to appropriate EmbedDatabaseMetaData methods 	 *  for now, using the sps in org.apache.derby.iapi.db.jdbc.datadictionary.metadata_net.properties	 *	 */	public static void METADATA (ResultSet[] rs)		throws SQLException	{				Connection conn = getDefaultConn();		PreparedStatement ps = conn.prepareStatement("execute statement SYSIBM.METADATA");		rs[0] = ps.executeQuery();		conn.close();	}	/**	 * Helper for ODBC metadata calls.	 * @param options	String containig the options to search through.	 * @return True if options contain ODBC indicator; false otherwise.	 */	private static boolean isForODBC(String options) {		String optionValue = getOption(DRIVER_TYPE_OPTION, options);		return ((optionValue != null) && optionValue.toUpperCase().equals(ODBC_DRIVER_OPTION));	}    /**     * Set/delete the value of a property of the database in current connection.     * <p>     * Will be called as SYSCS_UTIL.SYSCS_SET_DATABASE_PROPERTY.     *     * @param key       The property key.     * @param value     The new value, if null the property is deleted.     *	 * @exception  StandardException  Standard exception policy.     **/    public static void SYSCS_SET_DATABASE_PROPERTY(    String  key,    String  value)        throws SQLException    {        PropertyInfo.setDatabaseProperty(key, value);    }    /**     * Get the value of a property of the database in current connection.     * <p>     * Will be called as SYSCS_UTIL.SYSCS_GET_DATABASE_PROPERTY.     *     * @param key       The property key.     *	 * @exception  StandardException  Standard exception policy.     **/    public static String SYSCS_GET_DATABASE_PROPERTY(    String  key)        throws SQLException    {        return(PropertyInfo.getDatabaseProperty(key));    }    /**     * Compress the table.     * <p>     * Calls the "alter table compress {sequential}" sql.  This syntax     * is not db2 compatible so it mapped by a system routine.  This     * routine will be called when an application calls:     *     *     SYSCS_UTIL.SYSCS_COMPRESS_TABLE     * <p>     *	 * @return The identifier to be used to open the conglomerate later.     *     * @param schema        schema name of the table to compress.  Must be     *                      non-null, no default is used.     * @param tablename     table name of the table to compress.  Must be     *                      non-null.     * @param sequential    if non-zero then rebuild indexes sequentially,     *                      if 0 then rebuild all indexes in parallel.     *	 * @exception  StandardException  Standard exception policy.     **/    public static void SYSCS_COMPRESS_TABLE(    String  schema,    String  tablename,    int     sequential)        throws SQLException    {        String query =             "alter table " + "\"" + schema + "\"" + "." + "\"" +  tablename + "\"" + 			" compress" +  (sequential != 0 ? " sequential" : "");

⌨️ 快捷键说明

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