com.xigole.util.sql.outputformatter
Interface JisqlFormatter

All Known Implementing Classes:
CSVFormatter, DefaultFormatter, XMLFormatter

public interface JisqlFormatter

This is the definition of what a JisqlFormatter does.


Method Summary
 void consumeOptions(joptsimple.OptionSet options)
          Consumes any options that were specified on the command line.
 void formatData(java.io.PrintStream out, java.sql.ResultSet resultSet, java.sql.ResultSetMetaData metaData)
          Called to output the data.
 void formatFooter(java.io.PrintStream out, java.sql.ResultSetMetaData metaData)
          Outputs a footer for a query.
 void formatHeader(java.io.PrintStream out, java.sql.ResultSetMetaData metaData)
          Outputs a header for a query.
 void setSupportedOptions(joptsimple.OptionParser parser)
          Sets a the option list for this formatter.
 void usage(java.io.PrintStream out)
          Called to output a usage message to the command line window.
 

Method Detail

setSupportedOptions

void setSupportedOptions(joptsimple.OptionParser parser)
Sets a the option list for this formatter.

Parameters:
parser - - the OptionParser to use.

consumeOptions

void consumeOptions(joptsimple.OptionSet options)
                    throws java.lang.Exception
Consumes any options that were specified on the command line.

Parameters:
options - the OptionSet that the main driver is using. Implementing classes should add their supported parameters to the list.
Throws:
java.lang.Exception - if there is a problem parsing the command line arguments. Note that Jisql includes jopt-simple so you can use that to parse your command line. See http://jopt-simple.sourceforge.net/ for more information.

usage

void usage(java.io.PrintStream out)
Called to output a usage message to the command line window. This message should contain information on how to call the formatter.

Parameters:
out - where to put the usage message.

formatHeader

void formatHeader(java.io.PrintStream out,
                  java.sql.ResultSetMetaData metaData)
                  throws java.lang.Exception
Outputs a header for a query. This is called before any data is output.

Parameters:
out - where to put header output.
metaData - the ResultSetMetaData for the output.
Throws:
java.lang.Exception

formatData

void formatData(java.io.PrintStream out,
                java.sql.ResultSet resultSet,
                java.sql.ResultSetMetaData metaData)
                throws java.lang.Exception
Called to output the data.

Parameters:
out - where to put output data.
resultSet - the ResultSet for the row.
metaData - the ResultSetMetaData for the row.
Throws:
java.lang.Exception

formatFooter

void formatFooter(java.io.PrintStream out,
                  java.sql.ResultSetMetaData metaData)
                  throws java.lang.Exception
Outputs a footer for a query. This is called after all data has been exhausted.

Parameters:
out - where to put footer output.
metaData - the ResultSetMetaData for the output.
Throws:
java.lang.Exception