Hugh --

To clarify, I mean that I just want the SQL output without any headers
or footers.  This is for sysadmin-type scripting rather than for
actual DB use.  For example, the command:

echo "select U_NAME FROM SYS_USERS WHERE U_ID=106;"|\
  /opt/virtuoso/bin/isql 1111 dba $dba_password

results in:
Connected to OpenLink Virtuoso
Driver: 07.20.3212 OpenLink Virtuoso ODBC Driver
OpenLink Interactive SQL (Virtuoso), version 0.9849b.
Type HELP; for help and EXIT; to exit.
SQL> U_NAME
VARCHAR NOT NULL
_______________________________________________________________________________

SPARQL

1 Rows. -- 1 msec.
SQL> 

What I want is to get just the actual one line of output:

SPARQL

I can improve on the above somewhat through an approach like this:

$ cat foo.sql
set MESSAGE OFF;
set VERBOSE OFF;
set BANNER OFF;
select U_NAME FROM SYS_USERS WHERE U_ID=106;

$ /opt/virtuoso/bin/isql 1111 dba `cat $dba_password_file` foo.sql
Connected to OpenLink Virtuoso
Driver: 07.20.3212 OpenLink Virtuoso ODBC Driver
SPARQL

But I still get the "Connected" and "Driver:" output.  The isql
variables / macros are set too late to help me.  So presumably, a
command-line option is needed.

It is possible to script around this with suitable head, tail, and
grep pipe postprocessing.  However, those kinds of scripts tend to be
fragile in the face of software upgrades.  The formats tend to change
subtly between versions.

So DB systems often provide a command-line option that just outputs
raw data.  sybase's isql command has such an option.  mysql's mysql
command has such an option.  So does postgres's command.  It would be
nice if virtuoso's isql did as well, if it doesn't already.

Thanks!

- Morty


On Tue, Apr 07, 2015 at 12:39:32AM +0100, Hugh Williams wrote:
> Hi Morty,
> 
> Not sure what you mean by "Batch mode”, Virtuoso has a “load <filename>;” 
> command that can be used for executing multiple isql commands at once or are 
> you seeking to be able to load a series sql command as part of one 
> transaction and commit when done ?
> 
> Best Regards
> Hugh Williams
> Professional Services
> OpenLink Software, Inc.      //              http://www.openlinksw.com/
> Weblog   -- http://www.openlinksw.com/blogs/
> LinkedIn -- http://www.linkedin.com/company/openlink-software/
> Twitter  -- http://twitter.com/OpenLink
> Google+  -- http://plus.google.com/100570109519069333827/
> Facebook -- http://www.facebook.com/OpenLinkSoftware
> Universal Data Access, Integration, and Management Technology Providers
> 
> > On 4 Apr 2015, at 20:59, Morty <morty+virtu...@frakir.org> wrote:
> > 
> > Is there some way to put virtuoso isql into a true batch mode?  Some
> > other database system command-line interfaces provide a batch mode
> > option that just displays results, not version banners, table headers,
> > or time information.  This is very handy for building scripts around.
> > 
> > I can sort-of emulate this in isql by setting:
> > 
> > set VERBOSE OFF;
> > set BANNER OFF;
> > set MESSAGE OFF;
> > 
> > But I still get the "Connected to" and "Driver" lines.  And I'm also
> > concerned that later versions could add new sources of information.
> > So it would be nice to have a command-line option that will set the
> > options necessary to script cleanly, both now and in the future.
> > 
> > Hopefully such a thing already exists, and I just didn't find it.  If
> > not, feature request: please implement such a mechanism.
> > 
> > Note: this is currently under virtuoso open source version 7.2.0,
> > under Linux.  The commercial version is not an option at this time.
> > 
> > - Morty
> > 
> > ------------------------------------------------------------------------------
> > Dive into the World of Parallel Programming The Go Parallel Website, 
> > sponsored
> > by Intel and developed in partnership with Slashdot Media, is your hub for 
> > all
> > things parallel software development, from weekly thought leadership blogs 
> > to
> > news, videos, case studies, tutorials and more. Take a look and join the 
> > conversation now. http://goparallel.sourceforge.net/
> > _______________________________________________
> > Virtuoso-users mailing list
> > Virtuoso-users@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/virtuoso-users
> 

-- 
                           Mordechai T. Abzug
Linux red-sonja 3.11.0-24-generic #42-Ubuntu SMP Fri Jul 4 21:19:31 UTC 2014 
x86_64 x86_64 x86_64 GNU/Linux
"A billion here, a billion there, sooner or later it adds up to real
 money." -Everett Dirksen

------------------------------------------------------------------------------
BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT
Develop your own process in accordance with the BPMN 2 standard
Learn Process modeling best practices with Bonita BPM through live exercises
http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual- event?utm_
source=Sourceforge_BPM_Camp_5_6_15&utm_medium=email&utm_campaign=VA_SF
_______________________________________________
Virtuoso-users mailing list
Virtuoso-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/virtuoso-users

Reply via email to