duckdb 0.7.2-dev1625.0 → 0.7.2-dev1637.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
@@ -2,7 +2,7 @@
2
2
  "name": "duckdb",
3
3
  "main": "./lib/duckdb.js",
4
4
  "types": "./lib/duckdb.d.ts",
5
- "version": "0.7.2-dev1625.0",
5
+ "version": "0.7.2-dev1637.0",
6
6
  "description": "DuckDB node.js API",
7
7
  "gypfile": true,
8
8
  "dependencies": {
@@ -0,0 +1,21 @@
1
+ #include "duckdb/function/scalar/generic_functions.hpp"
2
+ #include <iostream>
3
+
4
+ namespace duckdb {
5
+
6
+ struct ErrorOperator {
7
+ template <class TA, class TR>
8
+ static inline TR Operation(const TA &input) {
9
+ throw Exception(input.GetString());
10
+ }
11
+ };
12
+
13
+ void ErrorFun::RegisterFunction(BuiltinFunctions &set) {
14
+ auto fun = ScalarFunction("error", {LogicalType::VARCHAR}, LogicalType::BOOLEAN,
15
+ ScalarFunction::UnaryFunction<string_t, bool, ErrorOperator>);
16
+ // Set the function with side effects to avoid the optimization.
17
+ fun.side_effects = FunctionSideEffects::HAS_SIDE_EFFECTS;
18
+ set.AddFunction(fun);
19
+ }
20
+
21
+ } // namespace duckdb
@@ -12,6 +12,7 @@ void BuiltinFunctions::RegisterGenericFunctions() {
12
12
  Register<ConstantOrNull>();
13
13
  Register<CurrentSettingFun>();
14
14
  Register<SystemFun>();
15
+ Register<ErrorFun>();
15
16
  }
16
17
 
17
18
  } // namespace duckdb
@@ -1,8 +1,8 @@
1
1
  #ifndef DUCKDB_VERSION
2
- #define DUCKDB_VERSION "0.7.2-dev1625"
2
+ #define DUCKDB_VERSION "0.7.2-dev1637"
3
3
  #endif
4
4
  #ifndef DUCKDB_SOURCE_ID
5
- #define DUCKDB_SOURCE_ID "92dc0c7c97"
5
+ #define DUCKDB_SOURCE_ID "bacede9532"
6
6
  #endif
7
7
  #include "duckdb/function/table/system_functions.hpp"
8
8
  #include "duckdb/main/database.hpp"
@@ -39,6 +39,10 @@ struct TypeOfFun {
39
39
  static void RegisterFunction(BuiltinFunctions &set);
40
40
  };
41
41
 
42
+ struct ErrorFun {
43
+ static void RegisterFunction(BuiltinFunctions &set);
44
+ };
45
+
42
46
  struct ConstantOrNull {
43
47
  static ScalarFunction GetFunction(const LogicalType &return_type);
44
48
  static unique_ptr<FunctionData> Bind(Value value);
@@ -6,6 +6,8 @@
6
6
 
7
7
  #include "src/function/scalar/generic/hash.cpp"
8
8
 
9
+ #include "src/function/scalar/generic/error.cpp"
10
+
9
11
  #include "src/function/scalar/generic/least.cpp"
10
12
 
11
13
  #include "src/function/scalar/generic/stats.cpp"