@@ -178,18 +178,17 @@ namespace xeus_sql
178178 return pub_data;
179179 }
180180
181- nl::json interpreter::execute_request_impl (int execution_counter,
182- const std::string& code,
183- bool /* silent*/ ,
184- bool /* store_history*/ ,
185- nl::json /* user_expressions*/ ,
186- bool /* allow_stdin*/ )
181+ void interpreter::execute_request_impl (send_reply_callback cb,
182+ int execution_counter,
183+ const std::string& code,
184+ xeus::execute_request_config /* config*/ ,
185+ nl::json user_expressions)
187186 {
188- auto ok = []() {
187+ auto ok = [& ]() {
189188 nl::json jresult;
190189 jresult[" status" ] = " ok" ;
191190 jresult[" payload" ] = nl::json::array ();
192- jresult[" user_expressions" ] = nl::json::object () ;
191+ jresult[" user_expressions" ] = user_expressions ;
193192 return jresult;
194193 };
195194
@@ -247,7 +246,8 @@ namespace xeus_sql
247246 std::move (chart),
248247 nl::json::object ());
249248
250- return ok ();
249+ cb (ok ());
250+ return ;
251251 } else if (xv_bindings::case_insentive_equals (" VEGA_LITE" , tokenized_input[0 ])) {
252252 if (tokenized_input.size () < 2 ) {
253253 throw std::runtime_error (" invalid input: " + code);
@@ -269,7 +269,8 @@ namespace xeus_sql
269269 auto bundle = nl::json::object ();
270270 bundle[" text/plain" ] = " SET " + spec_name + " success." ;
271271 publish_execution_result (execution_counter, std::move (bundle), nl::json::object ());
272- return ok ();
272+ cb (ok ());
273+ return ;
273274 }
274275 nl::json j;
275276 auto v = specs.find (tokenized_input[1 ]);
@@ -297,7 +298,8 @@ namespace xeus_sql
297298 auto bundle = nl::json::object ();
298299 bundle[" application/vnd.vegalite.v3+json" ] = j;
299300 publish_execution_result (execution_counter, std::move (bundle), nl::json::object ());
300- return ok ();
301+ cb (ok ());
302+ return ;
301303 }
302304
303305 /* Parses LOAD magic */
@@ -334,18 +336,18 @@ namespace xeus_sql
334336 }
335337 }
336338 } catch (const std::runtime_error &err) {
337- return handle_exception ((std::string)err.what ());
339+ cb ( handle_exception ((std::string)err.what () ));
338340#ifdef USE_POSTGRE_SQL
339341 } catch (const soci::postgresql_soci_error &err) {
340- return handle_exception ((std::string)err.what ());
342+ cb ( handle_exception ((std::string)err.what () ));
341343#endif
342344#ifdef USE_MYSQL
343345 } catch (const soci::mysql_soci_error &err) {
344- return handle_exception ((std::string)err.what ());
346+ cb ( handle_exception ((std::string)err.what () ));
345347#endif
346348#ifdef USE_SQLITE3
347349 } catch (const soci::sqlite3_soci_error &err) {
348- return handle_exception ((std::string)err.what ());
350+ cb ( handle_exception ((std::string)err.what () ));
349351#endif
350352 } catch (...) {
351353 // https: // stackoverflow.com/a/54242936/1203241
@@ -355,10 +357,11 @@ namespace xeus_sql
355357 std::rethrow_exception (curr_excp);
356358 }
357359 } catch (const std::exception &err) {
358- return handle_exception ((std::string)err.what ());
360+ cb ( handle_exception ((std::string)err.what () ));
359361 }
360362 }
361- return ok ();
363+ cb (ok ());
364+ return ;
362365 }
363366 nl::json interpreter::complete_request_impl (const std::string& raw_code,
364367 int cursor_pos)
0 commit comments