Package org.hsqldb.cmdline

Examples of org.hsqldb.cmdline.SqlFile$BadSubst


        sqlVarMap.put("invoker", getClass().getName());
        // This variable is pretty useless, but this should show you how to
        // set variables which you can access inside of scripts like *{this}.

        File file;
        SqlFile sqlFile;
        for (String fileString : fileStrings) {
            file = new File(fileString);
            if (!file.isFile())
                throw new IOException("SQL file not present: "
                        + file.getAbsolutePath());
            sqlFile = new SqlFile(file);
            sqlFile.setConnection(conn);
            sqlFile.addUserVars(sqlVarMap);
            sqlFile.execute();

            // The only reason for the following two statements is so that
            // changes made by one .sql file will effect the future SQL files.
            // Has no effect if you only execute one SQL file.
            conn = sqlFile.getConnection();
            sqlVarMap = sqlFile.getUserVars();
        }
    }
View Full Code Here


    {
        Connection conn = null;
        try
        {
            conn = getConnection();
            SqlFile userDbSetup = new SqlFile( new File( file ) );
            userDbSetup.setConnection(conn);
            userDbSetup.execute();
        }
        catch( Exception e )
        {
            LOG.error( e.getMessage(), e );
        }
View Full Code Here

        sqlVarMap.put("invoker", getClass().getName());
        // This variable is pretty useless, but this should show you how to
        // set variables which you can access inside of scripts like *{this}.

        File file;
        SqlFile sqlFile;
        for (String fileString : fileStrings) {
            file = new File(fileString);
            if (!file.isFile())
                throw new IOException("SQL file not present: "
                        + file.getAbsolutePath());
            sqlFile = new SqlFile(file);
            sqlFile.setConnection(conn);
            sqlFile.addUserVars(sqlVarMap);
            sqlFile.execute();

            // The only reason for the following two statements is so that
            // changes made by one .sql file will effect the future SQL files.
            // Has no effect if you only execute one SQL file.
            conn = sqlFile.getConnection();
            sqlVarMap = sqlFile.getUserVars();
        }
    }
View Full Code Here

     */
    public void load(final Logger logger,
                     final Database database,
                     final Source source) {
        try {
            final SqlFile sqlFile = new SqlFile(
                    getReader(source),
                    source.getSourceFile(),
                    System.out,
                    null,
                    false,
                    null);
            final DataSource dataSource = ((SQLDatabase)database).getDataSource();
            final Connection connection = dataSource.getConnection();
            try {
                sqlFile.setConnection(connection);
                sqlFile.execute();
            } finally {
                connection.close();
            }
        } catch (final IOException exception) {
            final String message = MessageUtil.getMessage(CANNOT_READ_SOURCE_FILE, source.getSourceFile());
View Full Code Here

        assert database != null;
        assert logger != null;
        assert source != null;

        try {
            final SqlFile sqlFile = new SqlFile(source);
            final DataSource dataSource = database.getDataSource();
            final Connection connection = dataSource.getConnection();
            try {
                sqlFile.setConnection(connection);
                sqlFile.execute();
                connection.commit();
            } finally {
                connection.close();
            }
        } catch (final IOException exception) {
View Full Code Here

    assert database != null;
    assert logger != null;
    assert source != null;

    try {
      final SqlFile sqlFile = new SqlFile(source);
      final DataSource dataSource = database.getDataSource();
      final Connection connection = dataSource.getConnection();
      try {
        sqlFile.setConnection(connection);
        sqlFile.execute();
        connection.commit();
      } finally {
        connection.close();
      }
    } catch (final IOException exception) {
View Full Code Here

     */
    public void load(final Logger logger,
                     final Database database,
                     final Source source) {
        try {
            final SqlFile sqlFile = new SqlFile(
                    getReader(source),
                    source.getSourceFile(),
                    System.out,
                    null,
                    false,
                    null);
            final DataSource dataSource = ((SQLDatabase)database).getDataSource();
            final Connection connection = dataSource.getConnection();
            try {
                sqlFile.setConnection(connection);
                sqlFile.execute();
            } finally {
                connection.close();
            }
        } catch (final IOException exception) {
            final String message = MessageUtil.getMessage(CANNOT_READ_SOURCE_FILE, source.getSourceFile());
View Full Code Here

TOP

Related Classes of org.hsqldb.cmdline.SqlFile$BadSubst

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.