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
8d600a7d
Commit
8d600a7d
authored
Jul 24, 2002
by
Barry Lind
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Second phase of restructuring to add jdbc3 support.
parent
43515ba3
Changes
13
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
1072 additions
and
1950 deletions
+1072
-1950
src/interfaces/jdbc/org/postgresql/jdbc1/AbstractJdbc1Statement.java
...ces/jdbc/org/postgresql/jdbc1/AbstractJdbc1Statement.java
+834
-2
src/interfaces/jdbc/org/postgresql/jdbc1/CallableStatement.java
...terfaces/jdbc/org/postgresql/jdbc1/CallableStatement.java
+1
-1
src/interfaces/jdbc/org/postgresql/jdbc1/Jdbc1Connection.java
...interfaces/jdbc/org/postgresql/jdbc1/Jdbc1Connection.java
+2
-2
src/interfaces/jdbc/org/postgresql/jdbc1/Jdbc1PreparedStatement.java
...ces/jdbc/org/postgresql/jdbc1/Jdbc1PreparedStatement.java
+14
-0
src/interfaces/jdbc/org/postgresql/jdbc1/Jdbc1Statement.java
src/interfaces/jdbc/org/postgresql/jdbc1/Jdbc1Statement.java
+2
-2
src/interfaces/jdbc/org/postgresql/jdbc1/PreparedStatement.java
...terfaces/jdbc/org/postgresql/jdbc1/PreparedStatement.java
+0
-843
src/interfaces/jdbc/org/postgresql/jdbc2/AbstractJdbc2ResultSet.java
...ces/jdbc/org/postgresql/jdbc2/AbstractJdbc2ResultSet.java
+4
-4
src/interfaces/jdbc/org/postgresql/jdbc2/AbstractJdbc2Statement.java
...ces/jdbc/org/postgresql/jdbc2/AbstractJdbc2Statement.java
+195
-3
src/interfaces/jdbc/org/postgresql/jdbc2/CallableStatement.java
...terfaces/jdbc/org/postgresql/jdbc2/CallableStatement.java
+1
-1
src/interfaces/jdbc/org/postgresql/jdbc2/Jdbc2Connection.java
...interfaces/jdbc/org/postgresql/jdbc2/Jdbc2Connection.java
+2
-2
src/interfaces/jdbc/org/postgresql/jdbc2/Jdbc2PreparedStatement.java
...ces/jdbc/org/postgresql/jdbc2/Jdbc2PreparedStatement.java
+15
-0
src/interfaces/jdbc/org/postgresql/jdbc2/Jdbc2Statement.java
src/interfaces/jdbc/org/postgresql/jdbc2/Jdbc2Statement.java
+2
-4
src/interfaces/jdbc/org/postgresql/jdbc2/PreparedStatement.java
...terfaces/jdbc/org/postgresql/jdbc2/PreparedStatement.java
+0
-1086
No files found.
src/interfaces/jdbc/org/postgresql/jdbc1/AbstractJdbc1Statement.java
View file @
8d600a7d
This diff is collapsed.
Click to expand it.
src/interfaces/jdbc/org/postgresql/jdbc1/CallableStatement.java
View file @
8d600a7d
...
...
@@ -39,7 +39,7 @@ import java.math.*;
* @see ResultSet
*/
public
class
CallableStatement
extends
PreparedStatement
implements
java
.
sql
.
CallableStatement
public
class
CallableStatement
extends
Jdbc1
PreparedStatement
implements
java
.
sql
.
CallableStatement
{
/*
* @exception SQLException on failure
...
...
src/interfaces/jdbc/org/postgresql/jdbc1/Jdbc1Connection.java
View file @
8d600a7d
...
...
@@ -6,7 +6,7 @@ import java.sql.*;
import
org.postgresql.Field
;
import
org.postgresql.util.PSQLException
;
/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc1/Attic/Jdbc1Connection.java,v 1.
1 2002/07/23 03:59:55
barry Exp $
/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc1/Attic/Jdbc1Connection.java,v 1.
2 2002/07/24 22:08:40
barry Exp $
* This class implements the java.sql.Connection interface for JDBC1.
* However most of the implementation is really done in
* org.postgresql.jdbc1.AbstractJdbc1Connection
...
...
@@ -21,7 +21,7 @@ public class Jdbc1Connection extends org.postgresql.jdbc1.AbstractJdbc1Connectio
public
java
.
sql
.
PreparedStatement
prepareStatement
(
String
sql
)
throws
SQLException
{
return
new
org
.
postgresql
.
jdbc1
.
PreparedStatement
(
this
,
sql
);
return
new
org
.
postgresql
.
jdbc1
.
Jdbc1
PreparedStatement
(
this
,
sql
);
}
//BJL TODO - merge callable statement logic from jdbc2 to jdbc1
...
...
src/interfaces/jdbc/org/postgresql/jdbc1/Jdbc1PreparedStatement.java
0 → 100644
View file @
8d600a7d
package
org.postgresql.jdbc1
;
import
java.sql.*
;
public
class
Jdbc1PreparedStatement
extends
AbstractJdbc1Statement
implements
PreparedStatement
{
public
Jdbc1PreparedStatement
(
Jdbc1Connection
connection
,
String
sql
)
throws
SQLException
{
super
(
connection
,
sql
);
}
}
src/interfaces/jdbc/org/postgresql/jdbc1/Jdbc1Statement.java
View file @
8d600a7d
...
...
@@ -3,7 +3,7 @@ package org.postgresql.jdbc1;
import
java.sql.*
;
/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc1/Attic/Jdbc1Statement.java,v 1.
1 2002/07/23 03:59:55
barry Exp $
/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc1/Attic/Jdbc1Statement.java,v 1.
2 2002/07/24 22:08:40
barry Exp $
* This class implements the java.sql.Statement interface for JDBC1.
* However most of the implementation is really done in
* org.postgresql.jdbc1.AbstractJdbc1Statement
...
...
@@ -13,7 +13,7 @@ public class Jdbc1Statement extends org.postgresql.jdbc1.AbstractJdbc1Statement
public
Jdbc1Statement
(
Jdbc1Connection
c
)
{
connection
=
c
;
super
(
c
)
;
}
}
src/interfaces/jdbc/org/postgresql/jdbc1/PreparedStatement.java
deleted
100644 → 0
View file @
43515ba3
This diff is collapsed.
Click to expand it.
src/interfaces/jdbc/org/postgresql/jdbc2/AbstractJdbc2ResultSet.java
View file @
8d600a7d
...
...
@@ -13,14 +13,14 @@ import org.postgresql.largeobject.*;
import
org.postgresql.util.PGbytea
;
import
org.postgresql.util.PSQLException
;
/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc2/Attic/AbstractJdbc2ResultSet.java,v 1.
1 2002/07/23 03:59:55
barry Exp $
/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc2/Attic/AbstractJdbc2ResultSet.java,v 1.
2 2002/07/24 22:08:42
barry Exp $
* This class defines methods of the jdbc2 specification. This class extends
* org.postgresql.jdbc1.AbstractJdbc1ResultSet which provides the jdbc1
* methods. The real Statement class (for jdbc2) is org.postgresql.jdbc2.Jdbc2ResultSet
*/
public
class
AbstractJdbc2ResultSet
extends
org
.
postgresql
.
jdbc1
.
AbstractJdbc1ResultSet
{
protected
Jdbc2
Statement
statement
;
protected
Statement
statement
;
protected
String
sqlQuery
=
null
;
...
...
@@ -373,7 +373,7 @@ public class AbstractJdbc2ResultSet extends org.postgresql.jdbc1.AbstractJdbc1Re
}
// This one needs some thought, as not all ResultSets come from a statement
public
java
.
sql
.
Statement
getStatement
()
throws
SQLException
public
Statement
getStatement
()
throws
SQLException
{
return
statement
;
}
...
...
@@ -740,7 +740,7 @@ public class AbstractJdbc2ResultSet extends org.postgresql.jdbc1.AbstractJdbc1Re
* It's used currently by getStatement() but may also with the new core
* package.
*/
public
void
setStatement
(
Jdbc2
Statement
statement
)
public
void
setStatement
(
Statement
statement
)
{
this
.
statement
=
statement
;
}
...
...
src/interfaces/jdbc/org/postgresql/jdbc2/AbstractJdbc2Statement.java
View file @
8d600a7d
package
org.postgresql.jdbc2
;
import
java.io.*
;
import
java.sql.*
;
import
java.util.Vector
;
import
org.postgresql.largeobject.*
;
import
org.postgresql.util.PSQLException
;
/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc2/Attic/AbstractJdbc2Statement.java,v 1.
1 2002/07/23 03:59:55
barry Exp $
/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc2/Attic/AbstractJdbc2Statement.java,v 1.
2 2002/07/24 22:08:42
barry Exp $
* This class defines methods of the jdbc2 specification. This class extends
* org.postgresql.jdbc1.AbstractJdbc1Statement which provides the jdbc1
* methods. The real Statement class (for jdbc2) is org.postgresql.jdbc2.Jdbc2Statement
...
...
@@ -17,6 +19,18 @@ public abstract class AbstractJdbc2Statement extends org.postgresql.jdbc1.Abstra
protected
int
resultsettype
;
// the resultset type to return
protected
int
concurrency
;
// is it updateable or not?
public
AbstractJdbc2Statement
(
AbstractJdbc2Connection
c
)
{
super
(
c
);
resultsettype
=
java
.
sql
.
ResultSet
.
TYPE_SCROLL_INSENSITIVE
;
concurrency
=
java
.
sql
.
ResultSet
.
CONCUR_READ_ONLY
;
}
public
AbstractJdbc2Statement
(
AbstractJdbc2Connection
connection
,
String
sql
)
throws
SQLException
{
super
(
connection
,
sql
);
}
/*
* Execute a SQL statement that may return multiple results. We
* don't have to worry about this since we do not support multiple
...
...
@@ -31,10 +45,9 @@ public abstract class AbstractJdbc2Statement extends org.postgresql.jdbc1.Abstra
public
boolean
execute
(
String
sql
)
throws
SQLException
{
boolean
l_return
=
super
.
execute
(
sql
);
//Now do the jdbc2 specific stuff
//required for ResultSet.getStatement() to work
((
AbstractJdbc2ResultSet
)
result
).
setStatement
((
Jdbc2
Statement
)
this
);
((
AbstractJdbc2ResultSet
)
result
).
setStatement
((
Statement
)
this
);
// Added this so that the Updateable resultset knows the query that gave this
((
AbstractJdbc2ResultSet
)
result
).
setSQLQuery
(
sql
);
...
...
@@ -139,4 +152,183 @@ public abstract class AbstractJdbc2Statement extends org.postgresql.jdbc1.Abstra
resultsettype
=
value
;
}
public
void
addBatch
()
throws
SQLException
{
addBatch
(
compileQuery
());
}
public
java
.
sql
.
ResultSetMetaData
getMetaData
()
throws
SQLException
{
java
.
sql
.
ResultSet
rs
=
getResultSet
();
if
(
rs
!=
null
)
return
rs
.
getMetaData
();
// Does anyone really know what this method does?
return
null
;
}
public
void
setArray
(
int
i
,
java
.
sql
.
Array
x
)
throws
SQLException
{
setString
(
i
,
x
.
toString
());
}
public
void
setBlob
(
int
i
,
Blob
x
)
throws
SQLException
{
InputStream
l_inStream
=
x
.
getBinaryStream
();
int
l_length
=
(
int
)
x
.
length
();
LargeObjectManager
lom
=
connection
.
getLargeObjectAPI
();
int
oid
=
lom
.
create
();
LargeObject
lob
=
lom
.
open
(
oid
);
OutputStream
los
=
lob
.
getOutputStream
();
try
{
// could be buffered, but then the OutputStream returned by LargeObject
// is buffered internally anyhow, so there would be no performance
// boost gained, if anything it would be worse!
int
c
=
l_inStream
.
read
();
int
p
=
0
;
while
(
c
>
-
1
&&
p
<
l_length
)
{
los
.
write
(
c
);
c
=
l_inStream
.
read
();
p
++;
}
los
.
close
();
}
catch
(
IOException
se
)
{
throw
new
PSQLException
(
"postgresql.unusual"
,
se
);
}
// lob is closed by the stream so don't call lob.close()
setInt
(
i
,
oid
);
}
public
void
setCharacterStream
(
int
i
,
java
.
io
.
Reader
x
,
int
length
)
throws
SQLException
{
if
(
connection
.
haveMinimumCompatibleVersion
(
"7.2"
))
{
//Version 7.2 supports CharacterStream for for the PG text types
//As the spec/javadoc for this method indicate this is to be used for
//large text values (i.e. LONGVARCHAR) PG doesn't have a separate
//long varchar datatype, but with toast all the text datatypes are capable of
//handling very large values. Thus the implementation ends up calling
//setString() since there is no current way to stream the value to the server
char
[]
l_chars
=
new
char
[
length
];
int
l_charsRead
;
try
{
l_charsRead
=
x
.
read
(
l_chars
,
0
,
length
);
}
catch
(
IOException
l_ioe
)
{
throw
new
PSQLException
(
"postgresql.unusual"
,
l_ioe
);
}
setString
(
i
,
new
String
(
l_chars
,
0
,
l_charsRead
));
}
else
{
//Version 7.1 only supported streams for LargeObjects
//but the jdbc spec indicates that streams should be
//available for LONGVARCHAR instead
LargeObjectManager
lom
=
connection
.
getLargeObjectAPI
();
int
oid
=
lom
.
create
();
LargeObject
lob
=
lom
.
open
(
oid
);
OutputStream
los
=
lob
.
getOutputStream
();
try
{
// could be buffered, but then the OutputStream returned by LargeObject
// is buffered internally anyhow, so there would be no performance
// boost gained, if anything it would be worse!
int
c
=
x
.
read
();
int
p
=
0
;
while
(
c
>
-
1
&&
p
<
length
)
{
los
.
write
(
c
);
c
=
x
.
read
();
p
++;
}
los
.
close
();
}
catch
(
IOException
se
)
{
throw
new
PSQLException
(
"postgresql.unusual"
,
se
);
}
// lob is closed by the stream so don't call lob.close()
setInt
(
i
,
oid
);
}
}
public
void
setClob
(
int
i
,
Clob
x
)
throws
SQLException
{
InputStream
l_inStream
=
x
.
getAsciiStream
();
int
l_length
=
(
int
)
x
.
length
();
LargeObjectManager
lom
=
connection
.
getLargeObjectAPI
();
int
oid
=
lom
.
create
();
LargeObject
lob
=
lom
.
open
(
oid
);
OutputStream
los
=
lob
.
getOutputStream
();
try
{
// could be buffered, but then the OutputStream returned by LargeObject
// is buffered internally anyhow, so there would be no performance
// boost gained, if anything it would be worse!
int
c
=
l_inStream
.
read
();
int
p
=
0
;
while
(
c
>
-
1
&&
p
<
l_length
)
{
los
.
write
(
c
);
c
=
l_inStream
.
read
();
p
++;
}
los
.
close
();
}
catch
(
IOException
se
)
{
throw
new
PSQLException
(
"postgresql.unusual"
,
se
);
}
// lob is closed by the stream so don't call lob.close()
setInt
(
i
,
oid
);
}
public
void
setNull
(
int
i
,
int
t
,
String
s
)
throws
SQLException
{
setNull
(
i
,
t
);
}
public
void
setRef
(
int
i
,
Ref
x
)
throws
SQLException
{
throw
org
.
postgresql
.
Driver
.
notImplemented
();
}
public
void
setDate
(
int
i
,
java
.
sql
.
Date
d
,
java
.
util
.
Calendar
cal
)
throws
SQLException
{
if
(
cal
==
null
)
setDate
(
i
,
d
);
else
{
cal
.
setTime
(
d
);
setDate
(
i
,
new
java
.
sql
.
Date
(
cal
.
getTime
().
getTime
()));
}
}
public
void
setTime
(
int
i
,
Time
t
,
java
.
util
.
Calendar
cal
)
throws
SQLException
{
if
(
cal
==
null
)
setTime
(
i
,
t
);
else
{
cal
.
setTime
(
t
);
setTime
(
i
,
new
java
.
sql
.
Time
(
cal
.
getTime
().
getTime
()));
}
}
public
void
setTimestamp
(
int
i
,
Timestamp
t
,
java
.
util
.
Calendar
cal
)
throws
SQLException
{
if
(
cal
==
null
)
setTimestamp
(
i
,
t
);
else
{
cal
.
setTime
(
t
);
setTimestamp
(
i
,
new
java
.
sql
.
Timestamp
(
cal
.
getTime
().
getTime
()));
}
}
}
src/interfaces/jdbc/org/postgresql/jdbc2/CallableStatement.java
View file @
8d600a7d
...
...
@@ -40,7 +40,7 @@ import org.postgresql.util.*;
* @author Paul Bethe (implementer)
*/
public
class
CallableStatement
extends
org
.
postgresql
.
jdbc2
.
PreparedStatement
implements
java
.
sql
.
CallableStatement
public
class
CallableStatement
extends
org
.
postgresql
.
jdbc2
.
Jdbc2
PreparedStatement
implements
java
.
sql
.
CallableStatement
{
/*
* @exception SQLException on failure
...
...
src/interfaces/jdbc/org/postgresql/jdbc2/Jdbc2Connection.java
View file @
8d600a7d
...
...
@@ -5,7 +5,7 @@ import java.sql.*;
import
java.util.Vector
;
import
org.postgresql.Field
;
/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc2/Attic/Jdbc2Connection.java,v 1.
1 2002/07/23 03:59:55
barry Exp $
/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc2/Attic/Jdbc2Connection.java,v 1.
2 2002/07/24 22:08:42
barry Exp $
* This class implements the java.sql.Connection interface for JDBC2.
* However most of the implementation is really done in
* org.postgresql.jdbc2.AbstractJdbc2Connection or one of it's parents
...
...
@@ -24,7 +24,7 @@ public class Jdbc2Connection extends org.postgresql.jdbc2.AbstractJdbc2Connectio
public
java
.
sql
.
PreparedStatement
prepareStatement
(
String
sql
,
int
resultSetType
,
int
resultSetConcurrency
)
throws
SQLException
{
org
.
postgresql
.
jdbc2
.
PreparedStatement
s
=
new
org
.
postgresql
.
jdbc2
.
PreparedStatement
(
this
,
sql
);
Jdbc2PreparedStatement
s
=
new
Jdbc2
PreparedStatement
(
this
,
sql
);
s
.
setResultSetType
(
resultSetType
);
s
.
setResultSetConcurrency
(
resultSetConcurrency
);
return
s
;
...
...
src/interfaces/jdbc/org/postgresql/jdbc2/Jdbc2PreparedStatement.java
0 → 100644
View file @
8d600a7d
package
org.postgresql.jdbc2
;
import
java.sql.*
;
public
class
Jdbc2PreparedStatement
extends
AbstractJdbc2Statement
implements
java
.
sql
.
PreparedStatement
{
public
Jdbc2PreparedStatement
(
Jdbc2Connection
connection
,
String
sql
)
throws
SQLException
{
super
(
connection
,
sql
);
}
}
src/interfaces/jdbc/org/postgresql/jdbc2/Jdbc2Statement.java
View file @
8d600a7d
...
...
@@ -3,7 +3,7 @@ package org.postgresql.jdbc2;
import
java.sql.*
;
/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc2/Attic/Jdbc2Statement.java,v 1.
1 2002/07/23 03:59:55
barry Exp $
/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc2/Attic/Jdbc2Statement.java,v 1.
2 2002/07/24 22:08:43
barry Exp $
* This class implements the java.sql.Statement interface for JDBC2.
* However most of the implementation is really done in
* org.postgresql.jdbc2.AbstractJdbc2Statement or one of it's parents
...
...
@@ -13,9 +13,7 @@ public class Jdbc2Statement extends org.postgresql.jdbc2.AbstractJdbc2Statement
public
Jdbc2Statement
(
Jdbc2Connection
c
)
{
connection
=
c
;
resultsettype
=
java
.
sql
.
ResultSet
.
TYPE_SCROLL_INSENSITIVE
;
concurrency
=
java
.
sql
.
ResultSet
.
CONCUR_READ_ONLY
;
super
(
c
);
}
}
src/interfaces/jdbc/org/postgresql/jdbc2/PreparedStatement.java
deleted
100644 → 0
View file @
43515ba3
This diff is collapsed.
Click to expand it.
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