use of com.ctrip.platform.dal.daogen.enums.DbType in project dal by ctripcorp.
the class CsharpSpParamResultSetExtractor method extract.
@Override
public List<AbstractParameterHost> extract(ResultSet rs) throws SQLException {
List<AbstractParameterHost> parameters = new ArrayList<>();
while (rs.next()) {
int paramMode = rs.getShort("COLUMN_TYPE");
if (!DbUtils.validMode.contains(paramMode)) {
continue;
}
CSharpParameterHost host = new CSharpParameterHost();
DbType dbType = DbUtils.getDotNetDbType(rs.getString("TYPE_NAME"), rs.getInt("DATA_TYPE"), rs.getInt("LENGTH"), false, null);
host.setDbType(dbType);
host.setNullable(rs.getShort("NULLABLE") == DatabaseMetaData.columnNullable);
if (paramMode == DatabaseMetaData.procedureColumnIn) {
host.setDirection(ParameterDirection.Input);
} else if (paramMode == DatabaseMetaData.procedureColumnInOut) {
host.setDirection(ParameterDirection.InputOutput);
} else {
host.setDirection(ParameterDirection.Output);
}
host.setName(rs.getString("COLUMN_NAME"));
host.setType(DbType.getCSharpType(host.getDbType()));
host.setNullable(rs.getShort("NULLABLE") == DatabaseMetaData.columnNullable);
if (host.getType() == null) {
host.setType("string");
host.setDbType(DbType.AnsiString);
}
parameters.add(host);
}
return parameters;
}
Aggregations