com.taosdata.jdbc.BlockData Maven / Gradle / Ivy
package com.taosdata.jdbc;
import com.taosdata.jdbc.rs.RestfulResultSet;
import java.nio.ByteBuffer;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.Semaphore;
import java.util.concurrent.TimeUnit;
import static com.taosdata.jdbc.TSDBConstants.*;
public class BlockData {
private List> data;
private int returnCode;
private boolean isCompleted;
private int numOfRows;
private ByteBuffer buffer;
private List fields;
Semaphore semaphore;
public BlockData(List> data, int returnCode, int numOfRows, ByteBuffer buffer, List fields) {
this.data = data;
this.returnCode = returnCode;
this.numOfRows = numOfRows;
this.buffer = buffer;
this.fields = fields;
this.semaphore = new Semaphore(0);
this.isCompleted = false;
}
public static BlockData getEmptyBlockData(List fields) {
return new BlockData(null, 0, 0, null, fields);
}
public void handleData() {
try {
int columns = fields.size();
List> list = new ArrayList<>();
if (buffer != null) {
buffer.getInt(); // buffer length
int pHeader = buffer.position() + 28 + columns * 5;
buffer.position(buffer.position() + 8);
this.numOfRows = buffer.getInt();
buffer.position(pHeader);
int bitMapOffset = BitmapLen(numOfRows);
List lengths = new ArrayList<>(columns);
for (int i = 0; i < columns; i++) {
lengths.add(buffer.getInt());
}
pHeader = buffer.position();
int length = 0;
for (int i = 0; i < columns; i++) {
List
© 2015 - 2025 Weber Informatics LLC | Privacy Policy