Package org.h2.value

Examples of org.h2.value.ValueUuid


            } else if ("timer".equals(args[0])) {
                new TestTimer().runTest(test);
            }
        } else {
            test.runTests();
            Profiler prof = new Profiler();
            prof.depth = 4;
            prof.interval = 1;
            prof.startCollecting();
            TestPerformance.main("-init", "-db", "1");
            prof.stopCollecting();
            System.out.println(prof.getTop(3));
//            Recover.execute("data", null);
//            RunScript.execute("jdbc:h2:data/test2",
//                 "sa1", "sa1", "data/test.h2.sql", null, false);
//            Recover.execute("data", null);
        }
View Full Code Here


        deleteDb("scriptSimple");
        reconnect();
        String inFile = "org/h2/test/testSimple.in.txt";
        InputStream is = getClass().getClassLoader().getResourceAsStream(inFile);
        LineNumberReader lineReader = new LineNumberReader(new InputStreamReader(is, "Cp1252"));
        ScriptReader reader = new ScriptReader(lineReader);
        while (true) {
            String sql = reader.readStatement();
            if (sql == null) {
                break;
            }
            sql = sql.trim();
            try {
                if ("@reconnect".equals(sql.toLowerCase())) {
                    reconnect();
                } else if (sql.length() == 0) {
                    // ignore
                } else if (sql.toLowerCase().startsWith("select")) {
                    ResultSet rs = conn.createStatement().executeQuery(sql);
                    while (rs.next()) {
                        String expected = reader.readStatement().trim();
                        String got = "> " + rs.getString(1);
                        assertEquals(sql, expected, got);
                    }
                } else {
                    conn.createStatement().execute(sql);
View Full Code Here

        // but for Ubuntu, the default ulimit is 1024,
        // which breaks the test
        int len = getSize(10, 50);
        Task[] tasks = new Task[len];
        for (int i = 0; i < len; i++) {
            tasks[i] = new Task() {
                public void call() throws SQLException {
                    Connection c = DriverManager.getConnection(url, user, password);
                    PreparedStatement prep = c.prepareStatement("insert into employee values(?, ?, 0)");
                    int id = getNextId();
                    prep.setInt(1, id);
View Full Code Here

    }

    private void testUUID() {
        long maxHigh = 0, maxLow = 0, minHigh = -1L, minLow = -1L;
        for (int i = 0; i < 100; i++) {
            ValueUuid uuid = ValueUuid.getNewRandom();
            maxHigh |= uuid.getHigh();
            maxLow |= uuid.getLow();
            minHigh &= uuid.getHigh();
            minLow &= uuid.getLow();
        }
        ValueUuid max = ValueUuid.get(maxHigh, maxLow);
        assertEquals("ffffffff-ffff-4fff-bfff-ffffffffffff", max.getString());
        ValueUuid min = ValueUuid.get(minHigh, minLow);
        assertEquals("00000000-0000-4000-8000-000000000000", min.getString());
    }
View Full Code Here

            }
            break;
        }
        case Value.UUID: {
            writeByte((byte) type);
            ValueUuid uuid = (ValueUuid) v;
            writeLong(uuid.getHigh());
            writeLong(uuid.getLow());
            break;
        }
        case Value.STRING: {
            String s = v.getString();
            int len = s.length();
View Full Code Here

        if ("IDENTITY".equals(originalSQL)) {
            originalSQL = "BIGINT";
        }
        String sequenceName;
        while (true) {
            ValueUuid uuid = ValueUuid.getNewRandom();
            String s = uuid.getString();
            s = s.replace('-', '_').toUpperCase();
            sequenceName = "SYSTEM_SEQUENCE_" + s;
            if (schema.findSequence(sequenceName) == null) {
                break;
            }
View Full Code Here

            }
            break;
        }
        case Value.UUID: {
            writeByte((byte) type);
            ValueUuid uuid = (ValueUuid) v;
            writeLong(uuid.getHigh());
            writeLong(uuid.getLow());
            break;
        }
        case Value.STRING: {
            String s = v.getString();
            int len = s.length();
View Full Code Here

        if ("IDENTITY".equals(originalSQL)) {
            originalSQL = "BIGINT";
        }
        String sequenceName;
        while (true) {
            ValueUuid uuid = ValueUuid.getNewRandom();
            String s = uuid.getString();
            s = s.replace('-', '_').toUpperCase();
            sequenceName = "SYSTEM_SEQUENCE_" + s;
            if (schema.findSequence(sequenceName) == null) {
                break;
            }
View Full Code Here

        if ("IDENTITY".equals(originalSQL)) {
            originalSQL = "BIGINT";
        }
        String sequenceName;
        for (int i = 0;; i++) {
            ValueUuid uuid = ValueUuid.getNewRandom();
            String s = uuid.getString();
            s = s.replace('-', '_').toUpperCase();
            sequenceName = "SYSTEM_SEQUENCE_" + s;
            if (schema.findSequence(sequenceName) == null) {
                break;
            }
View Full Code Here

            }
            break;
        }
        case Value.UUID: {
            writeByte((byte) type);
            ValueUuid uuid = (ValueUuid) v;
            writeLong(uuid.getHigh());
            writeLong(uuid.getLow());
            break;
        }
        case Value.STRING: {
            String s = v.getString();
            int len = s.length();
View Full Code Here

TOP

Related Classes of org.h2.value.ValueUuid

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.