unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#3887: [PATCH] Hive support for sql-mode
@ 2009-07-20 17:46 Ian Eure
  2012-04-12 17:30 ` Lars Magne Ingebrigtsen
  2016-02-29  3:40 ` Lars Ingebrigtsen
  0 siblings, 2 replies; 4+ messages in thread
From: Ian Eure @ 2009-07-20 17:46 UTC (permalink / raw)
  To: emacs-pretest-bug

[-- Attachment #1: Type: text/plain, Size: 201 bytes --]

I added basic support for Hive to sql-mode. Hive is a SQL-like  
interface for querying data stored in Hadoop, a distributed storage  
framework and map/reduce engine.

Patch against recent CVS HEAD.


[-- Attachment #2: sql-hive.patch --]
[-- Type: application/octet-stream, Size: 4460 bytes --]

diff --git a/sql.el b/sql.el
index da0794b..609eec6 100644
--- a/sql.el
+++ b/sql.el
@@ -283,6 +283,7 @@ highlighted properly when you open them."
 		 (const :tag "PostGres" postgres)
 		 (const :tag "Solid" solid)
 		 (const :tag "SQLite" sqlite)
+		 (const :tag "Hive" hive)
 		 (const :tag "Sybase" sybase))
   :group 'SQL)
 
@@ -360,6 +361,11 @@ highlighted properly when you open them."
      :sqli-connect sql-connect-sqlite
      :sqli-prompt-regexp "^sqlite> "
      :sqli-prompt-length 8)
+    (hive
+     :font-lock sql-mode-hive-font-lock-keywords
+     :sqli-connect sql-connect-hive
+     :sqli-prompt-range "^hive> "
+     :sqli-prompt-length 6)
     (sybase
      :font-lock sql-mode-sybase-font-lock-keywords
      :sqli-login (server user password database)
@@ -549,6 +555,21 @@ on Windows: \"-C\" \"-t\" \"-f\" \"-n\"."
   :version "20.8"
   :group 'SQL)
 
+;; Customization for Hive
+
+(defcustom sql-hive-program "hive"
+  "*Command to start hive.
+
+Starts `sql-interactive-mode' after doing some setup."
+  :type 'file
+  :group 'SQL)
+
+(defcustom sql-hive-options nil
+  "*List of additional options for `sql-hive-program'."
+  :type '(repeat string)
+  :version "20.8"
+  :group 'SQL)
+
 ;; Customization for MySql
 
 (defcustom sql-mysql-program "mysql"
@@ -840,6 +861,9 @@ Based on `comint-mode-map'.")
     ["SQLite" sql-highlight-sqlite-keywords
      :style radio
      :selected (eq sql-product 'sqlite)]
+    ["Hive" sql-highlight-hive-keywords
+     :style radio
+     :selected (eq sql-product 'hive)]
     ["Sybase" sql-highlight-sybase-keywords
      :style radio
      :selected (eq sql-product 'sybase)]
@@ -1637,6 +1661,14 @@ regular expressions are created during compilation by calling the
 function `regexp-opt'.  Therefore, take a look at the source before
 you define your own sql-mode-sqlite-font-lock-keywords.")
 
+(defvar sql-mode-hive-font-lock-keywords nil
+  "Hive SQL keywords used by font-lock.
+
+This variable is used by `sql-mode' and `sql-interactive-mode'.  The
+regular expressions are created during compilation by calling the
+function `regexp-opt'.  Therefore, take a look at the source before
+you define your own sql-mode-sqlite-font-lock-keywords.")
+
 (defvar sql-mode-db2-font-lock-keywords nil
   "DB2 SQL keywords used by font-lock.
 
@@ -1830,6 +1862,11 @@ highlighting."
   (interactive)
   (sql-set-product 'sqlite))
 
+(defun sql-highlight-hive-keywords ()
+  "Highlight Hive SQL keywords."
+  (interactive)
+  (sql-set-product 'hive))
+
 (defun sql-highlight-db2-keywords ()
   "Highlight DB2 SQL keywords."
   (interactive)
@@ -2614,7 +2651,48 @@ parameters and command options."
     (if (not (null sql-sqlite-options))
 	(setq params (append sql-sqlite-options params)))
     (set-buffer (apply 'make-comint "SQL" sql-sqlite-program
-		       nil params))))
+                       nil params))))
+
+\f
+
+;;;###autoload
+(defun sql-hive ()
+  "Run hive as an inferior process.
+
+Hive is free software.
+
+If buffer `*SQL*' exists but no process is running, make a new process.
+If buffer exists and a process is running, just switch to buffer
+`*SQL*'.
+
+Interpreter used comes from variable
+`sql-hive-program'. Additional command line parameters can be
+stored in the list `sql-hive-options'.
+
+The buffer is put in sql-interactive-mode, giving commands for sending
+input.  See `sql-interactive-mode'.
+
+To specify a coding system for converting non-ASCII characters
+in the input and output to the process, use \\[universal-coding-system-argument]
+before \\[sql-hive].  You can also specify this with \\[set-buffer-process-coding-system]
+in the SQL buffer, after you start the process.
+The default comes from `process-coding-system-alist' and
+`default-process-coding-system'.
+
+\(Type \\[describe-mode] in the SQL buffer for a list of commands.)"
+  (interactive)
+  (sql-product-interactive 'hive))
+
+(defun sql-connect-hive ()
+  "Create comint buffer and connect to Hive using the login
+parameters and command options."
+  ;; Put all parameters to the program (if defined) in a list and call
+  ;; make-comint.
+  (let ((params))
+    (if (not (null sql-hive-options))
+        (setq params (append sql-hive-options params)))
+    (set-buffer (apply 'make-comint "SQL" sql-hive-program
+                       nil params))))
 
 \f
 

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* bug#3887: [PATCH] Hive support for sql-mode
  2009-07-20 17:46 bug#3887: [PATCH] Hive support for sql-mode Ian Eure
@ 2012-04-12 17:30 ` Lars Magne Ingebrigtsen
  2016-02-29  3:40 ` Lars Ingebrigtsen
  1 sibling, 0 replies; 4+ messages in thread
From: Lars Magne Ingebrigtsen @ 2012-04-12 17:30 UTC (permalink / raw)
  To: Ian Eure; +Cc: 3887, Michael Mauger

Ian Eure <ian@digg.com> writes:

> I added basic support for Hive to sql-mode. Hive is a SQL-like
> interface for querying data stored in Hadoop, a distributed storage
> framework and map/reduce engine.

The patch seems useful.  What do you think, Michael?

-- 
(domestic pets only, the antidote for overdose, milk.)
  bloggy blog http://lars.ingebrigtsen.no/





^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#3887: [PATCH] Hive support for sql-mode
  2009-07-20 17:46 bug#3887: [PATCH] Hive support for sql-mode Ian Eure
  2012-04-12 17:30 ` Lars Magne Ingebrigtsen
@ 2016-02-29  3:40 ` Lars Ingebrigtsen
  2019-06-27 17:55   ` Lars Ingebrigtsen
  1 sibling, 1 reply; 4+ messages in thread
From: Lars Ingebrigtsen @ 2016-02-29  3:40 UTC (permalink / raw)
  To: Ian Eure; +Cc: 3887

Ian Eure <ian@digg.com> writes:

> I added basic support for Hive to sql-mode. Hive is a SQL-like
> interface for querying data stored in Hadoop, a distributed storage
> framework and map/reduce engine.
>
> Patch against recent CVS HEAD.

sql.el has changed a lot since this patch was originally proposed.  If
you re-spin the patch, I'll apply it...

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#3887: [PATCH] Hive support for sql-mode
  2016-02-29  3:40 ` Lars Ingebrigtsen
@ 2019-06-27 17:55   ` Lars Ingebrigtsen
  0 siblings, 0 replies; 4+ messages in thread
From: Lars Ingebrigtsen @ 2019-06-27 17:55 UTC (permalink / raw)
  To: Ian Eure; +Cc: 3887

Lars Ingebrigtsen <larsi@gnus.org> writes:

> Ian Eure <ian@digg.com> writes:
>
>> I added basic support for Hive to sql-mode. Hive is a SQL-like
>> interface for querying data stored in Hadoop, a distributed storage
>> framework and map/reduce engine.
>>
>> Patch against recent CVS HEAD.
>
> sql.el has changed a lot since this patch was originally proposed.  If
> you re-spin the patch, I'll apply it...

That was seven years ago, and there was a prod three years ago, so it
seems unlikely that progress will be made.  (And this sounds more like
an ELPA package instead of an sql.el addition, I think.)  So I'm closing
this bug report.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-06-27 17:55 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-07-20 17:46 bug#3887: [PATCH] Hive support for sql-mode Ian Eure
2012-04-12 17:30 ` Lars Magne Ingebrigtsen
2016-02-29  3:40 ` Lars Ingebrigtsen
2019-06-27 17:55   ` Lars Ingebrigtsen

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).