Package java.sql

Examples of java.sql.PreparedStatement.execute()


            for (int i = 0; i < rowCount; i++) {
                prep.setInt(1, i);
                prep.setInt(2, i);
                prep.setInt(3, i);
                prep.setInt(4, i);
                prep.execute();
            }
        }
        stat.executeUpdate("shutdown defrag");
        conn.close();
    }
View Full Code Here


        for (int i = 0; i < 2500; i++) {
            int id = random.nextInt(size);
            int newSize = random.nextInt(6000);
            prep.setInt(1, newSize);
            prep.setInt(2, id);
            prep.execute();
        }
        conn.close();
        conn = getConnection("pageStore");
        stat = conn.createStatement();
        ResultSet rs = stat.executeQuery("select * from test where test<>123");
View Full Code Here

                    if (random.nextInt(30) == 5) {
                        p.setInt(3, 3000);
                    } else {
                        p.setInt(3, random.nextInt(100));
                    }
                    p.execute();
                } else if (random.nextInt(100) < 90) {
                    p = updateMany[random.nextInt(tableCount)];
                    p.setInt(1, i);
                    p.setInt(2, random.nextInt(50));
                    int first = random.nextInt(1 + i);
View Full Code Here

                prep1a.setInt(1, account);
                prep1a.setInt(2, value);
                prep1a.execute();
                prep1b.setInt(1, value);
                prep1b.setInt(2, account);
                prep1b.execute();
                conn1.commit();
                if (random.nextInt(100) < 2) {
                    d = "D" + random.nextInt(1000);
                    account = random.nextInt(accounts);
                    conn1.createStatement().execute("UPDATE TEST_A SET DATA='" + d + "' WHERE ID=" + account);
View Full Code Here

        stat.execute("create table test(id identity, name text)");
        String[] data = { "\uff1e", "\ud848\udf1e" };
        PreparedStatement prep = conn.prepareStatement("insert into test(name) values(?)");
        for (int i = 0; i < data.length; i++) {
            prep.setString(1, data[i]);
            prep.execute();
        }
        prep = conn.prepareStatement("select * from test order by id");
        ResultSet rs = prep.executeQuery();
        for (int i = 0; i < data.length; i++) {
            assertTrue(rs.next());
View Full Code Here

        Statement stat = conn.createStatement();
        stat.execute("CREATE TABLE IF NOT EXISTS test (rowid INTEGER PRIMARY KEY AUTO_INCREMENT, txt VARCHAR(64000));");
        PreparedStatement prep = conn.prepareStatement("insert into test (txt) values(space(?))");
        for (int i = 0; i < 3000; i++) {
            prep.setInt(1, i * 3);
            prep.execute();
        }
        stat.execute("DELETE FROM test;");
        conn.close();
    }

View Full Code Here

                "select 1 from dual " +
                "inner join(select n from t where i=?) a on a.n='x' " +
                "inner join(select n from t where i=?) b on b.n='x'");
        prep.setInt(1, 1);
        prep.setInt(2, 1);
        prep.execute();
        conn.close();
    }

    private void testLobDecrypt() throws SQLException {
        Connection conn = getConnection("cases");
View Full Code Here

        }
        String big = new String(buff);
        prep.setInt(1, 1);
        prep.setString(2, big);
        prep.setString(3, big);
        prep.execute();
        prep.setInt(1, 2);
        prep.setCharacterStream(2, new StringReader(big), 0);
        prep.setCharacterStream(3, new StringReader(big), 0);
        prep.execute();
        ResultSet rs = stat.executeQuery("SELECT * FROM TEST ORDER BY ID");
View Full Code Here

        prep.setString(3, big);
        prep.execute();
        prep.setInt(1, 2);
        prep.setCharacterStream(2, new StringReader(big), 0);
        prep.setCharacterStream(3, new StringReader(big), 0);
        prep.execute();
        ResultSet rs = stat.executeQuery("SELECT * FROM TEST ORDER BY ID");
        rs.next();
        assertEquals(1, rs.getInt(1));
        assertEquals(big, rs.getString(2));
        assertEquals(big, readString(rs.getCharacterStream(2)));
View Full Code Here

        PreparedStatement prepared = conn.prepareStatement("INSERT INTO TEST VALUES(?, ?)");
        byte[] blobContent = "BLOB_CONTENT".getBytes();
        prepared.setInt(1, 1);
        prepared.setBytes(2, blobContent);
        prepared.execute();

        if (useDrop) {
            stat.execute("DROP TABLE TEST");
        } else {
            stat.execute("DELETE FROM TEST");
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.