Extended SQLite functions for StackQL providing additional capabilities for JSON manipulation, regular expressions, and string splitting.
This repository contains a set of extended functions for SQLite designed to enhance the SQL capabilities in StackQL. These extensions provide additional JSON handling, regular expression matching, and string manipulation functionalities.
- JSON Functions: Includes
json_equal
to compare JSON objects and arrays. - Regular Expression Functions: Includes
regexp_like
,regexp_substr
, andregexp_replace
for pattern matching and manipulation. - String Splitting Function: Includes
split_part
to split strings based on a separator and retrieve specific parts.
- SQLite: Ensure SQLite is installed on your system.
- GCC: Required for compiling the extensions.
- Git: For cloning the repository.
Clone the repository and build the extensions:
git clone https://github.com/stackql/sqlite-ext-functions.git
cd sqlite-ext-functions
# Prepare the distribution directory
make prepare-dist
# Download the SQLite amalgamation source
make download-sqlite
# Compile the extensions for your platform
make compile-linux # For Linux
make compile-windows # For Windows
make compile-macos # For macOS
After compilation, you can load the extensions in your SQLite shell using:
.load '/path/to/dist/json_equal'
.load '/path/to/dist/regexp'
.load '/path/to/dist/split_part'
Alternatively, you can download the extensions from sqlpkg.
SELECT json_equal('{"key": "value"}', '{"key": "value"}'); -- Returns 1 (true)
SELECT json_equal('[1, 2, 3]', '[3, 2, 1]'); -- Returns 0 (false)
SELECT regexp_like('hello world', '^hello'); -- Returns 1 (true)
SELECT regexp_substr('hello world', 'w.*d'); -- Returns 'world'
SELECT regexp_replace('hello world', 'world', 'SQLite'); -- Returns 'hello SQLite'
SELECT split_part('one,two,three', ',', 2); -- Returns 'two'
SELECT split_part('one,two,three', ',', -1); -- Returns 'three'
Run tests to verify the functionality of the extensions:
make test-all
Clean the distribution directory and test logs:
make clean
This project is licensed under the MIT License - see the LICENSE file for details.
For questions or support, please reach out to StackQL Studios.