duckdb 0.3.2-dev121.0 → 0.3.2-dev149.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.2-dev121.0",
4
+ "version": "0.3.2-dev149.0",
5
5
  "description": "DuckDB node.js API",
6
6
  "gypfile": true,
7
7
  "dependencies": {
package/src/duckdb.cpp CHANGED
@@ -20607,6 +20607,36 @@ private:
20607
20607
  #include <sys/types.h>
20608
20608
  #include <unistd.h>
20609
20609
  #else
20610
+ //===----------------------------------------------------------------------===//
20611
+ // DuckDB
20612
+ //
20613
+ // duckdb/common/windows_util.hpp
20614
+ //
20615
+ //
20616
+ //===----------------------------------------------------------------------===//
20617
+
20618
+
20619
+
20620
+
20621
+
20622
+
20623
+
20624
+
20625
+
20626
+ namespace duckdb {
20627
+
20628
+ #ifdef DUCKDB_WINDOWS
20629
+ class WindowsUtil {
20630
+ public:
20631
+ //! Windows helper functions
20632
+ static std::wstring UTF8ToUnicode(const char *input);
20633
+ static string UnicodeToUTF8(LPCWSTR input);
20634
+ static string UTF8ToMBCS(const char *input, bool use_ansi = false);
20635
+ };
20636
+ #endif
20637
+
20638
+ } // namespace duckdb
20639
+
20610
20640
  #include <string>
20611
20641
 
20612
20642
  #ifdef __MINGW32__
@@ -21077,8 +21107,9 @@ unique_ptr<FileHandle> LocalFileSystem::OpenFile(const string &path, uint8_t fla
21077
21107
  if (flags & FileFlags::FILE_FLAGS_DIRECT_IO) {
21078
21108
  flags_and_attributes |= FILE_FLAG_NO_BUFFERING;
21079
21109
  }
21080
- HANDLE hFile =
21081
- CreateFileA(path.c_str(), desired_access, share_mode, NULL, creation_disposition, flags_and_attributes, NULL);
21110
+ auto unicode_path = WindowsUtil::UTF8ToUnicode(path.c_str());
21111
+ HANDLE hFile = CreateFileW(unicode_path.c_str(), desired_access, share_mode, NULL, creation_disposition,
21112
+ flags_and_attributes, NULL);
21082
21113
  if (hFile == INVALID_HANDLE_VALUE) {
21083
21114
  auto error = GetLastErrorAsString();
21084
21115
  throw IOException("Cannot open file \"%s\": %s", path.c_str(), error);
@@ -21228,13 +21259,18 @@ void LocalFileSystem::Truncate(FileHandle &handle, int64_t new_size) {
21228
21259
  }
21229
21260
  }
21230
21261
 
21262
+ static DWORD WindowsGetFileAttributes(const string &filename) {
21263
+ auto unicode_path = WindowsUtil::UTF8ToUnicode(filename.c_str());
21264
+ return GetFileAttributesW(unicode_path.c_str());
21265
+ }
21266
+
21231
21267
  bool LocalFileSystem::DirectoryExists(const string &directory) {
21232
- DWORD attrs = GetFileAttributesA(directory.c_str());
21268
+ DWORD attrs = WindowsGetFileAttributes(directory);
21233
21269
  return (attrs != INVALID_FILE_ATTRIBUTES && (attrs & FILE_ATTRIBUTE_DIRECTORY));
21234
21270
  }
21235
21271
 
21236
21272
  bool LocalFileSystem::FileExists(const string &filename) {
21237
- DWORD attrs = GetFileAttributesA(filename.c_str());
21273
+ DWORD attrs = WindowsGetFileAttributes(filename);
21238
21274
  return (attrs != INVALID_FILE_ATTRIBUTES && !(attrs & FILE_ATTRIBUTE_DIRECTORY));
21239
21275
  }
21240
21276
 
@@ -21242,79 +21278,58 @@ void LocalFileSystem::CreateDirectory(const string &directory) {
21242
21278
  if (DirectoryExists(directory)) {
21243
21279
  return;
21244
21280
  }
21245
- if (directory.empty() || !CreateDirectoryA(directory.c_str(), NULL) || !DirectoryExists(directory)) {
21281
+ auto unicode_path = WindowsUtil::UTF8ToUnicode(directory.c_str());
21282
+ if (directory.empty() || !CreateDirectoryW(unicode_path.c_str(), NULL) || !DirectoryExists(directory)) {
21246
21283
  throw IOException("Could not create directory!");
21247
21284
  }
21248
21285
  }
21249
21286
 
21250
- static void delete_dir_special_snowflake_windows(FileSystem &fs, string directory) {
21251
- if (directory.size() + 3 > MAX_PATH) {
21252
- throw IOException("Pathname too long");
21253
- }
21254
- // create search pattern
21255
- TCHAR szDir[MAX_PATH];
21256
- snprintf(szDir, MAX_PATH, "%s\\*", directory.c_str());
21257
-
21258
- WIN32_FIND_DATA ffd;
21259
- HANDLE hFind = FindFirstFile(szDir, &ffd);
21260
- if (hFind == INVALID_HANDLE_VALUE) {
21261
- return;
21262
- }
21263
-
21264
- do {
21265
- if (string(ffd.cFileName) == "." || string(ffd.cFileName) == "..") {
21266
- continue;
21267
- }
21268
- if (ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
21269
- // recurse to zap directory contents
21270
- delete_dir_special_snowflake_windows(fs, fs.JoinPath(directory, ffd.cFileName));
21287
+ static void DeleteDirectoryRecursive(FileSystem &fs, string directory) {
21288
+ fs.ListFiles(directory, [&](const string &fname, bool is_directory) {
21289
+ if (is_directory) {
21290
+ DeleteDirectoryRecursive(fs, fs.JoinPath(directory, fname));
21271
21291
  } else {
21272
- if (strlen(ffd.cFileName) + directory.size() + 1 > MAX_PATH) {
21273
- throw IOException("Pathname too long");
21274
- }
21275
- // create search pattern
21276
- TCHAR del_path[MAX_PATH];
21277
- snprintf(del_path, MAX_PATH, "%s\\%s", directory.c_str(), ffd.cFileName);
21278
- if (!DeleteFileA(del_path)) {
21279
- throw IOException("Failed to delete directory entry");
21280
- }
21292
+ fs.RemoveFile(fs.JoinPath(directory, fname));
21281
21293
  }
21282
- } while (FindNextFile(hFind, &ffd) != 0);
21283
-
21284
- DWORD dwError = GetLastError();
21285
- if (dwError != ERROR_NO_MORE_FILES) {
21286
- throw IOException("Something went wrong");
21287
- }
21288
- FindClose(hFind);
21289
-
21290
- if (!RemoveDirectoryA(directory.c_str())) {
21294
+ });
21295
+ auto unicode_path = WindowsUtil::UTF8ToUnicode(directory.c_str());
21296
+ if (!RemoveDirectoryW(unicode_path.c_str())) {
21291
21297
  throw IOException("Failed to delete directory");
21292
21298
  }
21293
21299
  }
21294
21300
 
21295
21301
  void LocalFileSystem::RemoveDirectory(const string &directory) {
21296
- delete_dir_special_snowflake_windows(*this, directory.c_str());
21302
+ if (FileExists(directory)) {
21303
+ throw IOException("Attempting to delete directory \"%s\", but it is a file and not a directory!", directory);
21304
+ }
21305
+ if (!DirectoryExists(directory)) {
21306
+ return;
21307
+ }
21308
+ DeleteDirectoryRecursive(*this, directory.c_str());
21297
21309
  }
21298
21310
 
21299
21311
  void LocalFileSystem::RemoveFile(const string &filename) {
21300
- DeleteFileA(filename.c_str());
21312
+ auto unicode_path = WindowsUtil::UTF8ToUnicode(filename.c_str());
21313
+ DeleteFileW(unicode_path.c_str());
21301
21314
  }
21302
21315
 
21303
21316
  bool LocalFileSystem::ListFiles(const string &directory, const std::function<void(string, bool)> &callback) {
21304
21317
  string search_dir = JoinPath(directory, "*");
21305
21318
 
21306
- WIN32_FIND_DATA ffd;
21307
- HANDLE hFind = FindFirstFile(search_dir.c_str(), &ffd);
21319
+ auto unicode_path = WindowsUtil::UTF8ToUnicode(search_dir.c_str());
21320
+
21321
+ WIN32_FIND_DATAW ffd;
21322
+ HANDLE hFind = FindFirstFileW(unicode_path.c_str(), &ffd);
21308
21323
  if (hFind == INVALID_HANDLE_VALUE) {
21309
21324
  return false;
21310
21325
  }
21311
21326
  do {
21312
- string cFileName = string(ffd.cFileName);
21327
+ string cFileName = WindowsUtil::UnicodeToUTF8(ffd.cFileName);
21313
21328
  if (cFileName == "." || cFileName == "..") {
21314
21329
  continue;
21315
21330
  }
21316
21331
  callback(cFileName, ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY);
21317
- } while (FindNextFile(hFind, &ffd) != 0);
21332
+ } while (FindNextFileW(hFind, &ffd) != 0);
21318
21333
 
21319
21334
  DWORD dwError = GetLastError();
21320
21335
  if (dwError != ERROR_NO_MORE_FILES) {
@@ -21334,7 +21349,9 @@ void LocalFileSystem::FileSync(FileHandle &handle) {
21334
21349
  }
21335
21350
 
21336
21351
  void LocalFileSystem::MoveFile(const string &source, const string &target) {
21337
- if (!MoveFileA(source.c_str(), target.c_str())) {
21352
+ auto source_unicode = WindowsUtil::UTF8ToUnicode(source.c_str());
21353
+ auto target_unicode = WindowsUtil::UTF8ToUnicode(target.c_str());
21354
+ if (!MoveFileW(source_unicode.c_str(), target_unicode.c_str())) {
21338
21355
  throw IOException("Could not move file");
21339
21356
  }
21340
21357
  }
@@ -21345,7 +21362,7 @@ FileType LocalFileSystem::GetFileType(FileHandle &handle) {
21345
21362
  if (strncmp(path.c_str(), PIPE_PREFIX, strlen(PIPE_PREFIX)) == 0) {
21346
21363
  return FileType::FILE_TYPE_FIFO;
21347
21364
  }
21348
- DWORD attrs = GetFileAttributesA(path.c_str());
21365
+ DWORD attrs = WindowsGetFileAttributes(path.c_str());
21349
21366
  if (attrs != INVALID_FILE_ATTRIBUTES) {
21350
21367
  if (attrs & FILE_ATTRIBUTE_DIRECTORY) {
21351
21368
  return FileType::FILE_TYPE_DIR;
@@ -26256,13 +26273,29 @@ unique_ptr<FileHandle> PipeFileSystem::OpenPipe(unique_ptr<FileHandle> handle) {
26256
26273
  } // namespace duckdb
26257
26274
 
26258
26275
 
26276
+
26277
+
26259
26278
  #include <stdio.h>
26260
26279
 
26280
+ #ifndef DUCKDB_DISABLE_PRINT
26281
+ #ifdef DUCKDB_WINDOWS
26282
+ #include <io.h>
26283
+ #endif
26284
+ #endif
26285
+
26261
26286
  namespace duckdb {
26262
26287
 
26263
26288
  // LCOV_EXCL_START
26264
26289
  void Printer::Print(const string &str) {
26265
26290
  #ifndef DUCKDB_DISABLE_PRINT
26291
+ #ifdef DUCKDB_WINDOWS
26292
+ if (IsTerminal()) {
26293
+ // print utf8 to terminal
26294
+ auto unicode = WindowsUtil::UTF8ToMBCS(str.c_str());
26295
+ fprintf(stderr, "%s\n", unicode.c_str());
26296
+ return;
26297
+ }
26298
+ #endif
26266
26299
  fprintf(stderr, "%s\n", str.c_str());
26267
26300
  #endif
26268
26301
  }
@@ -26283,6 +26316,17 @@ void Printer::FinishProgressBarPrint(const char *pbstr, int pbwidth) {
26283
26316
  fflush(stdout);
26284
26317
  #endif
26285
26318
  }
26319
+
26320
+ bool Printer::IsTerminal() {
26321
+ #ifndef DUCKDB_DISABLE_PRINT
26322
+ #ifdef DUCKDB_WINDOWS
26323
+ return GetFileType(stderr) == FILE_TYPE_CHAR;
26324
+ #else
26325
+ throw InternalException("IsTerminal is only implemented for Windows");
26326
+ #endif
26327
+ #endif
26328
+ return false;
26329
+ }
26286
26330
  // LCOV_EXCL_STOP
26287
26331
 
26288
26332
  } // namespace duckdb
@@ -32284,19 +32328,19 @@ struct TreeRendererConfig {
32284
32328
  bool detailed = false;
32285
32329
 
32286
32330
  #ifndef DUCKDB_ASCII_TREE_RENDERER
32287
- const char *LTCORNER = "┌";
32288
- const char *RTCORNER = "┐";
32289
- const char *LDCORNER = "└";
32290
- const char *RDCORNER = "┘";
32291
-
32292
- const char *MIDDLE = "┼";
32293
- const char *TMIDDLE = "┬";
32294
- const char *LMIDDLE = "├";
32295
- const char *RMIDDLE = "┤";
32296
- const char *DMIDDLE = "┴";
32297
-
32298
- const char *VERTICAL = "│";
32299
- const char *HORIZONTAL = "─";
32331
+ const char *LTCORNER = "\342\224\214"; // "┌";
32332
+ const char *RTCORNER = "\342\224\220"; // "┐";
32333
+ const char *LDCORNER = "\342\224\224"; // "└";
32334
+ const char *RDCORNER = "\342\224\230"; // "┘";
32335
+
32336
+ const char *MIDDLE = "\342\224\274"; // "┼";
32337
+ const char *TMIDDLE = "\342\224\254"; // "┬";
32338
+ const char *LMIDDLE = "\342\224\234"; // "├";
32339
+ const char *RMIDDLE = "\342\224\244"; // "┤";
32340
+ const char *DMIDDLE = "\342\224\264"; // "┴";
32341
+
32342
+ const char *VERTICAL = "\342\224\202"; // "│";
32343
+ const char *HORIZONTAL = "\342\224\200"; // "─";
32300
32344
  #else
32301
32345
  // ASCII version
32302
32346
  const char *LTCORNER = "<";
@@ -43059,6 +43103,7 @@ struct EnumTypeInfo : public ExtraTypeInfo {
43059
43103
  TypeCatalogEntry *catalog_entry = nullptr;
43060
43104
 
43061
43105
  public:
43106
+ // Equalities are only used in enums with different catalog entries
43062
43107
  bool Equals(ExtraTypeInfo *other_p) override {
43063
43108
  if (!other_p) {
43064
43109
  return false;
@@ -43067,9 +43112,12 @@ public:
43067
43112
  return false;
43068
43113
  }
43069
43114
  auto &other = (EnumTypeInfo &)*other_p;
43070
- return other.enum_name == enum_name && other.values_insert_order == values_insert_order;
43115
+ // We must check if all elements are equal
43116
+ if (other.values_insert_order == values_insert_order) {
43117
+ return true;
43118
+ }
43119
+ return false;
43071
43120
  }
43072
-
43073
43121
  void Serialize(Serializer &serializer) const override {
43074
43122
  serializer.Write<uint32_t>(values_insert_order.size());
43075
43123
  serializer.WriteString(enum_name);
@@ -47350,6 +47398,59 @@ unique_ptr<FileHandle> VirtualFileSystem::OpenFile(const string &path, uint8_t f
47350
47398
  } // namespace duckdb
47351
47399
 
47352
47400
 
47401
+ namespace duckdb {
47402
+
47403
+ #ifdef DUCKDB_WINDOWS
47404
+
47405
+ std::wstring WindowsUtil::UTF8ToUnicode(const char *input) {
47406
+ idx_t result_size;
47407
+
47408
+ result_size = MultiByteToWideChar(CP_UTF8, 0, input, -1, nullptr, 0);
47409
+ if (result_size == 0) {
47410
+ throw IOException("Failure in MultiByteToWideChar");
47411
+ }
47412
+ auto buffer = unique_ptr<wchar_t[]>(new wchar_t[result_size]);
47413
+ result_size = MultiByteToWideChar(CP_UTF8, 0, input, -1, buffer.get(), result_size);
47414
+ if (result_size == 0) {
47415
+ throw IOException("Failure in MultiByteToWideChar");
47416
+ }
47417
+ return std::wstring(buffer.get(), result_size);
47418
+ }
47419
+
47420
+ static string WideCharToMultiByteWrapper(LPCWSTR input, uint32_t code_page) {
47421
+ idx_t result_size;
47422
+
47423
+ result_size = WideCharToMultiByte(code_page, 0, input, -1, 0, 0, 0, 0);
47424
+ if (result_size == 0) {
47425
+ throw IOException("Failure in WideCharToMultiByte");
47426
+ }
47427
+ auto buffer = unique_ptr<char[]>(new char[result_size]);
47428
+ result_size = WideCharToMultiByte(code_page, 0, input, -1, buffer.get(), result_size, 0, 0);
47429
+ if (result_size == 0) {
47430
+ throw IOException("Failure in WideCharToMultiByte");
47431
+ }
47432
+ return string(buffer.get(), result_size - 1);
47433
+ }
47434
+
47435
+ string WindowsUtil::UnicodeToUTF8(LPCWSTR input) {
47436
+ return WideCharToMultiByteWrapper(input, CP_UTF8);
47437
+ }
47438
+
47439
+ static string WindowsUnicodeToMBCS(LPCWSTR unicode_text, int use_ansi) {
47440
+ uint32_t code_page = use_ansi ? CP_ACP : CP_OEMCP;
47441
+ return WideCharToMultiByteWrapper(unicode_text, code_page);
47442
+ }
47443
+
47444
+ string WindowsUtil::UTF8ToMBCS(const char *input, bool use_ansi) {
47445
+ auto unicode = WindowsUtil::UTF8ToUnicode(input);
47446
+ return WindowsUnicodeToMBCS(unicode.c_str(), use_ansi);
47447
+ }
47448
+
47449
+ #endif
47450
+
47451
+ } // namespace duckdb
47452
+
47453
+
47353
47454
  //===----------------------------------------------------------------------===//
47354
47455
  // DuckDB
47355
47456
  //
@@ -68241,6 +68342,8 @@ public:
68241
68342
  UNORDERED,
68242
68343
  //! Only some entries have to be matched, the order of the matches does not matter
68243
68344
  SOME,
68345
+ //! Not initialized
68346
+ INVALID
68244
68347
  };
68245
68348
 
68246
68349
  /* The double {{}} in the intializer for excluded_entries is intentional, workaround for bug in gcc-4.9 */
@@ -68500,7 +68603,8 @@ public:
68500
68603
 
68501
68604
  class ComparisonExpressionMatcher : public ExpressionMatcher {
68502
68605
  public:
68503
- ComparisonExpressionMatcher() : ExpressionMatcher(ExpressionClass::BOUND_COMPARISON) {
68606
+ ComparisonExpressionMatcher()
68607
+ : ExpressionMatcher(ExpressionClass::BOUND_COMPARISON), policy(SetMatcher::Policy::INVALID) {
68504
68608
  }
68505
68609
  //! The matchers for the child expressions
68506
68610
  vector<unique_ptr<ExpressionMatcher>> matchers;
@@ -68534,7 +68638,8 @@ public:
68534
68638
 
68535
68639
  class ConjunctionExpressionMatcher : public ExpressionMatcher {
68536
68640
  public:
68537
- ConjunctionExpressionMatcher() : ExpressionMatcher(ExpressionClass::BOUND_CONJUNCTION) {
68641
+ ConjunctionExpressionMatcher()
68642
+ : ExpressionMatcher(ExpressionClass::BOUND_CONJUNCTION), policy(SetMatcher::Policy::INVALID) {
68538
68643
  }
68539
68644
  //! The matchers for the child expressions
68540
68645
  vector<unique_ptr<ExpressionMatcher>> matchers;
@@ -92550,6 +92655,7 @@ public:
92550
92655
  } // namespace duckdb
92551
92656
 
92552
92657
 
92658
+
92553
92659
  namespace duckdb {
92554
92660
 
92555
92661
  struct StructExtractBindData : public FunctionData {
@@ -92613,12 +92719,12 @@ static unique_ptr<FunctionData> StructExtractBind(ClientContext &context, Scalar
92613
92719
 
92614
92720
  if (key_child->return_type.id() != LogicalTypeId::VARCHAR ||
92615
92721
  key_child->return_type.id() != LogicalTypeId::VARCHAR || !key_child->IsFoldable()) {
92616
- throw Exception("Key name for struct_extract needs to be a constant string");
92722
+ throw BinderException("Key name for struct_extract needs to be a constant string");
92617
92723
  }
92618
92724
  Value key_val = ExpressionExecutor::EvaluateScalar(*key_child.get());
92619
92725
  D_ASSERT(key_val.type().id() == LogicalTypeId::VARCHAR);
92620
92726
  if (key_val.is_null || key_val.str_value.length() < 1) {
92621
- throw Exception("Key name for struct_extract needs to be neither NULL nor empty");
92727
+ throw BinderException("Key name for struct_extract needs to be neither NULL nor empty");
92622
92728
  }
92623
92729
  string key = StringUtil::Lower(key_val.str_value);
92624
92730
 
@@ -92628,15 +92734,23 @@ static unique_ptr<FunctionData> StructExtractBind(ClientContext &context, Scalar
92628
92734
 
92629
92735
  for (size_t i = 0; i < struct_children.size(); i++) {
92630
92736
  auto &child = struct_children[i];
92631
- if (child.first == key) {
92737
+ if (StringUtil::Lower(child.first) == key) {
92632
92738
  found_key = true;
92633
92739
  key_index = i;
92634
92740
  return_type = child.second;
92635
92741
  break;
92636
92742
  }
92637
92743
  }
92744
+
92638
92745
  if (!found_key) {
92639
- throw Exception("Could not find key in struct");
92746
+ vector<string> candidates;
92747
+ candidates.reserve(struct_children.size());
92748
+ for (auto &struct_child : struct_children) {
92749
+ candidates.push_back(struct_child.first);
92750
+ }
92751
+ auto closest_settings = StringUtil::TopNLevenshtein(candidates, key);
92752
+ auto message = StringUtil::CandidatesMessage(closest_settings, "Candidate Entries");
92753
+ throw BinderException("Could not find key \"%s\" in struct\n%s", key, message);
92640
92754
  }
92641
92755
 
92642
92756
  bound_function.return_type = return_type;
@@ -92703,7 +92817,7 @@ static void StructPackFunction(DataChunk &args, ExpressionState &state, Vector &
92703
92817
 
92704
92818
  static unique_ptr<FunctionData> StructPackBind(ClientContext &context, ScalarFunction &bound_function,
92705
92819
  vector<unique_ptr<Expression>> &arguments) {
92706
- unordered_set<string> name_collision_set;
92820
+ case_insensitive_set_t name_collision_set;
92707
92821
 
92708
92822
  // collect names and deconflict, construct return type
92709
92823
  if (arguments.empty()) {
@@ -145903,7 +146017,7 @@ vector<ColumnBinding> LogicalOperator::MapBindings(const vector<ColumnBinding> &
145903
146017
  }
145904
146018
  }
145905
146019
 
145906
- string LogicalOperator::ToString(idx_t depth) const {
146020
+ string LogicalOperator::ToString() const {
145907
146021
  TreeRenderer renderer;
145908
146022
  return renderer.ToString(*this);
145909
146023
  }
@@ -242572,7 +242686,7 @@ namespace duckdb_libpgquery {
242572
242686
  #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
242573
242687
 
242574
242688
  /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
242575
- * if you want the limit (max/min) macros for int types.
242689
+ * if you want the limit (max/min) macros for int types.
242576
242690
  */
242577
242691
  #ifndef __STDC_LIMIT_MACROS
242578
242692
  #define __STDC_LIMIT_MACROS 1
@@ -242590,7 +242704,7 @@ typedef uint64_t flex_uint64_t;
242590
242704
  typedef signed char flex_int8_t;
242591
242705
  typedef short int flex_int16_t;
242592
242706
  typedef int flex_int32_t;
242593
- typedef unsigned char flex_uint8_t;
242707
+ typedef unsigned char flex_uint8_t;
242594
242708
  typedef unsigned short int flex_uint16_t;
242595
242709
  typedef unsigned int flex_uint32_t;
242596
242710
 
@@ -242714,10 +242828,10 @@ typedef size_t yy_size_t;
242714
242828
  #define EOB_ACT_CONTINUE_SCAN 0
242715
242829
  #define EOB_ACT_END_OF_FILE 1
242716
242830
  #define EOB_ACT_LAST_MATCH 2
242717
-
242831
+
242718
242832
  #define YY_LESS_LINENO(n)
242719
242833
  #define YY_LINENO_REWIND_TO(ptr)
242720
-
242834
+
242721
242835
  /* Return all but the first "n" matched characters back to the input stream. */
242722
242836
  #define yyless(n) \
242723
242837
  do \
@@ -243627,9 +243741,9 @@ static int yy_init_globals ( yyscan_t yyscanner );
243627
243741
  /* This must go here because YYSTYPE and YYLTYPE are included
243628
243742
  * from bison output in section 1.*/
243629
243743
  # define yylval yyg->yylval_r
243630
-
243744
+
243631
243745
  # define yylloc yyg->yylloc_r
243632
-
243746
+
243633
243747
  int yylex_init (yyscan_t* scanner);
243634
243748
 
243635
243749
  int yylex_init_extra ( YY_EXTRA_TYPE user_defined, yyscan_t* scanner);
@@ -243672,9 +243786,9 @@ YYSTYPE * yyget_lval ( yyscan_t yyscanner );
243672
243786
  void yyset_lval ( YYSTYPE * yylval_param , yyscan_t yyscanner );
243673
243787
 
243674
243788
  YYLTYPE *yyget_lloc ( yyscan_t yyscanner );
243675
-
243789
+
243676
243790
  void yyset_lloc ( YYLTYPE * yylloc_param , yyscan_t yyscanner );
243677
-
243791
+
243678
243792
  /* Macros after this point can all be overridden by user definitions in
243679
243793
  * section 1.
243680
243794
  */
@@ -243688,7 +243802,7 @@ extern int yywrap ( yyscan_t yyscanner );
243688
243802
  #endif
243689
243803
 
243690
243804
  #ifndef YY_NO_UNPUT
243691
-
243805
+
243692
243806
  #endif
243693
243807
 
243694
243808
  #ifndef yytext_ptr
@@ -245386,7 +245500,7 @@ static void yy_load_buffer_state (yyscan_t yyscanner)
245386
245500
  YY_BUFFER_STATE yy_create_buffer (FILE * file, int size , yyscan_t yyscanner)
245387
245501
  {
245388
245502
  YY_BUFFER_STATE b;
245389
-
245503
+
245390
245504
  b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) , yyscanner );
245391
245505
  if ( ! b )
245392
245506
  YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
@@ -245452,7 +245566,7 @@ static void yy_load_buffer_state (yyscan_t yyscanner)
245452
245566
  }
245453
245567
 
245454
245568
  b->yy_is_interactive = 0;
245455
-
245569
+
245456
245570
  errno = oerrno;
245457
245571
  }
245458
245572
 
@@ -245594,7 +245708,7 @@ static void yyensure_buffer_stack (yyscan_t yyscanner)
245594
245708
  YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size , yyscan_t yyscanner)
245595
245709
  {
245596
245710
  YY_BUFFER_STATE b;
245597
-
245711
+
245598
245712
  if ( size < 2 ||
245599
245713
  base[size-2] != YY_END_OF_BUFFER_CHAR ||
245600
245714
  base[size-1] != YY_END_OF_BUFFER_CHAR )
@@ -245630,7 +245744,7 @@ YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size , yyscan_t yyscann
245630
245744
  */
245631
245745
  YY_BUFFER_STATE yy_scan_string (const char * yystr , yyscan_t yyscanner)
245632
245746
  {
245633
-
245747
+
245634
245748
  return yy_scan_bytes( yystr, (int) strlen(yystr) , yyscanner);
245635
245749
  }
245636
245750
 
@@ -245647,7 +245761,7 @@ YY_BUFFER_STATE yy_scan_bytes (const char * yybytes, yy_size_t _yybytes_len ,
245647
245761
  char *buf;
245648
245762
  yy_size_t n;
245649
245763
  yy_size_t i;
245650
-
245764
+
245651
245765
  /* Get memory for full buffer, including space for trailing EOB's. */
245652
245766
  n = (yy_size_t) (_yybytes_len + 2);
245653
245767
  buf = (char *) yyalloc( n , yyscanner );
@@ -245679,7 +245793,6 @@ static void yynoreturn yy_fatal_error (const char* msg , yyscan_t yyscanner)
245679
245793
  {
245680
245794
  struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
245681
245795
  (void)yyg;
245682
- fprintf( stderr, "%s\n", msg );
245683
245796
  throw std::runtime_error(msg); // YY_EXIT_FAILURE );
245684
245797
  }
245685
245798
 
@@ -245720,7 +245833,7 @@ int yyget_lineno (yyscan_t yyscanner)
245720
245833
 
245721
245834
  if (! YY_CURRENT_BUFFER)
245722
245835
  return 0;
245723
-
245836
+
245724
245837
  return yylineno;
245725
245838
  }
245726
245839
 
@@ -245733,7 +245846,7 @@ int yyget_column (yyscan_t yyscanner)
245733
245846
 
245734
245847
  if (! YY_CURRENT_BUFFER)
245735
245848
  return 0;
245736
-
245849
+
245737
245850
  return yycolumn;
245738
245851
  }
245739
245852
 
@@ -245795,7 +245908,7 @@ void yyset_lineno (int _line_number , yyscan_t yyscanner)
245795
245908
  /* lineno is only valid if an input buffer exists. */
245796
245909
  if (! YY_CURRENT_BUFFER )
245797
245910
  YY_FATAL_ERROR( "yyset_lineno called with no buffer" );
245798
-
245911
+
245799
245912
  yylineno = _line_number;
245800
245913
  }
245801
245914
 
@@ -245810,7 +245923,7 @@ void yyset_column (int _column_no , yyscan_t yyscanner)
245810
245923
  /* column is only valid if an input buffer exists. */
245811
245924
  if (! YY_CURRENT_BUFFER )
245812
245925
  YY_FATAL_ERROR( "yyset_column called with no buffer" );
245813
-
245926
+
245814
245927
  yycolumn = _column_no;
245815
245928
  }
245816
245929
 
@@ -245863,13 +245976,13 @@ YYLTYPE *yyget_lloc (yyscan_t yyscanner)
245863
245976
  struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
245864
245977
  return yylloc;
245865
245978
  }
245866
-
245979
+
245867
245980
  void yyset_lloc (YYLTYPE * yylloc_param , yyscan_t yyscanner)
245868
245981
  {
245869
245982
  struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
245870
245983
  yylloc = yylloc_param;
245871
245984
  }
245872
-
245985
+
245873
245986
  /* User-visible API */
245874
245987
 
245875
245988
  /* yylex_init is special because it creates the scanner itself, so it is
@@ -245949,13 +246062,8 @@ static int yy_init_globals (yyscan_t yyscanner)
245949
246062
  yyg->yy_start_stack = NULL;
245950
246063
 
245951
246064
  /* Defined in main.c */
245952
- #ifdef YY_STDINIT
245953
- yyin = stdin;
245954
- yyout = stdout;
245955
- #else
245956
246065
  yyin = NULL;
245957
246066
  yyout = NULL;
245958
- #endif
245959
246067
 
245960
246068
  /* For future reference: Set errno on error, since we are called by
245961
246069
  * yylex_init()
package/src/duckdb.hpp CHANGED
@@ -10,8 +10,8 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
10
10
 
11
11
  #pragma once
12
12
  #define DUCKDB_AMALGAMATION 1
13
- #define DUCKDB_SOURCE_ID "3c9727ac2"
14
- #define DUCKDB_VERSION "0.3.2-dev121"
13
+ #define DUCKDB_SOURCE_ID "76dcfb8ac"
14
+ #define DUCKDB_VERSION "0.3.2-dev149"
15
15
  //===----------------------------------------------------------------------===//
16
16
  // DuckDB
17
17
  //
@@ -198,6 +198,12 @@ enum class ProfilerPrintFormat : uint8_t { NONE, QUERY_TREE, JSON, QUERY_TREE_OP
198
198
  #define suint64_t int64_t
199
199
  #endif
200
200
 
201
+ #if defined(_WIN32) || defined(_WIN64)
202
+ #define DUCKDB_WINDOWS
203
+ #elif defined(__unix__) || defined(__unix) || (defined(__APPLE__) && defined(__MACH__))
204
+ #define DUCKDB_POSIX
205
+ #endif
206
+
201
207
  namespace duckdb {
202
208
  #if !defined(_MSC_VER) && (__cplusplus < 201402L)
203
209
  template <typename T, typename... Args>
@@ -7983,7 +7989,7 @@ public:
7983
7989
 
7984
7990
  virtual string GetName() const;
7985
7991
  virtual string ParamsToString() const;
7986
- virtual string ToString(idx_t depth = 0) const;
7992
+ virtual string ToString() const;
7987
7993
  void Print();
7988
7994
  //! Debug method: verify that the integrity of expressions & child nodes are maintained
7989
7995
  virtual void Verify();
@@ -9470,6 +9476,8 @@ public:
9470
9476
  static void PrintProgress(int percentage, const char *pbstr, int pbwidth);
9471
9477
  //! Prints an empty line when progress bar is done
9472
9478
  static void FinishProgressBarPrint(const char *pbstr, int pbwidth);
9479
+ //! Whether or not we are printing to a terminal
9480
+ static bool IsTerminal();
9473
9481
  };
9474
9482
  } // namespace duckdb
9475
9483