unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* comint or start-process
@ 2009-12-09 23:29 Xavier Maillard
  2009-12-10  3:00 ` Kevin Rodgers
  0 siblings, 1 reply; 5+ messages in thread
From: Xavier Maillard @ 2009-12-09 23:29 UTC (permalink / raw)
  To: help-gnu-emacs

Hi,

I am thinking of using SQLite in a non interactive way for stuff
I am developing.

As far as I know, there is nothing to play with sqlite
programatically in emacs. I know there is `sql-sqlite' based on
comint but it seems it is not designed to be run non
interactivaly (maybe I am wrong).

My plans are quite simple:

- connect to my db
- execute queries
- parse the output to retrieve my data
- disconnect

The retrieved data will be used later in my mode.

Questions: do I really need to do something with start-process
and friends or do you think I can hack around comint (and/or
sql-sqlite) ?

	Xavier
-- 
http://www.gnu.org
http://www.april.org
http://www.lolica.org




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

* Re: comint or start-process
  2009-12-09 23:29 comint or start-process Xavier Maillard
@ 2009-12-10  3:00 ` Kevin Rodgers
  2009-12-10  7:29   ` Xavier Maillard
  2009-12-10 12:00   ` Xavier Maillard
  0 siblings, 2 replies; 5+ messages in thread
From: Kevin Rodgers @ 2009-12-10  3:00 UTC (permalink / raw)
  To: help-gnu-emacs

Xavier Maillard wrote:
> Hi,
> 
> I am thinking of using SQLite in a non interactive way for stuff
> I am developing.
> 
> As far as I know, there is nothing to play with sqlite
> programatically in emacs. I know there is `sql-sqlite' based on
> comint but it seems it is not designed to be run non
> interactivaly (maybe I am wrong).
> 
> My plans are quite simple:
> 
> - connect to my db
> - execute queries
> - parse the output to retrieve my data
> - disconnect
> 
> The retrieved data will be used later in my mode.
> 
> Questions: do I really need to do something with start-process
> and friends or do you think I can hack around comint (and/or
> sql-sqlite) ?

I'd start with sql-sqlite: you should be able to get something working
pretty quickly, and if it turns out to have features that get in the way
you'll be familiar enough with it to drop down a level to comint.

-- 
Kevin Rodgers
Denver, Colorado, USA





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

* Re: comint or start-process
  2009-12-10  3:00 ` Kevin Rodgers
@ 2009-12-10  7:29   ` Xavier Maillard
  2009-12-10 12:00   ` Xavier Maillard
  1 sibling, 0 replies; 5+ messages in thread
From: Xavier Maillard @ 2009-12-10  7:29 UTC (permalink / raw)
  To: Kevin Rodgers; +Cc: help-gnu-emacs


   Xavier Maillard wrote:
   > Hi,
   > 
   > I am thinking of using SQLite in a non interactive way for stuff
   > I am developing.
   > 
   > As far as I know, there is nothing to play with sqlite
   > programatically in emacs. I know there is `sql-sqlite' based on
   > comint but it seems it is not designed to be run non
   > interactivaly (maybe I am wrong).
   > 
   > My plans are quite simple:
   > 
   > - connect to my db
   > - execute queries
   > - parse the output to retrieve my data
   > - disconnect
   > 
   > The retrieved data will be used later in my mode.
   > 
   > Questions: do I really need to do something with start-process
   > and friends or do you think I can hack around comint (and/or
   > sql-sqlite) ?

   I'd start with sql-sqlite: you should be able to get something working
   pretty quickly, and if it turns out to have features that get in the way
   you'll be familiar enough with it to drop down a level to comint.

Ok, then let's try that.

	Xavier
-- 
http://www.gnu.org
http://www.april.org
http://www.lolica.org




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

* Re: comint or start-process
  2009-12-10  3:00 ` Kevin Rodgers
  2009-12-10  7:29   ` Xavier Maillard
@ 2009-12-10 12:00   ` Xavier Maillard
  2009-12-11  3:58     ` Kevin Rodgers
  1 sibling, 1 reply; 5+ messages in thread
From: Xavier Maillard @ 2009-12-10 12:00 UTC (permalink / raw)
  To: Kevin Rodgers; +Cc: help-gnu-emacs


   > My plans are quite simple:
   > 
   > - connect to my db
   > - execute queries
   > - parse the output to retrieve my data
   > - disconnect
   > 
   > The retrieved data will be used later in my mode.
   > 
   > Questions: do I really need to do something with start-process
   > and friends or do you think I can hack around comint (and/or
   > sql-sqlite) ?

   I'd start with sql-sqlite: you should be able to get something working
   pretty quickly, and if it turns out to have features that get in the way
   you'll be familiar enough with it to drop down a level to comint.

Ok. I have tried to get something but failed:

 (defun sqlite-connect (db)
   (let ((sql-database db))
     (sql-connect-sqlite)))

 (sqlite-connect "/tmp/foo.db")
 (with-current-buffer (process-buffer (get-process "SQL")))
   (sql-send-string "select * from foo;"))

=>

No SQL process started.

M-x list-process:

Proc	  Status   Buffer	 Tty	    Command
----	  ------   ------	 ---	    -------
SQL	  run	   *SQL*	 /dev/pts/2 sqlite /tmp/foot.db

What is the problem ?

Thank you

	Xavier
-- 
http://www.gnu.org
http://www.april.org
http://www.lolica.org




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

* Re: comint or start-process
  2009-12-10 12:00   ` Xavier Maillard
@ 2009-12-11  3:58     ` Kevin Rodgers
  0 siblings, 0 replies; 5+ messages in thread
From: Kevin Rodgers @ 2009-12-11  3:58 UTC (permalink / raw)
  To: help-gnu-emacs

Xavier Maillard wrote:
> Ok. I have tried to get something but failed:
> 
>  (defun sqlite-connect (db)
>    (let ((sql-database db))
>      (sql-connect-sqlite)))
> 
>  (sqlite-connect "/tmp/foo.db")
>  (with-current-buffer (process-buffer (get-process "SQL")))
>    (sql-send-string "select * from foo;"))
> 
> =>
> 
> No SQL process started.
> 
> M-x list-process:
> 
> Proc	  Status   Buffer	 Tty	    Command
> ----	  ------   ------	 ---	    -------
> SQL	  run	   *SQL*	 /dev/pts/2 sqlite /tmp/foot.db
> 
> What is the problem ?

Use the source: "No SQL process started" is reported by sql-send-string
when (buffer-live-p sql-buffer) returns nil.  Usually, sql-buffer is
set by sql-product-interactive, which you have circumvented by calling
sql-connect-sqlite directly.

Perhaps all you need to do is:

(let ((sql-buffer (process-buffer (get-process "SQL"))))
   (with-current-buffer sql-buffer
     (sql-send-string "select * from foo;")))

-- 
Kevin Rodgers
Denver, Colorado, USA





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

end of thread, other threads:[~2009-12-11  3:58 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-12-09 23:29 comint or start-process Xavier Maillard
2009-12-10  3:00 ` Kevin Rodgers
2009-12-10  7:29   ` Xavier Maillard
2009-12-10 12:00   ` Xavier Maillard
2009-12-11  3:58     ` Kevin Rodgers

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).