本文整理匯總了Java中java.sql.ResultSetMetaData.isWritable方法的典型用法代碼示例。如果您正苦於以下問題:Java ResultSetMetaData.isWritable方法的具體用法?Java ResultSetMetaData.isWritable怎麽用?Java ResultSetMetaData.isWritable使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類java.sql.ResultSetMetaData
的用法示例。
在下文中一共展示了ResultSetMetaData.isWritable方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: isEqualsTo
import java.sql.ResultSetMetaData; //導入方法依賴的package包/類
boolean isEqualsTo(ResultSetMetaData metadata, int colNum) throws SQLException {
return
metadata.getCatalogName(colNum).equals(InfoSchemaConstants.IS_CATALOG_NAME) &&
metadata.getSchemaName(colNum).isEmpty() &&
metadata.getTableName(colNum).isEmpty() &&
metadata.getColumnName(colNum).equals(columnName) &&
metadata.getColumnLabel(colNum).equals(columnName) &&
metadata.getColumnType(colNum) == type &&
metadata.isNullable(colNum) == nullable &&
// There is an existing bug where query results doesn't contain the precision for VARCHAR field.
//metadata.getPrecision(colNum) == precision &&
metadata.getScale(colNum) == scale &&
metadata.isSigned(colNum) == signed &&
metadata.getColumnDisplaySize(colNum) == displaySize &&
metadata.getColumnClassName(colNum).equals(className) &&
metadata.isSearchable(colNum) &&
metadata.isAutoIncrement(colNum) == false &&
metadata.isCaseSensitive(colNum) == false &&
metadata.isReadOnly(colNum) &&
metadata.isWritable(colNum) == false &&
metadata.isDefinitelyWritable(colNum) == false &&
metadata.isCurrency(colNum) == false;
}
示例2: setTable
import java.sql.ResultSetMetaData; //導入方法依賴的package包/類
/**
* Configures this class, by reading in the structure of the log-table
* Throws an exception, if an database-error occurs !
*
* @param _table
* Description of Parameter
* @exception Exception
* Description of Exception
*/
public void setTable(String _table) throws Exception {
if (isconfigured) { return; }
if (poolConnectionHandler != null) {
con = poolConnectionHandler.getConnection();
if (!isConnected()) { throw new Exception(
"JDBCLogger::setTable(), Given connection isnt connected to database !"); }
}
//Fill logcols with META-informations of the table-columns
stmt = this.createUpdatableStatement();
rs = stmt.executeQuery("SELECT " + _table + ".* FROM " + _table + " WHERE 1 = 2");
JDBCLogColumn logcol;
ResultSetMetaData rsmd = rs.getMetaData();
num = rsmd.getColumnCount();
logcols = new ArrayList(num);
for (int i = 1; i <= num; i++) {
logcol = new JDBCLogColumn();
logcol.name = rsmd.getColumnName(i).toUpperCase();
logcol.sqlType = rsmd.getColumnType(i);
logcol.type = rsmd.getColumnTypeName(i);
logcol.nullable = (rsmd.isNullable(i) == ResultSetMetaData.columnNullable);
logcol.isWritable = rsmd.isWritable(i);
if (!logcol.isWritable) {
logcol.ignore = true;
}
logcols.add(logcol);
}
table = _table;
rs.close();
stmt.close();
freeConnection();
isconfigured = true;
}