Skip to content

Commit 52a46c5

Browse files
author
lucaijun
committed
Merge remote-tracking branch 'origin/release130' into release130
2 parents fb598f0 + 003eb10 commit 52a46c5

19 files changed

+1536
-3390
lines changed

src/com/xxdb/DBConnection.java

Lines changed: 13 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -177,18 +177,6 @@ private DBConnectionImpl(boolean asynTask, boolean sslEnable, boolean compress,
177177
this.lock_ = new ReentrantLock();
178178
}
179179

180-
private DBConnectionImpl(boolean asynTask, boolean sslEnable, boolean compress, boolean python, boolean ifUrgent, SqlStdEnum sqlStd){
181-
sessionID_ = "";
182-
this.sslEnable_ = sslEnable;
183-
this.asynTask_ = asynTask;
184-
this.compress_ = compress;
185-
this.ifUrgent_ = ifUrgent;
186-
this.python_ = python;
187-
this.isReverseStreaming_ = false;
188-
this.sqlStd_ = sqlStd;
189-
this.lock_ = new ReentrantLock();
190-
}
191-
192180
private boolean connect(String hostName, int port, String userId, String password, int connTimeout) throws IOException{
193181
this.hostName_ = hostName;
194182
this.port_ = port;
@@ -245,6 +233,8 @@ private boolean connect()throws IOException{
245233
return false;
246234
}
247235

236+
String msg = in_.readLine();
237+
248238
isConnected_ = true;
249239

250240
if (line.charAt(endPos + 1) == '0') {
@@ -447,17 +437,15 @@ private Entity run(String script, String scriptType, ProgressListener listener,
447437
if (asynTask_)
448438
return null;
449439

450-
ExtendedDataInput in = remoteLittleEndian_ ? new LittleEndianDataInputStream(new BufferedInputStream(socket_.getInputStream())) :
451-
new BigEndianDataInputStream(new BufferedInputStream(socket_.getInputStream()));
452440
String header = null;
453441
try {
454-
header = in.readLine();
442+
header = in_.readLine();
455443
while (header.equals("MSG")) {
456444
//read intermediate message to indicate the progress
457-
String msg = in.readString();
445+
String msg = in_.readString();
458446
if (listener != null)
459447
listener.progress(msg);
460-
header = in.readLine();
448+
header = in_.readLine();
461449
}
462450
}catch (IOException ex){
463451
isConnected_ = false;
@@ -476,7 +464,7 @@ private Entity run(String script, String scriptType, ProgressListener listener,
476464
int numObject = Integer.parseInt(headers[1]);
477465

478466
try {
479-
header = in.readLine();
467+
header = in_.readLine();
480468
}catch (IOException ex){
481469
isConnected_ = false;
482470
socket_ = null;
@@ -496,7 +484,7 @@ private Entity run(String script, String scriptType, ProgressListener listener,
496484

497485
short flag;
498486
try {
499-
flag = in.readShort();
487+
flag = in_.readShort();
500488
int form = flag >> 8;
501489
int type = flag & 0xff;
502490
boolean extended = type >= 128;
@@ -513,10 +501,10 @@ private Entity run(String script, String scriptType, ProgressListener listener,
513501

514502

515503
if(fetchSize>0 && df == Entity.DATA_FORM.DF_VECTOR && dt == Entity.DATA_TYPE.DT_ANY){
516-
return new EntityBlockReader(in);
504+
return new EntityBlockReader(in_);
517505
}
518506
EntityFactory factory = BasicEntityFactory.instance();
519-
return factory.createEntity(df, dt, in, extended);
507+
return factory.createEntity(df, dt, in_, extended);
520508
}catch (IOException ex){
521509
isConnected_ = false;
522510
socket_ = null;
@@ -609,23 +597,23 @@ public DBConnection(boolean asynchronousTask, boolean useSSL, boolean compress)
609597
}
610598

611599
public DBConnection(boolean asynchronousTask, boolean useSSL, boolean compress, boolean usePython){
612-
this.conn_ = new DBConnectionImpl(asynchronousTask, useSSL, compress, usePython, false, SqlStdEnum.DolphinDB);
600+
this.conn_ = new DBConnectionImpl(asynchronousTask, useSSL, compress, usePython, false, false, SqlStdEnum.DolphinDB);
613601
this.mutex_ = new ReentrantLock();
614602
}
615603

616604

617605
public DBConnection(boolean asynchronousTask, boolean useSSL, boolean compress, boolean usePython, SqlStdEnum sqlStd){
618-
this.conn_ = new DBConnectionImpl(asynchronousTask, useSSL, compress, usePython, false, sqlStd);
606+
this.conn_ = new DBConnectionImpl(asynchronousTask, useSSL, compress, usePython, false, false, sqlStd);
619607
this.mutex_ = new ReentrantLock();
620608
}
621609

622610
public DBConnection(boolean asynchronousTask, boolean useSSL, boolean compress, boolean usePython, boolean isUrgent){
623-
this.conn_ = new DBConnectionImpl(asynchronousTask, useSSL, compress, usePython, isUrgent, SqlStdEnum.DolphinDB);
611+
this.conn_ = new DBConnectionImpl(asynchronousTask, useSSL, compress, usePython, isUrgent, false, SqlStdEnum.DolphinDB);
624612
this.mutex_ = new ReentrantLock();
625613
}
626614

627615
public DBConnection(boolean asynchronousTask, boolean useSSL, boolean compress, boolean usePython, boolean isUrgent, SqlStdEnum sqlStd){
628-
this.conn_ = new DBConnectionImpl(asynchronousTask, useSSL, compress, usePython, isUrgent, sqlStd);
616+
this.conn_ = new DBConnectionImpl(asynchronousTask, useSSL, compress, usePython, isUrgent, false, sqlStd);
629617
this.mutex_ = new ReentrantLock();
630618
}
631619

src/com/xxdb/data/BasicTable.java

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -130,9 +130,9 @@ public void setColName (final List<String> colNames) {
130130
*/
131131
public void replaceColName(String originalColName, String newColName) {
132132
if (Utils.isEmpty(originalColName) || Utils.isEmpty(newColName))
133-
throw new RuntimeException("The param 'newColName' cannot be null or empty.");
133+
throw new RuntimeException("The param 'originalColName' or 'newColName' cannot be null or empty.");
134134

135-
if (!this.colNames.contains(originalColName) && this.colNames.contains(newColName))
135+
if (this.colNames.contains(newColName))
136136
throw new RuntimeException("The newColName '" + newColName +"' already exists in table. Column names cannot be duplicated.");
137137

138138
if (this.colNames.contains(originalColName)) {
@@ -410,9 +410,7 @@ public void replaceColumn(String colName, Vector col) {
410410
if (this.colRows != 0 && col.rows() != this.colRows)
411411
throw new RuntimeException("The length of column " + colName + " must be the same as the first column length: " + this.colRows +".");
412412

413-
colNames.add(colName);
414-
colNamesIndex.put(colName, colNamesIndex.size());
415-
columns.add(col);
416-
this.colRows = col.rows();
413+
int index = colNames.indexOf(colName);
414+
columns.set(index, col);
417415
}
418416
}

target/test-classes/com/xxdb/README.md

Lines changed: 0 additions & 12 deletions
This file was deleted.

0 commit comments

Comments
 (0)