}
protected String type = null;
public void doTag(XMLOutput output) throws JellyTagException {
SQLExecutionTag parent
= (SQLExecutionTag)findAncestorWithClass
(this, SQLExecutionTag.class);
if (parent == null) {
throw new JellyTagException
(Resources.getMessage("SQL_PARAM_OUTSIDE_PARENT"));
}
Object paramValue = value;
if (value != null) {
paramValue = value;
} else {
String bodyContent = getBodyText();
if (bodyContent != null) {
bodyContent = bodyContent.trim();
if (bodyContent.length() > 0) {
paramValue = bodyContent;
}
}
}
if (type != null) {
int typeVal = Integer.MIN_VALUE;
if (type.equals("ARRAY")) {
typeVal = Types.ARRAY;
} else if (type.equals("BLOB")) {
typeVal = Types.BLOB;
} else if (type.equals("CLOB")) {
typeVal = Types.CLOB;
} else if (type.equals("REF")) {
typeVal = Types.REF;
} else if (type.equals("DATALINK")) {
typeVal = Types.DATALINK;
} else if (type.equals("BOOLEAN")) {
typeVal = Types.BOOLEAN;
} else if (type.equals("BIT")) {
typeVal = Types.BIT;
} else if (type.equals("TINYINT")) {
typeVal = Types.TINYINT;
} else if (type.equals("SMALLINT")) {
typeVal = Types.SMALLINT;
} else if (type.equals("INTEGER")) {
typeVal = Types.INTEGER;
} else if (type.equals("BIGINT")) {
typeVal = Types.BIGINT;
} else if (type.equals("FLOAT")) {
typeVal = Types.FLOAT;
} else if (type.equals("REAL")) {
typeVal = Types.REAL;
} else if (type.equals("DOUBLE")) {
typeVal = Types.DOUBLE;
} else if (type.equals("NUMERIC")) {
typeVal = Types.NUMERIC;
} else if (type.equals("DECIMAL")) {
typeVal = Types.DECIMAL;
} else if (type.equals("CHAR")) {
typeVal = Types.CHAR;
} else if (type.equals("VARCHAR")) {
typeVal = Types.VARCHAR;
} else if (type.equals("LONGVARCHAR")) {
typeVal = Types.LONGVARCHAR;
} else if (type.equals("DATE")) {
typeVal = Types.DATE;
} else if (type.equals("TIME")) {
typeVal = Types.TIME;
} else if (type.equals("TIMESTAMP")) {
typeVal = Types.TIMESTAMP;
} else if (type.equals("BINARY")) {
typeVal = Types.BINARY;
} else if (type.equals("VARBINARY")) {
typeVal = Types.VARBINARY;
} else if (type.equals("LONGVARBINARY")) {
typeVal = Types.LONGVARBINARY;
} else if (type.equals("NULL")) {
typeVal = Types.NULL;
} else if (type.equals("OTHER")) {
typeVal = Types.OTHER;
} else if (type.equals("JAVA_OBJECT")) {
typeVal = Types.JAVA_OBJECT;
} else if (type.equals("DISTINCT")) {
typeVal = Types.DISTINCT;
} else if (type.equals("STRUCT")) {
typeVal = Types.STRUCT;
} else {
throw new JellyTagException
("Unrecognized value in \"type\" attribute.");
}
parent.addSQLParameter (new ParamAttributes(paramValue, typeVal));
return;
}
parent.addSQLParameter(paramValue);
}