-
Notifications
You must be signed in to change notification settings - Fork 0
Initial Commit #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Exposes DuckDB's parser for building IDEs, editors, and query tools: - tokenize_sql: syntax highlighting with byte positions (uses DuckDB's internal tokenizer) - parse_statements/num_statements: multi-statement parsing - is_valid_sql/sql_error_message: syntax validation - parse_columns/parse_column_types/parse_type_info: result schema introspection - parse_parameters: prepared statement parameter extraction - parse_tables/parse_table_names: table reference extraction - parse_functions/parse_function_names: function call extraction - parse_where: WHERE clause analysis - sql_keywords/is_keyword: keyword utilities - sql_strip_comments: comment removal - sql_parse_json: full JSON AST access Also updates to DuckDB v1.4.2 and extension-ci-tools v1.4.2.
Uses DuckDB's json_tree() and json_extract_string() to parse json_serialize_plan() output instead of manual string manipulation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
src/parser.c
Outdated
| if (bind->query) { | ||
| free(bind->query); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Free duckdb_get_varchar results with duckdb_free
Strings retrieved via duckdb_get_varchar are freed with free (bind->query here and in other bind destructors), but the DuckDB C API specifies that the returned buffer must be destroyed with duckdb_free (see duckdb.h around the duckdb_get_varchar declaration). Using the wrong allocator is undefined and can lead to heap corruption when DuckDB is built with a different allocator. The same pattern appears in other bind destructors that obtain SQL via duckdb_get_varchar (parse_parameters, parse_columns, parse_type_info, parse_tables, tokenize_sql, parse_functions, parse_where), so all those free calls need to switch to duckdb_free.
Useful? React with 👍 / 👎.
- Add duckdb as vcpkg dependency in CI workflow - Update CMakeLists.txt to find duckdb via vcpkg or system paths - Fix test ordering issues with DISTINCT results
Downloads DuckDB source via FetchContent for C++ headers (Parser, SimplifiedToken) without building DuckDB itself. Links against vcpkg libduckdb in CI or system libduckdb locally.
Fallback mechanism for CI: if vcpkg/system libduckdb not found, download platform-specific pre-built library from DuckDB releases. Removes vcpkg dependency.
FetchContent is designed for source code, not pre-built binaries. Using file(DOWNLOAD) + cmake -E tar for more reliable extraction.
No description provided.