You can now extend ValentinaDB using C, C++, Python, or JavaScript.
You can now create custom functions and procedures for ValentinaDB that work with Valentina Database ADK and Valentina Server.
Extensions allow developers to extend the Valentina SQL language with new functions and procedures, integrate external code, and customize the database engine for specific application needs. Extensions work like built-in features, expanding functionality (functions, procedures, engines, data sources) without modification of the ValentinaDB kernel.
ValentinaDB extensions are new in Valentina 16. Valentina Server supports using DuckDB and SQLite extensions as well as ValentinaDB extensions.
Types of Extensions Supported by ValentinaDB
The ValentinaDB engine supports the following types of extensions:
Scalar Functions | Aggregate Functions | Procedures |
Extensions that implement scalar functions, which can be used in SQL queries, such as sin(x).
|
Extensions that implement aggregate functions, which can be used in SQL queries, such as SUM(x).
|
Extensions that implement procedures, which can be used in SQL queries and return results as a cursor.
|
Specifics about how to build extensions along with several examples for each language are available on the Paradigma Software Wiki.
Creating Extensions
ValentinaDB can load the following formats of extensions:
- C-compiled shared libraries (DLLs)
- C++-compiled shared libraries (DLLs)
- JavaScript text-based extensions (.js)
- Python text-based extensions (.py)
JavaScript or Python scripts can be loaded directly, providing new functions or procedures without compilation.
Load Extensions Using SQL
Using SQL, you can load an extension from the specified path.
Relative paths are resolved relative to predefined locations. This starts with the vextensions directory, then a user-level directory. You can optionally provide a second parameter.
load_extension(absOrRelativePath[,entryFuncName]
See the documentation for more information
Show Extensions Using SQL
The SHOW VEXTENSION statement produces a list of ValentinaDB Extensions, specifying GLOBAL or database specific.
SHOW VEXTENSION [{FROM|OF} db_name]