Java Reference
In-Depth Information
out
=
writer
;
currentDecorator
.
setWriter
(
out
);
}
/** Run one Statement, and format results as per Update or Query.
* Called from runScript or from user code.
* @throws SyntaxException
*/
public
public
void
void
runStatement
(
final
final
String rawString
)
throws
throws
IOException
,
SQLException
,
SyntaxException
{
final
final
String inString
=
rawString
.
trim
();
iif
(
verbosity
!=
Verbosity
.
QUIET
) {
out
.
println
(
"Executing : <<"
+
inString
+
">>"
);
out
.
flush
();
}
currentDecorator
.
println
(
String
.
format
(
"-- output from command -- \"%s\"%n"
,
inString
));
escape
=
false
false
;
iif
(
inString
.
startsWith
(
"\\"
)) {
escape
=
true
true
;
doEscape
(
inString
);
return
return
;
}
boolean
boolean
hasResultSet
=
statement
.
execute
(
inString
);
// DO IT - call the database.
iif
(!
hasResultSet
) {
currentDecorator
.
printRowCount
(
statement
.
getUpdateCount
());
}
else
else
{
int
int
n
=
currentDecorator
.
write
(
cacheResultSet
(
statement
.
getResultSet
()));
iif
(
verbosity
==
Verbosity
.
VERBOSE
||
verbosity
==
Verbosity
.
DEBUG
) {
currentDecorator
.
printRowCount
(
n
);
}
}
currentDecorator
.
flush
();
}
/** Extract one statement from the given Reader.
* Ignore comments and null lines.
* @return The SQL statement, up to but not including the ';' character.
* May be null if no statement found.
*/