Package org.jboss.dna.common.jdbc.model.api

Examples of org.jboss.dna.common.jdbc.model.api.StoredProcedure


    }

    public void testAddStoredProcedure() {
        String NAME = "My Name";
        // create
        StoredProcedure object = new DefaultModelFactory().createStoredProcedure();
        // set
        object.setName(NAME);
        // add
        bean.addStoredProcedure(object);
        // check
        assertFalse(bean.getStoredProcedures().isEmpty());
    }
View Full Code Here


    }

    public void testDeleteStoredProcedure() {
        String NAME = "My Name";
        // create
        StoredProcedure object = new DefaultModelFactory().createStoredProcedure();
        // set
        object.setName(NAME);
        // add
        bean.addStoredProcedure(object);
        // check
        assertFalse(bean.getStoredProcedures().isEmpty());
View Full Code Here

    }

    public void testFindStoredProcedureByName() {
        String NAME = "My Name";
        // create
        StoredProcedure object = new DefaultModelFactory().createStoredProcedure();
        // set
        object.setName(NAME);
        // add
        bean.addStoredProcedure(object);
        // check
        assertSame(object, bean.findStoredProcedureByName(null, null, object.getName()));
    }
View Full Code Here

        String remarks = getString(resultSet, "REMARKS", false);
        // get kind of procedure
        Integer procedureType = getInteger(resultSet, "PROCEDURE_TYPE", false);

        // create Stored Procedure object
        StoredProcedure sp = factory.createStoredProcedure();

        // ***************************
        // *** DatabaseNamedObject ***
        // ***************************

        // set name
        sp.setName(procedureName);
        // set remarks
        sp.setRemarks(remarks);
        // TODO set extra properties
        // sp.addExtraProperty (String key, Object value);

        // ********************
        // *** SchemaObject ***
        // ********************

        // set catalog
        if ((procedureCatalog != null) && (procedureCatalog.trim().length() != 0)) {
            // find catalog
            Catalog catalog = database.findCatalogByName(procedureCatalog);
            // set catalog
            sp.setCatalog(catalog);
            // warn if null
            if (catalog == null) {
                traceLog.debug(String.format("[Database %s] Unable to find catalog '%4$s' for the procedure %s (schema %s, catalog %s)",
                                             database.getName(),
                                             procedureName,
                                             procedureSchema,
                                             procedureCatalog));
            }
            // if fail is enabled
            if (failOnError && (catalog == null)) {
                throw new DatabaseMetaDataMethodException("Catalog name shall be provided", "populateStoredProcedure");
            }
        }

        // set schema
        if ((procedureSchema != null) && (procedureSchema.trim().length() != 0)) {
            // find schema
            Schema schema = database.findSchemaByName(procedureCatalog, procedureSchema);
            // set schema
            sp.setSchema(schema);
            // warn if null
            if (schema == null) {
                traceLog.debug(String.format("[Database %s] Unable to find schema '%3$s' for the procedure %s (schema %s, catalog %s)",
                                             database.getName(),
                                             procedureName,
                                             procedureSchema,
                                             procedureCatalog));
            }
            // if fail is enabled
            if (failOnError && (schema == null)) {
                throw new DatabaseMetaDataMethodException("Schema name shall be provided", "populateStoredProcedure");
            }
        }

        // ***********************
        // *** StoredProcedure ***
        // ***********************

        // set sp result type
        sp.setResultType(getStoredProcedureResultType(procedureType));

        // add SP to the list
        database.addStoredProcedure(sp);

        // log
View Full Code Here

TOP

Related Classes of org.jboss.dna.common.jdbc.model.api.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.