Examples of SqlFile


Examples of com.dci.intellij.dbn.language.sql.SQLFile

        String condition = filter.getCondition();
        boolean isValidCondition = StringUtil.isNotEmptyOrSpaces(condition);
        selectStatement.append(isValidCondition ? condition : COMMENT);

        PsiFileFactory psiFileFactory = PsiFileFactory.getInstance(project);
        SQLFile selectStatementFile = (SQLFile)
                psiFileFactory.createFileFromText(
                    "filter.sql",
                    dataset.getLanguageDialect(SQLLanguage.INSTANCE),
                    selectStatement.toString());
        selectStatementFile.setParseRootId("subquery");

        selectStatementFile.setActiveConnection(dataset.getConnectionHandler());
        selectStatementFile.setCurrentSchema(dataset.getSchema());


        document = DocumentUtil.getDocument(selectStatementFile);
        document.createGuardedBlock(0, conditionStartOffset);
        editor = (EditorEx) EditorFactory.getInstance().createEditor(document, project);
View Full Code Here

Examples of com.dci.intellij.dbn.language.sql.SQLFile

        }

        if (previewDocument == null) {
            PsiFileFactory psiFileFactory = PsiFileFactory.getInstance(project);

            SQLFile selectStatementFile = (SQLFile)
                psiFileFactory.createFileFromText(
                    "filter.sql",
                    connectionHandler.getLanguageDialect(SQLLanguage.INSTANCE),
                    previewText);

            selectStatementFile.setActiveConnection(connectionHandler);
            selectStatementFile.setCurrentSchema(variablesBundle.getCurrentSchema());
            previewDocument = DocumentUtil.getDocument(selectStatementFile);

            viewer = (EditorEx) EditorFactory.getInstance().createViewer(previewDocument, project);
            viewer.setEmbeddedIntoDialogWrapper(true);
            JScrollPane viewerScrollPane = viewer.getScrollPane();
View Full Code Here

Examples of com.dci.intellij.dbn.language.sql.SQLFile

            }

            if (previewDocument == null) {
                PsiFileFactory psiFileFactory = PsiFileFactory.getInstance(dataset.getProject());

                SQLFile selectStatementFile = (SQLFile)
                        psiFileFactory.createFileFromText(
                                "filter.sql",
                                dataset.getLanguageDialect(SQLLanguage.INSTANCE),
                                selectStatement.toString());

                selectStatementFile.setActiveConnection(dataset.getConnectionHandler());
                selectStatementFile.setCurrentSchema(dataset.getSchema());
                previewDocument = DocumentUtil.getDocument(selectStatementFile);

                viewer = (EditorEx) EditorFactory.getInstance().createViewer(previewDocument, dataset.getProject());
                viewer.setEmbeddedIntoDialogWrapper(true);
                JScrollPane viewerScrollPane = viewer.getScrollPane();
View Full Code Here

Examples of org.hsqldb.cmdline.SqlFile

        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

Examples of org.hsqldb.cmdline.SqlFile

    {
        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

Examples of org.hsqldb.cmdline.SqlFile

        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

Examples of org.hsqldb.cmdline.SqlFile

     */
    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

Examples of org.hsqldb.cmdline.SqlFile

        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

Examples of org.hsqldb.cmdline.SqlFile

    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

Examples of org.hsqldb.cmdline.SqlFile

     */
    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
Copyright © 2018 www.massapi.com. 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.