APIdia Launch Partner
Top Inners Fields Constructors Methods
net.ucanaccess.console

public Class Main

extends Object
Class Inheritance
Annotations
@SuppressWarnings:java:S106
Static Imports
net.ucanaccess.type.SqlConstants.FROM, .SqlConstants.SELECT

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class
Main.TableFormat

Helper to produce table-formatted output of a JDBC resultset.

Field Summary

Modifier and TypeField and Description
private static boolean
private final Connection
private boolean
private static final String
private static final String
private final BufferedReader
private String

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
consoleDump(ResultSet resultSet, PrintStream printStream)

Prints the ResultSet resultSet in a format suitable for the terminal console given by printStream.

private void
executeExport(String cmd)

Parse the cmd to handle command line flags of the form: "export [-d delimiter] [-t table] pathToCsv".

private void
private void
exportCsvAndSchema(CharSequence sqlQuery, String csvFileName, String schemaFileName, Exporter exporter)

Runs the givensqlQuery and exports the CSV to csvFileName.

private static boolean
public static void
main(String[] args)

private void
private void
private void
prompt(String content)

private String
private void
sayHello(String version)

public static void
setBatchMode(boolean batchMode)

private void
start(String[] commands)

pack-priv static List<String>
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

batchModeback to summary
private static boolean batchMode
connback to summary
private final Connection conn
connectedback to summary
private boolean connected
EXPORT_PROMPTback to summary
private static final String EXPORT_PROMPT
EXPORT_USAGEback to summary
private static final String EXPORT_USAGE
inputback to summary
private final BufferedReader input
lastSqlQueryback to summary
private String lastSqlQuery

Constructor Detail

Mainback to summary
public Main(Connection conn, BufferedReader input)

Method Detail

consoleDumpback to summary
public void consoleDump(ResultSet resultSet, PrintStream printStream) throws SQLException

Prints the ResultSet resultSet in a format suitable for the terminal console given by printStream.

executeExportback to summary
private void executeExport(String cmd) throws SQLException, IOException

Parse the cmd to handle command line flags of the form: "export [-d delimiter] [-t table] pathToCsv". For example:

export -d , -t License License.csv
The -d , option changes the delimiter character to a comma instead of the default semicolon. The -t License option dumps the License table using the SQL statement "SELECT * FROM [License]".
executeStatementback to summary
private void executeStatement(String sql) throws SQLException
exportCsvAndSchemaback to summary
private void exportCsvAndSchema(CharSequence sqlQuery, String csvFileName, String schemaFileName, Exporter exporter) throws SQLException, IOException

Runs the givensqlQuery and exports the CSV to csvFileName. and the BigQuery schema to schemaFileName (if given). Uses the given exporter to perform the actual CSV and schema export operations.

hasPasswordback to summary
private static boolean hasPassword(File f) throws IOException
mainback to summary
public static void main(String[] args) throws Exception
printExportHelpback to summary
private void printExportHelp()
promptback to summary
private void prompt()
promptback to summary
private void prompt(String content)
readInputback to summary
private String readInput()
sayHelloback to summary
private void sayHello(String version)
setBatchModeback to summary
public static void setBatchMode(boolean batchMode)
startback to summary
private void start(String[] commands)
tokenizeback to summary
pack-priv static List<String> tokenize(String s) throws IOException
net.ucanaccess.console back to summary

pack-priv Class Main.TableFormat

extends Object
Class Inheritance

Helper to produce table-formatted output of a JDBC resultset.
Author
Markus Spann

Field Summary

Modifier and TypeField and Description
private final List<String>
private final List<Integer>
private final List<Integer>
private static final int
pack-priv static final List<Integer>
private final List<List<String>>

Constructor Summary

AccessConstructor and Description
pack-priv
pack-priv
TableFormat(ResultSet resultSet, int maxRows)

Method Summary

Modifier and TypeMethod and Description
pack-priv static boolean
pack-priv String
pack-priv static String
leftPad(String str, int width)

pack-priv void
output(PrintStream printStream)

pack-priv static String
repeat(String str, int count)

pack-priv static String
rightPad(String str, int width)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

colNamesback to summary
private final List<String> colNames
colTypesback to summary
private final List<Integer> colTypes
colWidthsback to summary
private final List<Integer> colWidths
MAX_COL_WIDTHback to summary
private static final int MAX_COL_WIDTH
NUMERIC_JDBC_TYPESback to summary
pack-priv static final List<Integer> NUMERIC_JDBC_TYPES
recordsback to summary
private final List<List<String>> records

Constructor Detail

TableFormatback to summary
pack-priv TableFormat(ResultSet resultSet) throws SQLException
TableFormatback to summary
pack-priv TableFormat(ResultSet resultSet, int maxRows) throws SQLException

Method Detail

isNumericJdbcTypeback to summary
pack-priv static boolean isNumericJdbcType(int type)
joinWithLenback to summary
pack-priv String joinWithLen(CharSequence delim, List<String> elems)
leftPadback to summary
pack-priv static String leftPad(String str, int width)
outputback to summary
pack-priv void output(PrintStream printStream)
repeatback to summary
pack-priv static String repeat(String str, int count)
rightPadback to summary
pack-priv static String rightPad(String str, int width)