duckdb 0.3.5-dev368.0 → 0.3.5-dev372.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/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 "14b9456ba"
15
- #define DUCKDB_VERSION "v0.3.5-dev368"
14
+ #define DUCKDB_SOURCE_ID "fb12cb330"
15
+ #define DUCKDB_VERSION "v0.3.5-dev372"
16
16
  //===----------------------------------------------------------------------===//
17
17
  // DuckDB
18
18
  //
@@ -9719,7 +9719,32 @@ enum class StatementType : uint8_t {
9719
9719
  };
9720
9720
 
9721
9721
  string StatementTypeToString(StatementType type);
9722
- bool StatementTypeReturnChanges(StatementType type);
9722
+
9723
+ enum class StatementReturnType : uint8_t {
9724
+ QUERY_RESULT, // the statement returns a query result (e.g. for display to the user)
9725
+ CHANGED_ROWS, // the statement returns a single row containing the number of changed rows (e.g. an insert stmt)
9726
+ NOTHING // the statement returns nothing
9727
+ };
9728
+
9729
+ //! A struct containing various properties of a SQL statement
9730
+ struct StatementProperties {
9731
+ StatementProperties()
9732
+ : read_only(true), requires_valid_transaction(true), allow_stream_result(false), bound_all_parameters(true),
9733
+ return_type(StatementReturnType::QUERY_RESULT) {
9734
+ }
9735
+
9736
+ //! Whether or not the statement is a read-only statement, or whether it can result in changes to the database
9737
+ bool read_only;
9738
+ //! Whether or not the statement requires a valid transaction. Almost all statements require this, with the
9739
+ //! exception of
9740
+ bool requires_valid_transaction;
9741
+ //! Whether or not the result can be streamed to the client
9742
+ bool allow_stream_result;
9743
+ //! Whether or not all parameters have successfully had their types determined
9744
+ bool bound_all_parameters;
9745
+ //! What type of data the statement returns
9746
+ StatementReturnType return_type;
9747
+ };
9723
9748
 
9724
9749
  } // namespace duckdb
9725
9750
 
@@ -9734,11 +9759,9 @@ enum class QueryResultType : uint8_t { MATERIALIZED_RESULT, STREAM_RESULT, PENDI
9734
9759
 
9735
9760
  class BaseQueryResult {
9736
9761
  public:
9737
- //! Creates a successful empty query result
9738
- DUCKDB_API BaseQueryResult(QueryResultType type, StatementType statement_type);
9739
9762
  //! Creates a successful query result with the specified names and types
9740
- DUCKDB_API BaseQueryResult(QueryResultType type, StatementType statement_type, vector<LogicalType> types,
9741
- vector<string> names);
9763
+ DUCKDB_API BaseQueryResult(QueryResultType type, StatementType statement_type, StatementProperties properties,
9764
+ vector<LogicalType> types, vector<string> names);
9742
9765
  //! Creates an unsuccessful query result with error condition
9743
9766
  DUCKDB_API BaseQueryResult(QueryResultType type, string error);
9744
9767
  DUCKDB_API virtual ~BaseQueryResult();
@@ -9747,6 +9770,8 @@ public:
9747
9770
  QueryResultType type;
9748
9771
  //! The type of the statement that created this result
9749
9772
  StatementType statement_type;
9773
+ //! Properties of the statement
9774
+ StatementProperties properties;
9750
9775
  //! The SQL types of the result
9751
9776
  vector<LogicalType> types;
9752
9777
  //! The names of the result
@@ -9767,11 +9792,9 @@ public:
9767
9792
  //! incrementally fetch data from the database.
9768
9793
  class QueryResult : public BaseQueryResult {
9769
9794
  public:
9770
- //! Creates a successful empty query result
9771
- DUCKDB_API QueryResult(QueryResultType type, StatementType statement_type);
9772
9795
  //! Creates a successful query result with the specified names and types
9773
- DUCKDB_API QueryResult(QueryResultType type, StatementType statement_type, vector<LogicalType> types,
9774
- vector<string> names);
9796
+ DUCKDB_API QueryResult(QueryResultType type, StatementType statement_type, StatementProperties properties,
9797
+ vector<LogicalType> types, vector<string> names);
9775
9798
  //! Creates an unsuccessful query result with error condition
9776
9799
  DUCKDB_API QueryResult(QueryResultType type, string error);
9777
9800
  DUCKDB_API virtual ~QueryResult() override;
@@ -9887,10 +9910,9 @@ namespace duckdb {
9887
9910
 
9888
9911
  class MaterializedQueryResult : public QueryResult {
9889
9912
  public:
9890
- //! Creates an empty successful query result
9891
- DUCKDB_API explicit MaterializedQueryResult(StatementType statement_type);
9892
9913
  //! Creates a successful query result with the specified names and types
9893
- DUCKDB_API MaterializedQueryResult(StatementType statement_type, vector<LogicalType> types, vector<string> names);
9914
+ DUCKDB_API MaterializedQueryResult(StatementType statement_type, StatementProperties properties,
9915
+ vector<LogicalType> types, vector<string> names);
9894
9916
  //! Creates an unsuccessful query result with error condition
9895
9917
  DUCKDB_API explicit MaterializedQueryResult(string error);
9896
9918
 
@@ -10954,6 +10976,8 @@ public:
10954
10976
  idx_t ColumnCount();
10955
10977
  //! Returns the statement type of the underlying prepared statement object
10956
10978
  StatementType GetStatementType();
10979
+ //! Returns the underlying statement properties
10980
+ StatementProperties GetStatementProperties();
10957
10981
  //! Returns the result SQL types of the prepared statement
10958
10982
  const vector<LogicalType> &GetTypes();
10959
10983
  //! Returns the result names of the prepared statement
@@ -13403,7 +13427,6 @@ private:
13403
13427
 
13404
13428
 
13405
13429
 
13406
- //#include "duckdb/catalog/catalog_entry/table_macro_catalog_entry.hpp"
13407
13430
 
13408
13431
  namespace duckdb {
13409
13432
  class BoundResultModifier;
@@ -13467,12 +13490,8 @@ public:
13467
13490
  vector<BoundParameterExpression *> *parameters;
13468
13491
  //! The types of the prepared statement parameters, if any
13469
13492
  vector<LogicalType> *parameter_types;
13470
- //! Whether or not the bound statement is read-only
13471
- bool read_only;
13472
- //! Whether or not the statement requires a valid transaction to run
13473
- bool requires_valid_transaction;
13474
- //! Whether or not the statement can be streamed to the client
13475
- bool allow_stream_result;
13493
+ //! Statement properties
13494
+ StatementProperties properties;
13476
13495
  //! The alias for the currently processing subquery, if it exists
13477
13496
  string alias;
13478
13497
  //! Macro parameter bindings (if any)
@@ -17028,8 +17047,8 @@ class StreamQueryResult : public QueryResult {
17028
17047
  public:
17029
17048
  //! Create a successful StreamQueryResult. StreamQueryResults should always be successful initially (it makes no
17030
17049
  //! sense to stream an error).
17031
- DUCKDB_API StreamQueryResult(StatementType statement_type, shared_ptr<ClientContext> context,
17032
- vector<LogicalType> types, vector<string> names);
17050
+ DUCKDB_API StreamQueryResult(StatementType statement_type, StatementProperties properties,
17051
+ shared_ptr<ClientContext> context, vector<LogicalType> types, vector<string> names);
17033
17052
  DUCKDB_API ~StreamQueryResult() override;
17034
17053
 
17035
17054
  public: