chdb-io / chdb

chDB is an in-process OLAP SQL Engine 🚀 powered by ClickHouse
https://clickhouse.com/docs/en/chdb
Apache License 2.0
2.03k stars 72 forks source link

Add function: chdb() to return version #25

Closed lmangani closed 1 year ago

lmangani commented 1 year ago

This PR adds a simple chdb() function with no parameters that returns the current version of chDB as a string. The version number is defined using the CHDB_VERSION macro, which should be defined during the build process.

The function is conditionally compiled using an #if directive that checks whether the CHDB_VERSION_STRING macro derived from CHDB_VERSION is defined, to avoid building and registering the function if the version number is not available.

Changelog category (leave one):

Changelog entry (a user-readable short description of the changes that goes to CHANGELOG.md):

add function chdb() returning the current build version

lmangani commented 1 year ago

Tested w/ ClickHouse

Build Flag:

-DCHDB_VERSION="0.6.2"

Validation:

# docker run -ti --rm clickhouse:chdb "SELECT version()"
23.4.1.1
# docker run -ti --rm clickhouse:chdb "SELECT chdb()"
0.6.2