public Builder mergeFrom(org.apache.calcite.avatica.proto.Requests.PrepareRequest other) { if (other == org.apache.calcite.avatica.proto.Requests.PrepareRequest.getDefaultInstance()) return this; if (!other.getConnectionId().isEmpty()) { connectionId_ = other.connectionId_; onChanged(); } if (!other.getSql().isEmpty()) { sql_ = other.sql_; onChanged(); } if (other.getMaxRowCount() != 0L) { setMaxRowCount(other.getMaxRowCount()); } onChanged(); return this; }
public Builder mergeFrom(org.apache.calcite.avatica.proto.Requests.PrepareRequest other) { if (other == org.apache.calcite.avatica.proto.Requests.PrepareRequest.getDefaultInstance()) return this; if (!other.getConnectionId().isEmpty()) { connectionId_ = other.connectionId_; onChanged(); } if (!other.getSql().isEmpty()) { sql_ = other.sql_; onChanged(); } if (other.getMaxRowCount() != 0L) { setMaxRowCount(other.getMaxRowCount()); } if (other.getMaxRowsTotal() != 0L) { setMaxRowsTotal(other.getMaxRowsTotal()); } this.mergeUnknownFields(other.unknownFields); onChanged(); return this; }
public Builder mergeFrom(org.apache.calcite.avatica.proto.Requests.PrepareRequest other) { if (other == org.apache.calcite.avatica.proto.Requests.PrepareRequest.getDefaultInstance()) return this; if (!other.getConnectionId().isEmpty()) { connectionId_ = other.connectionId_; onChanged(); } if (!other.getSql().isEmpty()) { sql_ = other.sql_; onChanged(); } if (other.getMaxRowCount() != 0L) { setMaxRowCount(other.getMaxRowCount()); } if (other.getMaxRowsTotal() != 0L) { setMaxRowsTotal(other.getMaxRowsTotal()); } this.mergeUnknownFields(other.unknownFields); onChanged(); return this; }
@Test public void testPrepareDeserialization() throws Exception { final String sql = "SELECT * FROM FOO"; final String connectionId = UUID.randomUUID().toString(); final long maxRowCount = 200L; // The "current" serialization strategy. Requests.PrepareRequest protoPrepare = Requests.PrepareRequest.newBuilder(). setConnectionId(connectionId).setSql(sql).setMaxRowsTotal(maxRowCount).build(); Service.PrepareRequest prepareReq = new Service.PrepareRequest().deserialize(protoPrepare); assertEquals(maxRowCount, prepareReq.maxRowCount); // The "old" serialization strategy. protoPrepare = Requests.PrepareRequest.newBuilder(). setConnectionId(connectionId).setSql(sql).setMaxRowCount(maxRowCount).build(); prepareReq = new Service.PrepareRequest().deserialize(protoPrepare); assertEquals(maxRowCount, prepareReq.maxRowCount); // Both the new and old provided should default to the new protoPrepare = Requests.PrepareRequest.newBuilder(). setConnectionId(connectionId).setSql(sql).setMaxRowCount(500L) .setMaxRowsTotal(maxRowCount).build(); prepareReq = new Service.PrepareRequest().deserialize(protoPrepare); assertEquals(maxRowCount, prepareReq.maxRowCount); }
@Test public void testPrepareDeserialization() throws Exception { final String sql = "SELECT * FROM FOO"; final String connectionId = UUID.randomUUID().toString(); final long maxRowCount = 200L; // The "current" serialization strategy. Requests.PrepareRequest protoPrepare = Requests.PrepareRequest.newBuilder(). setConnectionId(connectionId).setSql(sql).setMaxRowsTotal(maxRowCount).build(); Service.PrepareRequest prepareReq = new Service.PrepareRequest().deserialize(protoPrepare); assertEquals(maxRowCount, prepareReq.maxRowCount); // The "old" serialization strategy. protoPrepare = Requests.PrepareRequest.newBuilder(). setConnectionId(connectionId).setSql(sql).setMaxRowCount(maxRowCount).build(); prepareReq = new Service.PrepareRequest().deserialize(protoPrepare); assertEquals(maxRowCount, prepareReq.maxRowCount); // Both the new and old provided should default to the new protoPrepare = Requests.PrepareRequest.newBuilder(). setConnectionId(connectionId).setSql(sql).setMaxRowCount(500L) .setMaxRowsTotal(maxRowCount).build(); prepareReq = new Service.PrepareRequest().deserialize(protoPrepare); assertEquals(maxRowCount, prepareReq.maxRowCount); }
@Override Requests.PrepareRequest serialize() { Requests.PrepareRequest.Builder builder = Requests.PrepareRequest.newBuilder(); if (null != connectionId) { builder.setConnectionId(connectionId); } if (null != sql) { builder.setSql(sql); } // Set both field for backwards compatibility return builder.setMaxRowCount(maxRowCount).setMaxRowsTotal(maxRowCount).build(); }
@Override Requests.PrepareRequest serialize() { Requests.PrepareRequest.Builder builder = Requests.PrepareRequest.newBuilder(); if (null != connectionId) { builder.setConnectionId(connectionId); } if (null != sql) { builder.setSql(sql); } return builder.setMaxRowCount(maxRowCount).build(); }
@Override Requests.PrepareRequest serialize() { Requests.PrepareRequest.Builder builder = Requests.PrepareRequest.newBuilder(); if (null != connectionId) { builder.setConnectionId(connectionId); } if (null != sql) { builder.setSql(sql); } // Set both field for backwards compatibility return builder.setMaxRowCount(maxRowCount).setMaxRowsTotal(maxRowCount).build(); }