Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
52ea313c
提交
52ea313c
authored
17 年前
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
--no commit message
--no commit message
上级
35e27cd5
显示空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
36 行增加
和
13 行删除
+36
-13
PgServer.java
h2/src/main/org/h2/server/pg/PgServer.java
+1
-1
PgServerThread.java
h2/src/main/org/h2/server/pg/PgServerThread.java
+31
-8
pg_catalog.sql
h2/src/main/org/h2/server/pg/pg_catalog.sql
+3
-3
WebThread.java
h2/src/main/org/h2/server/web/WebThread.java
+1
-1
没有找到文件。
h2/src/main/org/h2/server/pg/PgServer.java
浏览文件 @
52ea313c
...
@@ -85,7 +85,7 @@ public class PgServer implements Service {
...
@@ -85,7 +85,7 @@ public class PgServer implements Service {
url
=
"pg://localhost:"
+
port
;
url
=
"pg://localhost:"
+
port
;
int
testing
;
int
testing
;
//
log = true;
log
=
true
;
}
}
public
String
getURL
()
{
public
String
getURL
()
{
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/server/pg/PgServerThread.java
浏览文件 @
52ea313c
...
@@ -25,6 +25,8 @@ import java.sql.SQLException;
...
@@ -25,6 +25,8 @@ import java.sql.SQLException;
import
java.sql.Statement
;
import
java.sql.Statement
;
import
java.sql.Types
;
import
java.sql.Types
;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.HashSet
;
import
java.util.Hashtable
;
import
java.util.Properties
;
import
java.util.Properties
;
import
org.h2.Driver
;
import
org.h2.Driver
;
...
@@ -60,6 +62,7 @@ public class PgServerThread implements Runnable {
...
@@ -60,6 +62,7 @@ public class PgServerThread implements Runnable {
private
String
dateStyle
=
"ISO"
;
private
String
dateStyle
=
"ISO"
;
private
HashMap
prepared
=
new
HashMap
();
private
HashMap
prepared
=
new
HashMap
();
private
HashMap
portals
=
new
HashMap
();
private
HashMap
portals
=
new
HashMap
();
private
HashSet
types
=
new
HashSet
();
PgServerThread
(
Socket
socket
,
PgServer
server
)
{
PgServerThread
(
Socket
socket
,
PgServer
server
)
{
this
.
server
=
server
;
this
.
server
=
server
;
...
@@ -210,7 +213,9 @@ Limitations:
...
@@ -210,7 +213,9 @@ Limitations:
int
count
=
readShort
();
int
count
=
readShort
();
p
.
paramType
=
new
int
[
count
];
p
.
paramType
=
new
int
[
count
];
for
(
int
i
=
0
;
i
<
count
;
i
++)
{
for
(
int
i
=
0
;
i
<
count
;
i
++)
{
p
.
paramType
[
i
]
=
readInt
();
int
type
=
readInt
();
checkType
(
type
);
p
.
paramType
[
i
]
=
type
;
}
}
try
{
try
{
p
.
prep
=
conn
.
prepareStatement
(
p
.
sql
);
p
.
prep
=
conn
.
prepareStatement
(
p
.
sql
);
...
@@ -369,6 +374,12 @@ Limitations:
...
@@ -369,6 +374,12 @@ Limitations:
}
}
}
}
private
void
checkType
(
int
type
)
{
if
(
types
.
contains
(
new
Integer
(
type
)))
{
error
(
"Unsupported type: "
+
type
,
null
);
}
}
private
String
getSQL
(
String
s
)
{
private
String
getSQL
(
String
s
)
{
String
lower
=
s
.
toLowerCase
();
String
lower
=
s
.
toLowerCase
();
int
todo
;
int
todo
;
...
@@ -483,11 +494,14 @@ Limitations:
...
@@ -483,11 +494,14 @@ Limitations:
startMessage
(
't'
);
startMessage
(
't'
);
writeShort
(
count
);
writeShort
(
count
);
for
(
int
i
=
0
;
i
<
count
;
i
++)
{
for
(
int
i
=
0
;
i
<
count
;
i
++)
{
int
type
;
if
(
p
.
paramType
!=
null
&&
p
.
paramType
[
i
]
!=
0
)
{
if
(
p
.
paramType
!=
null
&&
p
.
paramType
[
i
]
!=
0
)
{
writeInt
(
p
.
paramType
[
i
])
;
type
=
p
.
paramType
[
i
]
;
}
else
{
}
else
{
writeInt
(
TYPE_STRING
)
;
type
=
TYPE_STRING
;
}
}
checkType
(
type
);
writeInt
(
type
);
}
}
sendMessage
();
sendMessage
();
}
catch
(
SQLException
e
)
{
}
catch
(
SQLException
e
)
{
...
@@ -510,7 +524,9 @@ Limitations:
...
@@ -510,7 +524,9 @@ Limitations:
String
[]
names
=
new
String
[
columns
];
String
[]
names
=
new
String
[
columns
];
for
(
int
i
=
0
;
i
<
columns
;
i
++)
{
for
(
int
i
=
0
;
i
<
columns
;
i
++)
{
names
[
i
]
=
meta
.
getColumnName
(
i
+
1
);
names
[
i
]
=
meta
.
getColumnName
(
i
+
1
);
types
[
i
]
=
meta
.
getColumnType
(
i
+
1
);
int
type
=
meta
.
getColumnType
(
i
+
1
);
checkType
(
type
);
types
[
i
]
=
type
;
}
}
startMessage
(
'T'
);
startMessage
(
'T'
);
writeShort
(
columns
);
writeShort
(
columns
);
...
@@ -531,10 +547,11 @@ Limitations:
...
@@ -531,10 +547,11 @@ Limitations:
}
}
private
int
getType
(
int
type
)
{
private
int
getType
(
int
type
)
{
switch
(
type
)
{
int
testing
;
case
Types
.
VARCHAR
:
// switch(type) {
return
19
;
// case Types.VARCHAR:
}
// return 19;
// }
return
type
;
return
type
;
}
}
...
@@ -573,6 +590,7 @@ Limitations:
...
@@ -573,6 +590,7 @@ Limitations:
}
}
private
void
initDb
()
throws
SQLException
{
private
void
initDb
()
throws
SQLException
{
int
todoUseVersionOnlyInitWhenRequired
;
Statement
stat
=
conn
.
createStatement
();
Statement
stat
=
conn
.
createStatement
();
Reader
r
=
new
InputStreamReader
(
getClass
().
getResourceAsStream
(
"pg_catalog.sql"
));
Reader
r
=
new
InputStreamReader
(
getClass
().
getResourceAsStream
(
"pg_catalog.sql"
));
r
=
new
BufferedReader
(
r
);
r
=
new
BufferedReader
(
r
);
...
@@ -585,6 +603,11 @@ Limitations:
...
@@ -585,6 +603,11 @@ Limitations:
stat
.
execute
(
sql
);
stat
.
execute
(
sql
);
}
}
reader
.
close
();
reader
.
close
();
ResultSet
rs
=
stat
.
executeQuery
(
"SELECT OID FROM PG_CATALOG.PG_TYPE"
);
while
(
rs
.
next
())
{
types
.
add
(
new
Integer
(
rs
.
getInt
(
1
)));
}
}
}
// private void sendResultSet(ResultSet rs) throws SQLException, IOException {
// private void sendResultSet(ResultSet rs) throws SQLException, IOException {
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/server/pg/pg_catalog.sql
浏览文件 @
52ea313c
...
@@ -25,7 +25,7 @@ select
...
@@ -25,7 +25,7 @@ select
from
information_schema
.
schemata
;
from
information_schema
.
schemata
;
create
table
pg_catalog
.
pg_type
(
create
table
pg_catalog
.
pg_type
(
oid
int
,
oid
int
primary
key
,
typname
varchar_ignorecase
,
typname
varchar_ignorecase
,
typnamespace
int
,
typnamespace
int
,
typlen
int
,
typlen
int
,
...
@@ -41,7 +41,7 @@ select
...
@@ -41,7 +41,7 @@ select
from
information_schema
.
type_info
from
information_schema
.
type_info
where
pos
=
0
;
where
pos
=
0
;
insert
into
pg_catalog
.
pg_type
values
(
merge
into
pg_catalog
.
pg_type
values
(
1111
,
1111
,
'name'
,
'name'
,
(
select
oid
from
pg_catalog
.
pg_namespace
where
nspname
=
'pg_catalog'
),
(
select
oid
from
pg_catalog
.
pg_namespace
where
nspname
=
'pg_catalog'
),
...
@@ -144,7 +144,7 @@ select
...
@@ -144,7 +144,7 @@ select
false
indisclustered
,
false
indisclustered
,
not
non_unique
indisunique
,
not
non_unique
indisunique
,
primary_key
indisprimary
,
primary_key
indisprimary
,
cast
(
null
as
varchar_ignorecase
)
indexprs
,
cast
(
''
as
varchar_ignorecase
)
indexprs
,
cast
(
0
as
array
)
indkey
cast
(
0
as
array
)
indkey
from
information_schema
.
indexes
i
,
information_schema
.
tables
t
from
information_schema
.
indexes
i
,
information_schema
.
tables
t
where
i
.
table_schema
=
t
.
table_schema
where
i
.
table_schema
=
t
.
table_schema
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/server/web/WebThread.java
浏览文件 @
52ea313c
...
@@ -747,7 +747,7 @@ class WebThread extends Thread {
...
@@ -747,7 +747,7 @@ class WebThread extends Thread {
buff
.
append
(
"setNode("
+
treeIndex
+
", 0, 0, 'info', '"
+
PageParser
.
escapeJavaScript
(
version
)+
"', null);\n"
);
buff
.
append
(
"setNode("
+
treeIndex
+
", 0, 0, 'info', '"
+
PageParser
.
escapeJavaScript
(
version
)+
"', null);\n"
);
buff
.
append
(
"refreshQueryTables();"
);
buff
.
append
(
"refreshQueryTables();"
);
session
.
put
(
"tree"
,
buff
.
toString
());
session
.
put
(
"tree"
,
buff
.
toString
());
}
catch
(
SQL
Exception
e
)
{
}
catch
(
Exception
e
)
{
session
.
put
(
"tree"
,
""
);
session
.
put
(
"tree"
,
""
);
session
.
put
(
"error"
,
getStackTrace
(
0
,
e
));
session
.
put
(
"error"
,
getStackTrace
(
0
,
e
));
}
}
...
...
This diff is collapsed.
Click to expand it.
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论