Package org.apache.roller.util

Examples of org.apache.roller.util.SQLScriptRunner


    private void upgradeTo400(Connection con, boolean runScripts) throws StartupException {
       
        successMessage("Doing upgrade to 400 ...");
       
        // first we need to run upgrade scripts
        SQLScriptRunner runner = null;
        try {   
            if (runScripts) {
                String handle = getDatabaseHandle(con);
                String scriptPath = handle + "/310-to-400-migration.sql";
                successMessage("Running database upgrade script: "+scriptPath);               
                runner = new SQLScriptRunner(scripts.getDatabaseScript(scriptPath));
                runner.runScript(con, true);
                messages.addAll(runner.getMessages());
            }
        } catch(Exception ex) {
            log.error("ERROR running 400 database upgrade script", ex);
            if (runner != null) messages.addAll(runner.getMessages());
           
            errorMessage("Problem upgrading database to version 400", ex);
            throw new StartupException("Problem upgrading database to version 400", ex);
        }
       
View Full Code Here


     * Upgrade database for Roller 4.1.0
     */
    private void upgradeTo500(Connection con, boolean runScripts) throws StartupException {
       
        // first we need to run upgrade scripts
        SQLScriptRunner runner = null;
        try {   
            if (runScripts) {
                String handle = getDatabaseHandle(con);
                String scriptPath = handle + "/400-to-500-migration.sql";
                successMessage("Running database upgrade script: "+scriptPath);               
                runner = new SQLScriptRunner(scripts.getDatabaseScript(scriptPath));
                runner.runScript(con, true);
                messages.addAll(runner.getMessages());
            }
        } catch(Exception ex) {
            log.error("ERROR running 500 database upgrade script", ex);
            if (runner != null) messages.addAll(runner.getMessages());
           
            errorMessage("Problem upgrading database to version 500", ex);
            throw new StartupException("Problem upgrading database to version 500", ex);
        }       
    }
View Full Code Here

            dbname = "mysql";
        }
       
        String scriptPath = System.getProperty("project.build.directory")
                + "/test-classes/WEB-INF/dbscripts/dummydb/createdb-"+dbname+".sql";
        SQLScriptRunner runner = new SQLScriptRunner(scriptPath);
        assertTrue(runner != null);
        assertTrue(runner.getCommandCount() == 5);       
    }   
View Full Code Here

            // but some folks test against MySQL
            dbname = "mysql";
        }
       
        // run script to create tables
        SQLScriptRunner create =
            new SQLScriptRunner(System.getProperty("project.build.directory")
                    + "/test-classes/WEB-INF/dbscripts/dummydb/createdb-"+dbname+".sql");
        create.runScript(con, true);
       
        // check to ensure tables were created
        assertTrue(tableExists(con, "testrolleruser"));
        assertTrue(tableExists(con, "testuserrole"));
       
        // drop tables
        SQLScriptRunner drop =
            new SQLScriptRunner(System.getProperty("project.build.directory") + "/test-classes/WEB-INF/dbscripts/dummydb/droptables.sql");
        drop.runScript(con, false);

        // check to ensure tables were dropped
        assertFalse(tableExists(con, "testrolleruser"));
        assertFalse(tableExists(con, "testuserrole"));
    }
View Full Code Here

TOP

Related Classes of org.apache.roller.util.SQLScriptRunner

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.