Example #1
0
        internal VersionEntry GetVersionEntryByKey(string tableId, object recordKey, long versionKey, VersionEntry ve)
        {
            var rs = this.CQLExecute(string.Format(PartitionedCassandraVersionTable.CQL_GET_VERSION_ENTRY,
                                                   tableId, recordKey.ToString(), versionKey));
            var rse = rs.GetEnumerator();

            rse.MoveNext();
            Row row = rse.Current;

            if (row == null)
            {
                return(null);
            }

            if (ve == null)
            {
                return(new VersionEntry(versionKey, row.GetValue <long>("begintimestamp"),
                                        row.GetValue <long>("endtimestamp"),
                                        BytesSerializer.Deserialize(row.GetValue <byte[]>("record")),
                                        row.GetValue <long>("txid"),
                                        row.GetValue <long>("maxcommitts")));
            }
            else
            {
                ve.Set(
                    versionKey, row.GetValue <long>("begintimestamp"),
                    row.GetValue <long>("endtimestamp"),
                    BytesSerializer.Deserialize(row.GetValue <byte[]>("record")),
                    row.GetValue <long>("txid"),
                    row.GetValue <long>("maxcommitts"));

                return(ve);
            }
        }