From: Petr M. <mi...@ph...> - 2004-05-18 06:25:07
|
> > How is gnuplot ever going to know what to send other than just > > passing through what you type? I used a fifo in my example to > > show you that it can be done that way, but for the simple case > > at hand you can do it all in a single command anyhow: > > > > plot "< db 'select * from table'" with lines > > > > or whatever the database command might be. What syntax did > > you have in mind that would be simpler? > > The thing is that databases like mysql and postgres, the two most used OSS > servers, don't output useable data by default (it's "pretty print"), so > you would have to learn the somewhat cumbersome and irritating syntax to > fix this (although you could write another passthrough shell command for > it). Some databases may not even have a command-line client. If gnuplot > had support for several different backends, you could plot data from any > of them with ease, not needing to worry about differences in arguments > etc. Just simple SQL. > > Anyhow.. Is there any kind of documentation on the gnuplot internals, or > am I better off reading the source? I propose you write a "simple" C/C++/awk/perl program what would do the above you want gnuplot to do. This program would output just two columns on its standard output according to your select. This way, you can fully implement your idea but still don't put plenty of new code and external libraries into gnuplot. If your program is working, it can be referenced from gnuplot web page. Note that gnuplot is used this way for accessing other specific data formats, for example structured data files from synchrotron experiments. Loading dynamical functions would be another solution. But piping works OK. -- PM |