emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Org-mode as a metalanguage: calling SQL "functions"
@ 2013-04-01 19:28 Gary Oberbrunner
  2013-04-01 20:41 ` Mike Gauland
  2013-04-02  1:19 ` Eric Abrahamsen
  0 siblings, 2 replies; 17+ messages in thread
From: Gary Oberbrunner @ 2013-04-01 19:28 UTC (permalink / raw)
  To: Orgmode Mailing List

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

It seems like you can define "procedures" in org-mode and call them from
elsewhere, with args.
But I'm not sure how well-defined that process is; the documentation is not
completely perfect yet I think.  Here's one thing I'm trying that seems not
to work.

I define a "procedure" as a named ref called recorddate with two args, ver
and order.  The idea is I could later call that with different values of
those args.

#+NAME: recorddate(order="desc")
#+BEGIN_SRC sql :exports none :colnames no :results scalar
select Event.CreatedAt from Event join MachineInfo as MI on
Event.MachineInfoId=MI.Id
 where Event.CreatedAt is not NULL order by CreatedAt $order limit 1;
#+END_SRC sql

(BTW, I really like how $ vars are substituted into SQL.  Nice.)  But when
I try to call it like this:

 * earliest record is call_recorddate(ver="'.'", order="asc")
or like this:
 #+CALL: recorddate(ver="'.'", order="asc")

and I try to export as LaTeX (or anything), I get
 org-babel-ref-resolve: Reference 'recorddate' not found in this buffer

Is this supposed to work?

-- 
Gary

[-- Attachment #2: Type: text/html, Size: 1566 bytes --]

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

end of thread, other threads:[~2013-04-06 20:44 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-01 19:28 Org-mode as a metalanguage: calling SQL "functions" Gary Oberbrunner
2013-04-01 20:41 ` Mike Gauland
2013-04-02  1:19 ` Eric Abrahamsen
2013-04-02  1:45   ` Eric Schulte
2013-04-02  2:46     ` Eric Abrahamsen
2013-04-02  2:54     ` Gary Oberbrunner
2013-04-02 21:54       ` Eric Schulte
2013-04-03  5:50         ` Andreas Röhler
2013-04-03  5:54         ` Carsten Dominik
2013-04-03 13:09           ` Eric Schulte
2013-04-04 12:26             ` Sebastien Vauban
2013-04-04 12:49               ` Eric Schulte
2013-04-04 20:10                 ` Sebastien Vauban
2013-04-05 15:43                   ` Gary Oberbrunner
2013-04-05 16:31                     ` Eric Schulte
2013-04-05 17:51                       ` Andreas Röhler
2013-04-06 20:44                       ` Bastien

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

	https://git.savannah.gnu.org/cgit/emacs/org-mode.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).