Package org.apache.derby.catalog

Examples of org.apache.derby.catalog.TypeDescriptor


             AliasDescriptor.class,
             true,
             TransactionController.ISOLATION_REPEATABLE_READ,
             tc);
        RoutineAliasInfo   oldRai = (RoutineAliasInfo) oldAD.getAliasInfo();
        TypeDescriptor     newReturnType = DataTypeDescriptor.getCatalogType( Types.VARCHAR, Limits.MAX_CLOB_RETURN_LEN );
        RoutineAliasInfo   newRai = new RoutineAliasInfo
            (
             oldRai.getMethodName(),
             oldRai.getParameterCount(),
             oldRai.getParameterNames(),
View Full Code Here


       
        AliasDescriptor ad = sysfunDescriptors[f];
        if (ad == null)
        {
          // details[1] Return type
          TypeDescriptor rt =
            DataTypeDescriptor.getBuiltInDataTypeDescriptor(details[1]).getCatalogType();

                    boolean isDeterministic = Boolean.valueOf( details[ SYSFUN_DETERMINISTIC_INDEX ] ).booleanValue();
                    boolean hasVarargs = Boolean.valueOf( details[ SYSFUN_VARARGS_INDEX ] ).booleanValue();
                   
View Full Code Here

    private final void create_SYSCS_procedures(
                                               TransactionController   tc, HashSet<String> newlyCreatedRoutines )
        throws StandardException
    {
        // Types used for routine parameters and return types, all nullable.
        TypeDescriptor varchar32672Type = DataTypeDescriptor.getCatalogType(
                Types.VARCHAR, 32672);

        /*
    ** SYSCS_UTIL routines.
    */
 
View Full Code Here

     **/
    void create_10_10_system_procedures( TransactionController   tc, HashSet<String> newlyCreatedRoutines )
        throws StandardException
    {
        UUID  sysUtilUUID = getSystemUtilSchemaDescriptor().getUUID();
        TypeDescriptor varchar32672Type = DataTypeDescriptor.getCatalogType( Types.VARCHAR, 32672 );

        // void SYSCS_UTIL.SYSCS_INVALIDATE_STORED_STATEMENTS()
        {              
            createSystemProcedureOrFunction(
                "SYSCS_INVALIDATE_STORED_STATEMENTS",
View Full Code Here

            throws StandardException {
        ExecRow row;
        String oidString = null;
        String sequenceName = null;
        String schemaIdString = null;
        TypeDescriptor typeDesc = null;
        Long currentValue = null;
        long startValue = 0;
        long minimumValue = 0;
        long maximumValue = 0;
        long increment = 0;
View Full Code Here

          ** intended to be movable to the client, so they don't have
          ** the entire implementation.  We need to wrap them in DataTypeServices
          ** and TypeId objects that contain the full implementations for
          ** language processing.
          */
        TypeDescriptor catalogType = (TypeDescriptor) row.getColumn(SYSSEQUENCES_SEQUENCEDATATYPE).
                getObject();
        DataTypeDescriptor dataTypeServices =
                DataTypeDescriptor.getType(catalogType);

        col = row.getColumn(SYSSEQUENCES_CURRENT_VALUE);
View Full Code Here

    {
      case AliasInfo.ALIAS_TYPE_AGGREGATE_AS_CHAR:
        this.javaClassName = (String) targetObject;

        Object[] aggElements = (Object[]) aliasSpecificInfo;
                TypeDescriptor  aggForType = bindUserCatalogType( (TypeDescriptor) aggElements[ AGG_FOR_TYPE ] );
                TypeDescriptor  aggReturnType = bindUserCatalogType( (TypeDescriptor) aggElements[ AGG_RETURN_TYPE ] );

                // XML not allowed because SQLXML support has not been implemented
                if (
                    (aggForType.getJDBCTypeId() == Types.SQLXML) ||
                    (aggReturnType.getJDBCTypeId() == Types.SQLXML)
                   )
                {
                    throw StandardException.newException( SQLState.LANG_XML_NOT_ALLOWED_DJRS );
                }

        aliasInfo = new AggregateAliasInfo( aggForType, aggReturnType );
        implicitCreateSchema = true;
                break;
               
      case AliasInfo.ALIAS_TYPE_UDT_AS_CHAR:
        this.javaClassName = (String) targetObject;
        aliasInfo = new UDTAliasInfo();

        implicitCreateSchema = true;
                break;
               
      case AliasInfo.ALIAS_TYPE_PROCEDURE_AS_CHAR:
      case AliasInfo.ALIAS_TYPE_FUNCTION_AS_CHAR:
      {
        this.javaClassName = (String) targetObject;
                this.methodName = methodName;

        //routineElements contains the description of the procedure.
        //
        // 0 - Object[] 3 element array for parameters
        // 1 - TableName - specific name
        // 2 - Integer - dynamic result set count
        // 3 - String language (always java) - ignore
        // 4 - String external name (also passed directly to create alias node - ignore
        // 5 - Integer parameter style
        // 6 - Short - SQL control
        // 7 - Boolean - whether the routine is DETERMINISTIC
        // 8 - Boolean - CALLED ON NULL INPUT (always TRUE for procedures)
        // 9 - TypeDescriptor - return type (always NULL for procedures)

        Object[] routineElements = (Object[]) aliasSpecificInfo;
        Object[] parameters = (Object[]) routineElements[PARAMETER_ARRAY];
        int paramCount = ((List) parameters[0]).size();
       
        // Support for Java signatures in Derby was added in 10.1
        // Check to see the catalogs have been upgraded to 10.1 before
        // accepting such a method name for a routine. Otherwise
        // a routine that works in 10.1 soft upgrade mode would
        // exist when running 10.0 but not resolve to anything.
        if (this.methodName.indexOf('(') != -1)
        {
          getDataDictionary().checkVersion(
              DataDictionary.DD_VERSION_DERBY_10_1,
                            "EXTERNAL NAME 'class.method(<signature>)'");
         
        }

        String[] names = null;
        TypeDescriptor[] types = null;
        int[] modes = null;
       
        if (paramCount != 0) {

                    names = new String[paramCount];
                    types = new TypeDescriptor[paramCount];
          modes = new int[paramCount];

          for (int i = 0; i < paramCount; i++) {
                        names[i] = (String) ((List) parameters[0]).get(i);
                        types[i] = (TypeDescriptor) ((List) parameters[1]).get(i);
                        int currentMode =  ((Integer) (((List) parameters[2]).get(i))).intValue();
                        modes[i] = currentMode;
 
                        //
                        // We still don't support XML values as parameters.
                        // Presumably, the XML datatype would map to a JDBC java.sql.SQLXML type.
                        // We have no support for that type today.
                        //
                        if ( !types[ i ].isUserDefinedType() )
                        {
                            if (TypeId.getBuiltInTypeId(types[i].getJDBCTypeId()).isXMLTypeId())
                            { throw StandardException.newException(SQLState.LANG_LONG_DATA_TYPE_NOT_ALLOWED, names[i]); }
                        }
                    }

          if (paramCount > 1) {
            String[] dupNameCheck = new String[paramCount];
            System.arraycopy(names, 0, dupNameCheck, 0, paramCount);
            java.util.Arrays.sort(dupNameCheck);
            for (int dnc = 1; dnc < dupNameCheck.length; dnc++) {
              if (! dupNameCheck[dnc].equals("") && dupNameCheck[dnc].equals(dupNameCheck[dnc - 1]))
                throw StandardException.newException(SQLState.LANG_DB2_DUPLICATE_NAMES, dupNameCheck[dnc], getFullName());
            }
          }
        }

        Integer drso = (Integer) routineElements[DYNAMIC_RESULT_SET_COUNT];
        int drs = drso == null ? 0 : drso.intValue();

        short sqlAllowed;
        Short sqlAllowedObject = (Short) routineElements[SQL_CONTROL];
        if (sqlAllowedObject != null)
          sqlAllowed = sqlAllowedObject.shortValue();
        else
          sqlAllowed = (this.aliasType == AliasInfo.ALIAS_TYPE_PROCEDURE_AS_CHAR ?
          RoutineAliasInfo.MODIFIES_SQL_DATA : RoutineAliasInfo.READS_SQL_DATA);

        Boolean isDeterministicO = (Boolean) routineElements[DETERMINISTIC];
                boolean isDeterministic = (isDeterministicO == null) ? false : isDeterministicO.booleanValue();

        Boolean hasVarargsO = (Boolean) routineElements[ VARARGS ];
                boolean hasVarargs = (hasVarargsO == null) ? false : hasVarargsO.booleanValue();

                Boolean definersRightsO =
                    (Boolean) routineElements[ROUTINE_SECURITY_DEFINER];
                boolean definersRights  =
                    (definersRightsO == null) ? false :
                    definersRightsO.booleanValue();

        Boolean calledOnNullInputO = (Boolean) routineElements[NULL_ON_NULL_INPUT];
        boolean calledOnNullInput;
        if (calledOnNullInputO == null)
          calledOnNullInput = true;
        else
          calledOnNullInput = calledOnNullInputO.booleanValue();

                // bind the return type if it is a user defined type. this fills
                // in the class name.
                TypeDescriptor returnType = (TypeDescriptor) routineElements[RETURN_TYPE];
                if ( returnType != null )
                {
                    DataTypeDescriptor dtd = DataTypeDescriptor.getType( returnType );
                   
                    dtd = bindUserType( dtd );
View Full Code Here

    String          colName = null;
    String          defaultID = null;
    String          tabID = null;
    Integer          colID = null;
    TypeDescriptor         typeDesc = null;
    Object          defaultSerializable = null;
    long          autoincStart = 0;
    long          autoincInc = 0;
    long          autoincValue = 0;
    //The SYSCOLUMNS table's autoinc related columns change with different
View Full Code Here

    ** intended to be movable to the client, so they don't have
    ** the entire implementation.  We need to wrap them in DataTypeServices
    ** and TypeId objects that contain the full implementations for
    ** language processing.
    */
    TypeDescriptor catalogType = (TypeDescriptor) row.getColumn(SYSCOLUMNS_COLUMNDATATYPE).
                          getObject();
    DataTypeDescriptor dataTypeServices =
      DataTypeDescriptor.getType(catalogType);

    /* 7th column is AUTOINCREMENTVALUE (long) */
 
View Full Code Here

    {
      throw StandardException.newException(SQLState.LANG_NO_CORRESPONDING_S_Q_L_TYPE,
        javaNode.getJavaTypeName());
    }

        TypeDescriptor catalogType = dts.getCatalogType();

        if ( catalogType.isRowMultiSet() || (catalogType.getTypeName().equals( "java.sql.ResultSet" )) )
        {
      throw StandardException.newException(SQLState.LANG_TABLE_FUNCTION_NOT_ALLOWED);
        }
       
        setType(dts);
View Full Code Here

TOP

Related Classes of org.apache.derby.catalog.TypeDescriptor

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.