Package com.foundationdb.server.rowdata

Examples of com.foundationdb.server.rowdata.RowDef


    public void growALot() throws InvalidOperationException
    {
        // Buffer should grow two times
        int t = createTable("s", "t",
                            "string varchar(100)");
        RowDef rowDef = getRowDef(t);
        int initialBufferSize = RowData.MINIMUM_RECORD_LENGTH + 1 /* null bitmap */ + 5;
        RowData rowData = new RowData(new byte[initialBufferSize]);
        // initialBufferSize has room for varchar of size 4, (1 byte of the 5 is for length).
        // initialBufferSize is 24:
        assertEquals(24, initialBufferSize);
View Full Code Here


    @Test
    public void signedIntTypes() throws InvalidOperationException {
        final int tid = createTableFromTypes(SCHEMA, TABLE, IS_PK, INDEXES,
                                             "MCOMPAT_ tinyint", "MCOMPAT_ smallint", "MCOMPAT_ mediumint", "MCOMPAT_ int", "MCOMPAT_ bigint");
        final RowDef def = getRowDef(tid);
        testRow(def, 1, 0, 0, 0, 0, 0);                                              // zero
        testRow(def, 2, -128, -32768, -8388608, -2147483648, -9223372036854775808L); // min
        testRow(def, 3, 127, 32767, 8388607, 2147483647, 9223372036854775807L);      // max
        testRow(def, 4, 35, 23964, 7904325, -148932453, 86937294587L);               // other
    }
View Full Code Here

    @Test
    public void unsignedIntTypes() throws InvalidOperationException {
        final int tid = createTableFromTypes(SCHEMA, TABLE, IS_PK, INDEXES,
                                             "MCOMPAT_ tinyint unsigned", "MCOMPAT_ smallint unsigned", "MCOMPAT_ mediumint unsigned", "MCOMPAT_ int unsigned", "MCOMPAT_ bigint unsigned");
        final RowDef def = getRowDef(tid);
        testRow(def, 1, 0, 0, 0, 0, BigInteger.ZERO);                                               // zero/min
        testRow(def, 2, 255, 65535, 16777215, 4294967295L, new BigInteger("18446744073709551615")); // max
        testRow(def, 3, 42, 9848, 2427090, 290174268L, new BigInteger("73957261119487228"));        // other
    }
View Full Code Here

    }

    @Test
    public void signedRealTypes() throws InvalidOperationException {
        final int tid = createTableFromTypes(SCHEMA, TABLE, IS_PK, INDEXES, "MCOMPAT_ float", "MCOMPAT_ double");
        final RowDef def = getRowDef(tid);
        testRow(def, 1, 0f, 0d);                            // zero
        testRow(def, 2, Float.MIN_VALUE, Double.MIN_VALUE); // min
        testRow(def, 3, Float.MAX_VALUE, Double.MAX_VALUE); // max
        testRow(def, 4, -10f, -100d);                       // negative whole
        testRow(def, 5, -123.456f, -8692.18474823d);        // negative fraction
View Full Code Here

    }

    @Test
    public void unsignedRealTypes() throws InvalidOperationException {
        final int tid = createTableFromTypes(SCHEMA, TABLE, IS_PK, INDEXES, "MCOMPAT_ float unsigned","MCOMPAT_ double unsigned");
        final RowDef def = getRowDef(tid);
        testRow(def, 1, 0f, 0d);                            // zero
        testRow(def, 2, Float.MAX_VALUE, Double.MAX_VALUE); // max
        testRow(def, 3, 12345f, 9876543210d);               // positive whole
        testRow(def, 4, 7234.1321f, 3819476924.12342819d)// positive fraction
    }
View Full Code Here

    @Test
    public void decimalTypes() throws InvalidOperationException {
        final int tid = createTableFromTypes(SCHEMA, TABLE, IS_PK, INDEXES,
                                             new SimpleColumn("c1", "MCOMPAT_ decimal", 5L, 2L), new SimpleColumn("c2", "MCOMPAT_ decimal unsigned", 5L, 2L));
        final RowDef def = getRowDef(tid);
        testRow(def, 1, BigDecimal.valueOf(0), BigDecimal.valueOf(0));                // zero
        testRow(def, 2, BigDecimal.valueOf(-99999L, 2), BigDecimal.valueOf(0));       // min
        testRow(def, 3, BigDecimal.valueOf(99999L, 2), BigDecimal.valueOf(99999, 2)); // max
        testRow(def, 4, BigDecimal.valueOf(-999L), BigDecimal.valueOf(0));            // negative whole
        testRow(def, 5, BigDecimal.valueOf(-12345, 1), BigDecimal.valueOf(0));        // negative fraction
View Full Code Here

    @Test
    public void charTypes() throws InvalidOperationException {
        final int tid = createTableFromTypes(SCHEMA, TABLE, IS_PK, INDEXES,
                                             new SimpleColumn("c1", "MCOMPAT_ char", 10L, null), new SimpleColumn("c2", "MCOMPAT_ varchar", 26L, null));
        final RowDef def = getRowDef(tid);
        testRow(def, 1, "", "");                                     // empty
        testRow(def, 2, "0123456789", "abcdefghijklmnopqrstuvwxyz"); // full
        testRow(def, 3, "zebra", "see spot run");                    // other
    }
View Full Code Here

    @Test
    public void blobTypes() throws InvalidOperationException {
        final int tid = createTableFromTypes(SCHEMA, TABLE, IS_PK, INDEXES,
                                             "MCOMPAT_ tinyblob", "MCOMPAT_ blob", "MCOMPAT_ mediumblob", "MCOMPAT_ longblob");
        final RowDef def = getRowDef(tid);
        testRow(def, 1, "".getBytes(), "".getBytes(), "".getBytes(), "".getBytes());            // empty
        testRow(def, 2, "a".getBytes(), "bc".getBytes(), "def".getBytes(), "hijk".getBytes())// other
    }
View Full Code Here

    @Test
    public void textTypes() throws InvalidOperationException {
        final int tid = createTableFromTypes(SCHEMA, TABLE, IS_PK, INDEXES,
                                             "MCOMPAT_ tinytext", "MCOMPAT_ text", "MCOMPAT_ mediumtext", "MCOMPAT_ longtext");
        final RowDef def = getRowDef(tid);
        testRow(def, 1, "", "", "", "");            // empty
        testRow(def, 2, "1", "23", "456", "7890")// other
    }
View Full Code Here

    @Test
    public void binaryTypes() throws InvalidOperationException {
        final int tid = createTableFromTypes(SCHEMA, TABLE, IS_PK, INDEXES,
                                             new SimpleColumn("c1", "MCOMPAT_ binary", 10L, null), new SimpleColumn("c2", "MCOMPAT_ varbinary", 26L, null));
        final RowDef def = getRowDef(tid);
        final byte[] emptyArr = {};
        final byte[] partialArr5 = {1, 2, 3, 4, 5};
        final byte[] partialArr15 = {-24, 8, -98, 45, 67, 127, 34, -34, -42, 9, 10, 100, 57, -20, 5};
        final byte[] fullArr10 = {0, -10, 24, -128, 127, 83, 97, 100, -120, 42};
        final byte[] fullArr26 = {-47, -48, -66, 98, -54, -12, -53, -100, -25, -80, 9, 29, 17, -39, 45, 44, 15,
View Full Code Here

TOP

Related Classes of com.foundationdb.server.rowdata.RowDef

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.