Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
52ea313c
提交
52ea313c
authored
7月 28, 2007
作者:
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 {
url
=
"pg://localhost:"
+
port
;
int
testing
;
//
log = true;
log
=
true
;
}
public
String
getURL
()
{
...
...
h2/src/main/org/h2/server/pg/PgServerThread.java
浏览文件 @
52ea313c
...
...
@@ -25,6 +25,8 @@ import java.sql.SQLException;
import
java.sql.Statement
;
import
java.sql.Types
;
import
java.util.HashMap
;
import
java.util.HashSet
;
import
java.util.Hashtable
;
import
java.util.Properties
;
import
org.h2.Driver
;
...
...
@@ -60,6 +62,7 @@ public class PgServerThread implements Runnable {
private
String
dateStyle
=
"ISO"
;
private
HashMap
prepared
=
new
HashMap
();
private
HashMap
portals
=
new
HashMap
();
private
HashSet
types
=
new
HashSet
();
PgServerThread
(
Socket
socket
,
PgServer
server
)
{
this
.
server
=
server
;
...
...
@@ -210,7 +213,9 @@ Limitations:
int
count
=
readShort
();
p
.
paramType
=
new
int
[
count
];
for
(
int
i
=
0
;
i
<
count
;
i
++)
{
p
.
paramType
[
i
]
=
readInt
();
int
type
=
readInt
();
checkType
(
type
);
p
.
paramType
[
i
]
=
type
;
}
try
{
p
.
prep
=
conn
.
prepareStatement
(
p
.
sql
);
...
...
@@ -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
)
{
String
lower
=
s
.
toLowerCase
();
int
todo
;
...
...
@@ -483,11 +494,14 @@ Limitations:
startMessage
(
't'
);
writeShort
(
count
);
for
(
int
i
=
0
;
i
<
count
;
i
++)
{
int
type
;
if
(
p
.
paramType
!=
null
&&
p
.
paramType
[
i
]
!=
0
)
{
writeInt
(
p
.
paramType
[
i
])
;
type
=
p
.
paramType
[
i
]
;
}
else
{
writeInt
(
TYPE_STRING
)
;
type
=
TYPE_STRING
;
}
checkType
(
type
);
writeInt
(
type
);
}
sendMessage
();
}
catch
(
SQLException
e
)
{
...
...
@@ -510,7 +524,9 @@ Limitations:
String
[]
names
=
new
String
[
columns
];
for
(
int
i
=
0
;
i
<
columns
;
i
++)
{
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'
);
writeShort
(
columns
);
...
...
@@ -531,10 +547,11 @@ Limitations:
}
private
int
getType
(
int
type
)
{
switch
(
type
)
{
case
Types
.
VARCHAR
:
return
19
;
}
int
testing
;
// switch(type) {
// case Types.VARCHAR:
// return 19;
// }
return
type
;
}
...
...
@@ -573,6 +590,7 @@ Limitations:
}
private
void
initDb
()
throws
SQLException
{
int
todoUseVersionOnlyInitWhenRequired
;
Statement
stat
=
conn
.
createStatement
();
Reader
r
=
new
InputStreamReader
(
getClass
().
getResourceAsStream
(
"pg_catalog.sql"
));
r
=
new
BufferedReader
(
r
);
...
...
@@ -585,6 +603,11 @@ Limitations:
stat
.
execute
(
sql
);
}
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 {
...
...
h2/src/main/org/h2/server/pg/pg_catalog.sql
浏览文件 @
52ea313c
...
...
@@ -25,7 +25,7 @@ select
from
information_schema
.
schemata
;
create
table
pg_catalog
.
pg_type
(
oid
int
,
oid
int
primary
key
,
typname
varchar_ignorecase
,
typnamespace
int
,
typlen
int
,
...
...
@@ -41,7 +41,7 @@ select
from
information_schema
.
type_info
where
pos
=
0
;
insert
into
pg_catalog
.
pg_type
values
(
merge
into
pg_catalog
.
pg_type
values
(
1111
,
'name'
,
(
select
oid
from
pg_catalog
.
pg_namespace
where
nspname
=
'pg_catalog'
),
...
...
@@ -144,7 +144,7 @@ select
false
indisclustered
,
not
non_unique
indisunique
,
primary_key
indisprimary
,
cast
(
null
as
varchar_ignorecase
)
indexprs
,
cast
(
''
as
varchar_ignorecase
)
indexprs
,
cast
(
0
as
array
)
indkey
from
information_schema
.
indexes
i
,
information_schema
.
tables
t
where
i
.
table_schema
=
t
.
table_schema
...
...
h2/src/main/org/h2/server/web/WebThread.java
浏览文件 @
52ea313c
...
...
@@ -747,7 +747,7 @@ class WebThread extends Thread {
buff
.
append
(
"setNode("
+
treeIndex
+
", 0, 0, 'info', '"
+
PageParser
.
escapeJavaScript
(
version
)+
"', null);\n"
);
buff
.
append
(
"refreshQueryTables();"
);
session
.
put
(
"tree"
,
buff
.
toString
());
}
catch
(
SQL
Exception
e
)
{
}
catch
(
Exception
e
)
{
session
.
put
(
"tree"
,
""
);
session
.
put
(
"error"
,
getStackTrace
(
0
,
e
));
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论