File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11[package ]
22name = " springql-client-c"
3- version = " 0.3.0 "
3+ version = " 0.3.1 "
44
55authors = [" Sho Nakatani <lay.sakura@gmail.com>" ]
66license = " MIT OR Apache-2.0"
@@ -15,6 +15,6 @@ name = "springql_client"
1515cbindgen = " 0.21"
1616
1717[dependencies ]
18- springql-core = " 0.3"
18+ springql-core = " 0.3.1 "
1919
2020log = " 0.4"
Original file line number Diff line number Diff line change @@ -106,7 +106,9 @@ int main()
106106{
107107 SpringErrno ret ;
108108
109- SpringConfig * config = spring_config_default ();
109+ SpringConfig * config = spring_config_toml (
110+ "[memory]\n"
111+ "upper_limit_bytes = 1_000_000\n" );
110112 assert_not_null (config );
111113
112114 SpringPipeline * pipeline = spring_open (config );
Original file line number Diff line number Diff line change @@ -44,9 +44,24 @@ typedef void *SpringRow;
4444
4545/**
4646 * See: springql_core::api::spring_config_default
47+ *
48+ * Returned value is not modifiable (it is just a void pointer).
49+ * If you would like to change the default configuration, use `spring_config_toml()` instead.
4750 */
4851SpringConfig * spring_config_default (void );
4952
53+ /**
54+ * See: springql_core::api::spring_config_default
55+ *
56+ * Returned value is not modifiable (it is just a void pointer).
57+ * If you would like to change the default configuration, use `spring_config_toml()` instead.
58+ *
59+ * # Safety
60+ *
61+ * This function is unsafe because it uses raw pointer.
62+ */
63+ SpringConfig * spring_config_toml (const char * overwrite_config_toml );
64+
5065/**
5166 * # Returns
5267 *
Original file line number Diff line number Diff line change @@ -36,6 +36,9 @@ pub struct SpringPipeline(*mut c_void);
3636pub struct SpringRow ( * mut c_void ) ;
3737
3838/// See: springql_core::api::spring_config_default
39+ ///
40+ /// Returned value is not modifiable (it is just a void pointer).
41+ /// If you would like to change the default configuration, use `spring_config_toml()` instead.
3942#[ no_mangle]
4043pub extern "C" fn spring_config_default ( ) -> * mut SpringConfig {
4144 let config = springql_core:: spring_config_default ( ) ;
@@ -44,6 +47,25 @@ pub extern "C" fn spring_config_default() -> *mut SpringConfig {
4447 } ) ) )
4548}
4649
50+ /// See: springql_core::api::spring_config_default
51+ ///
52+ /// Returned value is not modifiable (it is just a void pointer).
53+ /// If you would like to change the default configuration, use `spring_config_toml()` instead.
54+ ///
55+ /// # Safety
56+ ///
57+ /// This function is unsafe because it uses raw pointer.
58+ #[ no_mangle]
59+ pub unsafe extern "C" fn spring_config_toml (
60+ overwrite_config_toml : * const c_char ,
61+ ) -> * mut SpringConfig {
62+ let s = { CStr :: from_ptr ( overwrite_config_toml) } ;
63+ let s = s. to_str ( ) . expect ( "failed to parse TOML string into UTF-8" ) ;
64+
65+ let config = springql_core:: spring_config_toml ( s) . expect ( "failed to parse TOML config" ) ;
66+ Box :: into_raw ( Box :: new ( SpringConfig ( mem:: transmute ( Box :: new ( config) ) ) ) )
67+ }
68+
4769/// # Returns
4870///
4971/// - `0`: if there are no recent errors.
You can’t perform that action at this time.
0 commit comments