Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Gpdb
提交
79d35b41
G
Gpdb
项目概览
Greenplum
/
Gpdb
通知
7
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
Gpdb
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
79d35b41
编写于
7月 30, 2002
作者:
D
Dave Cramer
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
added tests for crossReferences
上级
55695148
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
58 addition
and
6 deletion
+58
-6
src/interfaces/jdbc/org/postgresql/test/jdbc2/DatabaseMetaDataTest.java
.../jdbc/org/postgresql/test/jdbc2/DatabaseMetaDataTest.java
+58
-6
未找到文件。
src/interfaces/jdbc/org/postgresql/test/jdbc2/DatabaseMetaDataTest.java
浏览文件 @
79d35b41
...
...
@@ -9,7 +9,7 @@ import java.sql.*;
*
* PS: Do you know how difficult it is to type on a train? ;-)
*
* $Id: DatabaseMetaDataTest.java,v 1.
9 2002/07/23 03:59:55 barry
Exp $
* $Id: DatabaseMetaDataTest.java,v 1.
10 2002/07/30 13:22:38 davec
Exp $
*/
public
class
DatabaseMetaDataTest
extends
TestCase
...
...
@@ -48,7 +48,8 @@ public class DatabaseMetaDataTest extends TestCase
ResultSet
rs
=
dbmd
.
getTables
(
null
,
null
,
"test%"
,
new
String
[]
{
"TABLE"
});
assertTrue
(
rs
.
next
()
);
assertTrue
(
rs
.
getString
(
"TABLE_NAME"
).
equals
(
"testmetadata"
)
);
String
tableName
=
rs
.
getString
(
"TABLE_NAME"
);
assertTrue
(
tableName
.
equals
(
"testmetadata"
)
);
rs
.
close
();
...
...
@@ -101,7 +102,7 @@ public class DatabaseMetaDataTest extends TestCase
assertTrue
(
dbmd
.
supportsMinimumSQLGrammar
());
assertTrue
(!
dbmd
.
supportsCoreSQLGrammar
());
assertTrue
(!
dbmd
.
supportsExtendedSQLGrammar
());
assertTrue
(
!
dbmd
.
supportsANSI92EntryLevelSQL
());
assertTrue
(
dbmd
.
supportsANSI92EntryLevelSQL
());
assertTrue
(!
dbmd
.
supportsANSI92IntermediateSQL
());
assertTrue
(!
dbmd
.
supportsANSI92FullSQL
());
...
...
@@ -228,6 +229,57 @@ public class DatabaseMetaDataTest extends TestCase
}
}
public
void
testCrossReference
()
{
try
{
Connection
con1
=
JDBC2Tests
.
openDB
();
JDBC2Tests
.
createTable
(
con1
,
"vv"
,
"a int not null, b int not null, primary key ( a, b )"
);
JDBC2Tests
.
createTable
(
con1
,
"ww"
,
"m int not null, n int not null, primary key ( m, n ), foreign key ( m, n ) references vv ( a, b )"
);
DatabaseMetaData
dbmd
=
con
.
getMetaData
();
assertNotNull
(
dbmd
);
ResultSet
rs
=
dbmd
.
getCrossReference
(
null
,
""
,
"vv"
,
null
,
""
,
"ww"
);
for
(
int
j
=
1
;
rs
.
next
();
j
++
)
{
String
pkTableName
=
rs
.
getString
(
"PKTABLE_NAME"
);
assertTrue
(
pkTableName
.
equals
(
"vv"
)
);
String
pkColumnName
=
rs
.
getString
(
"PKCOLUMN_NAME"
);
assertTrue
(
pkColumnName
.
equals
(
"a"
)
||
pkColumnName
.
equals
(
"b"
));
String
fkTableName
=
rs
.
getString
(
"FKTABLE_NAME"
);
assertTrue
(
fkTableName
.
equals
(
"ww"
)
);
String
fkColumnName
=
rs
.
getString
(
"FKCOLUMN_NAME"
);
assertTrue
(
fkColumnName
.
equals
(
"m"
)
||
fkColumnName
.
equals
(
"n"
)
)
;
String
fkName
=
rs
.
getString
(
"FK_NAME"
);
assertTrue
(
fkName
.
equals
(
"<unnamed>"
)
);
String
pkName
=
rs
.
getString
(
"PK_NAME"
);
assertTrue
(
pkName
.
equals
(
"vv_pkey"
)
);
int
keySeq
=
rs
.
getInt
(
"KEY_SEQ"
);
assertTrue
(
keySeq
==
j
);
}
JDBC2Tests
.
dropTable
(
con1
,
"vv"
);
JDBC2Tests
.
dropTable
(
con1
,
"ww"
);
}
catch
(
SQLException
ex
)
{
fail
(
ex
.
getMessage
());
}
}
public
void
testForeignKeys
()
{
try
...
...
@@ -262,10 +314,10 @@ public class DatabaseMetaDataTest extends TestCase
assertTrue
(
fkColumnName
.
equals
(
"people_id"
)
||
fkColumnName
.
equals
(
"policy_id"
)
)
;
String
fkName
=
rs
.
getString
(
"FK_NAME"
);
assertTrue
(
fkName
.
equals
(
"people
_pkey"
)
||
fkName
.
equals
(
"policy_pke
y"
)
);
assertTrue
(
fkName
.
equals
(
"people
"
)
||
fkName
.
equals
(
"polic
y"
)
);
String
pkName
=
rs
.
getString
(
"PK_NAME"
);
// assertTrue( pkName.equals("users"
) );
assertTrue
(
pkName
.
equals
(
"people_pkey"
)
||
pkName
.
equals
(
"policy_pkey"
)
);
}
...
...
@@ -282,7 +334,7 @@ public class DatabaseMetaDataTest extends TestCase
assertTrue
(
rs
.
getString
(
"FKTABLE_NAME"
).
equals
(
"users"
)
);
assertTrue
(
rs
.
getString
(
"FKCOLUMN_NAME"
).
equals
(
"people_id"
)
);
assertTrue
(
rs
.
getString
(
"FK_NAME"
).
equals
(
"people
_pkey
"
)
);
assertTrue
(
rs
.
getString
(
"FK_NAME"
).
equals
(
"people"
)
);
JDBC2Tests
.
dropTable
(
con1
,
"users"
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录