Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
94ea0d82
提交
94ea0d82
authored
9月 04, 2016
作者:
Sergi Vladykin
提交者:
GitHub
9月 04, 2016
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #348 from kostya-sh/fix-describe-statement-response
上级
5b8374a2
4a19a160
显示空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
60 行增加
和
20 行删除
+60
-20
PgServerThread.java
h2/src/main/org/h2/server/pg/PgServerThread.java
+19
-20
TestPgServer.java
h2/src/test/org/h2/test/unit/TestPgServer.java
+37
-0
Build.java
h2/src/tools/org/h2/build/Build.java
+4
-0
没有找到文件。
h2/src/main/org/h2/server/pg/PgServerThread.java
浏览文件 @
94ea0d82
...
@@ -308,7 +308,12 @@ public class PgServerThread implements Runnable {
...
@@ -308,7 +308,12 @@ public class PgServerThread implements Runnable {
if
(
p
==
null
)
{
if
(
p
==
null
)
{
sendErrorResponse
(
"Prepared not found: "
+
name
);
sendErrorResponse
(
"Prepared not found: "
+
name
);
}
else
{
}
else
{
sendParameterDescription
(
p
);
try
{
sendParameterDescription
(
p
.
prep
.
getParameterMetaData
(),
p
.
paramType
);
sendRowDescription
(
p
.
prep
.
getMetaData
());
}
catch
(
Exception
e
)
{
sendErrorResponse
(
e
);
}
}
}
}
else
if
(
type
==
'P'
)
{
}
else
if
(
type
==
'P'
)
{
Portal
p
=
portals
.
get
(
name
);
Portal
p
=
portals
.
get
(
name
);
...
@@ -636,17 +641,14 @@ public class PgServerThread implements Runnable {
...
@@ -636,17 +641,14 @@ public class PgServerThread implements Runnable {
sendMessage
();
sendMessage
();
}
}
private
void
sendParameterDescription
(
Prepared
p
)
throws
IOException
{
private
void
sendParameterDescription
(
ParameterMetaData
meta
,
int
[]
paramTypes
)
throws
Exception
{
try
{
PreparedStatement
prep
=
p
.
prep
;
ParameterMetaData
meta
=
prep
.
getParameterMetaData
();
int
count
=
meta
.
getParameterCount
();
int
count
=
meta
.
getParameterCount
();
startMessage
(
't'
);
startMessage
(
't'
);
writeShort
(
count
);
writeShort
(
count
);
for
(
int
i
=
0
;
i
<
count
;
i
++)
{
for
(
int
i
=
0
;
i
<
count
;
i
++)
{
int
type
;
int
type
;
if
(
p
.
paramType
!=
null
&&
p
.
paramType
[
i
]
!=
0
)
{
if
(
paramTypes
!=
null
&&
paramTypes
[
i
]
!=
0
)
{
type
=
p
.
paramType
[
i
];
type
=
paramTypes
[
i
];
}
else
{
}
else
{
type
=
PgServer
.
PG_TYPE_VARCHAR
;
type
=
PgServer
.
PG_TYPE_VARCHAR
;
}
}
...
@@ -654,9 +656,6 @@ public class PgServerThread implements Runnable {
...
@@ -654,9 +656,6 @@ public class PgServerThread implements Runnable {
writeInt
(
type
);
writeInt
(
type
);
}
}
sendMessage
();
sendMessage
();
}
catch
(
Exception
e
)
{
sendErrorResponse
(
e
);
}
}
}
private
void
sendNoData
()
throws
IOException
{
private
void
sendNoData
()
throws
IOException
{
...
...
h2/src/test/org/h2/test/unit/TestPgServer.java
浏览文件 @
94ea0d82
...
@@ -23,6 +23,7 @@ import java.util.concurrent.Future;
...
@@ -23,6 +23,7 @@ import java.util.concurrent.Future;
import
org.h2.test.TestBase
;
import
org.h2.test.TestBase
;
import
org.h2.tools.Server
;
import
org.h2.tools.Server
;
import
org.postgresql.PGStatement
;
/**
/**
* Tests the PostgreSQL server protocol compliant implementation.
* Tests the PostgreSQL server protocol compliant implementation.
...
@@ -46,6 +47,7 @@ public class TestPgServer extends TestBase {
...
@@ -46,6 +47,7 @@ public class TestPgServer extends TestBase {
testKeyAlias
();
testKeyAlias
();
testCancelQuery
();
testCancelQuery
();
testBinaryTypes
();
testBinaryTypes
();
testPrepareWithUnspecifiedType
();
}
}
private
void
testLowerCaseIdentifiers
()
throws
SQLException
{
private
void
testLowerCaseIdentifiers
()
throws
SQLException
{
...
@@ -407,4 +409,39 @@ public class TestPgServer extends TestBase {
...
@@ -407,4 +409,39 @@ public class TestPgServer extends TestBase {
server
.
stop
();
server
.
stop
();
}
}
}
}
private
void
testPrepareWithUnspecifiedType
()
throws
Exception
{
if
(!
getPgJdbcDriver
())
{
return
;
}
Server
server
=
Server
.
createPgServer
(
"-pgPort"
,
"5535"
,
"-pgDaemon"
,
"-key"
,
"test"
,
"mem:test"
);
server
.
start
();
try
{
Connection
conn
=
DriverManager
.
getConnection
(
"jdbc:postgresql://localhost:5535/test"
,
"sa"
,
"sa"
);
Statement
stmt
=
conn
.
createStatement
();
stmt
.
executeUpdate
(
"create table t1 (id integer, value boolean)"
);
stmt
.
executeUpdate
(
"INSERT INTO t1 VALUES (1,'t')"
);
stmt
.
executeUpdate
(
"INSERT INTO t1 VALUES (2,'f')"
);
stmt
.
close
();
PreparedStatement
pstmt
=
conn
.
prepareStatement
(
"SELECT * FROM t1 WHERE value = ?"
);
((
PGStatement
)
pstmt
).
setPrepareThreshold
(
1
);
// force server side prepare
assertTrue
(((
PGStatement
)
pstmt
).
isUseServerPrepare
());
pstmt
.
setObject
(
1
,
false
,
Types
.
OTHER
);
ResultSet
rs
=
pstmt
.
executeQuery
();
assertTrue
(
rs
.
next
());
assertEquals
(
2
,
rs
.
getInt
(
1
));
rs
.
close
();
pstmt
.
close
();
conn
.
close
();
}
finally
{
server
.
stop
();
}
}
}
}
h2/src/tools/org/h2/build/Build.java
浏览文件 @
94ea0d82
...
@@ -209,6 +209,7 @@ public class Build extends BuildBase {
...
@@ -209,6 +209,7 @@ public class Build extends BuildBase {
File
.
pathSeparator
+
"ext/org.osgi.core-4.2.0.jar"
+
File
.
pathSeparator
+
"ext/org.osgi.core-4.2.0.jar"
+
File
.
pathSeparator
+
"ext/org.osgi.enterprise-4.2.0.jar"
+
File
.
pathSeparator
+
"ext/org.osgi.enterprise-4.2.0.jar"
+
File
.
pathSeparator
+
"ext/jts-core-1.14.0.jar"
+
File
.
pathSeparator
+
"ext/jts-core-1.14.0.jar"
+
File
.
pathSeparator
+
"ext/postgresql-8.3-603.jdbc3.jar"
+
File
.
pathSeparator
+
javaToolsJar
;
File
.
pathSeparator
+
javaToolsJar
;
FileList
files
;
FileList
files
;
if
(
clientOnly
)
{
if
(
clientOnly
)
{
...
@@ -317,6 +318,9 @@ public class Build extends BuildBase {
...
@@ -317,6 +318,9 @@ public class Build extends BuildBase {
downloadOrVerify
(
"ext/junit-4.12.jar"
,
downloadOrVerify
(
"ext/junit-4.12.jar"
,
"junit"
,
"junit"
,
"4.12"
,
"junit"
,
"junit"
,
"4.12"
,
"2973d150c0dc1fefe998f834810d68f278ea58ec"
,
offline
);
"2973d150c0dc1fefe998f834810d68f278ea58ec"
,
offline
);
downloadOrVerify
(
"ext/postgresql-8.3-603.jdbc3.jar"
,
"postgresql"
,
"postgresql"
,
"8.3-603.jdbc3"
,
"33d531c3c53055ddcbea3d88bfa093466ffef924"
,
offline
);
}
}
private
void
downloadOrVerify
(
String
target
,
String
group
,
String
artifact
,
private
void
downloadOrVerify
(
String
target
,
String
group
,
String
artifact
,
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论