3

I am working on a sql parser/interpreter for Objects. More here: Parsing SQL like syntax, design pattern

I just wanted to know if there are any off the shelf libraries for pretty printing the output results. The results would be simple types, collections etc ..

Something like this would be very nice

mysql> SELECT poet,SUM(copies_in_stock) FROM writer GROUP BY poet;
+----------------------+----------------------+
| poet                 | SUM(copies_in_stock) |
+----------------------+----------------------+
| Douglas Livingstone  |                   23 |
| Mongane Wally Serote |                   13 |
+----------------------+----------------------+

Any pointers would be helpful

Community
  • 1
  • 1
jack_carver
  • 1,510
  • 2
  • 13
  • 28

2 Answers2

1

Not that I know of. You can find some internal classes of open-source DB engines that do that, eg: http://www.docjar.org/docs/api/org/apache/derby/tools/JDBCDisplayUtil.html

Alternatively, there are libraries for outputting text in a table format, see: http://trac.inamik.com/trac/jtable_format/

Istvan Devai
  • 3,962
  • 23
  • 21
0

This was exactly what i needed. Pretty print 2D array in Java

Community
  • 1
  • 1
jack_carver
  • 1,510
  • 2
  • 13
  • 28