Java Reference
In-Depth Information
throws
throws IOException , SQLException , SyntaxException {
String rest = null
null ;
iif ( str . length () > 2 ) {
rest = str . substring ( 2 );
}
iif ( str . startsWith ( "\\d" )) {
// Display
iif ( rest == null
null ){
throw
throw new
new SyntaxException ( "\\d needs display arg" );
}
display ( rest );
} else
else iif ( str . startsWith ( "\\m" )) {
// MODE
iif ( rest == null
null ){
throw
throw new
new SyntaxException ( "\\m needs output mode arg" );
}
setOutputMode ( rest );
} else
else iif ( str . startsWith ( "\\o" )){
iif ( rest == null
null ){
throw
throw new
new SyntaxException ( "\\o needs output file arg" );
}
setOutputFile ( rest );
} else
else iif ( str . startsWith ( "\\q" )){
exit ( 0 );
} else
else {
throw
throw new
new SyntaxException ( "Unknown escape: " + str );
}
}
/**
* Display - generate output for \dt and similar escapes
* @param rest - what to display - the argument with the \d stripped off
* XXX: Move more formatting to ResultsDecorator: listTables(rs), listColumns(rs)
*/
private
private void
void display ( String rest )
throws
throws IOException , SQLException , SyntaxException {
// setOutputMode(OutputMode.t);
iif ( rest . equals ( "t" )) {
// Display list of tables
DatabaseMetaData md = conn . getMetaData ();
ResultSet rs =
md . getTables ( null
null , null
null , "%" , new
new String []{ "TABLE" , "VIEW" });
textDecorator . setWriter ( out );
textDecorator . write ( rs );
textDecorator . flush ();
Search WWH ::




Custom Search