Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
a2485214
提交
a2485214
authored
7月 06, 2010
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
ODBC: MS Access could not link to a table with unique index or primary key.
上级
ab39b595
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
32 行增加
和
9 行删除
+32
-9
PgServer.java
h2/src/main/org/h2/server/pg/PgServer.java
+7
-2
PgServerThread.java
h2/src/main/org/h2/server/pg/PgServerThread.java
+8
-1
pg_catalog.sql
h2/src/main/org/h2/server/pg/pg_catalog.sql
+17
-6
没有找到文件。
h2/src/main/org/h2/server/pg/PgServer.java
浏览文件 @
a2485214
...
@@ -46,6 +46,11 @@ public class PgServer implements Service {
...
@@ -46,6 +46,11 @@ public class PgServer implements Service {
*/
*/
public
static
final
int
PG_TYPE_VARCHAR
=
1043
;
public
static
final
int
PG_TYPE_VARCHAR
=
1043
;
/**
* The integer array type (for the column pg_index.indkey).
*/
public
static
final
int
PG_TYPE_INT2VECTOR
=
22
;
private
static
final
int
PG_TYPE_BOOL
=
16
;
private
static
final
int
PG_TYPE_BOOL
=
16
;
private
static
final
int
PG_TYPE_BYTEA
=
17
;
private
static
final
int
PG_TYPE_BYTEA
=
17
;
private
static
final
int
PG_TYPE_BPCHAR
=
1042
;
private
static
final
int
PG_TYPE_BPCHAR
=
1042
;
...
@@ -269,7 +274,7 @@ public class PgServer implements Service {
...
@@ -269,7 +274,7 @@ public class PgServer implements Service {
if
(
rs
.
next
())
{
if
(
rs
.
next
())
{
return
rs
.
getString
(
1
);
return
rs
.
getString
(
1
);
}
}
return
null
;
return
""
;
}
}
PreparedStatement
prep
=
conn
.
prepareStatement
(
"select column_name from information_schema.indexes where id=? and ordinal_position=?"
);
PreparedStatement
prep
=
conn
.
prepareStatement
(
"select column_name from information_schema.indexes where id=? and ordinal_position=?"
);
prep
.
setInt
(
1
,
indexId
);
prep
.
setInt
(
1
,
indexId
);
...
@@ -278,7 +283,7 @@ public class PgServer implements Service {
...
@@ -278,7 +283,7 @@ public class PgServer implements Service {
if
(
rs
.
next
())
{
if
(
rs
.
next
())
{
return
rs
.
getString
(
1
);
return
rs
.
getString
(
1
);
}
}
return
null
;
return
""
;
}
}
/**
/**
...
...
h2/src/main/org/h2/server/pg/PgServerThread.java
浏览文件 @
a2485214
...
@@ -516,9 +516,16 @@ public class PgServerThread implements Runnable {
...
@@ -516,9 +516,16 @@ public class PgServerThread implements Runnable {
int
[]
precision
=
new
int
[
columns
];
int
[]
precision
=
new
int
[
columns
];
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
);
String
name
=
meta
.
getColumnName
(
i
+
1
);
names
[
i
]
=
name
;
int
type
=
meta
.
getColumnType
(
i
+
1
);
int
type
=
meta
.
getColumnType
(
i
+
1
);
type
=
PgServer
.
convertType
(
type
);
type
=
PgServer
.
convertType
(
type
);
// the ODBC client needs the column pg_catalog.pg_index
// to be of type 'int2vector'
// if (name.equalsIgnoreCase("indkey") &&
// "pg_index".equalsIgnoreCase(meta.getTableName(i + 1))) {
// type = PgServer.PG_TYPE_INT2VECTOR;
// }
precision
[
i
]
=
meta
.
getColumnDisplaySize
(
i
+
1
);
precision
[
i
]
=
meta
.
getColumnDisplaySize
(
i
+
1
);
server
.
checkType
(
type
);
server
.
checkType
(
type
);
types
[
i
]
=
type
;
types
[
i
]
=
type
;
...
...
h2/src/main/org/h2/server/pg/pg_catalog.sql
浏览文件 @
a2485214
...
@@ -72,6 +72,15 @@ merge into pg_catalog.pg_type values(
...
@@ -72,6 +72,15 @@ merge into pg_catalog.pg_type values(
0
,
0
,
-
1
-
1
);
);
merge
into
pg_catalog
.
pg_type
values
(
22
,
'int2vector'
,
(
select
oid
from
pg_catalog
.
pg_namespace
where
nspname
=
'pg_catalog'
),
-
1
,
'c'
,
0
,
-
1
);
create
view
pg_catalog
.
pg_class
-- (oid, relname, relnamespace, relkind, relam, reltuples, relpages, relhasrules, relhasoids)
create
view
pg_catalog
.
pg_class
-- (oid, relname, relnamespace, relkind, relam, reltuples, relpages, relhasrules, relhasoids)
as
as
...
@@ -134,10 +143,10 @@ select
...
@@ -134,10 +143,10 @@ select
t
.
id
attrelid
,
t
.
id
attrelid
,
c
.
column_name
attname
,
c
.
column_name
attname
,
pg_convertType
(
data_type
)
atttypid
,
pg_convertType
(
data_type
)
atttypid
,
-
1
attlen
,
case
when
numeric_precision
>
255
then
-
1
else
numeric_precision
end
attlen
,
c
.
ordinal_position
attnum
,
c
.
ordinal_position
attnum
,
-
1
atttypmod
,
-
1
atttypmod
,
false
attnotnull
,
case
c
.
is_nullable
when
'YES'
then
false
else
true
end
attnotnull
,
false
attisdropped
,
false
attisdropped
,
false
atthasdef
false
atthasdef
from
information_schema
.
tables
t
,
information_schema
.
columns
c
from
information_schema
.
tables
t
,
information_schema
.
columns
c
...
@@ -149,10 +158,10 @@ select
...
@@ -149,10 +158,10 @@ select
i
.
id
attrelid
,
i
.
id
attrelid
,
c
.
column_name
attname
,
c
.
column_name
attname
,
pg_convertType
(
data_type
)
atttypid
,
pg_convertType
(
data_type
)
atttypid
,
-
1
attlen
,
case
when
numeric_precision
>
255
then
-
1
else
numeric_precision
end
attlen
,
c
.
ordinal_position
attnum
,
c
.
ordinal_position
attnum
,
-
1
atttypmod
,
-
1
atttypmod
,
false
attnotnull
,
case
c
.
is_nullable
when
'YES'
then
false
else
true
end
attnotnull
,
false
attisdropped
,
false
attisdropped
,
false
atthasdef
false
atthasdef
from
information_schema
.
tables
t
,
information_schema
.
indexes
i
,
information_schema
.
columns
c
from
information_schema
.
tables
t
,
information_schema
.
indexes
i
,
information_schema
.
columns
c
...
@@ -171,11 +180,13 @@ select
...
@@ -171,11 +180,13 @@ select
not
non_unique
indisunique
,
not
non_unique
indisunique
,
primary_key
indisprimary
,
primary_key
indisprimary
,
cast
(
''
as
varchar_ignorecase
)
indexprs
,
cast
(
''
as
varchar_ignorecase
)
indexprs
,
cast
(
0
as
array
)
indkey
cast
(
1
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
and
i
.
table_name
=
t
.
table_name
and
i
.
table_name
=
t
.
table_name
and
i
.
ordinal_position
=
1
;
and
i
.
ordinal_position
=
1
-- workaround for MS Access problem opening tables with primary key
and
1
=
0
;
drop
alias
if
exists
pg_get_indexdef
;
drop
alias
if
exists
pg_get_indexdef
;
create
alias
pg_get_indexdef
for
"org.h2.server.pg.PgServer.getIndexColumn"
;
create
alias
pg_get_indexdef
for
"org.h2.server.pg.PgServer.getIndexColumn"
;
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论