From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Ian Eure Newsgroups: gmane.emacs.bugs,gmane.emacs.pretest.bugs Subject: bug#3887: [PATCH] Hive support for sql-mode Date: Mon, 20 Jul 2009 10:46:59 -0700 Message-ID: <0303ACD8-F4D8-4789-8892-D7B4CC1BA815@digg.com> Reply-To: Ian Eure , 3887@emacsbugs.donarmstrong.com NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 (Apple Message framework v935.3) Content-Type: multipart/mixed; boundary=Apple-Mail-2--778120368 X-Trace: ger.gmane.org 1248112670 3268 80.91.229.12 (20 Jul 2009 17:57:50 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 20 Jul 2009 17:57:50 +0000 (UTC) To: emacs-pretest-bug@gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Jul 20 19:57:43 2009 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1MSx7O-0000KN-93 for geb-bug-gnu-emacs@m.gmane.org; Mon, 20 Jul 2009 19:57:42 +0200 Original-Received: from localhost ([127.0.0.1]:58810 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MSx7N-0006Mb-SJ for geb-bug-gnu-emacs@m.gmane.org; Mon, 20 Jul 2009 13:57:41 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MSx7J-0006ML-1X for bug-gnu-emacs@gnu.org; Mon, 20 Jul 2009 13:57:37 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MSx7E-0006Lv-2V for bug-gnu-emacs@gnu.org; Mon, 20 Jul 2009 13:57:35 -0400 Original-Received: from [199.232.76.173] (port=52207 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MSx7D-0006Ls-OW for bug-gnu-emacs@gnu.org; Mon, 20 Jul 2009 13:57:31 -0400 Original-Received: from rzlab.ucr.edu ([138.23.92.77]:33754) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1MSx7D-00081M-5w for bug-gnu-emacs@gnu.org; Mon, 20 Jul 2009 13:57:31 -0400 Original-Received: from rzlab.ucr.edu (rzlab.ucr.edu [127.0.0.1]) by rzlab.ucr.edu (8.14.3/8.14.3/Debian-5) with ESMTP id n6KHvTUQ020120; Mon, 20 Jul 2009 10:57:29 -0700 Original-Received: (from debbugs@localhost) by rzlab.ucr.edu (8.14.3/8.14.3/Submit) id n6KHo4ec018654; Mon, 20 Jul 2009 10:50:04 -0700 X-Loop: owner@emacsbugs.donarmstrong.com Resent-From: Ian Eure Resent-To: bug-submit-list@donarmstrong.com Resent-CC: Emacs Bugs Resent-Date: Mon, 20 Jul 2009 17:50:04 +0000 Resent-Message-ID: Resent-Sender: owner@emacsbugs.donarmstrong.com X-Emacs-PR-Message: report 3887 X-Emacs-PR-Package: emacs X-Emacs-PR-Keywords: Original-Received: via spool by submit@emacsbugs.donarmstrong.com id=B.124811202818403 (code B ref -1); Mon, 20 Jul 2009 17:50:04 +0000 Original-Received: (at submit) by emacsbugs.donarmstrong.com; 20 Jul 2009 17:47:08 +0000 X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. Original-Received: from fencepost.gnu.org (fencepost.gnu.org [140.186.70.10]) by rzlab.ucr.edu (8.14.3/8.14.3/Debian-5) with ESMTP id n6KHl3FU018394 for ; Mon, 20 Jul 2009 10:47:04 -0700 Original-Received: from mx10.gnu.org ([199.232.76.166]:43215) by fencepost.gnu.org with esmtp (Exim 4.67) (envelope-from ) id 1MSwx4-00030T-Ne for emacs-pretest-bug@gnu.org; Mon, 20 Jul 2009 13:47:02 -0400 Original-Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1MSwx3-0006Gt-Rt for emacs-pretest-bug@gnu.org; Mon, 20 Jul 2009 13:47:02 -0400 Original-Received: from mail.digg.com ([64.191.203.36]:34974) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MSwx3-0006Gf-Dn for emacs-pretest-bug@gnu.org; Mon, 20 Jul 2009 13:47:01 -0400 Original-Received: from localhost (localhost.localdomain [127.0.0.1]) by mail.digg.com (Postfix) with ESMTP id 334E1A85398 for ; Mon, 20 Jul 2009 10:47:00 -0700 (PDT) X-Virus-Scanned: amavisd-new at d242.digg.internal Original-Received: from mail.digg.com ([127.0.0.1]) by localhost (mail.digg.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id gus5rdlWJDFC for ; Mon, 20 Jul 2009 10:46:59 -0700 (PDT) Original-Received: from [10.2.16.50] (diggstage01.digg.com [64.191.203.34]) by mail.digg.com (Postfix) with ESMTP id B1519A85367 for ; Mon, 20 Jul 2009 10:46:59 -0700 (PDT) X-Mailer: Apple Mail (2.935.3) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) Resent-Date: Mon, 20 Jul 2009 13:57:35 -0400 X-BeenThere: bug-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:29523 gmane.emacs.pretest.bugs:24821 Archived-At: --Apple-Mail-2--778120368 Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit 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. --Apple-Mail-2--778120368 Content-Disposition: attachment; filename=sql-hive.patch Content-Type: application/octet-stream; x-unix-mode=0644; name="sql-hive.patch" Content-Transfer-Encoding: quoted-printable diff=20--git=20a/sql.el=20b/sql.el=0Aindex=20da0794b..609eec6=20100644=0A= ---=20a/sql.el=0A+++=20b/sql.el=0A@@=20-283,6=20+283,7=20@@=20= highlighted=20properly=20when=20you=20open=20them."=0A=20=09=09=20(const=20= :tag=20"PostGres"=20postgres)=0A=20=09=09=20(const=20:tag=20"Solid"=20= solid)=0A=20=09=09=20(const=20:tag=20"SQLite"=20sqlite)=0A+=09=09=20= (const=20:tag=20"Hive"=20hive)=0A=20=09=09=20(const=20:tag=20"Sybase"=20= sybase))=0A=20=20=20:group=20'SQL)=0A=20=0A@@=20-360,6=20+361,11=20@@=20= highlighted=20properly=20when=20you=20open=20them."=0A=20=20=20=20=20=20= :sqli-connect=20sql-connect-sqlite=0A=20=20=20=20=20=20= :sqli-prompt-regexp=20"^sqlite>=20"=0A=20=20=20=20=20=20= :sqli-prompt-length=208)=0A+=20=20=20=20(hive=0A+=20=20=20=20=20= :font-lock=20sql-mode-hive-font-lock-keywords=0A+=20=20=20=20=20= :sqli-connect=20sql-connect-hive=0A+=20=20=20=20=20:sqli-prompt-range=20= "^hive>=20"=0A+=20=20=20=20=20:sqli-prompt-length=206)=0A=20=20=20=20=20= (sybase=0A=20=20=20=20=20=20:font-lock=20= sql-mode-sybase-font-lock-keywords=0A=20=20=20=20=20=20:sqli-login=20= (server=20user=20password=20database)=0A@@=20-549,6=20+555,21=20@@=20on=20= Windows:=20\"-C\"=20\"-t\"=20\"-f\"=20\"-n\"."=0A=20=20=20:version=20= "20.8"=0A=20=20=20:group=20'SQL)=0A=20=0A+;;=20Customization=20for=20= Hive=0A+=0A+(defcustom=20sql-hive-program=20"hive"=0A+=20=20"*Command=20= to=20start=20hive.=0A+=0A+Starts=20`sql-interactive-mode'=20after=20= doing=20some=20setup."=0A+=20=20:type=20'file=0A+=20=20:group=20'SQL)=0A= +=0A+(defcustom=20sql-hive-options=20nil=0A+=20=20"*List=20of=20= additional=20options=20for=20`sql-hive-program'."=0A+=20=20:type=20= '(repeat=20string)=0A+=20=20:version=20"20.8"=0A+=20=20:group=20'SQL)=0A= +=0A=20;;=20Customization=20for=20MySql=0A=20=0A=20(defcustom=20= sql-mysql-program=20"mysql"=0A@@=20-840,6=20+861,9=20@@=20Based=20on=20= `comint-mode-map'.")=0A=20=20=20=20=20["SQLite"=20= sql-highlight-sqlite-keywords=0A=20=20=20=20=20=20:style=20radio=0A=20=20= =20=20=20=20:selected=20(eq=20sql-product=20'sqlite)]=0A+=20=20=20=20= ["Hive"=20sql-highlight-hive-keywords=0A+=20=20=20=20=20:style=20radio=0A= +=20=20=20=20=20:selected=20(eq=20sql-product=20'hive)]=0A=20=20=20=20=20= ["Sybase"=20sql-highlight-sybase-keywords=0A=20=20=20=20=20=20:style=20= radio=0A=20=20=20=20=20=20:selected=20(eq=20sql-product=20'sybase)]=0A@@=20= -1637,6=20+1661,14=20@@=20regular=20expressions=20are=20created=20during=20= compilation=20by=20calling=20the=0A=20function=20`regexp-opt'.=20=20= Therefore,=20take=20a=20look=20at=20the=20source=20before=0A=20you=20= define=20your=20own=20sql-mode-sqlite-font-lock-keywords.")=0A=20=0A= +(defvar=20sql-mode-hive-font-lock-keywords=20nil=0A+=20=20"Hive=20SQL=20= keywords=20used=20by=20font-lock.=0A+=0A+This=20variable=20is=20used=20= by=20`sql-mode'=20and=20`sql-interactive-mode'.=20=20The=0A+regular=20= expressions=20are=20created=20during=20compilation=20by=20calling=20the=0A= +function=20`regexp-opt'.=20=20Therefore,=20take=20a=20look=20at=20the=20= source=20before=0A+you=20define=20your=20own=20= sql-mode-sqlite-font-lock-keywords.")=0A+=0A=20(defvar=20= sql-mode-db2-font-lock-keywords=20nil=0A=20=20=20"DB2=20SQL=20keywords=20= used=20by=20font-lock.=0A=20=0A@@=20-1830,6=20+1862,11=20@@=20= highlighting."=0A=20=20=20(interactive)=0A=20=20=20(sql-set-product=20= 'sqlite))=0A=20=0A+(defun=20sql-highlight-hive-keywords=20()=0A+=20=20= "Highlight=20Hive=20SQL=20keywords."=0A+=20=20(interactive)=0A+=20=20= (sql-set-product=20'hive))=0A+=0A=20(defun=20sql-highlight-db2-keywords=20= ()=0A=20=20=20"Highlight=20DB2=20SQL=20keywords."=0A=20=20=20= (interactive)=0A@@=20-2614,7=20+2651,48=20@@=20parameters=20and=20= command=20options."=0A=20=20=20=20=20(if=20(not=20(null=20= sql-sqlite-options))=0A=20=09(setq=20params=20(append=20= sql-sqlite-options=20params)))=0A=20=20=20=20=20(set-buffer=20(apply=20= 'make-comint=20"SQL"=20sql-sqlite-program=0A-=09=09=20=20=20=20=20=20=20= nil=20params))))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20nil=20params))))=0A+=0A+=0C=0A+=0A+;;;###autoload=0A= +(defun=20sql-hive=20()=0A+=20=20"Run=20hive=20as=20an=20inferior=20= process.=0A+=0A+Hive=20is=20free=20software.=0A+=0A+If=20buffer=20= `*SQL*'=20exists=20but=20no=20process=20is=20running,=20make=20a=20new=20= process.=0A+If=20buffer=20exists=20and=20a=20process=20is=20running,=20= just=20switch=20to=20buffer=0A+`*SQL*'.=0A+=0A+Interpreter=20used=20= comes=20from=20variable=0A+`sql-hive-program'.=20Additional=20command=20= line=20parameters=20can=20be=0A+stored=20in=20the=20list=20= `sql-hive-options'.=0A+=0A+The=20buffer=20is=20put=20in=20= sql-interactive-mode,=20giving=20commands=20for=20sending=0A+input.=20=20= See=20`sql-interactive-mode'.=0A+=0A+To=20specify=20a=20coding=20system=20= for=20converting=20non-ASCII=20characters=0A+in=20the=20input=20and=20= output=20to=20the=20process,=20use=20= \\[universal-coding-system-argument]=0A+before=20\\[sql-hive].=20=20You=20= can=20also=20specify=20this=20with=20= \\[set-buffer-process-coding-system]=0A+in=20the=20SQL=20buffer,=20after=20= you=20start=20the=20process.=0A+The=20default=20comes=20from=20= `process-coding-system-alist'=20and=0A+`default-process-coding-system'.=0A= +=0A+\(Type=20\\[describe-mode]=20in=20the=20SQL=20buffer=20for=20a=20= list=20of=20commands.)"=0A+=20=20(interactive)=0A+=20=20= (sql-product-interactive=20'hive))=0A+=0A+(defun=20sql-connect-hive=20()=0A= +=20=20"Create=20comint=20buffer=20and=20connect=20to=20Hive=20using=20= the=20login=0A+parameters=20and=20command=20options."=0A+=20=20;;=20Put=20= all=20parameters=20to=20the=20program=20(if=20defined)=20in=20a=20list=20= and=20call=0A+=20=20;;=20make-comint.=0A+=20=20(let=20((params))=0A+=20=20= =20=20(if=20(not=20(null=20sql-hive-options))=0A+=20=20=20=20=20=20=20=20= (setq=20params=20(append=20sql-hive-options=20params)))=0A+=20=20=20=20= (set-buffer=20(apply=20'make-comint=20"SQL"=20sql-hive-program=0A+=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20nil=20= params))))=0A=20=0A=20=0C=0A=20=0A= --Apple-Mail-2--778120368--