2013/6/3 Cecil Westerhof <[email protected]>:
> At the moment I use:
> java -cp /home/cecil/java/h2/bin/h2-1.3.171.jar org.h2.tools.Shell …
>
> To get the result of a query in BASH. But the results of the query are
> limited to 100 characters per column. Is there a way to get the
> complete result?
>
> Less important, but icing on the cake: is it possible to get rid of the
> header?
As I already wrote: I found a solution. (I do not need to write a
patch yet. :-D )
But I found another one. Both solutions have there pro's and cons.
The solutions.
The ‘old’ one:
(java -cp /home/cecil/java/h2/bin/h2-1.3.171.jar org.h2.tools.Shell <<EOT
jdbc:h2:tcp://localhost/~/databases/quotes
LIST
SELECT 1
;
SELECT quote
, author
FROM quotes
, authors
WHERE quotes.authorID = authors.authorID
ORDER BY RAND()
LIMIT 10
;
EXIT
EOT
) | grep --only-matching '\(QUOTE :.*$\)\|\(AUTHOR:.*$\)'
The ‘new one:
java -cp /home/cecil/java/h2/bin/h2-1.3.171.jar org.h2.tools.Shell \
-url 'jdbc:h2:tcp://localhost/~/databases/quotes' \
-user sa \
-password '' \
-sql "
CALL CSVWRITE('test.csv', '
SELECT quote
, author
FROM quotes
, authors
WHERE quotes.authorID = authors.authorID
ORDER BY RAND()
LIMIT 10
;
');
"
There is more as one way to skin a cat.
--
Cecil Westerhof
--
You received this message because you are subscribed to the Google Groups "H2
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/h2-database?hl=en-US.
For more options, visit https://groups.google.com/groups/opt_out.