Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
422c2e38
Commit
422c2e38
authored
Sep 01, 2002
by
Dave Cramer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
testing for insertRow
parent
164e1bc9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
71 additions
and
70 deletions
+71
-70
src/interfaces/jdbc/org/postgresql/test/jdbc2/UpdateableResultTest.java
.../jdbc/org/postgresql/test/jdbc2/UpdateableResultTest.java
+71
-70
No files found.
src/interfaces/jdbc/org/postgresql/test/jdbc2/UpdateableResultTest.java
View file @
422c2e38
...
@@ -23,47 +23,48 @@ public class UpdateableResultTest extends TestCase
...
@@ -23,47 +23,48 @@ public class UpdateableResultTest extends TestCase
public
void
testUpdateable
()
public
void
testUpdateable
()
{
{
try
try
{
{
Connection
con
=
TestUtil
.
openDB
();
Connection
con
=
TestUtil
.
openDB
();
TestUtil
.
createTable
(
con
,
"updateable"
,
"id int primary key, name text, notselected text"
);
TestUtil
.
createTable
(
con
,
"updateable"
,
"id int primary key, name text, notselected text"
);
TestUtil
.
createTable
(
con
,
"second"
,
"id1 int primary key, name1 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')"
);
// put some dummy data into second
assertTrue
(
!
retVal
);
Statement
st2
=
con
.
createStatement
();
st1
.
close
();
st2
.
execute
(
"insert into second values (1,'anyvalue' )"
);
st2
.
close
();
Statement
st
=
con
.
createStatement
(
ResultSet
.
TYPE_SCROLL_INSENSITIVE
,
ResultSet
.
CONCUR_UPDATABLE
);
Statement
st
=
con
.
createStatement
(
ResultSet
.
TYPE_SCROLL_INSENSITIVE
,
ResultSet
.
CONCUR_UPDATABLE
);
ResultSet
rs
=
st
.
executeQuery
(
"select id, name, notselected from updateable"
);
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
())
assertTrue
(
rs
.
getInt
(
"id"
)
==
2
);
{
assertTrue
(
rs
.
getString
(
"name"
).
equals
(
"dave"
));
rs
.
updateInt
(
"id"
,
2
);
assertTrue
(
rs
.
getString
(
"notselected"
).
equals
(
"avalue"
)
);
rs
.
updateString
(
"name"
,
"dave"
);
rs
.
updateRow
();
assertTrue
(
rs
.
getInt
(
"id"
)
==
2
);
assertTrue
(
rs
.
getString
(
"name"
).
equals
(
"dave"
));
assertTrue
(
rs
.
getString
(
"notselected"
).
equals
(
"avalue"
)
);
rs
.
deleteRow
();
rs
.
deleteRow
();
rs
.
moveToInsertRow
();
rs
.
moveToInsertRow
();
rs
.
updateInt
(
"id"
,
3
);
rs
.
updateInt
(
"id"
,
3
);
rs
.
updateString
(
"name"
,
"paul"
);
rs
.
updateString
(
"name"
,
"paul"
);
rs
.
insertRow
();
rs
.
insertRow
();
rs
.
refreshRow
();
rs
.
refreshRow
();
assertTrue
(
rs
.
getInt
(
"id"
)
==
3
);
assertTrue
(
rs
.
getInt
(
"id"
)
==
3
);
assertTrue
(
rs
.
getString
(
"name"
).
equals
(
"paul"
));
assertTrue
(
rs
.
getString
(
"name"
).
equals
(
"paul"
));
assertTrue
(
rs
.
getString
(
"notselected"
)
==
null
);
assertTrue
(
rs
.
getString
(
"notselected"
)
==
null
);
}
rs
.
close
();
rs
.
close
();
rs
=
st
.
executeQuery
(
"select id1, id, name, name1 from updateable, second"
);
rs
=
st
.
executeQuery
(
"select id1, id, name, name1 from updateable, second"
);
try
try
...
@@ -82,53 +83,53 @@ public class UpdateableResultTest extends TestCase
...
@@ -82,53 +83,53 @@ public class UpdateableResultTest extends TestCase
try
try
{
{
rs
=
st
.
executeQuery
(
"select oid,* from updateable"
);
rs
=
st
.
executeQuery
(
"select oid,* from updateable"
);
if
(
rs
.
first
()
)
if
(
rs
.
first
()
)
{
{
rs
.
updateInt
(
"id"
,
3
);
rs
.
updateInt
(
"id"
,
3
);
rs
.
updateString
(
"name"
,
"dave3"
);
rs
.
updateString
(
"name"
,
"dave3"
);
rs
.
updateRow
();
rs
.
updateRow
();
assertTrue
(
rs
.
getInt
(
"id"
)
==
3
);
assertTrue
(
rs
.
getInt
(
"id"
)
==
3
);
assertTrue
(
rs
.
getString
(
"name"
).
equals
(
"dave3"
));
assertTrue
(
rs
.
getString
(
"name"
).
equals
(
"dave3"
));
rs
.
moveToInsertRow
();
rs
.
moveToInsertRow
();
rs
.
updateInt
(
"id"
,
4
);
rs
.
updateInt
(
"id"
,
4
);
rs
.
updateString
(
"name"
,
"dave4"
);
rs
.
updateString
(
"name"
,
"dave4"
);
rs
.
insertRow
();
rs
.
insertRow
();
rs
.
updateInt
(
"id"
,
5
);
rs
.
updateInt
(
"id"
,
5
);
rs
.
updateString
(
"name"
,
"dave5"
);
rs
.
updateString
(
"name"
,
"dave5"
);
rs
.
insertRow
();
rs
.
insertRow
();
rs
.
moveToCurrentRow
();
rs
.
moveToCurrentRow
();
assertTrue
(
rs
.
getInt
(
"id"
)
==
3
);
assertTrue
(
rs
.
getInt
(
"id"
)
==
3
);
assertTrue
(
rs
.
getString
(
"name"
).
equals
(
"dave3"
));
assertTrue
(
rs
.
getString
(
"name"
).
equals
(
"dave3"
));
assertTrue
(
rs
.
next
()
);
assertTrue
(
rs
.
next
()
);
assertTrue
(
rs
.
getInt
(
"id"
)
==
4
);
assertTrue
(
rs
.
getInt
(
"id"
)
==
4
);
assertTrue
(
rs
.
getString
(
"name"
).
equals
(
"dave4"
));
assertTrue
(
rs
.
getString
(
"name"
).
equals
(
"dave4"
));
assertTrue
(
rs
.
next
()
);
assertTrue
(
rs
.
next
()
);
assertTrue
(
rs
.
getInt
(
"id"
)
==
5
);
assertTrue
(
rs
.
getInt
(
"id"
)
==
5
);
assertTrue
(
rs
.
getString
(
"name"
).
equals
(
"dave5"
));
assertTrue
(
rs
.
getString
(
"name"
).
equals
(
"dave5"
));
}
}
}
}
catch
(
SQLException
ex
)
catch
(
SQLException
ex
)
{
{
fail
(
ex
.
getMessage
());
fail
(
ex
.
getMessage
());
}
}
st
.
close
();
st
.
close
();
TestUtil
.
dropTable
(
con
,
"updateable"
);
TestUtil
.
dropTable
(
con
,
"updateable"
);
TestUtil
.
closeDB
(
con
);
TestUtil
.
closeDB
(
con
);
}
}
catch
(
Exception
ex
)
catch
(
Exception
ex
)
{
{
fail
(
ex
.
getMessage
());
fail
(
ex
.
getMessage
());
}
}
}
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment