提交 42afda4b authored 作者: Thomas Mueller's avatar Thomas Mueller

Data type RESULT_SET: information_schema.function_aliases returned type 0; now…

Data type RESULT_SET: information_schema.function_aliases returned type 0; now type -10 is returned (the same as Oracle: OracleTypes.CURSOR = -10).
上级 8bcb3866
...@@ -42,40 +42,11 @@ import org.h2.util.StringUtils; ...@@ -42,40 +42,11 @@ import org.h2.util.StringUtils;
public class DataType { public class DataType {
/** /**
* This constant is used for JDK 1.3 compatibility * This constant is used to represent the type of a ResultSet. There is no
* and equal to java.sql.Types.BOOLEAN * equivalent java.sql.Types value, but Oracle uses it to represent a
* ResultSet (OracleTypes.CURSOR = -10).
*/ */
public static final int TYPE_BOOLEAN = 16; public static final int TYPE_RESULT_SET = -10;
/**
* This constant is used for JDK 1.3 compatibility
* and equal to java.sql.Types.DATALINK
*/
public static final int TYPE_DATALINK = 70;
/**
* This constant is used for JDK 1.5 compatibility
* and equal to java.sql.Types.LONGNVARCHAR
*/
public static final int TYPE_LONGNVARCHAR = -16;
/**
* This constant is used for JDK 1.5 compatibility
* and equal to java.sql.Types.NCHAR
*/
public static final int TYPE_NCHAR = -15;
/**
* This constant is used for JDK 1.5 compatibility
* and equal to java.sql.Types.NVARCHAR
*/
public static final int TYPE_NVARCHAR = -9;
/**
* This constant is used for JDK 1.5 compatibility
* and equal to java.sql.Types.NCLOB
*/
public static final int TYPE_NCLOB = 2011;
/** /**
* The list of types. An ArrayList so that Tomcat doesn't set it to null * The list of types. An ArrayList so that Tomcat doesn't set it to null
...@@ -222,7 +193,7 @@ public class DataType { ...@@ -222,7 +193,7 @@ public class DataType {
new String[]{"VARCHAR_IGNORECASE"}, new String[]{"VARCHAR_IGNORECASE"},
48 48
); );
add(Value.BOOLEAN, DataType.TYPE_BOOLEAN, "Boolean", add(Value.BOOLEAN, Types.BOOLEAN, "Boolean",
createDecimal(ValueBoolean.PRECISION, ValueBoolean.PRECISION, 0, ValueBoolean.DISPLAY_SIZE, false, false), createDecimal(ValueBoolean.PRECISION, ValueBoolean.PRECISION, 0, ValueBoolean.DISPLAY_SIZE, false, false),
new String[]{"BOOLEAN", "BIT", "BOOL"}, new String[]{"BOOLEAN", "BIT", "BOOL"},
// the value is always in the cache // the value is always in the cache
...@@ -354,7 +325,7 @@ public class DataType { ...@@ -354,7 +325,7 @@ public class DataType {
32 32
); );
dataType = new DataType(); dataType = new DataType();
add(Value.RESULT_SET, 0, "ResultSet", add(Value.RESULT_SET, DataType.TYPE_RESULT_SET, "ResultSet",
dataType, dataType,
new String[]{"RESULT_SET"}, new String[]{"RESULT_SET"},
400 400
...@@ -604,6 +575,13 @@ public class DataType { ...@@ -604,6 +575,13 @@ public class DataType {
v = ValueArray.get(values); v = ValueArray.get(values);
break; break;
} }
case Value.RESULT_SET: {
ResultSet x = (ResultSet) rs.getObject(columnIndex);
if (x == null) {
return ValueNull.INSTANCE;
}
return ValueResultSet.get(rs);
}
default: default:
throw DbException.throwInternalError("type="+type); throw DbException.throwInternalError("type="+type);
} }
...@@ -727,18 +705,18 @@ public class DataType { ...@@ -727,18 +705,18 @@ public class DataType {
public static int convertSQLTypeToValueType(int sqlType) { public static int convertSQLTypeToValueType(int sqlType) {
switch(sqlType) { switch(sqlType) {
case Types.CHAR: case Types.CHAR:
case DataType.TYPE_NCHAR: case Types.NCHAR:
return Value.STRING_FIXED; return Value.STRING_FIXED;
case Types.VARCHAR: case Types.VARCHAR:
case Types.LONGVARCHAR: case Types.LONGVARCHAR:
case DataType.TYPE_NVARCHAR: case Types.NVARCHAR:
case DataType.TYPE_LONGNVARCHAR: case Types.LONGNVARCHAR:
return Value.STRING; return Value.STRING;
case Types.NUMERIC: case Types.NUMERIC:
case Types.DECIMAL: case Types.DECIMAL:
return Value.DECIMAL; return Value.DECIMAL;
case Types.BIT: case Types.BIT:
case DataType.TYPE_BOOLEAN: case Types.BOOLEAN:
return Value.BOOLEAN; return Value.BOOLEAN;
case Types.INTEGER: case Types.INTEGER:
return Value.INT; return Value.INT;
...@@ -769,12 +747,14 @@ public class DataType { ...@@ -769,12 +747,14 @@ public class DataType {
case Types.BLOB: case Types.BLOB:
return Value.BLOB; return Value.BLOB;
case Types.CLOB: case Types.CLOB:
case DataType.TYPE_NCLOB: case Types.NCLOB:
return Value.CLOB; return Value.CLOB;
case Types.NULL: case Types.NULL:
return Value.NULL; return Value.NULL;
case Types.ARRAY: case Types.ARRAY:
return Value.ARRAY; return Value.ARRAY;
case DataType.TYPE_RESULT_SET:
return Value.RESULT_SET;
default: default:
throw DbException.get(ErrorCode.UNKNOWN_DATA_TYPE_1, "" + sqlType); throw DbException.get(ErrorCode.UNKNOWN_DATA_TYPE_1, "" + sqlType);
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论