Java Reference
In-Depth Information
}
else
else iif
(
rest
.
startsWith
(
"t"
)) {
// Display one table. Some DatabaseMetaData implementations
// don't do ignorecase so, for now, convert to UPPERCASE.
String tableName
=
rest
.
substring
(
1
).
trim
();
iif
(
upperCaseTableNames
) {
tableName
=
tableName
.
toUpperCase
();
}
System
.
out
.
println
(
"-- Display table "
+
tableName
);
DatabaseMetaData md
=
conn
.
getMetaData
();
ResultSet rs
=
md
.
getColumns
(
null
null
,
tableName
,
"%"
);
currentDecorator
.
displayTable
(
tableName
,
rs
);
textDecorator
.
flush
();
}
else
null
,
null
else
throw
throw new
new
SyntaxException
(
"\\d"
+
rest
+
" invalid"
);
}
/**
* @param rs
* @return
* @throws SQLException
*/
private
private static
static
CachedRowSet
cacheResultSet
(
ResultSet rs
)
throws
throws
SQLException
{
CachedRowSet rows
=
null
null
;
//new com.sun.rowset.WebRowSetImpl();
rows
.
populate
(
rs
);
return
return
rows
;
}
/** Set the output to the given filename.
* @param fileName
*/
public
public
void
void
setOutputFile
(
String fileName
)
throws
throws
IOException
{
iif
(
fileName
==
null
null
) {
/* Set the output file back to System.out */
setOutputFile
(
new
new
PrintWriter
(
System
.
out
,
true
true
));
}
else
else
{
File file
=
new
new
File
(
fileName
);
setOutputFile
(
new
true
));
System
.
out
.
println
(
"Output set to "
+
file
.
getCanonicalPath
());
new
PrintWriter
(
new
new
FileWriter
(
file
),
true
}
}
/** Set the output to the given Writer; immediately
* update the textDecorator so \dt works...
* @param writer
*/
public
public
void
void
setOutputFile
(
PrintWriter writer
) {