All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.jooq.Routine Maven / Gradle / Ivy

The newest version!
/*
 * Copyright (c) 2009-2016, Data Geekery GmbH (http://www.datageekery.com)
 * All rights reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *  http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 * Other licenses:
 * -----------------------------------------------------------------------------
 * Commercial licenses for this work are available. These replace the above
 * ASL 2.0 and offer limited warranties, support, maintenance, and commercial
 * database integrations.
 *
 * For more information, please visit: http://www.jooq.org/licenses
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 */
package org.jooq;

import java.util.List;

import org.jooq.exception.DataAccessException;

/**
 * A routine is a callable object in your RDBMS.
 * 

* Callable objects are mainly stored procedures and stored functions. The * distinction between those two object types is very subtle and not well * defined across various RDBMS. In general, this can be said: *

* Procedures: *

*

    *
  • Are called as callable statements
  • *
  • Have no return value
  • *
  • Support OUT parameters
  • *
* Functions *

*

    *
  • Can be used in SQL statements
  • *
  • Have a return value
  • *
  • Don't support OUT parameters
  • *
* But there are exceptions to these rules: *

*

    *
  • DB2, H2, and HSQLDB don't allow for JDBC escape syntax when calling * functions. Functions must be used in a SELECT statement
  • *
  • H2 only knows functions (without OUT parameters)
  • *
  • Oracle functions may have OUT parameters
  • *
  • Oracle knows functions that mustn't be used in SQL statements
  • *
  • Oracle parameters can have default values (to support this, jOOQ renders * PL/SQL instead of the JDBC escape syntax)
  • *
  • Postgres only knows functions (with all features combined)
  • *
  • The Sybase JDBC driver doesn't handle null values correctly when using * the JDBC escape syntax on functions
  • *
  • etc...
  • *
*

* Hence, with #852, jOOQ 1.6.8, the distinction between procedures and * functions becomes obsolete. All stored routines are simply referred to as * "Routine". * * @author Lukas Eder */ public interface Routine extends QueryPart { // ------------------------------------------------------------------------- // XXX: Meta information // ------------------------------------------------------------------------- /** * Get the routine catalog. */ Catalog getCatalog(); /** * Get the routine schema */ Schema getSchema(); /** * The name of this routine */ String getName(); /** * The container package of this stored procedure or function. *

* This is only supported in the {@link SQLDialect#ORACLE} dialect. * * @return The container package of this object, or null if * there is no such container. */ Package getPackage(); /** * The parameter representing this routine's {@link #getReturnValue()} * * @return The return parameter or null if this routine doesn't * have a return value. * @see #getParameters() */ Parameter getReturnParameter(); /** * A list of OUT parameters passed to the stored procedure as argument. This * list contains all parameters that are either OUT or INOUT in their * respective order of appearance in {@link #getParameters()}. * * @return The list of out parameters * @see #getParameters() */ List> getOutParameters(); /** * A list of IN parameters passed to the stored procedure as argument. This * list contains all parameters that are either IN or INOUT in their * respective order of appearance in {@link #getParameters()}. * * @return The list of in parameters * @see #getParameters() */ List> getInParameters(); /** * @return A list of parameters passed to the stored object as argument */ List> getParameters(); // ------------------------------------------------------------------------- // XXX: Call API // ------------------------------------------------------------------------- /** * Execute the stored object using a {@link Configuration} object * * @throws DataAccessException if something went wrong executing the query */ int execute(Configuration configuration) throws DataAccessException; /** * Execute the stored object on an underlying connection * * @throws DataAccessException if something went wrong executing the query */ int execute() throws DataAccessException; // ------------------------------------------------------------------------- // XXX: Call data // ------------------------------------------------------------------------- /** * Set the routine's IN value for an IN parameter. */ void setValue(Parameter parameter, Z value); /** * Set the routine's IN value for an IN parameter. */ void set(Parameter parameter, Z value); /** * @return The routine's OUT value for an OUT parameter. */ Z getValue(Parameter parameter); /** * @return The routine's OUT value for an OUT parameter. */ Z get(Parameter parameter); /** * @return The routine's return value (if it is a function) */ T getReturnValue(); /** * @return The routine's results (if available) */ Results getResults(); }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy