示例#1
0
 @Override
 public void remove(Session session, Row row) {
   if (mvTable.getContainsLargeObject()) {
     for (int i = 0, len = row.getColumnCount(); i < len; i++) {
       Value v = row.getValue(i);
       if (v.isLinked()) {
         session.unlinkAtCommit(v);
       }
     }
   }
   TransactionMap<Value, Value> map = getMap(session);
   try {
     Value old = map.remove(ValueLong.get(row.getKey()));
     if (old == null) {
       throw DbException.get(
           ErrorCode.ROW_NOT_FOUND_WHEN_DELETING_1, getSQL() + ": " + row.getKey());
     }
   } catch (IllegalStateException e) {
     throw DbException.get(ErrorCode.CONCURRENT_UPDATE_1, table.getName());
   }
 }
示例#2
0
 private Row readRow(Data buff) {
   if (buff.readByte() == 0) {
     return null;
   }
   int mem = buff.readInt();
   int columnCount = buff.readInt();
   long key = buff.readLong();
   int version = buff.readInt();
   if (readUncached) {
     key = 0;
   }
   boolean deleted = buff.readInt() == 1;
   int sessionId = buff.readInt();
   Value[] values = new Value[columnCount];
   for (int i = 0; i < columnCount; i++) {
     Value v;
     if (buff.readByte() == 0) {
       v = null;
     } else {
       v = buff.readValue();
       if (v.isLinked()) {
         // the table id is 0 if it was linked when writing
         // a temporary entry
         if (v.getTableId() == 0) {
           session.unlinkAtCommit(v);
         }
       }
     }
     values[i] = v;
   }
   Row row = new Row(values, mem);
   row.setKey(key);
   row.setVersion(version);
   row.setDeleted(deleted);
   row.setSessionId(sessionId);
   return row;
 }