kostafey / ejc-sql

Emacs SQL client uses Clojure JDBC.
279 stars 29 forks source link

C-h t ejc-describe-table #121

Closed holtzermann17 closed 4 years ago

holtzermann17 commented 4 years ago

The readme says that C-h t describes a table, but it actually opens the Emacs tutorial.

Furthermore M-x ejc-describe-table RET gives an error when used with a default slot-filler. For example:

Describe table (default quote_requests): RET

Error: ERROR: syntax error at end of input
  Position: 73

However, it works when I type out the name of the table:

Describe table (default quote_requests): quote_requestsRET

kostafey commented 4 years ago

The readme says that C-h t describes a table, but it actually opens the Emacs tutorial.

It's a part of ejc-sql-mode minor mode keymap. So, you should run ejc-connect first for sql-mode buffer or open SQL code snippet edit buffer (C-c ' or M-x org-edit-special) for org-mode buffers.

Furthermore M-x ejc-describe-table RET gives an error when used with a default slot-filler.

Please, provide the full error trace by enabling M-x toggle-debug-on-error.

holtzermann17 commented 4 years ago

Regarding the first issue: I was running within an Org Mode buffer, so that's why the binding wasn't there. Thanks for explaining!


Regarding the second one: I tried just now, it's not an Emacs error -- rather, contents printed into the *ejc-sql-output* buffer after I press C-c C-c. Is there another place to look for logs/traces?

holtzermann17 commented 4 years ago

I ran edebug-defun on ejc-describe-table and saw that I get different inputs in the (interactive ...) form when I press RET vs when I type in the table name.

S-exp in question:

(ejc-get-prompt-symbol-under-point "Describe table")

Accept default:

Result: (nil "js--tmp-location")

vs type out the table name:

Result: (nil "used_asset_transactions")

kostafey commented 4 years ago

@holtzermann17 Please, try the latest commit.

holtzermann17 commented 4 years ago

Version: ejc-sql-20200204.1415

I now see a different error:

used_asset_transactions<- M-x ejc-describe-table RET

Error: ERROR: syntax error at or near "-"
  Position: 40

Edebug inspection of the interactive form (ejc-get-prompt-symbol-under-point "Describe table") now gives me:

Result: (nil "shr-image-fetched")

Typing out the table name still works.

obarray seems not to be initialized properly

https://github.com/kostafey/ejc-sql/commit/f3de9a059ee611b0938e323625b0794e3b405318#r37173624

kostafey commented 4 years ago

@holtzermann17 Please, try the latest one.

kostafey commented 4 years ago

@holtzermann17, can I consider the issue closed?

holtzermann17 commented 4 years ago

At the moment I am seeing another error.

Wrong number of arguments: #[nil "\306 \210\307\310\311\312\313\211\314!!\310\307\211!#\210\315\316\317!\207" [truncate-lines major-mode mode-name ejc-result-table-impl view-read-only font-lock-defaults kill-all-local-variables t ejc-result-mode "SQL-Result" case orgtbl-mode 1 (ejc-result-font-lock-keywords) run-hooks ejc-result-mode-hook] 6 nil nil], 1
  in wrapped Clojure->Elisp function: ejc_sql.connect$complete_query@3a389163
  elisp: (ejc-complete-query nil :start-time nil :status nil :display-result t :mode 'ejc-result-mode :connection-name "PO1" :db '((:classpath . "/home/joe/.m2/repository/postgresql/postgresql/9.3-1102.jdbc41/postgresql-9.3-1102.jdbc41.jar")(:password . "exchange_development")(:user . "exchange_service")(:host . "localhost")(:dbname . "openmarkets_development")(:dbtype . "postgresql")) :goto-symbol nil)

It seems to be linked to this form inside ejc-show-last-result.

      (when mode
        (ejc-update-modes-ring mode)
        (funcall mode))
kostafey commented 4 years ago

@holtzermann17, Unfortunately, I can't reproduce your error. Please, check whether you can evaluate this code snippet after run M-x toggle-debug-on-error:

(ejc-complete-query
 nil
 :start-time nil
 :status nil
 :display-result t
 :mode 'ejc-result-mode
 :connection-name "PO1"
 :db '((:classpath . "/home/joe/.m2/repository/postgresql/postgresql/9.3-1102.jdbc41/postgresql-9.3-1102.jdbc41.jar")
       (:password . "secret")
       (:user . "exchange_service")
       (:host . "localhost")
       (:dbname . "openmarkets_development")
       (:dbtype . "postgresql"))
 :goto-symbol nil)

Furthermore, please provide the contents of ejc-result-mode-hook variable. Also, you can try to rebuild packages, probably this can help: https://github.com/kostafey/ejc-sql/issues/117#issuecomment-581959519

holtzermann17 commented 4 years ago

I reinstalled and it is working now. Thanks!