Closed robertbindar closed 3 years ago
I want to solve this issue, can assign it to me? 😃
Feel free to work on it, thanks a lot for the help! Let me know if you need help with this, feel free to ask questions 😄
mariadb_kernel/kernel.py is reponsible for execute the code when frontend run a cell, and the function handle this is do_execute(...)
,which would parse sql and magic command and execute it. The following code for execute sql statements.
# part of mariadb\_kernel/kernel.py
statements = parser.get_sql()
for s in statements:
result = self.mariadb_client.run_statement(s)
if self.mariadb_client.iserror():
self._send_message("stderr", self.mariadb\_client.error\_message())
continue
self._update_data(result)
display_content =Â {"data":Â {"text/html": str(result)}, "metadata":Â {}}
if not silent:
self.send_response(self.iopub_socket, "display_data", display_content)
when error occur, if self.mariadb_client.iserror():
will handle this. After that, if the result is empty we should display a pure text, show ''Query OK", make the user assure execution success
https://www.youtube.com/watch?v=-3GKlLQjwGA&ab_channel=%E6%B1%9F%E6%96%B0%E7%9F%A5
Fixed by @a97410985 in #21
For queries such as
create table t...
, the kernel either displays an error if there is a problem with the query, or displays nothing if the query is correct. That is because such queries don't return a result set, so the kernel has nothing to display. But this is confusing to users as pointed by @cvicentiu, so we should display aQuery OK
message to let the user know that the execution is done and successful.