Package com.scooterframework.orm.sqldataexpress.object

Examples of com.scooterframework.orm.sqldataexpress.object.StoredProcedure


    public static StoredProcedure lookupAndRegisterStoredProcedure(String storedProcedure) {
        if (storedProcedure == null)
            throw new IllegalArgumentException("Stored procedure name is empty.");
       
        String errorMessage = "Failed to get meta data info for stored procedur " + storedProcedure;
        StoredProcedure sp = DBStore.getInstance().getStoredProcedure(storedProcedure);
        if (sp == null) {
          UserDatabaseConnection udc = null;
            try {
                udc = SqlExpressUtil.getUserDatabaseConnection();
                sp = lookupStoredProcedure(udc, storedProcedure);
View Full Code Here


      Connection connection = udc.getConnection();
     
        if (connection == null || name == null)
            throw new IllegalArgumentException("connection or name is empty.");
       
        StoredProcedure sp = new StoredProcedure(name);
        ResultSet rs = null;
       
        try {
            String catalog = sp.getCatalog();
            String schema = sp.getSchema();
            String api = sp.getApi();
            DBAdapter dba = DBAdapterFactory.getInstance().getAdapter(udc.getConnectionName());
           
            boolean startToRecord = false;
            int previousIndex = -1;
           
            DatabaseMetaData dbmd = connection.getMetaData();
            String vendor = getDatabaseVendor(dbmd);
            rs = dbmd.getProcedureColumns(toUpperCaseIfAllowed(dba, catalog),
                toUpperCaseIfAllowed(dba, schema), toUpperCaseIfAllowed(dba, api), null);
           
            while (rs.next()) {
                catalog = rs.getString("PROCEDURE_CAT");
                schema = rs.getString("PROCEDURE_SCHEM");
                int index = rs.getInt("SEQUENCE");
                String columnName = rs.getString("COLUMN_NAME");
                String mode = rs.getString("COLUMN_TYPE");
                int sqlDataType = rs.getInt("DATA_TYPE");
                String sqlDataTypeName = rs.getString("TYPE_NAME");
               
                //check if start to record
                if (index == 1 && !Parameter.MODE_RETURN.equals(mode)) {
                    startToRecord = true;
                    previousIndex = -1;//clear position
                }
               
                if (index <= previousIndex) {
                    startToRecord = false;
                }
               
                if (startToRecord) {
                    Parameter p = ParameterFactory.getInstance().createParameter(vendor, index, columnName, mode, sqlDataType, sqlDataTypeName);
                    p.setCatalog(catalog);
                    p.setSchema(schema);
                    sp.addParameter(p);
                }
               
                previousIndex = index;
            }
            sp.setCataloge(catalog);
            sp.setSchema(schema);
           
            rs.close();
        }
        catch(SQLException sqlEx) {
            throw new UnsupportedStoredProcedureAPINameException(sqlEx);
View Full Code Here

    }
   
    public StoredProcedure getStoredProcedure(String name) {
        if (name == null) return null;
       
        StoredProcedure spoc = null;
        String spocKey = getSpocKey(name);
       
        if (DatabaseConfig.getInstance().isInDevelopmentEnvironment()) {
            spoc = (StoredProcedure)CurrentThreadCache.get(spocKey);
            return spoc;
View Full Code Here

        if (processorType == null) return null;
       
        DataProcessor selectedDataProcessor = null;
       
        if (DataProcessorTypes.STORED_PROCEDURE_PROCESSOR.equals(processorType)) {
            StoredProcedure storedProcedure = DBStore.getInstance().getStoredProcedure(processorName);
           
            if (storedProcedure == null) {
                //discovery
                storedProcedure = SqlExpressUtil.lookupStoredProcedure(udc, processorName);
               
View Full Code Here

TOP

Related Classes of com.scooterframework.orm.sqldataexpress.object.StoredProcedure

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.