Repository navigation
Split the built-in functions by family, and give int64 a header of its own - #1558
Merged
Merged
Conversation
The built-in functions are grouped as SQLite documents them, each header holding the legacy C++17 name tags and factories as well as the C++20 definitions and their public names, like window.h: - core.h: the core scalar functions (lang_corefunc) - datetime.h: the date and time functions (lang_datefunc) - aggregate.h: the aggregate functions (lang_aggfunc), including COUNT(*) and the percentile functions; MAX() and MIN() take their scalar forms along, as one definition covers both in C++20 builds - math.h: the mathematical functions (lang_mathfunc) - json.h: the JSON functions (json1), including their aggregates The overloaded arithmetic and bitwise operators move to operators.h, beside the nodes they build, as the comparison operators are beside theirs in conditions.h. core.h no longer includes conditions.h and operators.h. storage.h includes aggregate.h for its aggregate shortcuts, and core.h still for int64. The legacy unixepoch() returns sqlite_int64 as its C++20 definition does, so datetime.h does not depend on core.h for int64. Co-Authored-By: Claude Opus 5.5
The aliases of SQLite's 64-bit integer types lived in core.h for lack of a better home, and were reachable only through the order in which headers happened to be included: storage_base.h, column_result.h and carray.h use int64 in non-dependent contexts without including anything that declares it. functional/sqlite3_types.h holds the types of the SQLite C API that sqlite_orm republishes, next to sqlite3_config.h, and every header using int64 now includes it. Co-Authored-By: Claude Opus 5.5
sqlite3_config.h and sqlite3_types.h are sqlite_orm's interface to sqlite3.h - the configuration derived from it and the types republished from it - and move to a folder of their own. sqlite3_types.h exports public symbols, hence it is listed in the amalgamation manifest and the non-amalgamated include instead of relying on other headers to include it. Co-Authored-By: Claude Opus 5.5
With int64 in a header of its own, the headers that spelled it sqlite_int64 for want of the alias include sqlite3_types.h and use int64: the built-in functions LAST_INSERT_ROWID(), SQLITE_OFFSET() and UNIXEPOCH(), the column factories and the integer field predicates. Co-Authored-By: Claude Opus 5.5
fnc12
approved these changes
Oct 4, 2026
…-functions Co-Authored-By: Claude Opus 5.5
functional/ holds C++ language and standard library plumbing that knows nothing about SQLite. sqlite3_config.h and sqlite3_types.h instead sit on the boundary to the SQLite C library - the configuration derived from <sqlite3.h> and the types republished from it as public symbols - so their folder becomes a layer of its own beside functional/. functional/config.h, the headers using int64, the amalgamation manifest, the non-amalgamated include and a comment in tests/CMakeLists.txt follow the move; AGENTS.md describes the folder. The amalgamated code is unchanged apart from its include comments. Co-Authored-By: Claude Opus 5.5
fnc12
approved these changes
Oct 4, 2026
trueqbit
added a commit
that referenced
this pull request
Oct 4, 2026
…er-ast dev (#1558) moved the overloaded arithmetic and bitwise operators from core.h into operators.h, as this branch did when moving operators.h to ast/operators.h; both sides appended the same block, which is kept once. Resolved: - ast/operators.h keeps this branch's includes, relative to ast/. - core_functions.h, from which this branch took the operators, is gone on dev, replaced by builtin/functions/. Co-Authored-By: Claude Opus 5.5
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Split
builtin/functions/core.hby function familyThe built-in functions in
dev/builtin/functions/are grouped the way SQLite documents them:core.habs(),coalesce(),length(),lower(),replace(),substr(), ...datetime.hdate(),time(),datetime(),julianday(),strftime(),unixepoch(),timediff()aggregate.hcount(*),count(),total(),sum(),avg(),max(),min(),group_concat(),string_agg(),median(),percentile*()math.hacos()...trunc()json.hjson_group_array()andjson_group_object()window.hwindow.h. The C++17 branch holds the legacy name tags and factories; the C++20 branch holds the""_builtindefinitions and their public names.math.handjson.hguard their whole contents withSQLITE_ENABLE_MATH_FUNCTIONSandSQLITE_ORM_JSON_SUPPORTED.aggregate.htogether with their scalar forms MAX(X,Y,...) and MIN(X,Y,...), since one C++20 definition covers both. Their doc comments now say so.functions.h.- + * / % ~ << >> & |) move fromcore.htooperators.h, next to the nodes they build. The comparison operators already sit next to theirs inconditions.h. With that,core.hno longer needs to includeconditions.horoperators.h.storage.hincludesaggregate.hfor its aggregate shortcuts.int64anduint64insqlite3/sqlite3_types.hint64/uint64aliases lived incore.h, and several headers saw them only because of include order:storage_base.h,column_result.handcarray.huseint64outside templates without including anything that declares it.sqlite3/sqlite3_types.h, and every header that usesint64now includes it. The header is not included fromconfig.h. Because it exports public symbols, it is listed in the amalgamation manifest and in the non-amalgamated include instead.sqlite_int64for want of it useint64throughout: the built-in functions LAST_INSERT_ROWID(), SQLITE_OFFSET() and UNIXEPOCH(), the column factories, and the integer field predicates.sqlite_int64now appears only whereint64is defined.The SQLite C API headers in a top-level
sqlite3/sqlite3_config.hmoves fromfunctional/tosqlite3/, next tosqlite3_types.h. The folder holds sqlite_orm's interface to the SQLite C library: the configuration derived from<sqlite3.h>and the types republished from it.functional/rather than inside it, becausefunctional/is C++ language and standard library plumbing that knows nothing about SQLite.functional/config.hstill pulls insqlite3_config.hfirst, so the configuration stays universally available.AGENTS.mdand the vocabulary-layer doc describe the new layout.Overlap with #1550-#1553
#1552 (
refactor/operators-under-ast) also moves the arithmetic operators beside their nodes, in its case intoast/operators.h. #1550 changes the includes of what wascore_functions.h. Merging this PR before them will cause conflicts in that stack: the operator overloads end up in whichever header holds the operator nodes, and the include changes apply to the split headers.Test plan
The changes only move code. Existing tests cover the moved functions and operators:
tests/builtin_functions_tests/(core, date/time and math functions),tests/json.cpp,tests/window_function_tests.cpptests/statement_serializer_tests/core_functions.cpp,aggregate_functions.cpp,arithmetic_operators.cpp,bitwise_operators.cpptests/static_tests/core_function_return_types.cpp,aggregate_function_return_types.cpp,builtin_function_static_tests.cpp,arithmetic_operators_result_type.cpp,operators_adl.cpptests/operators/arithmetic_operators.cpp,bitwise_operators.cppint64🤖 Generated with Claude Code