Java Reference
In-Depth Information
System . out . println ( "SQLRunner: Connected to " + dbName );
statement = conn . createStatement ();
iif ( outputFileName == null
null ) {
out = new
new PrintWriter ( System . out );
} else
else {
out = new
new PrintWriter ( new
new FileWriter ( outputFileName ));
}
setOutputMode ( outputModeName );
}
/** Set the output mode.
* @param outputMode Must be a value equal to one of the MODE_XXX values.
* @throws IllegalArgumentException if the mode is not valid.
*/
void
void setOutputMode ( String outputModeName ) {
iif ( outputModeName == null
null ||
outputModeName . length () == 0 ) {
System . err . println (
"invalid mode: " + outputMode + "; must be t, h or s" ); }
outputMode = OutputMode . valueOf ( outputModeName );
setOutputMode ( outputMode );
}
/** Assign the correct ResultsDecorator, creating them on the fly
* using lazy evaluation.
*/
void
void setOutputMode ( OutputMode outputMode ) {
ResultsDecorator newDecorator = null
null ;
switch
switch ( outputMode ) {
case
case t:
newDecorator = textDecorator ;
break
break ;
case
case h:
iif ( htmlDecorator == null
null ) {
htmlDecorator = new
new ResultsDecoratorHTML ( out , verbosity );
}
newDecorator = htmlDecorator ;
break
break ;
case
case s:
iif ( sqlDecorator == null
null ) {
sqlDecorator = new
new ResultsDecoratorSQL ( out , verbosity );
}
newDecorator = sqlDecorator ;
Search WWH ::




Custom Search