@Override public void write(org.apache.thrift.protocol.TProtocol prot, TRowSet struct) throws org.apache.thrift.TException { TTupleProtocol oprot = (TTupleProtocol) prot; oprot.writeI64(struct.startRowOffset); { oprot.writeI32(struct.rows.size()); for (TRow _iter126 : struct.rows) { _iter126.write(oprot); } } BitSet optionals = new BitSet(); if (struct.isSetColumns()) { optionals.set(0); } oprot.writeBitSet(optionals, 1); if (struct.isSetColumns()) { { oprot.writeI32(struct.columns.size()); for (TColumn _iter127 : struct.columns) { _iter127.write(oprot); } } } }
@Override public void read(org.apache.thrift.protocol.TProtocol prot, TDelete struct) throws org.apache.thrift.TException { TTupleProtocol iprot = (TTupleProtocol) prot; struct.row = iprot.readBinary(); struct.setRowIsSet(true); BitSet incoming = iprot.readBitSet(6); if (incoming.get(0)) { { org.apache.thrift.protocol.TList _list55 = new org.apache.thrift.protocol.TList( org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); struct.columns = new ArrayList<TColumn>(_list55.size); for (int _i56 = 0; _i56 < _list55.size; ++_i56) { TColumn _elem57; // required _elem57 = new TColumn(); _elem57.read(iprot); struct.columns.add(_elem57); } } struct.setColumnsIsSet(true); } if (incoming.get(1)) { struct.timestamp = iprot.readI64(); struct.setTimestampIsSet(true); } if (incoming.get(2)) { struct.deleteType = TDeleteType.findByValue(iprot.readI32()); struct.setDeleteTypeIsSet(true); } if (incoming.get(3)) { struct.writeToWal = iprot.readBool(); struct.setWriteToWalIsSet(true); } if (incoming.get(4)) { { org.apache.thrift.protocol.TMap _map58 = new org.apache.thrift.protocol.TMap( org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, iprot.readI32()); struct.attributes = new HashMap<ByteBuffer, ByteBuffer>(2 * _map58.size); for (int _i59 = 0; _i59 < _map58.size; ++_i59) { ByteBuffer _key60; // required ByteBuffer _val61; // optional _key60 = iprot.readBinary(); _val61 = iprot.readBinary(); struct.attributes.put(_key60, _val61); } } struct.setAttributesIsSet(true); } if (incoming.get(5)) { struct.durability = TDurability.findByValue(iprot.readI32()); struct.setDurabilityIsSet(true); } }
@Override public void write(org.apache.thrift.protocol.TProtocol prot, TDelete struct) throws org.apache.thrift.TException { TTupleProtocol oprot = (TTupleProtocol) prot; oprot.writeBinary(struct.row); BitSet optionals = new BitSet(); if (struct.isSetColumns()) { optionals.set(0); } if (struct.isSetTimestamp()) { optionals.set(1); } if (struct.isSetDeleteType()) { optionals.set(2); } if (struct.isSetWriteToWal()) { optionals.set(3); } if (struct.isSetAttributes()) { optionals.set(4); } if (struct.isSetDurability()) { optionals.set(5); } oprot.writeBitSet(optionals, 6); if (struct.isSetColumns()) { { oprot.writeI32(struct.columns.size()); for (TColumn _iter53 : struct.columns) { _iter53.write(oprot); } } } if (struct.isSetTimestamp()) { oprot.writeI64(struct.timestamp); } if (struct.isSetDeleteType()) { oprot.writeI32(struct.deleteType.getValue()); } if (struct.isSetWriteToWal()) { oprot.writeBool(struct.writeToWal); } if (struct.isSetAttributes()) { { oprot.writeI32(struct.attributes.size()); for (Map.Entry<ByteBuffer, ByteBuffer> _iter54 : struct.attributes.entrySet()) { oprot.writeBinary(_iter54.getKey()); oprot.writeBinary(_iter54.getValue()); } } } if (struct.isSetDurability()) { oprot.writeI32(struct.durability.getValue()); } }
public void write(org.apache.thrift.protocol.TProtocol oprot, TRowSet struct) throws org.apache.thrift.TException { struct.validate(); oprot.writeStructBegin(STRUCT_DESC); oprot.writeFieldBegin(START_ROW_OFFSET_FIELD_DESC); oprot.writeI64(struct.startRowOffset); oprot.writeFieldEnd(); if (struct.rows != null) { oprot.writeFieldBegin(ROWS_FIELD_DESC); { oprot.writeListBegin( new org.apache.thrift.protocol.TList( org.apache.thrift.protocol.TType.STRUCT, struct.rows.size())); for (TRow _iter124 : struct.rows) { _iter124.write(oprot); } oprot.writeListEnd(); } oprot.writeFieldEnd(); } if (struct.columns != null) { if (struct.isSetColumns()) { oprot.writeFieldBegin(COLUMNS_FIELD_DESC); { oprot.writeListBegin( new org.apache.thrift.protocol.TList( org.apache.thrift.protocol.TType.STRUCT, struct.columns.size())); for (TColumn _iter125 : struct.columns) { _iter125.write(oprot); } oprot.writeListEnd(); } oprot.writeFieldEnd(); } } if (struct.binaryColumns != null) { if (struct.isSetBinaryColumns()) { oprot.writeFieldBegin(BINARY_COLUMNS_FIELD_DESC); oprot.writeBinary(struct.binaryColumns); oprot.writeFieldEnd(); } } if (struct.isSetColumnCount()) { oprot.writeFieldBegin(COLUMN_COUNT_FIELD_DESC); oprot.writeI32(struct.columnCount); oprot.writeFieldEnd(); } oprot.writeFieldStop(); oprot.writeStructEnd(); }
/** * Fill the client Data table from an Android Cursor Database * * @param pCursor */ public void fillFromCursor(Cursor pCursor) { _mCursor = pCursor; _mCursorSize = pCursor.getCount(); _mListOfRows.clear(); _mListOfRows.ensureCapacity(_mCursorSize); String[] lCursorColumnsNames = pCursor.getColumnNames(); int lNbrColumnsCDT = getColumnsCount(); int lNbrColumnsCursor = lCursorColumnsNames.length; if (lNbrColumnsCDT == 0) { for (int i = 0; i < lNbrColumnsCursor; i++) { _mListOfColumns.add(new TColumn(lCursorColumnsNames[i], ValueType.TEXT)); } } if (_mCursorSize > 0) { pCursor.moveToFirst(); _mPosition = 0; while (!pCursor.isAfterLast()) { TRow lRow = new TRow(); if (lNbrColumnsCDT > 0) { for (int i = 0; i < lNbrColumnsCDT; i++) { boolean lIsColumnFound = false; TColumn lColumn = _mListOfColumns.get(i); for (int j = 0; j < lNbrColumnsCursor; j++) { if (lColumn != null && lColumn.getName().equals(lCursorColumnsNames[j])) { lRow.addCell(_mContext, pCursor.getString(j), lColumn.getValueType(), _mCDTStatus); lIsColumnFound = true; break; } } if (!lIsColumnFound) lRow.addCell(_mContext, "", lColumn.getValueType(), _mCDTStatus); } } else { for (int i = 0; i < lNbrColumnsCursor; i++) { String lColumnName = lCursorColumnsNames[i]; if (lColumnName != null && !lColumnName.equals("")) lRow.addCell(_mContext, pCursor.getString(i), ValueType.TEXT, _mCDTStatus); } } _mListOfRows.add(lRow); pCursor.moveToNext(); } } Log.i("fillFromCursor", " Count :" + _mCursorSize); }
/** * Add row from values with differents type : boolean, String etc... * * @param values */ public void addRowFromValues(Object... values) { Iterator<TColumn> columnIt = _mListOfColumns.listIterator(); TRow lRow = new TRow(); for (int i = 0; i < values.length && columnIt.hasNext(); i++) { TColumn lCol = columnIt.next(); if (_mSqliteDataBase == null) lRow.addCell(_mContext, values[i], lCol.getValueType(), _mCDTStatus); else lRow.addCell(_mContext, values[i], lCol.getValueType(), _mCDTStatus); } addRow(lRow); }
public void write(org.apache.thrift.protocol.TProtocol oprot, TGet struct) throws org.apache.thrift.TException { struct.validate(); oprot.writeStructBegin(STRUCT_DESC); if (struct.row != null) { oprot.writeFieldBegin(ROW_FIELD_DESC); oprot.writeBinary(struct.row); oprot.writeFieldEnd(); } if (struct.columns != null) { if (struct.isSetColumns()) { oprot.writeFieldBegin(COLUMNS_FIELD_DESC); { oprot.writeListBegin( new org.apache.thrift.protocol.TList( org.apache.thrift.protocol.TType.STRUCT, struct.columns.size())); for (TColumn _iter11 : struct.columns) { _iter11.write(oprot); } oprot.writeListEnd(); } oprot.writeFieldEnd(); } } if (struct.isSetTimestamp()) { oprot.writeFieldBegin(TIMESTAMP_FIELD_DESC); oprot.writeI64(struct.timestamp); oprot.writeFieldEnd(); } if (struct.timeRange != null) { if (struct.isSetTimeRange()) { oprot.writeFieldBegin(TIME_RANGE_FIELD_DESC); struct.timeRange.write(oprot); oprot.writeFieldEnd(); } } if (struct.isSetMaxVersions()) { oprot.writeFieldBegin(MAX_VERSIONS_FIELD_DESC); oprot.writeI32(struct.maxVersions); oprot.writeFieldEnd(); } oprot.writeFieldStop(); oprot.writeStructEnd(); }
@Override public void read(org.apache.thrift.protocol.TProtocol prot, TRowSet struct) throws org.apache.thrift.TException { TTupleProtocol iprot = (TTupleProtocol) prot; struct.startRowOffset = iprot.readI64(); struct.setStartRowOffsetIsSet(true); { org.apache.thrift.protocol.TList _list128 = new org.apache.thrift.protocol.TList( org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); struct.rows = new ArrayList<TRow>(_list128.size); TRow _elem129; for (int _i130 = 0; _i130 < _list128.size; ++_i130) { _elem129 = new TRow(); _elem129.read(iprot); struct.rows.add(_elem129); } } struct.setRowsIsSet(true); BitSet incoming = iprot.readBitSet(3); if (incoming.get(0)) { { org.apache.thrift.protocol.TList _list131 = new org.apache.thrift.protocol.TList( org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); struct.columns = new ArrayList<TColumn>(_list131.size); TColumn _elem132; for (int _i133 = 0; _i133 < _list131.size; ++_i133) { _elem132 = new TColumn(); _elem132.read(iprot); struct.columns.add(_elem132); } } struct.setColumnsIsSet(true); } if (incoming.get(1)) { struct.binaryColumns = iprot.readBinary(); struct.setBinaryColumnsIsSet(true); } if (incoming.get(2)) { struct.columnCount = iprot.readI32(); struct.setColumnCountIsSet(true); } }
@Override public void write(org.apache.thrift.protocol.TProtocol prot, TGet struct) throws org.apache.thrift.TException { TTupleProtocol oprot = (TTupleProtocol) prot; oprot.writeBinary(struct.row); BitSet optionals = new BitSet(); if (struct.isSetColumns()) { optionals.set(0); } if (struct.isSetTimestamp()) { optionals.set(1); } if (struct.isSetTimeRange()) { optionals.set(2); } if (struct.isSetMaxVersions()) { optionals.set(3); } oprot.writeBitSet(optionals, 4); if (struct.isSetColumns()) { { oprot.writeI32(struct.columns.size()); for (TColumn _iter12 : struct.columns) { _iter12.write(oprot); } } } if (struct.isSetTimestamp()) { oprot.writeI64(struct.timestamp); } if (struct.isSetTimeRange()) { struct.timeRange.write(oprot); } if (struct.isSetMaxVersions()) { oprot.writeI32(struct.maxVersions); } }
@Override public void read(org.apache.thrift.protocol.TProtocol prot, TGet struct) throws org.apache.thrift.TException { TTupleProtocol iprot = (TTupleProtocol) prot; struct.row = iprot.readBinary(); struct.setRowIsSet(true); BitSet incoming = iprot.readBitSet(4); if (incoming.get(0)) { { org.apache.thrift.protocol.TList _list13 = new org.apache.thrift.protocol.TList( org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); struct.columns = new ArrayList<TColumn>(_list13.size); for (int _i14 = 0; _i14 < _list13.size; ++_i14) { TColumn _elem15; // optional _elem15 = new TColumn(); _elem15.read(iprot); struct.columns.add(_elem15); } } struct.setColumnsIsSet(true); } if (incoming.get(1)) { struct.timestamp = iprot.readI64(); struct.setTimestampIsSet(true); } if (incoming.get(2)) { struct.timeRange = new TTimeRange(); struct.timeRange.read(iprot); struct.setTimeRangeIsSet(true); } if (incoming.get(3)) { struct.maxVersions = iprot.readI32(); struct.setMaxVersionsIsSet(true); } }
public void read(org.apache.thrift.protocol.TProtocol iprot, TDelete struct) throws org.apache.thrift.TException { org.apache.thrift.protocol.TField schemeField; iprot.readStructBegin(); while (true) { schemeField = iprot.readFieldBegin(); if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { break; } switch (schemeField.id) { case 1: // ROW if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { struct.row = iprot.readBinary(); struct.setRowIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; case 2: // COLUMNS if (schemeField.type == org.apache.thrift.protocol.TType.LIST) { { org.apache.thrift.protocol.TList _list44 = iprot.readListBegin(); struct.columns = new ArrayList<TColumn>(_list44.size); for (int _i45 = 0; _i45 < _list44.size; ++_i45) { TColumn _elem46; // required _elem46 = new TColumn(); _elem46.read(iprot); struct.columns.add(_elem46); } iprot.readListEnd(); } struct.setColumnsIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; case 3: // TIMESTAMP if (schemeField.type == org.apache.thrift.protocol.TType.I64) { struct.timestamp = iprot.readI64(); struct.setTimestampIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; case 4: // DELETE_TYPE if (schemeField.type == org.apache.thrift.protocol.TType.I32) { struct.deleteType = TDeleteType.findByValue(iprot.readI32()); struct.setDeleteTypeIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; case 5: // WRITE_TO_WAL if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) { struct.writeToWal = iprot.readBool(); struct.setWriteToWalIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; case 6: // ATTRIBUTES if (schemeField.type == org.apache.thrift.protocol.TType.MAP) { { org.apache.thrift.protocol.TMap _map47 = iprot.readMapBegin(); struct.attributes = new HashMap<ByteBuffer, ByteBuffer>(2 * _map47.size); for (int _i48 = 0; _i48 < _map47.size; ++_i48) { ByteBuffer _key49; // required ByteBuffer _val50; // optional _key49 = iprot.readBinary(); _val50 = iprot.readBinary(); struct.attributes.put(_key49, _val50); } iprot.readMapEnd(); } struct.setAttributesIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; case 7: // DURABILITY if (schemeField.type == org.apache.thrift.protocol.TType.I32) { struct.durability = TDurability.findByValue(iprot.readI32()); struct.setDurabilityIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; default: org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } iprot.readFieldEnd(); } iprot.readStructEnd(); // check for required fields of primitive type, which can't be checked in the validate method struct.validate(); }
public void write(org.apache.thrift.protocol.TProtocol oprot, TDelete struct) throws org.apache.thrift.TException { struct.validate(); oprot.writeStructBegin(STRUCT_DESC); if (struct.row != null) { oprot.writeFieldBegin(ROW_FIELD_DESC); oprot.writeBinary(struct.row); oprot.writeFieldEnd(); } if (struct.columns != null) { if (struct.isSetColumns()) { oprot.writeFieldBegin(COLUMNS_FIELD_DESC); { oprot.writeListBegin( new org.apache.thrift.protocol.TList( org.apache.thrift.protocol.TType.STRUCT, struct.columns.size())); for (TColumn _iter51 : struct.columns) { _iter51.write(oprot); } oprot.writeListEnd(); } oprot.writeFieldEnd(); } } if (struct.isSetTimestamp()) { oprot.writeFieldBegin(TIMESTAMP_FIELD_DESC); oprot.writeI64(struct.timestamp); oprot.writeFieldEnd(); } if (struct.deleteType != null) { if (struct.isSetDeleteType()) { oprot.writeFieldBegin(DELETE_TYPE_FIELD_DESC); oprot.writeI32(struct.deleteType.getValue()); oprot.writeFieldEnd(); } } if (struct.isSetWriteToWal()) { oprot.writeFieldBegin(WRITE_TO_WAL_FIELD_DESC); oprot.writeBool(struct.writeToWal); oprot.writeFieldEnd(); } if (struct.attributes != null) { if (struct.isSetAttributes()) { oprot.writeFieldBegin(ATTRIBUTES_FIELD_DESC); { oprot.writeMapBegin( new org.apache.thrift.protocol.TMap( org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, struct.attributes.size())); for (Map.Entry<ByteBuffer, ByteBuffer> _iter52 : struct.attributes.entrySet()) { oprot.writeBinary(_iter52.getKey()); oprot.writeBinary(_iter52.getValue()); } oprot.writeMapEnd(); } oprot.writeFieldEnd(); } } if (struct.durability != null) { if (struct.isSetDurability()) { oprot.writeFieldBegin(DURABILITY_FIELD_DESC); oprot.writeI32(struct.durability.getValue()); oprot.writeFieldEnd(); } } oprot.writeFieldStop(); oprot.writeStructEnd(); }
public void read(org.apache.thrift.protocol.TProtocol iprot, TGet struct) throws org.apache.thrift.TException { org.apache.thrift.protocol.TField schemeField; iprot.readStructBegin(); while (true) { schemeField = iprot.readFieldBegin(); if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { break; } switch (schemeField.id) { case 1: // ROW if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { struct.row = iprot.readBinary(); struct.setRowIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; case 2: // COLUMNS if (schemeField.type == org.apache.thrift.protocol.TType.LIST) { { org.apache.thrift.protocol.TList _list8 = iprot.readListBegin(); struct.columns = new ArrayList<TColumn>(_list8.size); for (int _i9 = 0; _i9 < _list8.size; ++_i9) { TColumn _elem10; // optional _elem10 = new TColumn(); _elem10.read(iprot); struct.columns.add(_elem10); } iprot.readListEnd(); } struct.setColumnsIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; case 3: // TIMESTAMP if (schemeField.type == org.apache.thrift.protocol.TType.I64) { struct.timestamp = iprot.readI64(); struct.setTimestampIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; case 4: // TIME_RANGE if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { struct.timeRange = new TTimeRange(); struct.timeRange.read(iprot); struct.setTimeRangeIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; case 5: // MAX_VERSIONS if (schemeField.type == org.apache.thrift.protocol.TType.I32) { struct.maxVersions = iprot.readI32(); struct.setMaxVersionsIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; default: org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } iprot.readFieldEnd(); } iprot.readStructEnd(); // check for required fields of primitive type, which can't be checked in the validate method struct.validate(); }
public void read(org.apache.thrift.protocol.TProtocol iprot, TRowSet struct) throws org.apache.thrift.TException { org.apache.thrift.protocol.TField schemeField; iprot.readStructBegin(); while (true) { schemeField = iprot.readFieldBegin(); if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { break; } switch (schemeField.id) { case 1: // START_ROW_OFFSET if (schemeField.type == org.apache.thrift.protocol.TType.I64) { struct.startRowOffset = iprot.readI64(); struct.setStartRowOffsetIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; case 2: // ROWS if (schemeField.type == org.apache.thrift.protocol.TType.LIST) { { org.apache.thrift.protocol.TList _list118 = iprot.readListBegin(); struct.rows = new ArrayList<TRow>(_list118.size); TRow _elem119; for (int _i120 = 0; _i120 < _list118.size; ++_i120) { _elem119 = new TRow(); _elem119.read(iprot); struct.rows.add(_elem119); } iprot.readListEnd(); } struct.setRowsIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; case 3: // COLUMNS if (schemeField.type == org.apache.thrift.protocol.TType.LIST) { { org.apache.thrift.protocol.TList _list121 = iprot.readListBegin(); struct.columns = new ArrayList<TColumn>(_list121.size); TColumn _elem122; for (int _i123 = 0; _i123 < _list121.size; ++_i123) { _elem122 = new TColumn(); _elem122.read(iprot); struct.columns.add(_elem122); } iprot.readListEnd(); } struct.setColumnsIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; case 4: // BINARY_COLUMNS if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { struct.binaryColumns = iprot.readBinary(); struct.setBinaryColumnsIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; case 5: // COLUMN_COUNT if (schemeField.type == org.apache.thrift.protocol.TType.I32) { struct.columnCount = iprot.readI32(); struct.setColumnCountIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; default: org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } iprot.readFieldEnd(); } iprot.readStructEnd(); struct.validate(); }