Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
e2dea134
提交
e2dea134
authored
1月 17, 2019
作者:
Evgenij Ryazanov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Use TypeInfo in results
上级
f70ff5e2
显示空白字符变更
内嵌
并排
正在显示
22 个修改的文件
包含
112 行增加
和
194 行删除
+112
-194
Expression.java
h2/src/main/org/h2/expression/Expression.java
+2
-5
ConditionInSelect.java
...c/main/org/h2/expression/condition/ConditionInSelect.java
+1
-1
JdbcArray.java
h2/src/main/org/h2/jdbc/JdbcArray.java
+3
-2
JdbcDatabaseMetaData.java
h2/src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
+6
-6
JdbcResultSetMetaData.java
h2/src/main/org/h2/jdbc/JdbcResultSetMetaData.java
+6
-6
ValueDataType.java
h2/src/main/org/h2/mvstore/db/ValueDataType.java
+6
-4
LazyResult.java
h2/src/main/org/h2/result/LazyResult.java
+3
-17
LocalResultImpl.java
h2/src/main/org/h2/result/LocalResultImpl.java
+3
-17
MergedResult.java
h2/src/main/org/h2/result/MergedResult.java
+1
-2
ResultColumn.java
h2/src/main/org/h2/result/ResultColumn.java
+13
-25
ResultInterface.java
h2/src/main/org/h2/result/ResultInterface.java
+2
-25
ResultRemote.java
h2/src/main/org/h2/result/ResultRemote.java
+2
-16
SimpleResult.java
h2/src/main/org/h2/result/SimpleResult.java
+24
-30
UpdatableRow.java
h2/src/main/org/h2/result/UpdatableRow.java
+1
-1
Data.java
h2/src/main/org/h2/store/Data.java
+11
-8
FunctionTable.java
h2/src/main/org/h2/table/FunctionTable.java
+1
-5
DataType.java
h2/src/main/org/h2/value/DataType.java
+1
-0
Transfer.java
h2/src/main/org/h2/value/Transfer.java
+8
-7
Value.java
h2/src/main/org/h2/value/Value.java
+2
-4
ValueResultSet.java
h2/src/main/org/h2/value/ValueResultSet.java
+3
-3
TestFunctions.java
h2/src/test/org/h2/test/db/TestFunctions.java
+2
-2
TestValue.java
h2/src/test/org/h2/test/unit/TestValue.java
+11
-8
没有找到文件。
h2/src/main/org/h2/expression/Expression.java
浏览文件 @
e2dea134
...
@@ -402,11 +402,8 @@ public abstract class Expression {
...
@@ -402,11 +402,8 @@ public abstract class Expression {
Database
db
=
session
==
null
?
null
:
session
.
getDatabase
();
Database
db
=
session
==
null
?
null
:
session
.
getDatabase
();
for
(
int
i
=
0
;
i
<
columnCount
;
i
++)
{
for
(
int
i
=
0
;
i
<
columnCount
;
i
++)
{
String
name
=
result
.
getColumnName
(
i
);
String
name
=
result
.
getColumnName
(
i
);
int
type
=
result
.
getColumnType
(
i
);
TypeInfo
type
=
result
.
getColumnType
(
i
);
long
precision
=
result
.
getColumnPrecision
(
i
);
Column
col
=
new
Column
(
name
,
type
);
int
scale
=
result
.
getColumnScale
(
i
);
int
displaySize
=
result
.
getDisplaySize
(
i
);
Column
col
=
new
Column
(
name
,
type
,
precision
,
scale
,
displaySize
);
Expression
expr
=
new
ExpressionColumn
(
db
,
col
);
Expression
expr
=
new
ExpressionColumn
(
db
,
col
);
expressions
[
i
]
=
expr
;
expressions
[
i
]
=
expr
;
}
}
...
...
h2/src/main/org/h2/expression/condition/ConditionInSelect.java
浏览文件 @
e2dea134
...
@@ -72,7 +72,7 @@ public class ConditionInSelect extends Condition {
...
@@ -72,7 +72,7 @@ public class ConditionInSelect extends Condition {
return
ValueBoolean
.
TRUE
;
return
ValueBoolean
.
TRUE
;
}
}
}
else
{
}
else
{
int
dataType
=
rows
.
getColumnType
(
0
);
int
dataType
=
rows
.
getColumnType
(
0
)
.
getValueType
()
;
if
(
dataType
==
Value
.
NULL
)
{
if
(
dataType
==
Value
.
NULL
)
{
return
ValueBoolean
.
FALSE
;
return
ValueBoolean
.
FALSE
;
}
}
...
...
h2/src/main/org/h2/jdbc/JdbcArray.java
浏览文件 @
e2dea134
...
@@ -15,6 +15,7 @@ import org.h2.api.ErrorCode;
...
@@ -15,6 +15,7 @@ import org.h2.api.ErrorCode;
import
org.h2.message.DbException
;
import
org.h2.message.DbException
;
import
org.h2.message.TraceObject
;
import
org.h2.message.TraceObject
;
import
org.h2.result.SimpleResult
;
import
org.h2.result.SimpleResult
;
import
org.h2.value.TypeInfo
;
import
org.h2.value.Value
;
import
org.h2.value.Value
;
import
org.h2.value.ValueArray
;
import
org.h2.value.ValueArray
;
import
org.h2.value.ValueLong
;
import
org.h2.value.ValueLong
;
...
@@ -257,9 +258,9 @@ public class JdbcArray extends TraceObject implements Array {
...
@@ -257,9 +258,9 @@ public class JdbcArray extends TraceObject implements Array {
private
ResultSet
getResultSetImpl
(
long
index
,
int
count
)
{
private
ResultSet
getResultSetImpl
(
long
index
,
int
count
)
{
int
id
=
getNextId
(
TraceObject
.
RESULT_SET
);
int
id
=
getNextId
(
TraceObject
.
RESULT_SET
);
SimpleResult
rs
=
new
SimpleResult
();
SimpleResult
rs
=
new
SimpleResult
();
rs
.
addColumn
(
"INDEX"
,
"INDEX"
,
Value
.
LONG
,
0
,
0
,
ValueLong
.
DISPLAY_SIZE
);
rs
.
addColumn
(
"INDEX"
,
"INDEX"
,
TypeInfo
.
TYPE_LONG
);
// TODO array result set: there are multiple data types possible
// TODO array result set: there are multiple data types possible
rs
.
addColumn
(
"VALUE"
,
"VALUE"
,
Value
.
NULL
,
0
,
0
,
15
);
rs
.
addColumn
(
"VALUE"
,
"VALUE"
,
TypeInfo
.
TYPE_NULL
);
if
(
value
!=
ValueNull
.
INSTANCE
)
{
if
(
value
!=
ValueNull
.
INSTANCE
)
{
Value
[]
values
=
((
ValueArray
)
value
).
getList
();
Value
[]
values
=
((
ValueArray
)
value
).
getList
();
count
=
checkRange
(
index
,
count
,
values
.
length
);
count
=
checkRange
(
index
,
count
,
values
.
length
);
...
...
h2/src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
浏览文件 @
e2dea134
...
@@ -11,7 +11,6 @@ import java.sql.PreparedStatement;
...
@@ -11,7 +11,6 @@ import java.sql.PreparedStatement;
import
java.sql.ResultSet
;
import
java.sql.ResultSet
;
import
java.sql.RowIdLifetime
;
import
java.sql.RowIdLifetime
;
import
java.sql.SQLException
;
import
java.sql.SQLException
;
import
java.sql.Types
;
import
java.util.Arrays
;
import
java.util.Arrays
;
import
java.util.Map.Entry
;
import
java.util.Map.Entry
;
import
java.util.Properties
;
import
java.util.Properties
;
...
@@ -26,6 +25,7 @@ import org.h2.message.Trace;
...
@@ -26,6 +25,7 @@ import org.h2.message.Trace;
import
org.h2.message.TraceObject
;
import
org.h2.message.TraceObject
;
import
org.h2.result.SimpleResult
;
import
org.h2.result.SimpleResult
;
import
org.h2.util.StringUtils
;
import
org.h2.util.StringUtils
;
import
org.h2.value.TypeInfo
;
import
org.h2.value.ValueInt
;
import
org.h2.value.ValueInt
;
import
org.h2.value.ValueString
;
import
org.h2.value.ValueString
;
...
@@ -3187,12 +3187,12 @@ public class JdbcDatabaseMetaData extends TraceObject implements
...
@@ -3187,12 +3187,12 @@ public class JdbcDatabaseMetaData extends TraceObject implements
public
ResultSet
getClientInfoProperties
()
throws
SQLException
{
public
ResultSet
getClientInfoProperties
()
throws
SQLException
{
Properties
clientInfo
=
conn
.
getClientInfo
();
Properties
clientInfo
=
conn
.
getClientInfo
();
SimpleResult
result
=
new
SimpleResult
();
SimpleResult
result
=
new
SimpleResult
();
result
.
addColumn
(
"NAME"
,
"NAME"
,
Type
s
.
VARCHAR
,
0
,
0
,
Integer
.
MAX_VALUE
);
result
.
addColumn
(
"NAME"
,
"NAME"
,
Type
Info
.
TYPE_STRING_DEFAULT
);
result
.
addColumn
(
"MAX_LEN"
,
"MAX_LEN"
,
Type
s
.
INTEGER
,
0
,
0
,
ValueInt
.
DISPLAY_SIZE
);
result
.
addColumn
(
"MAX_LEN"
,
"MAX_LEN"
,
Type
Info
.
TYPE_INT
);
result
.
addColumn
(
"DEFAULT_VALUE"
,
"DEFAULT_VALUE"
,
Type
s
.
VARCHAR
,
0
,
0
,
Integer
.
MAX_VALUE
);
result
.
addColumn
(
"DEFAULT_VALUE"
,
"DEFAULT_VALUE"
,
Type
Info
.
TYPE_STRING_DEFAULT
);
result
.
addColumn
(
"DESCRIPTION"
,
"DESCRIPTION"
,
Type
s
.
VARCHAR
,
0
,
0
,
Integer
.
MAX_VALUE
);
result
.
addColumn
(
"DESCRIPTION"
,
"DESCRIPTION"
,
Type
Info
.
TYPE_STRING_DEFAULT
);
// Non-standard column
// Non-standard column
result
.
addColumn
(
"VALUE"
,
"VALUE"
,
Type
s
.
VARCHAR
,
0
,
0
,
Integer
.
MAX_VALUE
);
result
.
addColumn
(
"VALUE"
,
"VALUE"
,
Type
Info
.
TYPE_STRING_DEFAULT
);
for
(
Entry
<
Object
,
Object
>
entry
:
clientInfo
.
entrySet
())
{
for
(
Entry
<
Object
,
Object
>
entry
:
clientInfo
.
entrySet
())
{
result
.
addRow
(
ValueString
.
get
((
String
)
entry
.
getKey
()),
ValueInt
.
get
(
Integer
.
MAX_VALUE
),
result
.
addRow
(
ValueString
.
get
((
String
)
entry
.
getKey
()),
ValueInt
.
get
(
Integer
.
MAX_VALUE
),
ValueString
.
EMPTY
,
ValueString
.
EMPTY
,
ValueString
.
get
((
String
)
entry
.
getValue
()));
ValueString
.
EMPTY
,
ValueString
.
EMPTY
,
ValueString
.
get
((
String
)
entry
.
getValue
()));
...
...
h2/src/main/org/h2/jdbc/JdbcResultSetMetaData.java
浏览文件 @
e2dea134
...
@@ -102,7 +102,7 @@ public class JdbcResultSetMetaData extends TraceObject implements
...
@@ -102,7 +102,7 @@ public class JdbcResultSetMetaData extends TraceObject implements
try
{
try
{
debugCodeCall
(
"getColumnType"
,
column
);
debugCodeCall
(
"getColumnType"
,
column
);
checkColumnIndex
(
column
);
checkColumnIndex
(
column
);
int
type
=
result
.
getColumnType
(--
column
);
int
type
=
result
.
getColumnType
(--
column
)
.
getValueType
()
;
return
DataType
.
convertTypeToSQLType
(
type
);
return
DataType
.
convertTypeToSQLType
(
type
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
throw
logAndConvert
(
e
);
throw
logAndConvert
(
e
);
...
@@ -121,7 +121,7 @@ public class JdbcResultSetMetaData extends TraceObject implements
...
@@ -121,7 +121,7 @@ public class JdbcResultSetMetaData extends TraceObject implements
try
{
try
{
debugCodeCall
(
"getColumnTypeName"
,
column
);
debugCodeCall
(
"getColumnTypeName"
,
column
);
checkColumnIndex
(
column
);
checkColumnIndex
(
column
);
int
type
=
result
.
getColumnType
(--
column
);
int
type
=
result
.
getColumnType
(--
column
)
.
getValueType
()
;
return
DataType
.
getDataType
(
type
).
name
;
return
DataType
.
getDataType
(
type
).
name
;
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
throw
logAndConvert
(
e
);
throw
logAndConvert
(
e
);
...
@@ -370,7 +370,7 @@ public class JdbcResultSetMetaData extends TraceObject implements
...
@@ -370,7 +370,7 @@ public class JdbcResultSetMetaData extends TraceObject implements
try
{
try
{
debugCodeCall
(
"getColumnClassName"
,
column
);
debugCodeCall
(
"getColumnClassName"
,
column
);
checkColumnIndex
(
column
);
checkColumnIndex
(
column
);
int
type
=
result
.
getColumnType
(--
column
);
int
type
=
result
.
getColumnType
(--
column
)
.
getValueType
()
;
return
DataType
.
getTypeClassName
(
type
,
true
);
return
DataType
.
getTypeClassName
(
type
,
true
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
throw
logAndConvert
(
e
);
throw
logAndConvert
(
e
);
...
@@ -389,7 +389,7 @@ public class JdbcResultSetMetaData extends TraceObject implements
...
@@ -389,7 +389,7 @@ public class JdbcResultSetMetaData extends TraceObject implements
try
{
try
{
debugCodeCall
(
"getPrecision"
,
column
);
debugCodeCall
(
"getPrecision"
,
column
);
checkColumnIndex
(
column
);
checkColumnIndex
(
column
);
long
prec
=
result
.
getColumn
Precision
(--
column
);
long
prec
=
result
.
getColumn
Type
(--
column
).
getPrecision
(
);
return
MathUtils
.
convertLongToInt
(
prec
);
return
MathUtils
.
convertLongToInt
(
prec
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
throw
logAndConvert
(
e
);
throw
logAndConvert
(
e
);
...
@@ -408,7 +408,7 @@ public class JdbcResultSetMetaData extends TraceObject implements
...
@@ -408,7 +408,7 @@ public class JdbcResultSetMetaData extends TraceObject implements
try
{
try
{
debugCodeCall
(
"getScale"
,
column
);
debugCodeCall
(
"getScale"
,
column
);
checkColumnIndex
(
column
);
checkColumnIndex
(
column
);
return
result
.
getColumn
Scale
(--
column
);
return
result
.
getColumn
Type
(--
column
).
getScale
(
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
throw
logAndConvert
(
e
);
throw
logAndConvert
(
e
);
}
}
...
@@ -426,7 +426,7 @@ public class JdbcResultSetMetaData extends TraceObject implements
...
@@ -426,7 +426,7 @@ public class JdbcResultSetMetaData extends TraceObject implements
try
{
try
{
debugCodeCall
(
"getColumnDisplaySize"
,
column
);
debugCodeCall
(
"getColumnDisplaySize"
,
column
);
checkColumnIndex
(
column
);
checkColumnIndex
(
column
);
return
result
.
get
DisplaySize
(--
column
);
return
result
.
get
ColumnType
(--
column
).
getDisplaySize
(
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
throw
logAndConvert
(
e
);
throw
logAndConvert
(
e
);
}
}
...
...
h2/src/main/org/h2/mvstore/db/ValueDataType.java
浏览文件 @
e2dea134
...
@@ -26,6 +26,7 @@ import org.h2.store.DataHandler;
...
@@ -26,6 +26,7 @@ import org.h2.store.DataHandler;
import
org.h2.util.JdbcUtils
;
import
org.h2.util.JdbcUtils
;
import
org.h2.util.Utils
;
import
org.h2.util.Utils
;
import
org.h2.value.CompareMode
;
import
org.h2.value.CompareMode
;
import
org.h2.value.TypeInfo
;
import
org.h2.value.Value
;
import
org.h2.value.Value
;
import
org.h2.value.ValueArray
;
import
org.h2.value.ValueArray
;
import
org.h2.value.ValueBoolean
;
import
org.h2.value.ValueBoolean
;
...
@@ -417,10 +418,11 @@ public class ValueDataType implements DataType {
...
@@ -417,10 +418,11 @@ public class ValueDataType implements DataType {
for
(
int
i
=
0
;
i
<
columnCount
;
i
++)
{
for
(
int
i
=
0
;
i
<
columnCount
;
i
++)
{
writeString
(
buff
,
result
.
getAlias
(
i
));
writeString
(
buff
,
result
.
getAlias
(
i
));
writeString
(
buff
,
result
.
getColumnName
(
i
));
writeString
(
buff
,
result
.
getColumnName
(
i
));
buff
.
putVarInt
(
result
.
getColumnType
(
i
)).
TypeInfo
columnType
=
result
.
getColumnType
(
i
);
putVarLong
(
result
.
getColumnPrecision
(
i
)).
buff
.
putVarInt
(
columnType
.
getValueType
()).
putVarInt
(
result
.
getColumnScale
(
i
)).
putVarLong
(
columnType
.
getPrecision
()).
putVarInt
(
result
.
getDisplaySize
(
i
));
putVarInt
(
columnType
.
getScale
()).
putVarInt
(
columnType
.
getDisplaySize
());
}
}
while
(
result
.
next
())
{
while
(
result
.
next
())
{
buff
.
put
((
byte
)
1
);
buff
.
put
((
byte
)
1
);
...
...
h2/src/main/org/h2/result/LazyResult.java
浏览文件 @
e2dea134
...
@@ -8,6 +8,7 @@ package org.h2.result;
...
@@ -8,6 +8,7 @@ package org.h2.result;
import
org.h2.engine.SessionInterface
;
import
org.h2.engine.SessionInterface
;
import
org.h2.expression.Expression
;
import
org.h2.expression.Expression
;
import
org.h2.message.DbException
;
import
org.h2.message.DbException
;
import
org.h2.value.TypeInfo
;
import
org.h2.value.Value
;
import
org.h2.value.Value
;
/**
/**
...
@@ -139,23 +140,8 @@ public abstract class LazyResult implements ResultInterface {
...
@@ -139,23 +140,8 @@ public abstract class LazyResult implements ResultInterface {
}
}
@Override
@Override
public
int
getColumnType
(
int
i
)
{
public
TypeInfo
getColumnType
(
int
i
)
{
return
expressions
[
i
].
getValueType
();
return
expressions
[
i
].
getType
();
}
@Override
public
long
getColumnPrecision
(
int
i
)
{
return
expressions
[
i
].
getType
().
getPrecision
();
}
@Override
public
int
getColumnScale
(
int
i
)
{
return
expressions
[
i
].
getType
().
getScale
();
}
@Override
public
int
getDisplaySize
(
int
i
)
{
return
expressions
[
i
].
getType
().
getDisplaySize
();
}
}
@Override
@Override
...
...
h2/src/main/org/h2/result/LocalResultImpl.java
浏览文件 @
e2dea134
...
@@ -15,6 +15,7 @@ import org.h2.message.DbException;
...
@@ -15,6 +15,7 @@ import org.h2.message.DbException;
import
org.h2.mvstore.db.MVTempResult
;
import
org.h2.mvstore.db.MVTempResult
;
import
org.h2.util.Utils
;
import
org.h2.util.Utils
;
import
org.h2.util.ValueHashMap
;
import
org.h2.util.ValueHashMap
;
import
org.h2.value.TypeInfo
;
import
org.h2.value.Value
;
import
org.h2.value.Value
;
import
org.h2.value.ValueArray
;
import
org.h2.value.ValueArray
;
...
@@ -527,24 +528,14 @@ public class LocalResultImpl implements LocalResult {
...
@@ -527,24 +528,14 @@ public class LocalResultImpl implements LocalResult {
return
expressions
[
i
].
getSchemaName
();
return
expressions
[
i
].
getSchemaName
();
}
}
@Override
public
int
getDisplaySize
(
int
i
)
{
return
expressions
[
i
].
getType
().
getDisplaySize
();
}
@Override
@Override
public
String
getColumnName
(
int
i
)
{
public
String
getColumnName
(
int
i
)
{
return
expressions
[
i
].
getColumnName
();
return
expressions
[
i
].
getColumnName
();
}
}
@Override
@Override
public
int
getColumnType
(
int
i
)
{
public
TypeInfo
getColumnType
(
int
i
)
{
return
expressions
[
i
].
getValueType
();
return
expressions
[
i
].
getType
();
}
@Override
public
long
getColumnPrecision
(
int
i
)
{
return
expressions
[
i
].
getType
().
getPrecision
();
}
}
@Override
@Override
...
@@ -557,11 +548,6 @@ public class LocalResultImpl implements LocalResult {
...
@@ -557,11 +548,6 @@ public class LocalResultImpl implements LocalResult {
return
expressions
[
i
].
isAutoIncrement
();
return
expressions
[
i
].
isAutoIncrement
();
}
}
@Override
public
int
getColumnScale
(
int
i
)
{
return
expressions
[
i
].
getType
().
getScale
();
}
/**
/**
* Set the offset of the first row to return.
* Set the offset of the first row to return.
*
*
...
...
h2/src/main/org/h2/result/MergedResult.java
浏览文件 @
e2dea134
...
@@ -40,8 +40,7 @@ public final class MergedResult {
...
@@ -40,8 +40,7 @@ public final class MergedResult {
SimpleResult
.
Column
[]
cols
=
new
SimpleResult
.
Column
[
count
];
SimpleResult
.
Column
[]
cols
=
new
SimpleResult
.
Column
[
count
];
for
(
int
i
=
0
;
i
<
count
;
i
++)
{
for
(
int
i
=
0
;
i
<
count
;
i
++)
{
SimpleResult
.
Column
c
=
new
SimpleResult
.
Column
(
result
.
getAlias
(
i
),
result
.
getColumnName
(
i
),
SimpleResult
.
Column
c
=
new
SimpleResult
.
Column
(
result
.
getAlias
(
i
),
result
.
getColumnName
(
i
),
result
.
getColumnType
(
i
),
result
.
getColumnPrecision
(
i
),
result
.
getColumnScale
(
i
),
result
.
getColumnType
(
i
));
result
.
getDisplaySize
(
i
));
cols
[
i
]
=
c
;
cols
[
i
]
=
c
;
if
(!
columns
.
contains
(
c
))
{
if
(!
columns
.
contains
(
c
))
{
columns
.
add
(
c
);
columns
.
add
(
c
);
...
...
h2/src/main/org/h2/result/ResultColumn.java
浏览文件 @
e2dea134
...
@@ -8,6 +8,7 @@ package org.h2.result;
...
@@ -8,6 +8,7 @@ package org.h2.result;
import
java.io.IOException
;
import
java.io.IOException
;
import
org.h2.value.Transfer
;
import
org.h2.value.Transfer
;
import
org.h2.value.TypeInfo
;
/**
/**
* A result set column of a remote result.
* A result set column of a remote result.
...
@@ -35,24 +36,9 @@ public class ResultColumn {
...
@@ -35,24 +36,9 @@ public class ResultColumn {
final
String
columnName
;
final
String
columnName
;
/**
/**
* The
value type of this column
.
* The
column type
.
*/
*/
final
int
columnType
;
final
TypeInfo
columnType
;
/**
* The precision.
*/
final
long
precision
;
/**
* The scale.
*/
final
int
scale
;
/**
* The expected display size.
*/
final
int
displaySize
;
/**
/**
* True if this is an autoincrement column.
* True if this is an autoincrement column.
...
@@ -74,10 +60,11 @@ public class ResultColumn {
...
@@ -74,10 +60,11 @@ public class ResultColumn {
schemaName
=
in
.
readString
();
schemaName
=
in
.
readString
();
tableName
=
in
.
readString
();
tableName
=
in
.
readString
();
columnName
=
in
.
readString
();
columnName
=
in
.
readString
();
columnType
=
in
.
readInt
();
int
valueType
=
in
.
readInt
();
precision
=
in
.
readLong
();
long
precision
=
in
.
readLong
();
scale
=
in
.
readInt
();
int
scale
=
in
.
readInt
();
displaySize
=
in
.
readInt
();
int
displaySize
=
in
.
readInt
();
columnType
=
new
TypeInfo
(
valueType
,
precision
,
scale
,
displaySize
,
null
);
autoIncrement
=
in
.
readBoolean
();
autoIncrement
=
in
.
readBoolean
();
nullable
=
in
.
readInt
();
nullable
=
in
.
readInt
();
}
}
...
@@ -95,10 +82,11 @@ public class ResultColumn {
...
@@ -95,10 +82,11 @@ public class ResultColumn {
out
.
writeString
(
result
.
getSchemaName
(
i
));
out
.
writeString
(
result
.
getSchemaName
(
i
));
out
.
writeString
(
result
.
getTableName
(
i
));
out
.
writeString
(
result
.
getTableName
(
i
));
out
.
writeString
(
result
.
getColumnName
(
i
));
out
.
writeString
(
result
.
getColumnName
(
i
));
out
.
writeInt
(
result
.
getColumnType
(
i
));
TypeInfo
type
=
result
.
getColumnType
(
i
);
out
.
writeLong
(
result
.
getColumnPrecision
(
i
));
out
.
writeInt
(
type
.
getValueType
());
out
.
writeInt
(
result
.
getColumnScale
(
i
));
out
.
writeLong
(
type
.
getPrecision
());
out
.
writeInt
(
result
.
getDisplaySize
(
i
));
out
.
writeInt
(
type
.
getScale
());
out
.
writeInt
(
type
.
getDisplaySize
());
out
.
writeBoolean
(
result
.
isAutoIncrement
(
i
));
out
.
writeBoolean
(
result
.
isAutoIncrement
(
i
));
out
.
writeInt
(
result
.
getNullable
(
i
));
out
.
writeInt
(
result
.
getNullable
(
i
));
}
}
...
...
h2/src/main/org/h2/result/ResultInterface.java
浏览文件 @
e2dea134
...
@@ -6,6 +6,7 @@
...
@@ -6,6 +6,7 @@
package
org
.
h2
.
result
;
package
org
.
h2
.
result
;
import
org.h2.engine.SessionInterface
;
import
org.h2.engine.SessionInterface
;
import
org.h2.value.TypeInfo
;
import
org.h2.value.Value
;
import
org.h2.value.Value
;
/**
/**
...
@@ -123,31 +124,7 @@ public interface ResultInterface extends AutoCloseable {
...
@@ -123,31 +124,7 @@ public interface ResultInterface extends AutoCloseable {
* @param i the column number (starting with 0)
* @param i the column number (starting with 0)
* @return the column data type
* @return the column data type
*/
*/
int
getColumnType
(
int
i
);
TypeInfo
getColumnType
(
int
i
);
/**
* Get the precision for this column.
*
* @param i the column number (starting with 0)
* @return the precision
*/
long
getColumnPrecision
(
int
i
);
/**
* Get the scale for this column.
*
* @param i the column number (starting with 0)
* @return the scale
*/
int
getColumnScale
(
int
i
);
/**
* Get the display size for this column.
*
* @param i the column number (starting with 0)
* @return the display size
*/
int
getDisplaySize
(
int
i
);
/**
/**
* Check if this is an auto-increment column.
* Check if this is an auto-increment column.
...
...
h2/src/main/org/h2/result/ResultRemote.java
浏览文件 @
e2dea134
...
@@ -14,6 +14,7 @@ import org.h2.engine.SysProperties;
...
@@ -14,6 +14,7 @@ import org.h2.engine.SysProperties;
import
org.h2.message.DbException
;
import
org.h2.message.DbException
;
import
org.h2.message.Trace
;
import
org.h2.message.Trace
;
import
org.h2.value.Transfer
;
import
org.h2.value.Transfer
;
import
org.h2.value.TypeInfo
;
import
org.h2.value.Value
;
import
org.h2.value.Value
;
/**
/**
...
@@ -77,25 +78,10 @@ public class ResultRemote implements ResultInterface {
...
@@ -77,25 +78,10 @@ public class ResultRemote implements ResultInterface {
}
}
@Override
@Override
public
int
getColumnType
(
int
i
)
{
public
TypeInfo
getColumnType
(
int
i
)
{
return
columns
[
i
].
columnType
;
return
columns
[
i
].
columnType
;
}
}
@Override
public
long
getColumnPrecision
(
int
i
)
{
return
columns
[
i
].
precision
;
}
@Override
public
int
getColumnScale
(
int
i
)
{
return
columns
[
i
].
scale
;
}
@Override
public
int
getDisplaySize
(
int
i
)
{
return
columns
[
i
].
displaySize
;
}
@Override
@Override
public
boolean
isAutoIncrement
(
int
i
)
{
public
boolean
isAutoIncrement
(
int
i
)
{
return
columns
[
i
].
autoIncrement
;
return
columns
[
i
].
autoIncrement
;
...
...
h2/src/main/org/h2/result/SimpleResult.java
浏览文件 @
e2dea134
...
@@ -10,6 +10,7 @@ import java.util.ArrayList;
...
@@ -10,6 +10,7 @@ import java.util.ArrayList;
import
org.h2.engine.SessionInterface
;
import
org.h2.engine.SessionInterface
;
import
org.h2.util.Utils
;
import
org.h2.util.Utils
;
import
org.h2.value.TypeInfo
;
import
org.h2.value.Value
;
import
org.h2.value.Value
;
/**
/**
...
@@ -28,16 +29,7 @@ public class SimpleResult implements ResultInterface {
...
@@ -28,16 +29,7 @@ public class SimpleResult implements ResultInterface {
final
String
columnName
;
final
String
columnName
;
/** Column type. */
/** Column type. */
final
int
columnType
;
final
TypeInfo
columnType
;
/** Column precision. */
final
long
columnPrecision
;
/** Column scale. */
final
int
columnScale
;
/** Displayed size of the column. */
final
int
displaySize
;
Column
(
String
alias
,
String
columnName
,
int
columnType
,
long
columnPrecision
,
int
columnScale
,
Column
(
String
alias
,
String
columnName
,
int
columnType
,
long
columnPrecision
,
int
columnScale
,
int
displaySize
)
{
int
displaySize
)
{
...
@@ -46,10 +38,16 @@ public class SimpleResult implements ResultInterface {
...
@@ -46,10 +38,16 @@ public class SimpleResult implements ResultInterface {
}
}
this
.
alias
=
alias
;
this
.
alias
=
alias
;
this
.
columnName
=
columnName
;
this
.
columnName
=
columnName
;
this
.
columnType
=
TypeInfo
.
getTypeInfo
(
columnType
,
columnPrecision
,
columnScale
,
displaySize
,
null
);
}
Column
(
String
alias
,
String
columnName
,
TypeInfo
columnType
)
{
if
(
alias
==
null
||
columnName
==
null
)
{
throw
new
NullPointerException
();
}
this
.
alias
=
alias
;
this
.
columnName
=
columnName
;
this
.
columnType
=
columnType
;
this
.
columnType
=
columnType
;
this
.
columnPrecision
=
columnPrecision
;
this
.
columnScale
=
columnScale
;
this
.
displaySize
=
displaySize
;
}
}
@Override
@Override
...
@@ -107,7 +105,7 @@ public class SimpleResult implements ResultInterface {
...
@@ -107,7 +105,7 @@ public class SimpleResult implements ResultInterface {
*
*
* @param alias Column's alias.
* @param alias Column's alias.
* @param columnName Column's name.
* @param columnName Column's name.
* @param columnType Column's type.
* @param columnType Column's
value
type.
* @param columnPrecision Column's precision.
* @param columnPrecision Column's precision.
* @param columnScale Column's scale.
* @param columnScale Column's scale.
* @param displaySize Column's display data size.
* @param displaySize Column's display data size.
...
@@ -117,6 +115,17 @@ public class SimpleResult implements ResultInterface {
...
@@ -117,6 +115,17 @@ public class SimpleResult implements ResultInterface {
addColumn
(
new
Column
(
alias
,
columnName
,
columnType
,
columnPrecision
,
columnScale
,
displaySize
));
addColumn
(
new
Column
(
alias
,
columnName
,
columnType
,
columnPrecision
,
columnScale
,
displaySize
));
}
}
/**
* Add column to the result.
*
* @param alias Column's alias.
* @param columnName Column's name.
* @param columnType Column's type.
*/
public
void
addColumn
(
String
alias
,
String
columnName
,
TypeInfo
columnType
)
{
addColumn
(
new
Column
(
alias
,
columnName
,
columnType
));
}
/**
/**
* Add column to the result.
* Add column to the result.
*
*
...
@@ -212,25 +221,10 @@ public class SimpleResult implements ResultInterface {
...
@@ -212,25 +221,10 @@ public class SimpleResult implements ResultInterface {
}
}
@Override
@Override
public
int
getColumnType
(
int
i
)
{
public
TypeInfo
getColumnType
(
int
i
)
{
return
columns
.
get
(
i
).
columnType
;
return
columns
.
get
(
i
).
columnType
;
}
}
@Override
public
long
getColumnPrecision
(
int
i
)
{
return
columns
.
get
(
i
).
columnPrecision
;
}
@Override
public
int
getColumnScale
(
int
i
)
{
return
columns
.
get
(
i
).
columnScale
;
}
@Override
public
int
getDisplaySize
(
int
i
)
{
return
columns
.
get
(
i
).
displaySize
;
}
@Override
@Override
public
boolean
isAutoIncrement
(
int
i
)
{
public
boolean
isAutoIncrement
(
int
i
)
{
return
false
;
return
false
;
...
...
h2/src/main/org/h2/result/UpdatableRow.java
浏览文件 @
e2dea134
...
@@ -232,7 +232,7 @@ public class UpdatableRow {
...
@@ -232,7 +232,7 @@ public class UpdatableRow {
}
}
Value
[]
newRow
=
new
Value
[
columnCount
];
Value
[]
newRow
=
new
Value
[
columnCount
];
for
(
int
i
=
0
;
i
<
columnCount
;
i
++)
{
for
(
int
i
=
0
;
i
<
columnCount
;
i
++)
{
int
type
=
result
.
getColumnType
(
i
);
int
type
=
result
.
getColumnType
(
i
)
.
getValueType
()
;
newRow
[
i
]
=
DataType
.
readValue
(
conn
.
getSession
(),
rs
,
i
+
1
,
type
);
newRow
[
i
]
=
DataType
.
readValue
(
conn
.
getSession
(),
rs
,
i
+
1
,
type
);
}
}
return
newRow
;
return
newRow
;
...
...
h2/src/main/org/h2/store/Data.java
浏览文件 @
e2dea134
...
@@ -27,6 +27,7 @@ import org.h2.util.DateTimeUtils;
...
@@ -27,6 +27,7 @@ import org.h2.util.DateTimeUtils;
import
org.h2.util.JdbcUtils
;
import
org.h2.util.JdbcUtils
;
import
org.h2.util.MathUtils
;
import
org.h2.util.MathUtils
;
import
org.h2.util.Utils
;
import
org.h2.util.Utils
;
import
org.h2.value.TypeInfo
;
import
org.h2.value.Value
;
import
org.h2.value.Value
;
import
org.h2.value.ValueArray
;
import
org.h2.value.ValueArray
;
import
org.h2.value.ValueBoolean
;
import
org.h2.value.ValueBoolean
;
...
@@ -679,10 +680,11 @@ public class Data {
...
@@ -679,10 +680,11 @@ public class Data {
for
(
int
i
=
0
;
i
<
columnCount
;
i
++)
{
for
(
int
i
=
0
;
i
<
columnCount
;
i
++)
{
writeString
(
result
.
getAlias
(
i
));
writeString
(
result
.
getAlias
(
i
));
writeString
(
result
.
getColumnName
(
i
));
writeString
(
result
.
getColumnName
(
i
));
writeVarInt
(
result
.
getColumnType
(
i
));
TypeInfo
columnType
=
result
.
getColumnType
(
i
);
writeVarLong
(
result
.
getColumnPrecision
(
i
));
writeVarInt
(
columnType
.
getValueType
());
writeVarInt
(
result
.
getColumnScale
(
i
));
writeVarLong
(
columnType
.
getPrecision
());
writeVarInt
(
result
.
getDisplaySize
(
i
));
writeVarInt
(
columnType
.
getScale
());
writeVarInt
(
columnType
.
getDisplaySize
());
}
}
while
(
result
.
next
())
{
while
(
result
.
next
())
{
writeByte
((
byte
)
1
);
writeByte
((
byte
)
1
);
...
@@ -1166,10 +1168,11 @@ public class Data {
...
@@ -1166,10 +1168,11 @@ public class Data {
for
(
int
i
=
0
;
i
<
columnCount
;
i
++)
{
for
(
int
i
=
0
;
i
<
columnCount
;
i
++)
{
len
+=
getStringLen
(
result
.
getAlias
(
i
));
len
+=
getStringLen
(
result
.
getAlias
(
i
));
len
+=
getStringLen
(
result
.
getColumnName
(
i
));
len
+=
getStringLen
(
result
.
getColumnName
(
i
));
len
+=
getVarIntLen
(
result
.
getColumnType
(
i
));
TypeInfo
columnType
=
result
.
getColumnType
(
i
);
len
+=
getVarLongLen
(
result
.
getColumnPrecision
(
i
));
len
+=
getVarIntLen
(
columnType
.
getValueType
());
len
+=
getVarIntLen
(
result
.
getColumnScale
(
i
));
len
+=
getVarLongLen
(
columnType
.
getPrecision
());
len
+=
getVarIntLen
(
result
.
getDisplaySize
(
i
));
len
+=
getVarIntLen
(
columnType
.
getScale
());
len
+=
getVarIntLen
(
columnType
.
getDisplaySize
());
}
}
while
(
result
.
next
())
{
while
(
result
.
next
())
{
len
++;
len
++;
...
...
h2/src/main/org/h2/table/FunctionTable.java
浏览文件 @
e2dea134
...
@@ -67,11 +67,7 @@ public class FunctionTable extends Table {
...
@@ -67,11 +67,7 @@ public class FunctionTable extends Table {
int
columnCount
=
result
.
getVisibleColumnCount
();
int
columnCount
=
result
.
getVisibleColumnCount
();
Column
[]
cols
=
new
Column
[
columnCount
];
Column
[]
cols
=
new
Column
[
columnCount
];
for
(
int
i
=
0
;
i
<
columnCount
;
i
++)
{
for
(
int
i
=
0
;
i
<
columnCount
;
i
++)
{
cols
[
i
]
=
new
Column
(
result
.
getColumnName
(
i
),
cols
[
i
]
=
new
Column
(
result
.
getColumnName
(
i
),
result
.
getColumnType
(
i
));
result
.
getColumnType
(
i
),
result
.
getColumnPrecision
(
i
),
result
.
getColumnScale
(
i
),
result
.
getDisplaySize
(
i
));
}
}
setColumns
(
cols
);
setColumns
(
cols
);
}
}
...
...
h2/src/main/org/h2/value/DataType.java
浏览文件 @
e2dea134
...
@@ -509,6 +509,7 @@ public class DataType {
...
@@ -509,6 +509,7 @@ public class DataType {
dataType
.
params
=
"PRECISION,SCALE"
;
dataType
.
params
=
"PRECISION,SCALE"
;
dataType
.
supportsPrecision
=
true
;
dataType
.
supportsPrecision
=
true
;
dataType
.
supportsScale
=
true
;
dataType
.
supportsScale
=
true
;
dataType
.
maxScale
=
maxPrecision
;
}
}
dataType
.
decimal
=
true
;
dataType
.
decimal
=
true
;
dataType
.
autoIncrement
=
autoInc
;
dataType
.
autoIncrement
=
autoInc
;
...
...
h2/src/main/org/h2/value/Transfer.java
浏览文件 @
e2dea134
...
@@ -512,18 +512,19 @@ public class Transfer {
...
@@ -512,18 +512,19 @@ public class Transfer {
int
columnCount
=
result
.
getVisibleColumnCount
();
int
columnCount
=
result
.
getVisibleColumnCount
();
writeInt
(
columnCount
);
writeInt
(
columnCount
);
for
(
int
i
=
0
;
i
<
columnCount
;
i
++)
{
for
(
int
i
=
0
;
i
<
columnCount
;
i
++)
{
TypeInfo
columnType
=
result
.
getColumnType
(
i
);
if
(
version
>=
Constants
.
TCP_PROTOCOL_VERSION_18
)
{
if
(
version
>=
Constants
.
TCP_PROTOCOL_VERSION_18
)
{
writeString
(
result
.
getAlias
(
i
));
writeString
(
result
.
getAlias
(
i
));
writeString
(
result
.
getColumnName
(
i
));
writeString
(
result
.
getColumnName
(
i
));
writeInt
(
result
.
getColumnType
(
i
));
writeInt
(
columnType
.
getValueType
(
));
writeLong
(
result
.
getColumnPrecision
(
i
));
writeLong
(
columnType
.
getPrecision
(
));
writeInt
(
result
.
getColumnScale
(
i
));
writeInt
(
columnType
.
getScale
(
));
writeInt
(
result
.
getDisplaySize
(
i
));
writeInt
(
columnType
.
getDisplaySize
(
));
}
else
{
}
else
{
writeString
(
result
.
getColumnName
(
i
));
writeString
(
result
.
getColumnName
(
i
));
writeInt
(
DataType
.
getDataType
(
result
.
getColumnType
(
i
)).
sqlType
);
writeInt
(
DataType
.
getDataType
(
columnType
.
getValueType
(
)).
sqlType
);
writeInt
(
MathUtils
.
convertLongToInt
(
result
.
getColumnPrecision
(
i
)));
writeInt
(
MathUtils
.
convertLongToInt
(
columnType
.
getPrecision
(
)));
writeInt
(
result
.
getColumnScale
(
i
));
writeInt
(
columnType
.
getScale
(
));
}
}
}
}
while
(
result
.
next
())
{
while
(
result
.
next
())
{
...
...
h2/src/main/org/h2/value/Value.java
浏览文件 @
e2dea134
...
@@ -1335,8 +1335,7 @@ public abstract class Value extends VersionedValue {
...
@@ -1335,8 +1335,7 @@ public abstract class Value extends VersionedValue {
private
ValueResultSet
convertToResultSet
()
{
private
ValueResultSet
convertToResultSet
()
{
SimpleResult
result
=
new
SimpleResult
();
SimpleResult
result
=
new
SimpleResult
();
TypeInfo
type
=
getType
();
result
.
addColumn
(
"X"
,
"X"
,
getType
());
result
.
addColumn
(
"X"
,
"X"
,
type
.
getValueType
(),
type
.
getPrecision
(),
type
.
getScale
(),
type
.
getDisplaySize
());
result
.
addRow
(
this
);
result
.
addRow
(
this
);
return
ValueResultSet
.
get
(
result
);
return
ValueResultSet
.
get
(
result
);
}
}
...
@@ -1637,8 +1636,7 @@ public abstract class Value extends VersionedValue {
...
@@ -1637,8 +1636,7 @@ public abstract class Value extends VersionedValue {
*/
*/
public
ResultInterface
getResult
()
{
public
ResultInterface
getResult
()
{
SimpleResult
rs
=
new
SimpleResult
();
SimpleResult
rs
=
new
SimpleResult
();
TypeInfo
type
=
getType
();
rs
.
addColumn
(
"X"
,
"X"
,
getType
());
rs
.
addColumn
(
"X"
,
"X"
,
type
.
getValueType
(),
type
.
getPrecision
(),
type
.
getScale
(),
type
.
getDisplaySize
());
rs
.
addRow
(
this
);
rs
.
addRow
(
this
);
return
rs
;
return
rs
;
}
}
...
...
h2/src/main/org/h2/value/ValueResultSet.java
浏览文件 @
e2dea134
...
@@ -64,7 +64,8 @@ public class ValueResultSet extends Value {
...
@@ -64,7 +64,8 @@ public class ValueResultSet extends Value {
for
(
int
i
=
0
;
i
<
maxrows
&&
rs
.
next
();
i
++)
{
for
(
int
i
=
0
;
i
<
maxrows
&&
rs
.
next
();
i
++)
{
Value
[]
list
=
new
Value
[
columnCount
];
Value
[]
list
=
new
Value
[
columnCount
];
for
(
int
j
=
0
;
j
<
columnCount
;
j
++)
{
for
(
int
j
=
0
;
j
<
columnCount
;
j
++)
{
list
[
j
]
=
DataType
.
convertToValue
(
session
,
rs
.
getObject
(
j
+
1
),
simple
.
getColumnType
(
j
));
list
[
j
]
=
DataType
.
convertToValue
(
session
,
rs
.
getObject
(
j
+
1
),
simple
.
getColumnType
(
j
).
getValueType
());
}
}
simple
.
addRow
(
list
);
simple
.
addRow
(
list
);
}
}
...
@@ -87,8 +88,7 @@ public class ValueResultSet extends Value {
...
@@ -87,8 +88,7 @@ public class ValueResultSet extends Value {
int
columnCount
=
result
.
getVisibleColumnCount
();
int
columnCount
=
result
.
getVisibleColumnCount
();
SimpleResult
simple
=
new
SimpleResult
();
SimpleResult
simple
=
new
SimpleResult
();
for
(
int
i
=
0
;
i
<
columnCount
;
i
++)
{
for
(
int
i
=
0
;
i
<
columnCount
;
i
++)
{
simple
.
addColumn
(
result
.
getAlias
(
i
),
result
.
getColumnName
(
i
),
result
.
getColumnType
(
i
),
simple
.
addColumn
(
result
.
getAlias
(
i
),
result
.
getColumnName
(
i
),
result
.
getColumnType
(
i
));
result
.
getColumnPrecision
(
i
),
result
.
getColumnScale
(
i
),
result
.
getDisplaySize
(
i
));
}
}
result
.
reset
();
result
.
reset
();
for
(
int
i
=
0
;
i
<
maxrows
&&
result
.
next
();
i
++)
{
for
(
int
i
=
0
;
i
<
maxrows
&&
result
.
next
();
i
++)
{
...
...
h2/src/test/org/h2/test/db/TestFunctions.java
浏览文件 @
e2dea134
...
@@ -540,8 +540,8 @@ public class TestFunctions extends TestDb implements AggregateFunction {
...
@@ -540,8 +540,8 @@ public class TestFunctions extends TestDb implements AggregateFunction {
stat
.
execute
(
"create aggregate agg_sum for \""
+
getClass
().
getName
()+
"\""
);
stat
.
execute
(
"create aggregate agg_sum for \""
+
getClass
().
getName
()+
"\""
);
rs
=
stat
.
executeQuery
(
"select agg_sum(1), sum(1.6) from dual"
);
rs
=
stat
.
executeQuery
(
"select agg_sum(1), sum(1.6) from dual"
);
rs
.
next
();
rs
.
next
();
assertEquals
(
1
,
rs
.
getMetaData
().
getScale
(
2
));
assertEquals
(
Integer
.
MAX_VALUE
,
rs
.
getMetaData
().
getScale
(
2
));
assertEquals
(
32767
,
rs
.
getMetaData
().
getScale
(
1
));
assertEquals
(
Integer
.
MAX_VALUE
,
rs
.
getMetaData
().
getScale
(
1
));
stat
.
executeQuery
(
"select * from information_schema.function_aliases"
);
stat
.
executeQuery
(
"select * from information_schema.function_aliases"
);
conn
.
close
();
conn
.
close
();
}
}
...
...
h2/src/test/org/h2/test/unit/TestValue.java
浏览文件 @
e2dea134
...
@@ -37,6 +37,7 @@ import org.h2.test.utils.AssertThrows;
...
@@ -37,6 +37,7 @@ import org.h2.test.utils.AssertThrows;
import
org.h2.tools.SimpleResultSet
;
import
org.h2.tools.SimpleResultSet
;
import
org.h2.util.Bits
;
import
org.h2.util.Bits
;
import
org.h2.value.DataType
;
import
org.h2.value.DataType
;
import
org.h2.value.TypeInfo
;
import
org.h2.value.Value
;
import
org.h2.value.Value
;
import
org.h2.value.ValueArray
;
import
org.h2.value.ValueArray
;
import
org.h2.value.ValueBytes
;
import
org.h2.value.ValueBytes
;
...
@@ -253,16 +254,18 @@ public class TestValue extends TestDb {
...
@@ -253,16 +254,18 @@ public class TestValue extends TestDb {
assertEquals
(
2
,
res
.
getVisibleColumnCount
());
assertEquals
(
2
,
res
.
getVisibleColumnCount
());
assertEquals
(
"ID"
,
res
.
getAlias
(
0
));
assertEquals
(
"ID"
,
res
.
getAlias
(
0
));
assertEquals
(
"ID"
,
res
.
getColumnName
(
0
));
assertEquals
(
"ID"
,
res
.
getColumnName
(
0
));
assertEquals
(
Value
.
INT
,
res
.
getColumnType
(
0
));
TypeInfo
type
=
res
.
getColumnType
(
0
);
assertEquals
(
0
,
res
.
getColumnPrecision
(
0
));
assertEquals
(
Value
.
INT
,
type
.
getValueType
());
assertEquals
(
0
,
res
.
getColumnScale
(
0
));
assertEquals
(
ValueInt
.
PRECISION
,
type
.
getPrecision
());
assertEquals
(
fromSimple
?
15
:
ValueInt
.
DISPLAY_SIZE
,
res
.
getDisplaySize
(
0
));
assertEquals
(
0
,
type
.
getScale
());
assertEquals
(
ValueInt
.
DISPLAY_SIZE
,
type
.
getDisplaySize
());
assertEquals
(
"NAME"
,
res
.
getAlias
(
1
));
assertEquals
(
"NAME"
,
res
.
getAlias
(
1
));
assertEquals
(
"NAME"
,
res
.
getColumnName
(
1
));
assertEquals
(
"NAME"
,
res
.
getColumnName
(
1
));
assertEquals
(
Value
.
STRING
,
res
.
getColumnType
(
1
));
type
=
res
.
getColumnType
(
1
);
assertEquals
(
255
,
res
.
getColumnPrecision
(
1
));
assertEquals
(
Value
.
STRING
,
type
.
getValueType
());
assertEquals
(
0
,
res
.
getColumnScale
(
1
));
assertEquals
(
255
,
type
.
getPrecision
());
assertEquals
(
fromSimple
?
15
:
255
,
res
.
getDisplaySize
(
1
));
assertEquals
(
0
,
type
.
getScale
());
assertEquals
(
255
,
type
.
getDisplaySize
());
if
(
count
>=
1
)
{
if
(
count
>=
1
)
{
assertTrue
(
res
.
next
());
assertTrue
(
res
.
next
());
assertEquals
(
new
Value
[]
{
ValueInt
.
get
(
1
),
ValueString
.
get
(
"Hello"
)},
res
.
currentRow
());
assertEquals
(
new
Value
[]
{
ValueInt
.
get
(
1
),
ValueString
.
get
(
"Hello"
)},
res
.
currentRow
());
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论