Package com.foundationdb.server

Examples of com.foundationdb.server.PersistitKeyValueSource


    @Test
    public void testValueSourceHasher()
    {
        AkCollator caseInsensitiveCollator = AkCollatorFactory.getAkCollator("sv_se_ci");
        AkCollator binaryCollator = AkCollatorFactory.getAkCollator(AkCollatorFactory.UCS_BINARY);
        PersistitKeyValueSource source = new PersistitKeyValueSource(MString.VARCHAR.instance(true));
        long hash_AB;
        long hash_ab;
        Key key = store().createKey();
        {
            binaryCollator.append(key.clear(), "AB");
            source.attach(key, 0, MString.VARCHAR.instance(true));
            hash_AB = ValueSources.hash(source, binaryCollator);
            binaryCollator.append(key.clear(), "ab");
            source.attach(key, 0, MString.VARCHAR.instance(true));
            hash_ab = ValueSources.hash(source, binaryCollator);
            assertTrue(hash_AB != hash_ab);
        }
        {
            caseInsensitiveCollator.append(key.clear(), "AB");
            source.attach(key, 0, MString.VARCHAR.instance(true));
            hash_AB = ValueSources.hash(source, caseInsensitiveCollator);
            caseInsensitiveCollator.append(key.clear(), "ab");
            source.attach(key, 0, MString.VARCHAR.instance(true));
            hash_ab = ValueSources.hash(source, caseInsensitiveCollator);
            assertTrue(hash_AB == hash_ab);
        }
    }
View Full Code Here


            Object keyValue;
            if (useRawSegment) {
                keyValue = getRawSegment(key, i);
            }
            else {
                PersistitKeyValueSource keySource = new PersistitKeyValueSource(type);
                keySource.attach(key, i, type);
                if (convertToType(type)) {
                    keyValue = ValueSources.toObject(keySource);
                }
                else if (keySource.isNull()) {
                    keyValue = null;
                }
                else {
                    StringBuilder str = new StringBuilder();
                    type.format(keySource, AkibanAppender.of(str));
View Full Code Here

    @Override
    public final ValueSource uncheckedValue(int i)
    {
        TInstance type = types[i];
        PersistitKeyValueSource keySource = keyPSource(i, type);
        attach(keySource, i, type);
        return keySource;
    }
View Full Code Here

    private PersistitKeyValueSource keyPSource(int i, TInstance type)
    {
        if (keyPSources == null)
            keyPSources = new PersistitKeyValueSource[nIndexFields];
        if (keyPSources[i] == null) {
            keyPSources[i] = new PersistitKeyValueSource(type);
        }
        return keyPSources[i];
    }
View Full Code Here

        return indexRowType;
    }

    @Override
    protected ValueSource uncheckedValue(int i) {
        PersistitKeyValueSource source = new PersistitKeyValueSource(types[i]);
        source.attach(iKey, i, types[i]);
        return source;
    }
View Full Code Here

              
                for(IndexColumn indexColumn : index.getKeyColumns()) {
                    Column column = indexColumn.getColumn();
                    int colPos = column.getPosition();
                    Object objFromRow = ValueSources.toObject(row.value(colPos));
                    PersistitKeyValueSource valueSource = new PersistitKeyValueSource(indexColumn.getColumn().getType());
                    valueSource.attach(key, indexColumn);
                   
                    final Object lastConvertedValue;
                    try {
                        lastConvertedValue = ValueSources.toObject(valueSource);
                    } catch (Exception e) {
View Full Code Here

        public ValueSource asSource() {
            return source;
        }
       
        public ValueSortKeySource(TInstance type) {
            source = new PersistitKeyValueSource(type);
        }
View Full Code Here

TOP

Related Classes of com.foundationdb.server.PersistitKeyValueSource

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.