duckdb 0.4.1-dev1046.0 → 0.4.1-dev1053.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.4.1-dev1046.0",
4
+ "version": "0.4.1-dev1053.0",
5
5
  "description": "DuckDB node.js API",
6
6
  "gypfile": true,
7
7
  "dependencies": {
package/src/duckdb.cpp CHANGED
@@ -115515,6 +115515,15 @@ duckdb_type duckdb_param_type(duckdb_prepared_statement prepared_statement, idx_
115515
115515
  return ConvertCPPTypeToC(entry->second->return_type);
115516
115516
  }
115517
115517
 
115518
+ duckdb_state duckdb_clear_bindings(duckdb_prepared_statement prepared_statement) {
115519
+ auto wrapper = (PreparedStatementWrapper *)prepared_statement;
115520
+ if (!wrapper || !wrapper->statement || !wrapper->statement->success) {
115521
+ return DuckDBError;
115522
+ }
115523
+ wrapper->values.clear();
115524
+ return DuckDBSuccess;
115525
+ }
115526
+
115518
115527
  static duckdb_state duckdb_bind_value(duckdb_prepared_statement prepared_statement, idx_t param_idx, Value val) {
115519
115528
  auto wrapper = (PreparedStatementWrapper *)prepared_statement;
115520
115529
  if (!wrapper || !wrapper->statement || !wrapper->statement->success) {
@@ -165019,8 +165028,6 @@ unique_ptr<SQLStatement> Transformer::TransformStatementInternal(duckdb_libpgque
165019
165028
 
165020
165029
 
165021
165030
 
165022
-
165023
-
165024
165031
  #include <algorithm>
165025
165032
 
165026
165033
  namespace duckdb {
@@ -165362,16 +165369,45 @@ void BindContext::GenerateAllColumnExpressions(StarExpression &expr,
165362
165369
  }
165363
165370
  } else {
165364
165371
  // SELECT tbl.* case
165372
+ // SELECT struct.* case
165365
165373
  string error;
165366
165374
  auto binding = GetBinding(expr.relation_name, error);
165375
+ bool is_struct_ref = false;
165367
165376
  if (!binding) {
165368
- throw BinderException(error);
165369
- }
165370
- for (auto &column_name : binding->names) {
165371
- if (CheckExclusionList(expr, binding, column_name, new_select_list, excluded_columns)) {
165372
- continue;
165377
+ auto binding_name = GetMatchingBinding(expr.relation_name);
165378
+ if (binding_name.empty()) {
165379
+ throw BinderException(error);
165380
+ }
165381
+ binding = bindings[binding_name].get();
165382
+ is_struct_ref = true;
165383
+ }
165384
+
165385
+ if (is_struct_ref) {
165386
+ auto col_idx = binding->GetBindingIndex(expr.relation_name);
165387
+ auto col_type = binding->types[col_idx];
165388
+ if (col_type.id() != LogicalTypeId::STRUCT) {
165389
+ throw BinderException(StringUtil::Format(
165390
+ "Cannot extract field from expression \"%s\" because it is not a struct", expr.ToString()));
165391
+ }
165392
+ auto &struct_children = StructType::GetChildTypes(col_type);
165393
+ vector<string> column_names(3);
165394
+ column_names[0] = binding->alias;
165395
+ column_names[1] = expr.relation_name;
165396
+ for (auto &child : struct_children) {
165397
+ if (CheckExclusionList(expr, binding, child.first, new_select_list, excluded_columns)) {
165398
+ continue;
165399
+ }
165400
+ column_names[2] = child.first;
165401
+ new_select_list.push_back(make_unique<ColumnRefExpression>(column_names));
165402
+ }
165403
+ } else {
165404
+ for (auto &column_name : binding->names) {
165405
+ if (CheckExclusionList(expr, binding, column_name, new_select_list, excluded_columns)) {
165406
+ continue;
165407
+ }
165408
+
165409
+ new_select_list.push_back(make_unique<ColumnRefExpression>(column_name, binding->alias));
165373
165410
  }
165374
- new_select_list.push_back(make_unique<ColumnRefExpression>(column_name, binding->alias));
165375
165411
  }
165376
165412
  }
165377
165413
  for (auto &excluded : expr.exclude_list) {
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 "512009a16"
15
- #define DUCKDB_VERSION "v0.4.1-dev1046"
14
+ #define DUCKDB_SOURCE_ID "a931db94d"
15
+ #define DUCKDB_VERSION "v0.4.1-dev1053"
16
16
  //===----------------------------------------------------------------------===//
17
17
  // DuckDB
18
18
  //
@@ -16617,6 +16617,11 @@ Returns `DUCKDB_TYPE_INVALID` if the parameter index is out of range or the stat
16617
16617
  */
16618
16618
  DUCKDB_API duckdb_type duckdb_param_type(duckdb_prepared_statement prepared_statement, idx_t param_idx);
16619
16619
 
16620
+ /*!
16621
+ Clear the params bind to the prepared statement.
16622
+ */
16623
+ DUCKDB_API duckdb_state duckdb_clear_bindings(duckdb_prepared_statement prepared_statement);
16624
+
16620
16625
  /*!
16621
16626
  Binds a bool value to the prepared statement at the specified index.
16622
16627
  */