diff --git a/enode-lisp/enode-mysql.el b/enode-lisp/enode-mysql.el index efdb673..709e74d 100644 --- a/enode-lisp/enode-mysql.el +++ b/enode-lisp/enode-mysql.el @@ -17,12 +17,38 @@ ;; along with ENODE. If not, see . (defun enode-mysql-start-sql-engine () - "A function to set up the SQL engine for connecting to a mysql or MariaDB database." - (call-interactively 'sql-mysql) - ;; Set the prompt regexps properly - (save-excursion - (set-buffer "*SQL*") - (setq comint-prompt-regexp "^[0-9A-Za-z]\\{3\\}> ") - (setq sql-prompt-regexp "^[0-9A-Za-z]\\{3\\}> ") + "A function to set up the SQL engine for connecting to a mysql +or MariaDB database. + +Until further notice, this function does nothing. It just returns +T." + t + ) + + +(defun enode-mysql-connect (conn-user conn-pass conn-database conn-hostname &optional conn-port) + "A function to create to a mysql/mariadb database" + + (if sql-buffer + (if (not (get-buffer-process sql-buffer)) + (progn + (kill-buffer sql-buffer) + (enode-mysql-new-session conn-user conn-pass conn-database conn-hostname conn-port) + ) + (enode-mysql-reconnect conn-user conn-pass conn-database conn-hostname conn-port) + ) + (enode-mysql-new-session conn-user conn-pass conn-database conn-hostname conn-port) + ) + (setq enode-current-connection connection-description) + (setq enode-connected t) + ) + +(defun enode-mysql-new-session (conn-user conn-pass conn-database conn-hostname conn-port) + "A function to start a brand-new mysql/mariadb session" + (let ((sql-user conn-user) + (sql-database conn-database) + (sql-server conn-hostname) + ) + (sql-mysql) ) ) diff --git a/enode-lisp/enode.el b/enode-lisp/enode.el index 8a8636c..0fe06f4 100755 --- a/enode-lisp/enode.el +++ b/enode-lisp/enode.el @@ -898,13 +898,20 @@ of projects that are available." (read-from-minibuffer (format "Database for %s: " conn-desc))) ;; Get the prompt that will be used (setq conn-prompt - (read-from-minibuffer (format "SQLPROMPT for %s: " conn-desc))) + (read-from-minibuffer (format "PROMPT for %s: " conn-desc))) + (setq conn-hostname (if (eq enode-current-connection-type 'mysql) + (read-from-minibuffer (format "HOSTNAME for %s: " conn-desc)) + nil + ) + ) + ;; Add these details to the list of connections for the current type (setq current-type-connections (cons (list conn-desc conn-user nil conn-connection + conn-hostname conn-prompt) current-type-connections)) ;; Replace the connections for this type in the list of all