* Is is a major or minor mode?
@ 2002-10-31 2:19 Galen Boyer
2002-10-31 12:29 ` Phillip Lord
0 siblings, 1 reply; 7+ messages in thread
From: Galen Boyer @ 2002-10-31 2:19 UTC (permalink / raw)
I have been working on a package I am calling ejsql.el (Emacs JDBC SQL).
The idea is to use the beanshell (the way that the JDEE is using it) to
act as a JVM and serve up metadata objects that have specific JDBC
connections. I have a connection pooling mechanism working and a data
caching mechanism working and this is being "eval'd" into elisp
completing-reads. So, now, from (hopefully) any sql buffer, I can start
to build a dynamic sql generator (among a host of other enhancements
providing me years worth of weekends spent with my favorite addiction
and keeping me from my previous golf addiction). The data I'm currently
retrieving is a table listing and a table/column mapping. I cache these
data structures using java objects hosted within the Emacs process (*bsh*)
so the user won't take a big time data retrieval hit while they are
coding their sql. I will provide the user the mechanism to have Emacs
retrieve these structures directly from the database as well, or in
other words, to refresh the cache.
Now, my question.
I want this to be available in both SQLi and sql-mode buffers and
piggyback on its comint integration. I was planning to write a wrapper
around the login functionality of sql.el which would then define the
specific variables that the sql-mode and sqli buffers needed to know
about to get at the *bsh* variables. I'm just not sure if this is the
right plan to proceed with. Should I make my own major-mode and steal
liberally from sql.el?
--
Galen deForest Boyer
Sweet dreams and flying machines in pieces on the ground.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Is is a major or minor mode?
2002-10-31 2:19 Is is a major or minor mode? Galen Boyer
@ 2002-10-31 12:29 ` Phillip Lord
2002-10-31 17:22 ` Kevin Rodgers
2002-11-01 3:26 ` Galen Boyer
0 siblings, 2 replies; 7+ messages in thread
From: Phillip Lord @ 2002-10-31 12:29 UTC (permalink / raw)
>>>>> "Galen" == Galen Boyer <galenboyer@hotpop.com> writes:
Galen> I want this to be available in both SQLi and sql-mode buffers
Galen> and piggyback on its comint integration. I was planning to
Galen> write a wrapper around the login functionality of sql.el
Galen> which would then define the specific variables that the
Galen> sql-mode and sqli buffers needed to know about to get at the
Galen> *bsh* variables. I'm just not sure if this is the right plan
Galen> to proceed with. Should I make my own major-mode and steal
Galen> liberally from sql.el?
I think that the answer to this is partly sociological. Is sql.el very
large? Is it being actively developed? If the answer is yes to either
of these the code stealing option would be much less attractive.
Incidentally the mode sounds excellent! I'd like a really nice SQL
mode, with JDBC connectivity.
Cheers
Phil
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Is is a major or minor mode?
2002-10-31 12:29 ` Phillip Lord
@ 2002-10-31 17:22 ` Kevin Rodgers
2002-11-01 3:26 ` Galen Boyer
1 sibling, 0 replies; 7+ messages in thread
From: Kevin Rodgers @ 2002-10-31 17:22 UTC (permalink / raw)
Phillip Lord wrote:
>>>>>>"Galen" == Galen Boyer <galenboyer@hotpop.com> writes:
>>>>>>
>
> Galen> I want this to be available in both SQLi and sql-mode buffers
> Galen> and piggyback on its comint integration. I was planning to
> Galen> write a wrapper around the login functionality of sql.el
> Galen> which would then define the specific variables that the
> Galen> sql-mode and sqli buffers needed to know about to get at the
> Galen> *bsh* variables. I'm just not sure if this is the right plan
> Galen> to proceed with. Should I make my own major-mode and steal
> Galen> liberally from sql.el?
>
>
> I think that the answer to this is partly sociological. Is sql.el very
> large? Is it being actively developed? If the answer is yes to either
> of these the code stealing option would be much less attractive.
But it would make define-derived-mode an attractive approach to implementing
it as a major mode.
--
<a href="mailto:<kevinr@ihs.com>">Kevin Rodgers</a>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Is is a major or minor mode?
2002-10-31 12:29 ` Phillip Lord
2002-10-31 17:22 ` Kevin Rodgers
@ 2002-11-01 3:26 ` Galen Boyer
2002-11-03 23:36 ` Tim Cross
1 sibling, 1 reply; 7+ messages in thread
From: Galen Boyer @ 2002-11-01 3:26 UTC (permalink / raw)
On 31 Oct 2002, p.lord@russet.org.uk wrote:
>
>>>>>> "Galen" == Galen Boyer <galenboyer@hotpop.com> writes:
>
> Galen> I want this to be available in both SQLi and sql-mode buffers
> Galen> and piggyback on its comint integration. I was planning to
> Galen> write a wrapper around the login functionality of sql.el
> Galen> which would then define the specific variables that the
> Galen> sql-mode and sqli buffers needed to know about to get at the
> Galen> *bsh* variables. I'm just not sure if this is the right plan
> Galen> to proceed with. Should I make my own major-mode and steal
> Galen> liberally from sql.el?
>
>
> I think that the answer to this is partly sociological. Is sql.el very
> large?
No.
> Is it being actively developed?
I don't think so. It is part of the base Emacs distribution. Its
actually quite simple/elegant in its design. It gives one all the nice
shell functionality for a sql command-line. Being able to hop between
sql prompts, this alone, is worth learning the mode. I can't tell you
how many times I've kicked off a sql query that has returned > 1000
rows. Then, I hit C-[space] C-c C-p C-x n n M-x occur blah.
> If the answer is yes to either of these the code stealing option would
> be much less attractive.
>
> Incidentally the mode sounds excellent! I'd like a really nice SQL
> mode, with JDBC connectivity.
Well, I didn't really want to provide a "SQL mode" nor do I really want
to rewrite the command-line interfaces provided by the database vendors
(although, the thought has crossed my mind, and I would bet with eshell,
something nifty about cd'n to a JDBC connection could be concocted and
then all sorts of Emacs magic could make the database experience that
much more enjoyable). I wanted to provide a metadata layer that allowed
dynamic creation of SQL that was then displayed in a sql-mode or sqli
buffer. In the sqli buffer, hit enter and it is executed. In the
sql-mode, it helps you get at your finished code faster.
I do want it to try to be context sensitive. So, if its in the middle
of a piece of SQL and I ask for a metadata listing, it would gleam
whether point is within the "select" section versus the "from" section
versus the "where" section and then be intelligent about what to bring
back. But, the most important thing is for the buffer to know what
metadata object it is associated with, how to get at the passwords for
connection creation (maybe through the .authinfo file) and how to
refresh the cache when needed.
I do think that this kind of thing could then serve up the appropriate
outputs to the speedbar so we could get database "browsing" but I would
need to do something useful with that which would be another years worth
of work (Man, this Emacs thing never ends). Also, pop-up frames for
choosing different entities would be nice. Definitely canned queries
should be there, especially analytic type queries: The following query,
select fld1,fld2,...,fldn, count(*)
from table
group by fld1,fld2,...,fldn;
was, really, the entire reason I decided to do this in the first place.
I want this query, as well as others, to be available and prompt with
appropriate object names, for all sql buffers.
If you are a sql user, the following template and abbreviation might be
useful for you:
(tempo-define-template
"select-count-group-by" ;; template name
'((p "Table Selected From: " tsf 'NOINSERT)
(p "Fields To Group On: " fgo 'NOINSERT)
"SELECT "
(s fgo)
",count(*) " n>
"from "
(s tsf) n>
" group by "
(s fgo)
";"))
(define-abbrev sql-mode-abbrev-table "scg" ""
'tempo-template-select-count-group-by)
With ejsql, this template will provide appropriate completing-reads from
the JDBC metadata layer. Actually, my next task will be to make this
template work with the ejsql code. The completing reads from ejsql have
been tested enough that I can say they work reasonably well, but I still
have lots more to discover with the DatabaseMetaData interface.
But, anyways. My main focus will be to get the creation of the sql-mode
and sqli buffers to understand how to create their respective metadata
object and how to constantly refer to them. Understanding how best to
make this happen and play nice with the already established sql.el was
why I posted.
--
Galen deForest Boyer
Sweet dreams and flying machines in pieces on the ground.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Is is a major or minor mode?
2002-11-01 3:26 ` Galen Boyer
@ 2002-11-03 23:36 ` Tim Cross
2002-11-04 4:17 ` Galen Boyer
0 siblings, 1 reply; 7+ messages in thread
From: Tim Cross @ 2002-11-03 23:36 UTC (permalink / raw)
Galen Boyer <galenboyer@hotpop.com> writes:
> On 31 Oct 2002, p.lord@russet.org.uk wrote:
> > Galen> I want this to be available in both SQLi and sql-mode buffers
> > Galen> and piggyback on its comint integration. I was planning to
> > Galen> write a wrapper around the login functionality of sql.el
> > Galen> which would then define the specific variables that the
> > Galen> sql-mode and sqli buffers needed to know about to get at the
> > Galen> *bsh* variables. I'm just not sure if this is the right plan
> > Galen> to proceed with. Should I make my own major-mode and steal
> > Galen> liberally from sql.el?
> >
> >
> > I think that the answer to this is partly sociological. Is sql.el very
> > large?
>
> No.
>
> > Is it being actively developed?
>
> I don't think so. It is part of the base Emacs distribution. Its
> actually quite simple/elegant in its design. It gives one all the nice
> shell functionality for a sql command-line. Being able to hop between
I think the mode you are proposing sounds very useful. I would
recommend contacting Alex Schroeder, the author of sql.el. He is
maintaining the code and does release occasional updates.
Alex is very approachable and almost always willing to help if he can
and has some experience authoring emacs packages. I htink his e-mail
is in the sources for sql.el. It would probably be worth talking with
him just to get his opinion and verify what the immediate plans for
sql.el are (if any). I would not be surprised if he wasn't willing to
provide some guideance or advice on what he felt would be the best
direction to take with your mode and he would probably be interested
in having a look at early drafts and possibly making suggestions etc.
Tim
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Is is a major or minor mode?
2002-11-03 23:36 ` Tim Cross
@ 2002-11-04 4:17 ` Galen Boyer
2002-11-04 22:51 ` Tim Cross
0 siblings, 1 reply; 7+ messages in thread
From: Galen Boyer @ 2002-11-04 4:17 UTC (permalink / raw)
On 04 Nov 2002, tcross@nospam.une.edu.au wrote:
> Galen Boyer <galenboyer@hotpop.com> writes:
>> > Is it being actively developed?
>>
>> I don't think so. It is part of the base Emacs distribution. Its
>> actually quite simple/elegant in its design. It gives one all the
>> nice shell functionality for a sql command-line. Being able to hop
>> between
>
> I think the mode you are proposing sounds very useful. I would
> recommend contacting Alex Schroeder, the author of sql.el. He is
> maintaining the code and does release occasional updates.
Alex is aware of what I'm trying to do, at least somewhat. sql.el is
simple enough that I don't think I would have much of an issue just
stealing liberally, but I'd rather "hook" into already written Emacs
code. I really like how he piggybacked on the comint mode. It is very
simplistic (ie powerful) in its implementation.
I'm actually having alot of success with defadvice. I'm just advising
the sql-interactive-mode and sql-mode on how to hook into my code and
the java metadata and connection objects are getting spawned. I'm still
playing around in the new world of eieio though. I'd like to subscribe
to this package as well, but I keep just going back to straight defuns.
eieio would probably pay off if this mode were to grow.
I'm not too far from getting this thing on sourceforge for an initial
submission. But, keep my use of the term "too far" in perspective. I
have two small children. :-)
--
Galen deForest Boyer
Sweet dreams and flying machines in pieces on the ground.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Is is a major or minor mode?
2002-11-04 4:17 ` Galen Boyer
@ 2002-11-04 22:51 ` Tim Cross
0 siblings, 0 replies; 7+ messages in thread
From: Tim Cross @ 2002-11-04 22:51 UTC (permalink / raw)
Galen Boyer <galenboyer@hotpop.com> writes:
> I'm actually having alot of success with defadvice. I'm just advising
> the sql-interactive-mode and sql-mode on how to hook into my code and
> the java metadata and connection objects are getting spawned. I'm still
> playing around in the new world of eieio though. I'd like to subscribe
> to this package as well, but I keep just going back to straight defuns.
> eieio would probably pay off if this mode were to grow.
>
I think advising functions is possibly my favorite emacs power
tool. If you ever feel like seeing some of the clever things you can
do with it, check out the emacspeak package. The initial reason I
moved to emacs was the result of losing my sight five years ago. I
wanted a powerful and effective text-to-speech system for working on a
linux box. The emacspeak package makes extensive use of defadvice to
provide very powerful and friendly text-to-speech interface. Unlike
other text-to-speech systems, because of the power of emacs, emacspeak
provides audible highlighting - similar to font-lock, you get
voice-lock, where different syntactic elements are spoken in different
voices. All of this speech support is achieved without the need to
modify any emacs source code/libraries etc. Instead, you just have the
emacspeak sources which are essentially collections of advised
functions with some additional housekeeping and interface code for
various text-to-speech systems.
Another package which might be worth checking out, but which I have
not tried out yet is the PL/SQL mode, which I believe just extends
sql.el - don't know how it does this, but it might be worth looking at
for some ideas of how you could extend/hook into sql.el.
Tim
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2002-11-04 22:51 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-10-31 2:19 Is is a major or minor mode? Galen Boyer
2002-10-31 12:29 ` Phillip Lord
2002-10-31 17:22 ` Kevin Rodgers
2002-11-01 3:26 ` Galen Boyer
2002-11-03 23:36 ` Tim Cross
2002-11-04 4:17 ` Galen Boyer
2002-11-04 22:51 ` Tim Cross
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).