Package org.h2.util

Examples of org.h2.util.ScriptReader.readStatement()


            String query = readString();
            ScriptReader reader = new ScriptReader(new StringReader(query));
            while (true) {
                JdbcStatement stat = null;
                try {
                    String s = reader.readStatement();
                    if (s == null) {
                        break;
                    }
                    s = getSQL(s);
                    stat = (JdbcStatement) conn.createStatement();
View Full Code Here


        try {
            r = new InputStreamReader(new ByteArrayInputStream(Utils
                    .getResource("/org/h2/server/pg/pg_catalog.sql")));
            ScriptReader reader = new ScriptReader(r);
            while (true) {
                String sql = reader.readStatement();
                if (sql == null) {
                    break;
                }
                stat.execute(sql);
            }
View Full Code Here

    public static ResultSet execute(Connection conn, Reader reader) throws SQLException {
        Statement stat = conn.createStatement();
        ResultSet rs = null;
        ScriptReader r = new ScriptReader(reader);
        while (true) {
            String sql = r.readStatement();
            if (sql == null) {
                break;
            }
            boolean resultSet = stat.execute(sql);
            if (resultSet) {
View Full Code Here

    private void process(Connection conn, boolean continueOnError,
            String path, Reader reader, String charsetName) throws SQLException, IOException {
        Statement stat = conn.createStatement();
        ScriptReader r = new ScriptReader(reader);
        while (true) {
            String sql = r.readStatement();
            if (sql == null) {
                break;
            }
            String trim = sql.trim();
            if (trim.startsWith("@") && StringUtils.toUpperEnglish(trim).startsWith("@INCLUDE")) {
View Full Code Here

                                String result = buff.toString();
                                if (showResults) {
                                    out.print(result);
                                }
                                if (checkResults) {
                                    String expected = r.readStatement() + ";";
                                    expected = StringUtils.replaceAll(expected, "\r\n", "\n");
                                    expected = StringUtils.replaceAll(expected, "\r", "\n");
                                    if (!expected.equals(result)) {
                                        expected = StringUtils.replaceAll(expected, " ", "+");
                                        result = StringUtils.replaceAll(result, " ", "+");
View Full Code Here

        String newsfeed = IOUtils.readStringAndClose(new FileReader("src/tools/org/h2/build/doc/buildNewsfeed.sql"), -1);
        ScriptReader r = new ScriptReader(new StringReader(newsfeed));
        Statement stat = conn.createStatement();
        ResultSet rs = null;
        while (true) {
            String s = r.readStatement();
            if (s == null) {
                break;
            }
            if (stat.execute(s)) {
                rs = stat.getResultSet();
View Full Code Here

                logger.info("Installing pg_catalog schema...");
                r = new InputStreamReader(new FileInputStream("./install/pg_catalog.sql"));
                ScriptReader reader = new ScriptReader(new BufferedReader(r));
                while (true)
                {
                   String sql = reader.readStatement();
                   if (sql == null)
                   {
                       break;
                   }
                   stat.execute(sql);
View Full Code Here

            while (true)
            {
                Statement stat = null;
                try
                {
                    String s = reader.readStatement();                   
                    if (s == null)
                    {
                        break;
                    }
                    String _s = new String(s);
View Full Code Here

        try {
            openInput();
            Reader reader = new InputStreamReader(in, charset);
            ScriptReader r = new ScriptReader(reader);
            while (true) {
                String sql = r.readStatement();
                if (sql == null) {
                    break;
                }
                execute(sql);
                count++;
View Full Code Here

        if (sql == null) {
            promptLoop();
        } else {
            ScriptReader r = new ScriptReader(new StringReader(sql));
            while (true) {
                String s = r.readStatement();
                if (s == null) {
                    break;
                }
                execute(s);
            }
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.