@@ -14,9 +14,27 @@ use sqlite_loadable::{
1414use zerocopy:: AsBytes ;
1515
1616const FLOAT32_VECTOR_SUBTYPE : u8 = 223 ;
17-
1817const CLIENT_OPTIONS_POINTER_NAME : & [ u8 ] = b"sqlite-rembed-client-options\0 " ;
1918
19+ pub fn rembed_version ( context : * mut sqlite3_context , _values : & [ * mut sqlite3_value ] ) -> Result < ( ) > {
20+ api:: result_text ( context, format ! ( "v{}" , env!( "CARGO_PKG_VERSION" ) ) ) ?;
21+ Ok ( ( ) )
22+ }
23+
24+ pub fn rembed_debug ( context : * mut sqlite3_context , _values : & [ * mut sqlite3_value ] ) -> Result < ( ) > {
25+ api:: result_text (
26+ context,
27+ format ! (
28+ "Version: v{}
29+ Source: {}
30+ " ,
31+ env!( "CARGO_PKG_VERSION" ) ,
32+ env!( "GIT_HASH" )
33+ ) ,
34+ ) ?;
35+ Ok ( ( ) )
36+ }
37+
2038pub fn rembed_client_options (
2139 context : * mut sqlite3_context ,
2240 values : & [ * mut sqlite3_value ] ,
@@ -123,6 +141,20 @@ pub fn sqlite3_rembed_init(db: *mut sqlite3) -> Result<()> {
123141
124142 let c = Rc :: new ( RefCell :: new ( HashMap :: new ( ) ) ) ;
125143
144+ define_scalar_function (
145+ db,
146+ "rembed_version" ,
147+ 0 ,
148+ rembed_version,
149+ FunctionFlags :: UTF8 | FunctionFlags :: DETERMINISTIC ,
150+ ) ?;
151+ define_scalar_function (
152+ db,
153+ "rembed_debug" ,
154+ 0 ,
155+ rembed_debug,
156+ FunctionFlags :: UTF8 | FunctionFlags :: DETERMINISTIC ,
157+ ) ?;
126158 define_scalar_function_with_aux ( db, "rembed" , 2 , rembed, flags, Rc :: clone ( & c) ) ?;
127159 define_scalar_function_with_aux ( db, "rembed" , 3 , rembed, flags, Rc :: clone ( & c) ) ?;
128160 define_scalar_function (
0 commit comments