@@ -14,9 +14,27 @@ use sqlite_loadable::{
14
14
use zerocopy:: AsBytes ;
15
15
16
16
const FLOAT32_VECTOR_SUBTYPE : u8 = 223 ;
17
-
18
17
const CLIENT_OPTIONS_POINTER_NAME : & [ u8 ] = b"sqlite-rembed-client-options\0 " ;
19
18
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
+
20
38
pub fn rembed_client_options (
21
39
context : * mut sqlite3_context ,
22
40
values : & [ * mut sqlite3_value ] ,
@@ -123,6 +141,20 @@ pub fn sqlite3_rembed_init(db: *mut sqlite3) -> Result<()> {
123
141
124
142
let c = Rc :: new ( RefCell :: new ( HashMap :: new ( ) ) ) ;
125
143
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
+ ) ?;
126
158
define_scalar_function_with_aux ( db, "rembed" , 2 , rembed, flags, Rc :: clone ( & c) ) ?;
127
159
define_scalar_function_with_aux ( db, "rembed" , 3 , rembed, flags, Rc :: clone ( & c) ) ?;
128
160
define_scalar_function (
0 commit comments