Package org.apache.derbyTesting.functionTests.util

Examples of org.apache.derbyTesting.functionTests.util.UniqueRandomSequence


            PreparedStatement ps =
                c.prepareStatement("INSERT INTO " + tableName +
                                   "(ID, TEXT" + extraCols +
                                   ") VALUES (?, ?" + extraParams + ")");

            UniqueRandomSequence secIdSequence = null;
            if (withSecIndexColumn) {
                secIdSequence = new UniqueRandomSequence(tableSize);
            }

            UniqueRandomSequence nonIndexedSequence = null;
            if (withNonIndexedColumn) {
                nonIndexedSequence = new UniqueRandomSequence(tableSize);
            }

            for (int i = 0; i < tableSize; i++) {
                int col = 1;
                ps.setInt(col++, i);
                if (dataType == Types.VARCHAR) {
                    ps.setString(col++, randomString(i));
                } else if (dataType == Types.CLOB) {
                    StringReader reader = new StringReader(randomString(i));
                    ps.setCharacterStream(col++, reader, TEXT_SIZE);
                } else if (dataType == Types.BLOB) {
                    ByteArrayInputStream stream =
                            new ByteArrayInputStream(randomBytes(i));
                    ps.setBinaryStream(col++, stream, TEXT_SIZE);
                }
                if (withSecIndexColumn) {
                    ps.setInt(col++, secIdSequence.nextValue());
                }
                if (withNonIndexedColumn) {
                    ps.setInt(col++, nonIndexedSequence.nextValue());
                }
                ps.executeUpdate();
                if ((i % 1000) == 0) {
                    c.commit();
                }
View Full Code Here


            PreparedStatement ps =
                c.prepareStatement("INSERT INTO " + tableName +
                                   "(ID, TEXT" + extraCols +
                                   ") VALUES (?, ?" + extraParams + ")");

            UniqueRandomSequence secIdSequence = null;
            if (withSecIndexColumn) {
                secIdSequence = new UniqueRandomSequence(tableSize);
            }

            UniqueRandomSequence nonIndexedSequence = null;
            if (withNonIndexedColumn) {
                nonIndexedSequence = new UniqueRandomSequence(tableSize);
            }

            for (int i = 0; i < tableSize; i++) {
                int col = 1;
                ps.setInt(col++, i);
                if (dataType == Types.VARCHAR) {
                    ps.setString(col++, randomString(i));
                } else if (dataType == Types.CLOB) {
                    StringReader reader = new StringReader(randomString(i));
                    ps.setCharacterStream(col++, reader, TEXT_SIZE);
                } else if (dataType == Types.BLOB) {
                    ByteArrayInputStream stream =
                            new ByteArrayInputStream(randomBytes(i));
                    ps.setBinaryStream(col++, stream, TEXT_SIZE);
                }
                if (withSecIndexColumn) {
                    ps.setInt(col++, secIdSequence.nextValue());
                }
                if (withNonIndexedColumn) {
                    ps.setInt(col++, nonIndexedSequence.nextValue());
                }
                ps.executeUpdate();
                if ((i % 1000) == 0) {
                    c.commit();
                }
View Full Code Here

TOP

Related Classes of org.apache.derbyTesting.functionTests.util.UniqueRandomSequence

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.