Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Gpdb
提交
422c2e38
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,发现更多精彩内容 >>
提交
422c2e38
编写于
9月 01, 2002
作者:
D
Dave Cramer
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
testing for insertRow
上级
164e1bc9
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
71 addition
and
70 deletion
+71
-70
src/interfaces/jdbc/org/postgresql/test/jdbc2/UpdateableResultTest.java
.../jdbc/org/postgresql/test/jdbc2/UpdateableResultTest.java
+71
-70
未找到文件。
src/interfaces/jdbc/org/postgresql/test/jdbc2/UpdateableResultTest.java
浏览文件 @
422c2e38
...
...
@@ -23,47 +23,48 @@ public class UpdateableResultTest extends TestCase
public
void
testUpdateable
()
{
try
{
Connection
con
=
TestUtil
.
openDB
();
try
{
Connection
con
=
TestUtil
.
openDB
();
TestUtil
.
createTable
(
con
,
"updateable"
,
"id int primary key, name text, notselected text"
);
TestUtil
.
createTable
(
con
,
"second"
,
"id1 int primary key, name1 text"
);
Statement
st1
=
con
.
createStatement
();
boolean
retVal
=
st1
.
execute
(
"insert into updateable ( id, name, notselected ) values (1, 'jake', 'avalue')"
);
assertTrue
(!
retVal
);
retVal
=
st1
.
execute
(
"insert into second (id1, name1) values (1, 'jake')"
);
assertTrue
(
!
retVal
);
st1
.
close
();
// put some dummy data into second
Statement
st2
=
con
.
createStatement
();
st2
.
execute
(
"insert into second values (1,'anyvalue' )"
);
st2
.
close
();
Statement
st
=
con
.
createStatement
(
ResultSet
.
TYPE_SCROLL_INSENSITIVE
,
ResultSet
.
CONCUR_UPDATABLE
);
ResultSet
rs
=
st
.
executeQuery
(
"select id, name, notselected from updateable"
);
Statement
st
=
con
.
createStatement
(
ResultSet
.
TYPE_SCROLL_INSENSITIVE
,
ResultSet
.
CONCUR_UPDATABLE
);
ResultSet
rs
=
st
.
executeQuery
(
"select * from updateable"
);
assertNotNull
(
rs
);
rs
.
moveToInsertRow
();
rs
.
updateInt
(
1
,
1
);
rs
.
updateString
(
2
,
"jake"
);
rs
.
updateString
(
3
,
"avalue"
);
rs
.
insertRow
();
rs
.
first
();
assertNotNull
(
rs
);
rs
.
updateInt
(
"id"
,
2
);
rs
.
updateString
(
"name"
,
"dave"
);
rs
.
updateRow
();
while
(
rs
.
next
())
{
rs
.
updateInt
(
"id"
,
2
);
rs
.
updateString
(
"name"
,
"dave"
);
rs
.
updateRow
();
assertTrue
(
rs
.
getInt
(
"id"
)
==
2
);
assertTrue
(
rs
.
getString
(
"name"
).
equals
(
"dave"
));
assertTrue
(
rs
.
getString
(
"notselected"
).
equals
(
"avalue"
)
);
assertTrue
(
rs
.
getInt
(
"id"
)
==
2
);
assertTrue
(
rs
.
getString
(
"name"
).
equals
(
"dave"
));
assertTrue
(
rs
.
getString
(
"notselected"
).
equals
(
"avalue"
)
);
rs
.
deleteRow
();
rs
.
moveToInsertRow
();
rs
.
updateInt
(
"id"
,
3
);
rs
.
updateString
(
"name"
,
"paul"
);
rs
.
deleteRow
();
rs
.
moveToInsertRow
();
rs
.
updateInt
(
"id"
,
3
);
rs
.
updateString
(
"name"
,
"paul"
);
rs
.
insertRow
();
rs
.
refreshRow
();
assertTrue
(
rs
.
getInt
(
"id"
)
==
3
);
assertTrue
(
rs
.
getString
(
"name"
).
equals
(
"paul"
));
assertTrue
(
rs
.
getString
(
"notselected"
)
==
null
);
rs
.
insertRow
();
rs
.
refreshRow
();
assertTrue
(
rs
.
getInt
(
"id"
)
==
3
);
assertTrue
(
rs
.
getString
(
"name"
).
equals
(
"paul"
));
assertTrue
(
rs
.
getString
(
"notselected"
)
==
null
);
}
rs
.
close
();
rs
.
close
();
rs
=
st
.
executeQuery
(
"select id1, id, name, name1 from updateable, second"
);
try
...
...
@@ -82,53 +83,53 @@ public class UpdateableResultTest extends TestCase
try
{
rs
=
st
.
executeQuery
(
"select oid,* from updateable"
);
if
(
rs
.
first
()
)
{
rs
.
updateInt
(
"id"
,
3
);
rs
.
updateString
(
"name"
,
"dave3"
);
rs
.
updateRow
();
assertTrue
(
rs
.
getInt
(
"id"
)
==
3
);
assertTrue
(
rs
.
getString
(
"name"
).
equals
(
"dave3"
));
rs
.
moveToInsertRow
();
rs
.
updateInt
(
"id"
,
4
);
rs
.
updateString
(
"name"
,
"dave4"
);
rs
.
insertRow
();
rs
.
updateInt
(
"id"
,
5
);
rs
.
updateString
(
"name"
,
"dave5"
);
rs
.
insertRow
();
rs
.
moveToCurrentRow
();
assertTrue
(
rs
.
getInt
(
"id"
)
==
3
);
assertTrue
(
rs
.
getString
(
"name"
).
equals
(
"dave3"
));
assertTrue
(
rs
.
next
()
);
assertTrue
(
rs
.
getInt
(
"id"
)
==
4
);
assertTrue
(
rs
.
getString
(
"name"
).
equals
(
"dave4"
));
assertTrue
(
rs
.
next
()
);
assertTrue
(
rs
.
getInt
(
"id"
)
==
5
);
assertTrue
(
rs
.
getString
(
"name"
).
equals
(
"dave5"
));
}
rs
=
st
.
executeQuery
(
"select oid,* from updateable"
);
if
(
rs
.
first
()
)
{
rs
.
updateInt
(
"id"
,
3
);
rs
.
updateString
(
"name"
,
"dave3"
);
rs
.
updateRow
();
assertTrue
(
rs
.
getInt
(
"id"
)
==
3
);
assertTrue
(
rs
.
getString
(
"name"
).
equals
(
"dave3"
));
rs
.
moveToInsertRow
();
rs
.
updateInt
(
"id"
,
4
);
rs
.
updateString
(
"name"
,
"dave4"
);
rs
.
insertRow
();
rs
.
updateInt
(
"id"
,
5
);
rs
.
updateString
(
"name"
,
"dave5"
);
rs
.
insertRow
();
rs
.
moveToCurrentRow
();
assertTrue
(
rs
.
getInt
(
"id"
)
==
3
);
assertTrue
(
rs
.
getString
(
"name"
).
equals
(
"dave3"
));
assertTrue
(
rs
.
next
()
);
assertTrue
(
rs
.
getInt
(
"id"
)
==
4
);
assertTrue
(
rs
.
getString
(
"name"
).
equals
(
"dave4"
));
assertTrue
(
rs
.
next
()
);
assertTrue
(
rs
.
getInt
(
"id"
)
==
5
);
assertTrue
(
rs
.
getString
(
"name"
).
equals
(
"dave5"
));
}
}
catch
(
SQLException
ex
)
{
fail
(
ex
.
getMessage
());
}
st
.
close
();
st
.
close
();
TestUtil
.
dropTable
(
con
,
"updateable"
);
TestUtil
.
closeDB
(
con
);
}
catch
(
Exception
ex
)
{
fail
(
ex
.
getMessage
());
}
}
TestUtil
.
closeDB
(
con
);
}
catch
(
Exception
ex
)
{
fail
(
ex
.
getMessage
());
}
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录