Skip to content

Commit db13136

Browse files
committed
release 3.0.4.0
1 parent effce51 commit db13136

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+8387
-2231
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@
88
/.vscode/
99
/.python-version
1010
**/__pycache__/*
11+
/.cache/

CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ project(dolphindbcpp LANGUAGES CXX)
44
set(MODULE_NAME _dolphindbcpp)
55
set(CMAKE_CXX_STANDARD 11)
66
set(CMAKE_CXX_STANDARD_REQUIRED ON)
7+
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
78
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
89
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
910

@@ -138,7 +139,7 @@ if(WIN32)
138139
)
139140
get_filename_component(OPENSSL_ROOT_DIR ${OPENSSL_INCLUDE_DIR} DIRECTORY)
140141
target_link_directories(${MODULE_NAME}
141-
PUBLIC
142+
PUBLIC
142143
"${OPENSSL_ROOT_DIR}/lib64"
143144
"${OPENSSL_ROOT_DIR}/lib"
144145
)

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ To use DolphinDB Python SDK, you'll need:
1414
- pandas: version 1.0.0 and newer, but not version 1.3.0
1515
- future
1616
- packaging
17+
- pydantic: version 2.0 and newer
1718
- Extension Packages:
1819
- PyArrow: version 9.0.0 and newer
1920

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55

66
namespace dolphindb {
77
class DBConnection;
8-
class AsynWorker: public Runnable {
8+
class EXPORT_DECL AsyncWorker: public Runnable {
99
public:
1010
using Task = DBConnectionPoolImpl::Task;
11-
AsynWorker(DBConnectionPoolImpl& pool, CountDownLatchSP latch, const SmartPointer<DBConnection>& conn,
11+
AsyncWorker(DBConnectionPoolImpl& pool, CountDownLatchSP latch, const SmartPointer<DBConnection>& conn,
1212
const SmartPointer<SynchronizedQueue<Task>>& queue, TaskStatusMgmt& status,
1313
const string& hostName, int port, const string& userId , const string& password)
1414
: pool_(pool), latch_(latch), conn_(conn), queue_(queue),taskStatus_(status),

core/include/BatchTableWriter.h

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,20 @@
1-
#ifndef BATCHTABLEWRITER_H_
2-
#define BATCHTABLEWRITER_H_
1+
#pragma once
2+
3+
/**
4+
* BatchTableWriter.h
5+
*
6+
* Deprecated
7+
*/
38

49
#include "Exports.h"
510
#include "Concurrent.h"
611
#include "Types.h"
712
#include "Exceptions.h"
813
#include "Constant.h"
9-
#include "Dictionary.h"
1014
#include "Table.h"
1115
#include <unordered_map>
1216
#include <string>
1317
#include <vector>
14-
#include <memory>
1518
#include <functional>
1619
#include <tuple>
1720
#include <cassert>
@@ -178,5 +181,4 @@ class EXPORT_DECL BatchTableWriter {
178181
};
179182

180183

181-
};
182-
#endif /* BATCHTABLEWRITER_H_ */
184+
} // namespace dolphindb

core/include/Compress.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
#pragma once
2-
#ifndef COMPRESSION_H_
3-
#define COMPRESSION_H_
42

53
#include "Types.h"
64
#include "SysIO.h"
@@ -63,5 +61,4 @@ class CompressDeltaofDelta : public CompressEncoderDecoder {
6361
static const int maxCompressedSize_;
6462
};
6563

66-
};//dolphindb
67-
#endif//COMPRESSION_H_
64+
} // namespace dolphindb

core/include/Concurrent.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ class EXPORT_DECL RWLockGuard{
213213
};
214214

215215
template<class T>
216-
class TryRWLockGuard{
216+
class EXPORT_DECL TryRWLockGuard{
217217
public:
218218
TryRWLockGuard(T* res, bool exclusive, bool acquireLock = true):res_(res), exclusive_(exclusive), locked_(false){
219219
if(acquireLock){
@@ -255,7 +255,7 @@ class EXPORT_DECL CountDownLatch{
255255

256256

257257
template<class T>
258-
class Future {
258+
class EXPORT_DECL Future {
259259
public:
260260
Future(): latch_(1) {}
261261
//Wait till the result is ready or the specified milliseconds timeout. Return whether the result is ready.
@@ -268,9 +268,9 @@ class Future {
268268
latch_.countDown();
269269
}
270270
//Get the value as promised. Blocked if the result is not ready.
271-
T get() {
271+
T get() {
272272
latch_.wait();
273-
return val_;
273+
return val_;
274274
}
275275
private:
276276
CountDownLatch latch_;
@@ -319,7 +319,7 @@ class EXPORT_DECL ConditionalNotifier {
319319
};
320320

321321
template<class T>
322-
class BoundedBlockingQueue{
322+
class EXPORT_DECL BoundedBlockingQueue{
323323
public:
324324
BoundedBlockingQueue(size_t maxItems) : capacity_(maxItems), size_(0), head_(0), tail_(0){
325325
buf_ = new T[maxItems];
@@ -368,7 +368,7 @@ class BoundedBlockingQueue{
368368
};
369369

370370
template<class T>
371-
class SynchronizedQueue{
371+
class EXPORT_DECL SynchronizedQueue{
372372
public:
373373
SynchronizedQueue(){}
374374
void push(const T& item){
@@ -646,7 +646,7 @@ class BlockingQueue {
646646
ConditionalVariable full_;
647647
ConditionalVariable empty_;
648648
ConditionalVariable batch_;
649-
649+
650650
};
651651

652652
};

core/include/DBConnectionPoolImpl.h

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,13 @@ class DBConnectionPoolImpl{
2727
bool pickleTableToList = false;
2828
bool disableDecimal = false;
2929
};
30-
31-
DBConnectionPoolImpl(const string& hostName, int port, int threadNum = 10, const string& userId = "", const string& password = "",
32-
bool loadBalance = true, bool highAvailability = true, bool compress = false, bool reConnect = false,
33-
PARSER_TYPE parser = PARSER_TYPE::PARSER_DOLPHINDB, PROTOCOL protocol = PROTOCOL_DDB, bool show_output = true, int sqlStd = 0, int tryReconnectNums = -1);
34-
30+
31+
DBConnectionPoolImpl(const string &hostName, int port, int threadNum = 10, const string &userId = "",
32+
const string &password = "", bool loadBalance = true, bool highAvailability = true,
33+
bool compress = false, bool reConnect = false,
34+
PARSER_TYPE parser = PARSER_TYPE::PARSER_DOLPHINDB, PROTOCOL protocol = PROTOCOL_DDB,
35+
bool show_output = true, int sqlStd = 0, int tryReconnectNums = -1, bool usePublicName = false);
36+
3537
~DBConnectionPoolImpl(){
3638
shutDown();
3739
Task emptyTask;
@@ -98,7 +100,7 @@ class DBConnectionPoolImpl{
98100
));
99101
taskStatus_.setResult(identity, TaskStatusMgmt::Result());
100102
}
101-
103+
102104
py::object getPyData(int identity){
103105
return taskStatus_.getPyData(identity);
104106
}
@@ -110,7 +112,7 @@ class DBConnectionPoolImpl{
110112
}
111113
return sessionIds_;
112114
}
113-
115+
114116
private:
115117
std::atomic<bool> shutDownFlag_;
116118
CountDownLatchSP latch_;

core/include/DolphinDB.h

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ namespace dolphindb {
5555

5656
class DBConnectionImpl;
5757
class BlockReader;
58-
class Domain;
58+
class Domain;
5959
class DBConnectionPoolImpl;
6060
class PartitionedTableAppender;
6161
class DBConnection;
@@ -85,8 +85,11 @@ class EXPORT_DECL DBConnection {
8585
* will be performed along with connecting. If one would send userId and password in encrypted mode,
8686
* please use the login function for authentication separately.
8787
*/
88-
bool connect(const string& hostName, int port, const string& userId = "", const string& password = "", const string& initialScript = "",
89-
bool highAvailability = false, const vector<string>& highAvailabilitySites = vector<string>(), int keepAliveTime=7200, bool reconnect = false, int tryReconnectNums = -1, int readTimeout = -1, int writeTimeout = -1);
88+
bool connect(const string &hostName, int port, const string &userId = "", const string &password = "",
89+
const string &initialScript = "", bool highAvailability = false,
90+
const vector<string> &highAvailabilitySites = vector<string>(), int keepAliveTime = 7200,
91+
bool reconnect = false, int tryReconnectNums = -1, int readTimeout = -1, int writeTimeout = -1,
92+
bool usePublicName = false);
9093

9194
/**
9295
* Log onto the DolphinDB server using the given userId and password. If the parameter enableEncryption
@@ -148,6 +151,11 @@ class EXPORT_DECL DBConnection {
148151
void setKeepAliveTime(int keepAliveTime);
149152
void setTimeout(int readTimeout, int writeTimeout);
150153
const string getSessionId() const;
154+
const string getHostName() const;
155+
const int getPort() const;
156+
const string getUserId() const;
157+
const string getPassword() const;
158+
bool isClosed() const;
151159
void setProtocol(PROTOCOL protocol);
152160
void setShowOutput(bool flag);
153161
std::shared_ptr<Logger> getMsgLogger();
@@ -227,17 +235,17 @@ class EXPORT_DECL DBConnectionPool{
227235
public:
228236
DBConnectionPool(const string& hostName, int port, int threadNum = 10, const string& userId = "", const string& password = "",
229237
bool loadBalance = false, bool highAvailability = false, bool compress = false, bool reConnect = false, PARSER_TYPE parser = PARSER_TYPE::PARSER_DOLPHINDB,
230-
PROTOCOL protocol = PROTOCOL_DDB, bool showOutput = true, int sqlStd = 0, int tryReconnectNums = -1);
238+
PROTOCOL protocol = PROTOCOL_DDB, bool showOutput = true, int sqlStd = 0, int tryReconnectNums = -1, bool usePublicName = false);
231239
virtual ~DBConnectionPool();
232-
240+
233241
void run(const string& script, int identity, int priority=4, int parallelism=64, int fetchSize=0, bool clearMemory = false);
234-
242+
235243
void run(const string& functionName, const vector<ConstantSP>& args, int identity, int priority=4, int parallelism=64, int fetchSize=0, bool clearMemory = false);
236-
244+
237245
bool isFinished(int identity);
238246

239247
ConstantSP getData(int identity);
240-
248+
241249
void shutDown();
242250

243251
bool isShutDown();
@@ -259,7 +267,7 @@ class EXPORT_DECL DBConnectionPool{
259267
private:
260268
// SmartPointer<DBConnectionPoolImpl> pool_;
261269
std::shared_ptr<DBConnectionPoolImpl> pool_;
262-
friend class PartitionedTableAppender;
270+
friend class PartitionedTableAppender;
263271

264272
};
265273

core/include/DolphinDBImp.h

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33
#include "ConstantImp.h"
44
#include <string>
55
#include "pybind11/pybind11.h"
6-
#include "DdbPythonUtil.h"
6+
#include "PytoDdbRowPool.h"
77

88
namespace py = pybind11;
99

1010
namespace dolphindb {
1111

12-
class DdbInit {
12+
class EXPORT_DECL DdbInit {
1313
public:
1414
DdbInit() {
1515
#ifdef WINDOWS
@@ -22,7 +22,7 @@ class DdbInit {
2222
}
2323
};
2424

25-
class DBConnectionImpl {
25+
class EXPORT_DECL DBConnectionImpl {
2626
public:
2727
DBConnectionImpl(bool sslEnable = false, bool asynTask = false, int keepAliveTime = 7200, bool compress = false, PARSER_TYPE parser = PARSER_TYPE::PARSER_DOLPHINDB, bool isReverseStreaming = false, int sqlStd = 0);
2828
~DBConnectionImpl();
@@ -34,8 +34,14 @@ class DBConnectionImpl {
3434
ConstantSP upload(vector<string>& names, vector<ConstantSP>& objs);
3535
void close();
3636
bool isConnected() { return isConnected_; }
37-
void getHostPort(string &host, int &port) { host = hostName_; port = port_; }
38-
37+
void getHostPort(string &host, int &port) {
38+
host = hostName_;
39+
port = port_;
40+
}
41+
void getUserPwd(string &user, string &pwd) {
42+
user = userId_;
43+
pwd = pwd_;
44+
}
3945
void setProtocol(PROTOCOL protocol) {
4046
protocol_ = protocol;
4147
if (protocol_ == PROTOCOL_ARROW) {

0 commit comments

Comments
 (0)