Skip to content

Commit 9aa7763

Browse files
committed
update
1 parent c76b9dc commit 9aa7763

File tree

2 files changed

+33
-17
lines changed

2 files changed

+33
-17
lines changed

README.md

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ public void Test_Connect(){
5050
DBConnection conn=new DBConnection();
5151
Assert.AreEqual(true,conn.connect("localhost",8848));
5252
}
53-
5453
```
5554

5655
Establish a connection with a username and password
@@ -137,7 +136,6 @@ public void testSet(){
137136
Console.WriteLine(s.rows());
138137
Console.WriteLine(s.columns());
139138
}
140-
141139
```
142140

143141
- Matrix
@@ -154,7 +152,6 @@ public void testIntMatrix(){
154152
Console.WriteLine(m.columns());
155153
Console.WriteLine(((BasicInt)m.get(0, 1)).getValue());
156154
}
157-
158155
```
159156

160157
- Dictionary
@@ -171,7 +168,6 @@ public void testDictionary(){
171168
Console.WriteLine(val);
172169
}
173170
}
174-
175171
```
176172

177173

@@ -185,7 +181,6 @@ public void testTable(){
185181
DataTable dt = tb.toDataTable();
186182
Console.WriteLine(dt.Rows.Count);
187183
}
188-
189184
```
190185
- NULL object
191186

@@ -196,7 +191,6 @@ public void testVoid(){
196191
IEntity obj = conn.run("NULL");
197192
Assert.AreEqual(obj.getObject(), null);
198193
}
199-
200194
```
201195

202196
### 7.Call DolphinDB function
@@ -215,7 +209,6 @@ public void testFunction(){
215209
BasicDouble result = (BasicDouble)conn.run("sum", args);
216210
Console.WriteLine(result.getValue());
217211
}
218-
219212
```
220213

221214
### 8.Upload the object to the DolphinDB server
@@ -232,7 +225,6 @@ public void testUpload(){
232225
BasicIntVector v = (BasicIntVector)conn.run("table_uploaded.id");
233226
Console.WriteLine(v.rows());
234227
}
235-
236228
```
237229

238230
### 9. How to save C# data table objects to DolphinDB database

README_CN.md

Lines changed: 33 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ C# API遵循面向接口编程的原则。C# API使用接口类IEntity来表示D
1111
scalar|`Basic<DataType>`|BasicInt, BasicDouble, BasicDate, etc.
1212
vector,matrix|`Basic<DataType><DataForm>`|BasicIntVector, BasicDoubleMatrix, BasicAnyVector, etc.
1313
set, dictionary和table|`Basic<DataForm>`|BasicSet, BasicDictionary, BasicTable.
14-
chart|BasicChart|
14+
chart||BasicChart
1515

1616
“Basic”表示基本的数据类型接口,`<DataType>`表示DolphinDB数据类型名称,`<DataForm>`是一个DolphinDB数据形式名称。
1717

@@ -42,7 +42,6 @@ public void Test_Connect(){
4242
DBConnection conn=new DBConnection();
4343
Assert.AreEqual(true,conn.connect("localhost",8848));
4444
}
45-
4645
```
4746
使用用户名和密码建立连接:
4847

@@ -121,7 +120,6 @@ public void testSet(){
121120
Console.WriteLine(s.rows());
122121
Console.WriteLine(s.columns());
123122
}
124-
125123
```
126124

127125
- 矩阵
@@ -136,7 +134,6 @@ public void testIntMatrix(){
136134
Console.WriteLine(m.columns());
137135
Console.WriteLine(((BasicInt)m.get(0, 1)).getValue());
138136
}
139-
140137
```
141138

142139
- 字典
@@ -152,7 +149,6 @@ public void testDictionary(){
152149
Console.WriteLine(val);
153150
}
154151
}
155-
156152
```
157153

158154

@@ -166,7 +162,6 @@ public void testTable(){
166162
DataTable dt = tb.toDataTable();
167163
Console.WriteLine(dt.Rows.Count);
168164
}
169-
170165
```
171166
- NULL对象
172167

@@ -176,7 +171,6 @@ public void testVoid(){
176171
IEntity obj = conn.run("NULL");
177172
Assert.AreEqual(obj.getObject(), null);
178173
}
179-
180174
```
181175

182176
### 7.调用DolphinDB函数
@@ -194,7 +188,6 @@ public void testFunction(){
194188
BasicDouble result = (BasicDouble)conn.run("sum", args);
195189
Console.WriteLine(result.getValue());
196190
}
197-
198191
```
199192

200193
### 8.将对象上传到DolphinDB服务器
@@ -211,7 +204,6 @@ public void testUpload(){
211204
BasicIntVector v = (BasicIntVector)conn.run("table_uploaded.id");
212205
Console.WriteLine(v.rows());
213206
}
214-
215207
```
216208

217209
### 9. 如何将C#数据表对象保存到DolphinDB的数据库中
@@ -441,3 +433,35 @@ ThreadPooledClient client = new ThreadPooledClient(subscribePort);
441433
442434
client.subscribe(serverIP, serverPort, tableName, new MyHandler(), offsetInt);
443435
```
436+
437+
#### 断线重连
438+
439+
`reconnect`参数是一个布尔值,表示订阅意外中断后,是否会自动重新订阅。默认值为`false`。如果`reconnect=true`,有以下三种情况:
440+
441+
- 如果发布端与订阅端处于正常状态,但是网络中断,那么订阅端会在网络正常时,自动从中断位置重新订阅。
442+
- 如果发布端崩溃,订阅端会在发布端重启后不断尝试重新订阅。
443+
- 如果发布端对流数据表启动了持久化,发布端重启后会首先读取硬盘上的数据,直到发布端读取到订阅中断位置的数据,订阅端才能成功重新订阅。
444+
- 如果发布端没有对流数据表启用持久化,那么订阅端将自动重新订阅失败。
445+
- 如果订阅端崩溃,订阅端重启后不会自动重新订阅,需要重新执行`subscribe`函数。
446+
447+
以下例子在订阅时,设置`reconnect``true`
448+
449+
```
450+
PollingClient client = new PollingClient(subscribePort);
451+
TopicPoller poller1 = client.subscribe(serverIP, serverPort, tableName, offset, true);
452+
```
453+
454+
#### 启用filter
455+
456+
`filter`参数是一个向量。该参数需要发布端配合`setStreamTableFilterColumn`函数一起使用。使用`setStreamTableFilterColumn`指定流数据表的过滤列,流数据表过滤列在`filter`中的数据才会发布到订阅端,不在`filter`中的数据不会发布。
457+
458+
以下例子将一个包含元素1和2的整数类型向量作为`subscribe``filter`参数:
459+
460+
```
461+
BasicIntVector filter = new BasicIntVector(2);
462+
filter.setInt(0, 1);
463+
filter.setInt(1, 2);
464+
465+
PollingClient client = new PollingClient(subscribePort);
466+
TopicPoller poller1 = client.subscribe(serverIP, serverPort, tableName, actionName, offset, filter);
467+
```

0 commit comments

Comments
 (0)