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
777acbb3
Commit
777acbb3
authored
Dec 12, 2003
by
Dave Cramer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix casting pooled connections to PGStatement problem patch by JariP
parent
ef6a8043
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
5 deletions
+28
-5
src/interfaces/jdbc/org/postgresql/jdbc2/optional/PooledConnectionImpl.java
...c/org/postgresql/jdbc2/optional/PooledConnectionImpl.java
+4
-4
src/interfaces/jdbc/org/postgresql/test/jdbc2/optional/ConnectionPoolTest.java
...rg/postgresql/test/jdbc2/optional/ConnectionPoolTest.java
+24
-1
No files found.
src/interfaces/jdbc/org/postgresql/jdbc2/optional/PooledConnectionImpl.java
View file @
777acbb3
...
...
@@ -14,7 +14,7 @@ import org.postgresql.PGConnection;
*
* @author Aaron Mulder (ammulder@chariotsolutions.com)
* @author Csaba Nagy (ncsaba@yahoo.com)
* @version $Revision: 1.
7
$
* @version $Revision: 1.
8
$
*/
public
class
PooledConnectionImpl
implements
PooledConnection
{
...
...
@@ -266,17 +266,17 @@ public class PooledConnectionImpl implements PooledConnection
else
if
(
method
.
getName
().
equals
(
"createStatement"
))
{
Statement
st
=
(
Statement
)
method
.
invoke
(
con
,
args
);
return
Proxy
.
newProxyInstance
(
getClass
().
getClassLoader
(),
new
Class
[]{
Statement
.
class
},
new
StatementHandler
(
this
,
st
));
return
Proxy
.
newProxyInstance
(
getClass
().
getClassLoader
(),
new
Class
[]{
Statement
.
class
,
org
.
postgresql
.
PGStatement
.
class
},
new
StatementHandler
(
this
,
st
));
}
else
if
(
method
.
getName
().
equals
(
"prepareCall"
))
{
Statement
st
=
(
Statement
)
method
.
invoke
(
con
,
args
);
return
Proxy
.
newProxyInstance
(
getClass
().
getClassLoader
(),
new
Class
[]{
CallableStatement
.
class
},
new
StatementHandler
(
this
,
st
));
return
Proxy
.
newProxyInstance
(
getClass
().
getClassLoader
(),
new
Class
[]{
CallableStatement
.
class
,
org
.
postgresql
.
PGStatement
.
class
},
new
StatementHandler
(
this
,
st
));
}
else
if
(
method
.
getName
().
equals
(
"prepareStatement"
))
{
Statement
st
=
(
Statement
)
method
.
invoke
(
con
,
args
);
return
Proxy
.
newProxyInstance
(
getClass
().
getClassLoader
(),
new
Class
[]{
PreparedStatement
.
class
},
new
StatementHandler
(
this
,
st
));
return
Proxy
.
newProxyInstance
(
getClass
().
getClassLoader
(),
new
Class
[]{
PreparedStatement
.
class
,
org
.
postgresql
.
PGStatement
.
class
},
new
StatementHandler
(
this
,
st
));
}
else
{
...
...
src/interfaces/jdbc/org/postgresql/test/jdbc2/optional/ConnectionPoolTest.java
View file @
777acbb3
...
...
@@ -11,7 +11,7 @@ import java.sql.*;
* interface to the PooledConnection is through the CPDS.
*
* @author Aaron Mulder (ammulder@chariotsolutions.com)
* @version $Revision: 1.
7
$
* @version $Revision: 1.
8
$
*/
public
class
ConnectionPoolTest
extends
BaseDataSourceTest
{
...
...
@@ -422,6 +422,29 @@ public class ConnectionPoolTest extends BaseDataSourceTest
}
}
/**
* Ensure that a statement created from a pool can be used
* like any other statement in regard to pg extensions.
*/
public
void
testStatementsProxyPGStatement
()
{
try
{
PooledConnection
pc
=
getPooledConnection
();
con
=
pc
.
getConnection
();
Statement
s
=
con
.
createStatement
();
boolean
b
=
((
org
.
postgresql
.
PGStatement
)
s
).
isUseServerPrepare
();
PreparedStatement
ps
=
con
.
prepareStatement
(
"select 'x'"
);
b
=
((
org
.
postgresql
.
PGStatement
)
ps
).
isUseServerPrepare
();
CallableStatement
cs
=
con
.
prepareCall
(
"select 'x'"
);
b
=
((
org
.
postgresql
.
PGStatement
)
cs
).
isUseServerPrepare
();
}
catch
(
SQLException
e
)
{
fail
(
e
.
getMessage
());
}
}
/**
* Helper class to remove a listener during event dispatching.
*/
...
...
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