Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

It would be super if isql had a "-Q" switch for ultra-quiet [CORE6099] #6348

Open
firebird-automations opened this issue Jul 13, 2019 · 3 comments

Comments

@firebird-automations
Copy link
Collaborator

Submitted by: Ray Holme (rholme)

Votes: 1

If "-Q" would turn off all blank lines and all headers (names plus the "====" underline lines), it would be super useful for plain files
being used by other routines where SQL access is kind of hard (e.g. bash scripts, but any program could use these fixed size files).

For me to use SQL output now, I use "-q" and an egrep statement like '^$|=====|COUNT" (if I have a count in the output, else some other field name).
This is somewhat flawed as the latter two conditions could actually occur in data.

@firebird-automations
Copy link
Collaborator Author

Commented by: @pavel-zotov

If you create trivial script:
C:\FB\30SS>echo set heading off;select count(*) from rdb$database; > c:\temp\tmp4isql.tmp

... and run ISQL like this:
C:\FB\30SS>C:\FB\30SS\isql /:e30 -i c:\temp\tmp4isql.tmp

-- then outbut will contain two empty lines and result of count(*), but WITHOUT header and "========":

                1

PS.
Unfortunately, for some backward compatibility reasons one can not do almost the same but using PIPE (without creating script):

C:\FB\30SS>echo set heading off;select count(*) from rdb$database; | C:\FB\30SS\isql /:e30 -q
Database: /:e30, User: SYSDBA
SQL>
1

SQL>

Garbage lines with "SQL>" prompt appear always :(

@firebird-automations
Copy link
Collaborator Author

Commented by: Ray Holme (rholme)

Nice Pavel. Thank you.

So to summarize and get SUPER quiet -
a) use "isql -q"
b) embed the following command before doing anything else
"set heading off;"

I assume one does not need to specify "-page 999999999" as ALL heading are gone
and even voluminous output will not get a page heading.

VERY NICE. Thanks again. Close this one and suggest that it go in the FB book.

@firebird-automations
Copy link
Collaborator Author

Commented by: Ray Holme (rholme)

Just a note in passing, I do NOT get "SQL>" in my output streams.

I suspect that is because isql knows my input is not from a human typing, but from an input stream
I think that is a feature - at least it is in Linux and I like it a lot (don't change that :=]]] )

[rainbow]$ echo 'set heading off;select count(*) from rdb$database;' | isql $DB

       1 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant