duckdb 0.3.3-dev891.0 → 0.3.3-dev901.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "duckdb",
3
3
  "main": "./lib/duckdb.js",
4
- "version": "0.3.3-dev891.0",
4
+ "version": "0.3.3-dev901.0",
5
5
  "description": "DuckDB node.js API",
6
6
  "gypfile": true,
7
7
  "dependencies": {
package/src/duckdb.cpp CHANGED
@@ -104974,21 +104974,26 @@ public:
104974
104974
 
104975
104975
  void AddConnection(ClientContext &context) {
104976
104976
  lock_guard<mutex> lock(connections_lock);
104977
- connections.push_back(weak_ptr<ClientContext>(context.shared_from_this()));
104977
+ connections.insert(make_pair(&context, weak_ptr<ClientContext>(context.shared_from_this())));
104978
+ }
104979
+
104980
+ void RemoveConnection(ClientContext &context) {
104981
+ lock_guard<mutex> lock(connections_lock);
104982
+ connections.erase(&context);
104978
104983
  }
104979
104984
 
104980
104985
  vector<shared_ptr<ClientContext>> GetConnectionList() {
104981
104986
  vector<shared_ptr<ClientContext>> result;
104982
- for (size_t i = 0; i < connections.size(); i++) {
104983
- auto connection = connections[i].lock();
104987
+ for (auto &it : connections) {
104988
+ auto connection = it.second.lock();
104984
104989
  if (!connection) {
104985
- connections.erase(connections.begin() + i);
104986
- i--;
104990
+ connections.erase(it.first);
104987
104991
  continue;
104988
104992
  } else {
104989
104993
  result.push_back(move(connection));
104990
104994
  }
104991
104995
  }
104996
+
104992
104997
  return result;
104993
104998
  }
104994
104999
 
@@ -104997,7 +105002,7 @@ public:
104997
105002
 
104998
105003
  public:
104999
105004
  mutex connections_lock;
105000
- vector<weak_ptr<ClientContext>> connections;
105005
+ unordered_map<ClientContext *, weak_ptr<ClientContext>> connections;
105001
105006
  };
105002
105007
 
105003
105008
  } // namespace duckdb
@@ -105016,6 +105021,10 @@ Connection::Connection(DatabaseInstance &database) : context(make_shared<ClientC
105016
105021
  Connection::Connection(DuckDB &database) : Connection(*database.instance) {
105017
105022
  }
105018
105023
 
105024
+ Connection::~Connection() {
105025
+ ConnectionManager::Get(*context->db).RemoveConnection(*context);
105026
+ }
105027
+
105019
105028
  string Connection::GetProfilingInformation(ProfilerPrintFormat format) {
105020
105029
  auto &profiler = QueryProfiler::Get(*context);
105021
105030
  if (format == ProfilerPrintFormat::JSON) {
package/src/duckdb.hpp CHANGED
@@ -11,8 +11,8 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
11
11
  #pragma once
12
12
  #define DUCKDB_AMALGAMATION 1
13
13
  #define DUCKDB_AMALGAMATION_EXTENDED 1
14
- #define DUCKDB_SOURCE_ID "96666e411"
15
- #define DUCKDB_VERSION "v0.3.3-dev891"
14
+ #define DUCKDB_SOURCE_ID "9c88ae129"
15
+ #define DUCKDB_VERSION "v0.3.3-dev901"
16
16
  //===----------------------------------------------------------------------===//
17
17
  // DuckDB
18
18
  //
@@ -16647,6 +16647,7 @@ class Connection {
16647
16647
  public:
16648
16648
  DUCKDB_API explicit Connection(DuckDB &database);
16649
16649
  DUCKDB_API explicit Connection(DatabaseInstance &database);
16650
+ DUCKDB_API ~Connection();
16650
16651
 
16651
16652
  shared_ptr<ClientContext> context;
16652
16653
  warning_callback warning_cb;
@@ -16828,6 +16829,7 @@ private:
16828
16829
  };
16829
16830
 
16830
16831
  } // namespace duckdb
16832
+
16831
16833
  //===----------------------------------------------------------------------===//
16832
16834
  // DuckDB
16833
16835
  //