Codota Logo
FunctionAlias
Code IndexAdd Codota to your IDE (free)

How to use
FunctionAlias
in
org.h2.engine

Best Java code snippets using org.h2.engine.FunctionAlias (Showing top 20 results out of 315)

  • Common ways to obtain FunctionAlias
private void myMethod () {
FunctionAlias f =
  • Codota IconDatabase database;String schemaName;String functionAlias;database.getSchema(schemaName).findFunction(functionAlias)
  • Codota IconSchema schema;String functionAlias;schema.findFunction(functionAlias)
  • Codota IconParser parser;String schema;String str;parser.findFunctionAlias(schema, str)
  • Smart code suggestions by Codota
}
origin: com.h2database/h2

/**
 * Create a new alias based on source code.
 *
 * @param schema the schema
 * @param id the id
 * @param name the name
 * @param source the source code
 * @param force create the object even if the class or method does not exist
 * @param bufferResultSetToLocalTemp whether the result should be buffered
 * @return the database object
 */
public static FunctionAlias newInstanceFromSource(
    Schema schema, int id, String name, String source, boolean force,
    boolean bufferResultSetToLocalTemp) {
  FunctionAlias alias = new FunctionAlias(schema, id, name);
  alias.source = source;
  alias.bufferResultSetToLocalTemp = bufferResultSetToLocalTemp;
  alias.init(force);
  return alias;
}
origin: com.h2database/h2

@Override
public synchronized void removeChildrenAndResources(Session session) {
  database.removeMeta(session, getId());
  className = null;
  methodName = null;
  javaMethods = null;
  invalidate();
}
origin: com.h2database/h2

  getMethodSignature(m).equals(methodName)) {
JavaMethod javaMethod = new JavaMethod(m, i);
for (JavaMethod old : list) {
origin: com.h2database/h2

@Override
public String getSQL() {
  // TODO can remove this method once FUNCTIONS_IN_SCHEMA is enabled
  if (database.getSettings().functionsInSchema ||
      !getSchema().getName().equals(Constants.SCHEMA_MAIN)) {
    return super.getSQL();
  }
  return Parser.quoteIdentifier(getName());
}
origin: org.wowtools/h2

JavaMethod[] methods;
try {
  methods = alias.getJavaMethods();
} catch (DbException e) {
  methods = new JavaMethod[0];
      alias.getSchema().getName(),
      identifier(alias.getName()),
      alias.getJavaClassName(),
      alias.getJavaMethodName(),
      replaceNullWithEmpty(alias.getComment()),
      "" + alias.getId(),
      alias.getSource()
JavaMethod[] methods;
try {
  methods = alias.getJavaMethods();
} catch (DbException e) {
  methods = new JavaMethod[0];
        alias.getSchema().getName(),
        identifier(alias.getName()),
origin: com.h2database/h2

JavaMethod[] methods;
try {
  methods = alias.getJavaMethods();
} catch (DbException e) {
  methods = new JavaMethod[0];
      alias.getSchema().getName(),
      identifier(alias.getName()),
      alias.getJavaClassName(),
      alias.getSource()
JavaMethod[] methods;
try {
  methods = alias.getJavaMethods();
} catch (DbException e) {
  methods = new JavaMethod[0];
        alias.getSchema().getName(),
        identifier(alias.getName()),
        alias.getJavaClassName(),
        alias.getSchema().getName(),
        identifier(alias.getName()),
origin: com.h2database/h2

@Override
public String getSQL() {
  StatementBuilder buff = new StatementBuilder();
  // TODO always append the schema once FUNCTIONS_IN_SCHEMA is enabled
  if (functionAlias.getDatabase().getSettings().functionsInSchema ||
      !functionAlias.getSchema().getName().equals(Constants.SCHEMA_MAIN)) {
    buff.append(
        Parser.quoteIdentifier(functionAlias.getSchema().getName()))
        .append('.');
  }
  buff.append(Parser.quoteIdentifier(functionAlias.getName())).append('(');
  for (Expression e : args) {
    buff.appendExceptFirst(", ");
    buff.append(e.getSQL());
  }
  return buff.append(')').toString();
}
origin: com.h2database/h2

/**
 * Find the Java method that matches the arguments.
 *
 * @param args the argument list
 * @return the Java method
 * @throws DbException if no matching method could be found
 */
public JavaMethod findJavaMethod(Expression[] args) {
  load();
  int parameterCount = args.length;
  for (JavaMethod m : javaMethods) {
    int count = m.getParameterCount();
    if (count == parameterCount || (m.isVarArgs() &&
        count <= parameterCount + 1)) {
      return m;
    }
  }
  throw DbException.get(ErrorCode.METHOD_NOT_FOUND_1, getName() + " (" +
      className + ", parameter count: " + parameterCount + ")");
}
origin: com.h2database/com.springsource.org.h2

for (int i = 0; i < aliases.size(); i++) {
  FunctionAlias alias = (FunctionAlias) aliases.get(i);
  int returnsResult = alias.getDataType() == Value.NULL ? DatabaseMetaData.procedureNoResult
      : DatabaseMetaData.procedureReturnsResult;
  add(rows, new String[] {
      identifier(alias.getName()), // ALIAS_NAME
      alias.getJavaClassName(), // JAVA_CLASS
      alias.getJavaMethodName(), // JAVA_METHOD
      ""+DataType.convertTypeToSQLType(alias.getDataType()), // DATA_TYPE
      ""+ alias.getColumnClasses().length, // COLUMN_COUNT INT
      ""+ returnsResult, // RETURNS_RESULT SMALLINT
for (int i = 0; i < aliases.size(); i++) {
  FunctionAlias alias = (FunctionAlias) aliases.get(i);
  Class[] columns = alias.getColumnClasses();
  for (int j = 0; j < columns.length; j++) {
    Class clazz = columns[j];
        identifier(alias.getName()), // ALIAS_NAME
        alias.getJavaClassName(), // JAVA_CLASS
        alias.getJavaMethodName(), // JAVA_METHOD
        "" + j, // POS INT
        "P" + (j+1), // COLUMN_NAME
origin: com.h2database/h2

private void init(boolean force) {
  try {
    // at least try to compile the class, otherwise the data type is not
    // initialized if it could be
    load();
  } catch (DbException e) {
    if (!force) {
      throw e;
    }
  }
}
origin: com.h2database/h2

@Override
public String getName() {
  return functionAlias.getName();
}
origin: com.h2database/h2

@Override
public String getDropSQL() {
  return "DROP ALIAS IF EXISTS " + getSQL();
}
origin: com.h2database/com.springsource.org.h2

public FunctionAlias(Database db, int id, String name, String javaClassMethod, boolean force) throws SQLException {
  initDbObjectBase(db, id, name, Trace.FUNCTION);
  int paren = javaClassMethod.indexOf('(');
  int lastDot = javaClassMethod.lastIndexOf('.', paren < 0 ? javaClassMethod.length() : paren);
  if (lastDot < 0) {
    throw Message.getSQLException(ErrorCode.SYNTAX_ERROR_1, javaClassMethod);
  }
  className = javaClassMethod.substring(0, lastDot);
  methodName = javaClassMethod.substring(lastDot + 1);
  try {
    // at least try to load the class, otherwise the data type is not
    // initialized if it could be
    load();
  } catch (SQLException e) {
    if (!force) {
      throw e;
    }
  }
}
origin: apache/ignite

GridSqlFunction res = new GridSqlFunction(alias.getSchema().getName(), f.getName());
origin: com.h2database/h2

public JavaFunction(FunctionAlias functionAlias, Expression[] args) {
  this.functionAlias = functionAlias;
  this.javaMethod = functionAlias.findJavaMethod(args);
  this.args = args;
}
origin: com.h2database/com.springsource.org.h2

public int update() throws SQLException {
  session.commit(true);
  session.getUser().checkAdmin();
  Database db = session.getDatabase();
  if (db.findFunctionAlias(aliasName) != null) {
    if (!ifNotExists) {
      throw Message.getSQLException(ErrorCode.FUNCTION_ALIAS_ALREADY_EXISTS_1, aliasName);
    }
  } else {
    int id = getObjectId(false, true);
    FunctionAlias functionAlias = new FunctionAlias(db, id, aliasName, javaClassMethod, force);
    db.addDatabaseObject(session, functionAlias);
  }
  return 0;
}
origin: com.eventsourcing/h2

JavaMethod[] methods;
try {
  methods = alias.getJavaMethods();
} catch (DbException e) {
  methods = new JavaMethod[0];
      alias.getSchema().getName(),
      identifier(alias.getName()),
      alias.getJavaClassName(),
      alias.getSource()
JavaMethod[] methods;
try {
  methods = alias.getJavaMethods();
} catch (DbException e) {
  methods = new JavaMethod[0];
        alias.getSchema().getName(),
        identifier(alias.getName()),
        alias.getJavaClassName(),
        alias.getSchema().getName(),
        identifier(alias.getName()),
origin: com.eventsourcing/h2

@Override
public String getSQL() {
  StatementBuilder buff = new StatementBuilder();
  // TODO always append the schema once FUNCTIONS_IN_SCHEMA is enabled
  if (functionAlias.getDatabase().getSettings().functionsInSchema ||
      !functionAlias.getSchema().getName().equals(Constants.SCHEMA_MAIN)) {
    buff.append(
        Parser.quoteIdentifier(functionAlias.getSchema().getName()))
        .append('.');
  }
  buff.append(Parser.quoteIdentifier(functionAlias.getName())).append('(');
  for (Expression e : args) {
    buff.appendExceptFirst(", ");
    buff.append(e.getSQL());
  }
  return buff.append(')').toString();
}
origin: org.wowtools/h2

@Override
public String getSQL() {
  // TODO can remove this method once FUNCTIONS_IN_SCHEMA is enabled
  if (database.getSettings().functionsInSchema ||
      !getSchema().getName().equals(Constants.SCHEMA_MAIN)) {
    return super.getSQL();
  }
  return Parser.quoteIdentifier(getName());
}
origin: org.wowtools/h2

/**
 * Find the Java method that matches the arguments.
 *
 * @param args the argument list
 * @return the Java method
 * @throws DbException if no matching method could be found
 */
public JavaMethod findJavaMethod(Expression[] args) {
  load();
  int parameterCount = args.length;
  for (JavaMethod m : javaMethods) {
    int count = m.getParameterCount();
    if (count == parameterCount || (m.isVarArgs() &&
        count <= parameterCount + 1)) {
      return m;
    }
  }
  throw DbException.get(ErrorCode.METHOD_NOT_FOUND_1, getName() + " (" +
      className + ", parameter count: " + parameterCount + ")");
}
org.h2.engineFunctionAlias

Javadoc

Represents a user-defined function, or alias.

Most used methods

  • <init>
  • getId
  • getJavaClassName
  • getMethodSignature
  • getName
  • getSQL
  • getSchema
  • invalidate
  • load
  • findJavaMethod
    Find the Java method that matches the arguments.
  • getDatabase
  • getJavaMethods
    Get the Java methods mapped by this function.
  • getDatabase,
  • getJavaMethods,
  • getSource,
  • init,
  • initSchemaObjectBase,
  • isBufferResultSetToLocalTemp,
  • isDeterministic,
  • loadClass,
  • loadFromSource,
  • newInstance

Popular in Java

  • Finding current android device location
  • onCreateOptionsMenu (Activity)
  • onRequestPermissionsResult (Fragment)
  • addToBackStack (FragmentTransaction)
  • MalformedURLException (java.net)
    Thrown to indicate that a malformed URL has occurred. Either no legal protocol could be found in a s
  • MessageFormat (java.text)
    MessageFormat provides a means to produce concatenated messages in language-neutral way. Use this to
  • Stack (java.util)
    The Stack class represents a last-in-first-out (LIFO) stack of objects. It extends class Vector with
  • Handler (java.util.logging)
    A Handler object accepts a logging request and exports the desired messages to a target, for example
  • BoxLayout (javax.swing)
  • Location (org.springframework.beans.factory.parsing)
    Class that models an arbitrary location in a Resource.Typically used to track the location of proble
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now