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
e2ad5816
Commit
e2ad5816
authored
Dec 20, 2002
by
Dave Cramer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mike beachy's patch for statement handling
parent
83feff3e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
82 additions
and
4 deletions
+82
-4
src/interfaces/jdbc/org/postgresql/jdbc2/optional/PooledConnectionImpl.java
...c/org/postgresql/jdbc2/optional/PooledConnectionImpl.java
+17
-3
src/interfaces/jdbc/org/postgresql/test/jdbc2/optional/ConnectionPoolTest.java
...rg/postgresql/test/jdbc2/optional/ConnectionPoolTest.java
+65
-1
No files found.
src/interfaces/jdbc/org/postgresql/jdbc2/optional/PooledConnectionImpl.java
View file @
e2ad5816
...
...
@@ -12,7 +12,7 @@ import java.lang.reflect.*;
* @see ConnectionPool
*
* @author Aaron Mulder (ammulder@chariotsolutions.com)
* @version $Revision: 1.
4
$
* @version $Revision: 1.
5
$
*/
public
class
PooledConnectionImpl
implements
PooledConnection
{
...
...
@@ -204,7 +204,14 @@ public class PooledConnectionImpl implements PooledConnection
return
Boolean
.
FALSE
;
}
}
return
method
.
invoke
(
con
,
args
);
try
{
return
method
.
invoke
(
con
,
args
);
}
catch
(
InvocationTargetException
e
)
{
throw
e
.
getTargetException
();
}
}
// All the rest is from the Connection interface
if
(
method
.
getName
().
equals
(
"isClosed"
))
...
...
@@ -355,7 +362,14 @@ public class PooledConnectionImpl implements PooledConnection
}
else
{
return
method
.
invoke
(
st
,
args
);
try
{
return
method
.
invoke
(
st
,
args
);
}
catch
(
InvocationTargetException
e
)
{
throw
e
.
getTargetException
();
}
}
}
}
...
...
src/interfaces/jdbc/org/postgresql/test/jdbc2/optional/ConnectionPoolTest.java
View file @
e2ad5816
...
...
@@ -11,7 +11,7 @@ import java.sql.*;
* interface to the PooledConnection is through the CPDS.
*
* @author Aaron Mulder (ammulder@chariotsolutions.com)
* @version $Revision: 1.
4
$
* @version $Revision: 1.
5
$
*/
public
class
ConnectionPoolTest
extends
BaseDataSourceTest
{
...
...
@@ -359,6 +359,70 @@ public class ConnectionPoolTest extends BaseDataSourceTest
}
}
/**
* Ensures that the Statement proxy generated by the Connection handle
* throws the correct kind of exception.
*/
public
void
testStatementProxy
()
{
Statement
s
=
null
;
try
{
PooledConnection
pc
=
getPooledConnection
();
Connection
con
=
pc
.
getConnection
();
s
=
con
.
createStatement
();
}
catch
(
SQLException
e
)
{
fail
(
e
.
getMessage
());
}
try
{
s
.
executeQuery
(
"SELECT * FROM THIS_TABLE_SHOULD_NOT_EXIST"
);
fail
(
"An SQL exception was not thrown that should have been"
);
}
catch
(
SQLException
e
)
{
;
// This is the expected and correct path
}
catch
(
Exception
e
)
{
fail
(
"bad exception; was expecting SQLException, not"
+
e
.
getClass
().
getName
());
}
}
/**
* Ensures that the Statement proxy generated by the Connection handle
* throws the correct kind of exception.
*/
public
void
testStatementProxy
()
{
Statement
s
=
null
;
try
{
PooledConnection
pc
=
getPooledConnection
();
Connection
con
=
pc
.
getConnection
();
s
=
con
.
createStatement
();
}
catch
(
SQLException
e
)
{
fail
(
e
.
getMessage
());
}
try
{
s
.
executeQuery
(
"SELECT * FROM THIS_TABLE_SHOULD_NOT_EXIST"
);
fail
(
"An SQL exception was not thrown that should have been"
);
}
catch
(
SQLException
e
)
{
;
// This is the expected and correct path
}
catch
(
Exception
e
)
{
fail
(
"bad exception; was expecting SQLException, not"
+
e
.
getClass
().
getName
());
}
}
/**
* Ensures that a prepared statement generated by a proxied connection
* returns the proxied connection from getConnection() [not the physical
...
...
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