/** * Insert row into table. * * @param rowBytes Serialized row to be written */ public void insertRow(byte[] rowBytes) { checkTableOpen(); checkNotNull(rowBytes); TableSchema schema = store.getSchema(tableName); Row row = Row.deserialize(rowBytes); row.setRandomUUID(); String auto_inc_col = schema.getAutoIncrementColumn(); if (auto_inc_col != null) { ByteBuffer bb = row.getRecords().get(auto_inc_col); if (bb != null) { long auto_inc = bb.getLong(); long next_auto_inc = auto_inc + 1; if (auto_inc > next_auto_inc) { // The autoincrement will wrap around. MySQL says don't wrap. next_auto_inc = auto_inc; } bb.rewind(); store.setAutoInc(tableName, next_auto_inc); } } table.insertRow(row); if (schema.hasUniqueIndices()) { table.flush(); } }