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
24c82830
Commit
24c82830
authored
Sep 14, 1999
by
Peter Mount
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Patches for 6.5.2
parent
4197aaa8
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
203 additions
and
131 deletions
+203
-131
src/interfaces/jdbc/CHANGELOG
src/interfaces/jdbc/CHANGELOG
+15
-0
src/interfaces/jdbc/Makefile
src/interfaces/jdbc/Makefile
+40
-31
src/interfaces/jdbc/makeVersion.java
src/interfaces/jdbc/makeVersion.java
+0
-30
src/interfaces/jdbc/postgresql/Connection.java
src/interfaces/jdbc/postgresql/Connection.java
+14
-1
src/interfaces/jdbc/postgresql/Driver.java
src/interfaces/jdbc/postgresql/Driver.java
+27
-12
src/interfaces/jdbc/postgresql/PG_Stream.java
src/interfaces/jdbc/postgresql/PG_Stream.java
+10
-5
src/interfaces/jdbc/postgresql/errors.properties
src/interfaces/jdbc/postgresql/errors.properties
+1
-0
src/interfaces/jdbc/postgresql/jdbc1/Connection.java
src/interfaces/jdbc/postgresql/jdbc1/Connection.java
+29
-6
src/interfaces/jdbc/postgresql/jdbc1/DatabaseMetaData.java
src/interfaces/jdbc/postgresql/jdbc1/DatabaseMetaData.java
+21
-22
src/interfaces/jdbc/postgresql/jdbc2/Connection.java
src/interfaces/jdbc/postgresql/jdbc2/Connection.java
+28
-5
src/interfaces/jdbc/postgresql/jdbc2/DatabaseMetaData.java
src/interfaces/jdbc/postgresql/jdbc2/DatabaseMetaData.java
+18
-19
No files found.
src/interfaces/jdbc/CHANGELOG
View file @
24c82830
Mon Sep 13 23:56:00 BST 1999 peter@retep.org.uk
- PG_Stream.SendChar() optimised, increased default buffer size of
output stream to 8k, and introduced an 8k buffer on the input stream
Sverre H Huseby <sverrehu@online.no>
- Added a finalize() method to Connection class in both drivers so that
the connection to the backend is really closed.
- Due to many JVM's not returning a meaningful value for java.version
the decision for building the JDBC1.2 or JDBC2 driver is now a
compile time option.
- Replaced $$(cmd...) with `cmd...` in the Makefile. This should allow
the driver to compile when using shells other than Bash.
Sun Aug 1 18:05:42 CEST 1999 jens@jens.de
- added support for getTransactionIsolation and setTransactionIsolation
Sun Jun 27 12:00:00 BST 1999
Sun Jun 27 12:00:00 BST 1999
- Fixed typo in postgresql.Driver that prevented compilation
- Fixed typo in postgresql.Driver that prevented compilation
- Implemented getTimestamp() fix submitted by Philipp Matthias Hahn
- Implemented getTimestamp() fix submitted by Philipp Matthias Hahn
...
...
src/interfaces/jdbc/Makefile
View file @
24c82830
...
@@ -4,7 +4,7 @@
...
@@ -4,7 +4,7 @@
# Makefile for Java JDBC interface
# Makefile for Java JDBC interface
#
#
# IDENTIFICATION
# IDENTIFICATION
# $Header: /cvsroot/pgsql/src/interfaces/jdbc/Attic/Makefile,v 1.1
4 1999/06/23 05:56:1
7 peter Exp $
# $Header: /cvsroot/pgsql/src/interfaces/jdbc/Attic/Makefile,v 1.1
5 1999/09/14 05:50:2
7 peter Exp $
#
#
#-------------------------------------------------------------------------
#-------------------------------------------------------------------------
...
@@ -12,7 +12,7 @@ FIND = find
...
@@ -12,7 +12,7 @@ FIND = find
IDL2JAVA
=
idltojava
-fno-cpp
-fno-tie
IDL2JAVA
=
idltojava
-fno-cpp
-fno-tie
JAR
=
jar
JAR
=
jar
JAVA
=
java
JAVA
=
java
JAVAC
=
javac
JAVAC
=
javac
-g
JAVADOC
=
javadoc
JAVADOC
=
javadoc
RM
=
rm
-f
RM
=
rm
-f
TOUCH
=
touch
TOUCH
=
touch
...
@@ -22,12 +22,26 @@ TOUCH = touch
...
@@ -22,12 +22,26 @@ TOUCH = touch
$(JAVAC)
$<
$(JAVAC)
$<
.SUFFIXES
:
.class .java
.SUFFIXES
:
.class .java
.PHONY
:
all clean doc examples
.PHONY
:
all clean doc examples
msg
# In 6.5, the all rule builds the makeVersion class which then calls make using
# In 6.5, the all rule builds the makeVersion class which then calls make using
# the jdbc1 or jdbc2 rules
# the jdbc1 or jdbc2 rules
all
:
makeVersion.class
all
:
make
$$
(
$(JAVA)
makeVersion
)
@
echo
------------------------------------------------------------
@
echo
Due to problems with some JVMs that dont
return
a meaningful
@
echo
version number, we have had to make the choice of what jdbc
@
echo
version is built as a compile
time
option.
@
echo
@
echo
If you are using JDK1.1.x, you will need the JDBC1.2 driver.
@
echo
To compile,
type
:
@
echo
" make jdbc1"
@
echo
@
echo
"If you are using JDK1.2 (aka Java2) you need the JDBC2."
@
echo
To compile,
type
:
@
echo
" make jdbc2"
@
echo
------------------------------------------------------------
msg
:
@
echo
------------------------------------------------------------
@
echo
------------------------------------------------------------
@
echo
The JDBC driver has now been built. To make it available to
@
echo
The JDBC driver has now been built. To make it available to
@
echo
other applications, copy the postgresql.jar file to a public
@
echo
other applications, copy the postgresql.jar file to a public
...
@@ -107,34 +121,29 @@ OBJ_JDBC2= postgresql/jdbc2/ResultSet.class \
...
@@ -107,34 +121,29 @@ OBJ_JDBC2= postgresql/jdbc2/ResultSet.class \
postgresql/jdbc2/ResultSetMetaData.class
\
postgresql/jdbc2/ResultSetMetaData.class
\
postgresql/jdbc2/Statement.class
postgresql/jdbc2/Statement.class
# This rule should never occur, but will be called when makeVersion fails to
# understand the java.version property correctly.
jdbc0
:
@
echo
@
echo
FATAL ERROR!
@
echo
@
echo
makeVersion has not been able to determine what version of
@
echo
the JDK you are using, and hence what version of the driver
@
echo
to compile.
@
echo
@
echo
There are two versions available, one that conforms to the
@
echo
JDBC 1 specification, and one to the JDBC 2 specification.
@
echo
@
echo
To build the driver
for
JDBC 1
(
usually
for
JDK 1.1 thru 1.1.7
)
@
echo
then
type
: make jdbc1
@
echo
@
echo
To build the driver
for
JDBC 2
(
usually
for
JDK 1.2 and later
)
@
echo
then
type
: make jdbc2
@
echo
@
echo
If you still have problems,
then
please email the interfaces
@
echo
or bugs lists, or better still to me direct
(
peter@retep.org.uk
)
@
echo
# This rule builds the JDBC1 compliant driver
# This rule builds the JDBC1 compliant driver
jdbc1
:
$(OBJ_COMMON) $(OBJ_JDBC1) postgresql.jar
jdbc1
:
(
echo
"package postgresql;"
;
\
echo
"public class DriverClass {"
;
\
echo
"public static String connectClass=
\"
postgresql.jdbc1.Connection
\"
;"
;
\
echo
"}"
\
)
>
postgresql/DriverClass.java
@
$(MAKE)
jdbc1real
jdbc2real
:
postgresql/DriverClass.class
\
$(OBJ_COMMON) $(OBJ_JDBC2) postgresql.jar msg
# This rule builds the JDBC2 compliant driver
# This rule builds the JDBC2 compliant driver
jdbc2
:
$(OBJ_COMMON) $(OBJ_JDBC2) postgresql.jar
jdbc2
:
(
echo
"package postgresql;"
;
\
echo
"public class DriverClass {"
;
\
echo
"public static String connectClass=
\"
postgresql.jdbc2.Connection
\"
;"
;
\
echo
"}"
\
)
>
postgresql/DriverClass.java
@
$(MAKE)
jdbc2real
jdbc2real
:
postgresql/DriverClass.class
\
$(OBJ_COMMON) $(OBJ_JDBC2) postgresql.jar msg
# If you have problems with this rule, replace the $( ) with ` ` as some
# If you have problems with this rule, replace the $( ) with ` ` as some
# shells (mainly sh under Solaris) doesn't recognise $( )
# shells (mainly sh under Solaris) doesn't recognise $( )
...
@@ -143,7 +152,7 @@ jdbc2: $(OBJ_COMMON) $(OBJ_JDBC2) postgresql.jar
...
@@ -143,7 +152,7 @@ jdbc2: $(OBJ_COMMON) $(OBJ_JDBC2) postgresql.jar
# directory. We use this later for compiling the dual-mode driver.
# directory. We use this later for compiling the dual-mode driver.
#
#
postgresql.jar
:
$(OBJ) $(OBJ_COMMON)
postgresql.jar
:
$(OBJ) $(OBJ_COMMON)
$(JAR)
-c0f
$@
$$
(
$(FIND)
postgresql
-name
"*.class"
-print
)
\
$(JAR)
-c0f
$@
`
$(FIND)
postgresql
-name
"*.class"
-print
`
\
$(
wildcard
postgresql/
*
.properties
)
$(
wildcard
postgresql/
*
.properties
)
# This rule removes any temporary and compiled files from the source tree.
# This rule removes any temporary and compiled files from the source tree.
...
...
src/interfaces/jdbc/makeVersion.java
deleted
100644 → 0
View file @
4197aaa8
/**
* This class is used by the makefile to determine which version of the
* JDK is currently in use, and if it's using JDK1.1.x then it returns JDBC1
* and if later, it returns JDBC2
*
* $Id: makeVersion.java,v 1.1 1999/01/17 04:51:49 momjian Exp $
*/
public
class
makeVersion
{
public
static
void
main
(
String
[]
args
)
{
String
key
=
"java.version"
;
String
version
=
System
.
getProperty
(
key
);
//System.out.println(key+" = \""+version+"\"");
// Tip: use print not println here as println breaks the make that
// comes with CygWin-B20.1
if
(
version
.
startsWith
(
"1.0"
))
{
// This will trigger the unknown rule in the makefile
System
.
out
.
print
(
"jdbc0"
);
}
else
if
(
version
.
startsWith
(
"1.1"
))
{
// This will trigger the building of the JDBC 1 driver
System
.
out
.
print
(
"jdbc1"
);
}
else
{
// This will trigger the building of the JDBC 2 driver
System
.
out
.
print
(
"jdbc2"
);
}
}
}
src/interfaces/jdbc/postgresql/Connection.java
View file @
24c82830
...
@@ -10,7 +10,7 @@ import postgresql.largeobject.*;
...
@@ -10,7 +10,7 @@ import postgresql.largeobject.*;
import
postgresql.util.*
;
import
postgresql.util.*
;
/**
/**
* $Id: Connection.java,v 1.1
7 1999/05/18 23:17:15
peter Exp $
* $Id: Connection.java,v 1.1
8 1999/09/14 05:50:33
peter Exp $
*
*
* This abstract class is used by postgresql.Driver to open either the JDBC1 or
* This abstract class is used by postgresql.Driver to open either the JDBC1 or
* JDBC2 versions of the Connection class.
* JDBC2 versions of the Connection class.
...
@@ -692,4 +692,17 @@ public abstract class Connection
...
@@ -692,4 +692,17 @@ public abstract class Connection
* version (from jdbc1 or jdbc2) are returned.
* version (from jdbc1 or jdbc2) are returned.
*/
*/
protected
abstract
java
.
sql
.
ResultSet
getResultSet
(
postgresql
.
Connection
conn
,
Field
[]
fields
,
Vector
tuples
,
String
status
,
int
updateCount
)
throws
SQLException
;
protected
abstract
java
.
sql
.
ResultSet
getResultSet
(
postgresql
.
Connection
conn
,
Field
[]
fields
,
Vector
tuples
,
String
status
,
int
updateCount
)
throws
SQLException
;
/**
* Overides finalize(). If called, it closes the connection.
*
* This was done at the request of Rachel Greenham
* <rachel@enlarion.demon.co.uk> who hit a problem where multiple
* clients didn't close the connection, and once a fortnight enough
* clients were open to kill the postgres server.
*/
public
void
finalize
()
throws
Throwable
{
close
();
}
}
}
src/interfaces/jdbc/postgresql/Driver.java
View file @
24c82830
...
@@ -31,9 +31,6 @@ public class Driver implements java.sql.Driver
...
@@ -31,9 +31,6 @@ public class Driver implements java.sql.Driver
static
final
int
MAJORVERSION
=
6
;
static
final
int
MAJORVERSION
=
6
;
static
final
int
MINORVERSION
=
5
;
static
final
int
MINORVERSION
=
5
;
// Cache the version of the JDK in use
static
String
connectClass
;
static
static
{
{
try
{
try
{
...
@@ -56,11 +53,27 @@ public class Driver implements java.sql.Driver
...
@@ -56,11 +53,27 @@ public class Driver implements java.sql.Driver
{
{
// Set the connectClass variable so that future calls will handle the correct
// Set the connectClass variable so that future calls will handle the correct
// base class
// base class
if
(
System
.
getProperty
(
"java.version"
).
startsWith
(
"1.1"
))
{
//if(System.getProperty("java.version").startsWith("1.1")) {
connectClass
=
"postgresql.jdbc1.Connection"
;
//connectClass = "postgresql.jdbc1.Connection";
}
else
{
//} else {
connectClass
=
"postgresql.jdbc2.Connection"
;
//connectClass = "postgresql.jdbc2.Connection";
}
//}
// Ok, when the above code was introduced in 6.5 it's intention was to allow
// the driver to automatically detect which version of JDBC was being used
// and to detect the version of the JVM accordingly.
//
// It did this by using the java.version parameter.
//
// However, it was quickly discovered that not all JVM's returned an easily
// parseable version number (ie "1.2") and some don't return a value at all.
// The latter came from a discussion on the advanced java list.
//
// So, to solve this, I've moved the decision out of the driver, and it's now
// a compile time parameter.
//
// For this to work, the Makefile creates a pseudo class which contains the class
// name that will actually make the connection.
}
}
/**
/**
...
@@ -96,10 +109,10 @@ public class Driver implements java.sql.Driver
...
@@ -96,10 +109,10 @@ public class Driver implements java.sql.Driver
if
((
props
=
parseURL
(
url
,
info
))==
null
)
if
((
props
=
parseURL
(
url
,
info
))==
null
)
return
null
;
return
null
;
DriverManager
.
println
(
"Using "
+
connectClass
);
DriverManager
.
println
(
"Using "
+
DriverClass
.
connectClass
);
try
{
try
{
postgresql
.
Connection
con
=
(
postgresql
.
Connection
)(
Class
.
forName
(
connectClass
).
newInstance
());
postgresql
.
Connection
con
=
(
postgresql
.
Connection
)(
Class
.
forName
(
DriverClass
.
connectClass
).
newInstance
());
con
.
openConnection
(
host
(),
port
(),
props
,
database
(),
url
,
this
);
con
.
openConnection
(
host
(),
port
(),
props
,
database
(),
url
,
this
);
return
(
java
.
sql
.
Connection
)
con
;
return
(
java
.
sql
.
Connection
)
con
;
}
catch
(
ClassNotFoundException
ex
)
{
}
catch
(
ClassNotFoundException
ex
)
{
...
@@ -302,8 +315,10 @@ public class Driver implements java.sql.Driver
...
@@ -302,8 +315,10 @@ public class Driver implements java.sql.Driver
// PM June 29 1997
// PM June 29 1997
// This now outputs the properties only if we are logging
// This now outputs the properties only if we are logging
if
(
DriverManager
.
getLogStream
()
!=
null
)
// PM Sep 13 1999 Commented out, as it throws a Deprecation warning
urlProps
.
list
(
DriverManager
.
getLogStream
());
// when compiled under JDK1.2.
//if(DriverManager.getLogStream() != null)
// urlProps.list(DriverManager.getLogStream());
return
urlProps
;
return
urlProps
;
...
...
src/interfaces/jdbc/postgresql/PG_Stream.java
View file @
24c82830
...
@@ -39,8 +39,9 @@ public class PG_Stream
...
@@ -39,8 +39,9 @@ public class PG_Stream
// improvement on FreeBSD machines (caused by a bug in their TCP Stack)
// improvement on FreeBSD machines (caused by a bug in their TCP Stack)
connection
.
setTcpNoDelay
(
true
);
connection
.
setTcpNoDelay
(
true
);
pg_input
=
connection
.
getInputStream
();
// Buffer sizes submitted by Sverre H Huseby <sverrehu@online.no>
pg_output
=
new
BufferedOutputStream
(
connection
.
getOutputStream
());
pg_input
=
new
BufferedInputStream
(
connection
.
getInputStream
(),
8192
);
pg_output
=
new
BufferedOutputStream
(
connection
.
getOutputStream
(),
8192
);
}
}
/**
/**
...
@@ -51,9 +52,13 @@ public class PG_Stream
...
@@ -51,9 +52,13 @@ public class PG_Stream
*/
*/
public
void
SendChar
(
int
val
)
throws
IOException
public
void
SendChar
(
int
val
)
throws
IOException
{
{
byte
b
[]
=
new
byte
[
1
];
// Original code
b
[
0
]
=
(
byte
)
val
;
//byte b[] = new byte[1];
pg_output
.
write
(
b
);
//b[0] = (byte)val;
//pg_output.write(b);
// Optimised version by Sverre H. Huseby Aug 22 1999 Applied Sep 13 1999
pg_output
.
write
((
byte
)
val
);
}
}
/**
/**
...
...
src/interfaces/jdbc/postgresql/errors.properties
View file @
24c82830
...
@@ -15,6 +15,7 @@ postgresql.con.refused:Connection refused. Check that the hostname and port is c
...
@@ -15,6 +15,7 @@ postgresql.con.refused:Connection refused. Check that the hostname and port is c
postgresql.con.strobj
:
The object could not be stored. Check that any tables required have already been created in the database.
postgresql.con.strobj
:
The object could not be stored. Check that any tables required have already been created in the database.
postgresql.con.strobjex
:
Failed to store object - {0}
postgresql.con.strobjex
:
Failed to store object - {0}
postgresql.con.toolong
:
The SQL Statement is too long - {0}
postgresql.con.toolong
:
The SQL Statement is too long - {0}
postgresql.con.isolevel
:
Transaction isolation level {0} is not supported.
postgresql.con.tuple
:
Tuple received before MetaData.
postgresql.con.tuple
:
Tuple received before MetaData.
postgresql.con.type
:
Unknown Response Type {0}
postgresql.con.type
:
Unknown Response Type {0}
postgresql.con.user
:
The user property is missing. It is mandatory.
postgresql.con.user
:
The user property is missing. It is mandatory.
...
...
src/interfaces/jdbc/postgresql/jdbc1/Connection.java
View file @
24c82830
...
@@ -17,7 +17,7 @@ import postgresql.largeobject.*;
...
@@ -17,7 +17,7 @@ import postgresql.largeobject.*;
import
postgresql.util.*
;
import
postgresql.util.*
;
/**
/**
* $Id: Connection.java,v 1.
2 1999/05/18 23:17:21
peter Exp $
* $Id: Connection.java,v 1.
3 1999/09/14 05:50:39
peter Exp $
*
*
* A Connection represents a session with a specific database. Within the
* A Connection represents a session with a specific database. Within the
* context of a Connection, SQL statements are executed and results are
* context of a Connection, SQL statements are executed and results are
...
@@ -216,7 +216,7 @@ public class Connection extends postgresql.Connection implements java.sql.Connec
...
@@ -216,7 +216,7 @@ public class Connection extends postgresql.Connection implements java.sql.Connec
pg_stream
=
null
;
pg_stream
=
null
;
}
}
}
}
/**
/**
* Tests to see if a Connection is closed
* Tests to see if a Connection is closed
*
*
...
@@ -311,9 +311,23 @@ public class Connection extends postgresql.Connection implements java.sql.Connec
...
@@ -311,9 +311,23 @@ public class Connection extends postgresql.Connection implements java.sql.Connec
*/
*/
public
void
setTransactionIsolation
(
int
level
)
throws
SQLException
public
void
setTransactionIsolation
(
int
level
)
throws
SQLException
{
{
throw
postgresql
.
Driver
.
notImplemented
();
String
q
=
"SET TRANSACTION ISOLATION LEVEL"
;
switch
(
level
)
{
case
java
.
sql
.
Connection
.
TRANSACTION_READ_COMMITTED
:
ExecSQL
(
q
+
" READ COMMITTED"
);
return
;
case
java
.
sql
.
Connection
.
TRANSACTION_SERIALIZABLE
:
ExecSQL
(
q
+
" SERIALIZABLE"
);
return
;
default
:
throw
new
PSQLException
(
"postgresql.con.isolevel"
,
new
Integer
(
level
));
}
}
}
/**
/**
* Get this Connection's current transaction isolation mode.
* Get this Connection's current transaction isolation mode.
*
*
...
@@ -322,9 +336,18 @@ public class Connection extends postgresql.Connection implements java.sql.Connec
...
@@ -322,9 +336,18 @@ public class Connection extends postgresql.Connection implements java.sql.Connec
*/
*/
public
int
getTransactionIsolation
()
throws
SQLException
public
int
getTransactionIsolation
()
throws
SQLException
{
{
return
java
.
sql
.
Connection
.
TRANSACTION_SERIALIZABLE
;
ExecSQL
(
"show xactisolevel"
);
SQLWarning
w
=
getWarnings
();
if
(
w
!=
null
)
{
if
(
w
.
getMessage
().
indexOf
(
"READ COMMITTED"
)
!=
-
1
)
return
java
.
sql
.
Connection
.
TRANSACTION_READ_COMMITTED
;
else
if
(
w
.
getMessage
().
indexOf
(
"READ UNCOMMITTED"
)
!=
-
1
)
return
java
.
sql
.
Connection
.
TRANSACTION_READ_UNCOMMITTED
;
else
if
(
w
.
getMessage
().
indexOf
(
"REPEATABLE READ"
)
!=
-
1
)
return
java
.
sql
.
Connection
.
TRANSACTION_REPEATABLE_READ
;
else
if
(
w
.
getMessage
().
indexOf
(
"SERIALIZABLE"
)
!=
-
1
)
return
java
.
sql
.
Connection
.
TRANSACTION_SERIALIZABLE
;
}
return
java
.
sql
.
Connection
.
TRANSACTION_READ_COMMITTED
;
}
}
/**
/**
* The first warning reported by calls on this Connection is
* The first warning reported by calls on this Connection is
* returned.
* returned.
...
...
src/interfaces/jdbc/postgresql/jdbc1/DatabaseMetaData.java
View file @
24c82830
...
@@ -179,7 +179,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
...
@@ -179,7 +179,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
*/
*/
public
String
getDatabaseProductVersion
()
throws
SQLException
public
String
getDatabaseProductVersion
()
throws
SQLException
{
{
return
(
"6.
4
"
);
return
(
"6.
5.2
"
);
}
}
/**
/**
...
@@ -1350,7 +1350,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
...
@@ -1350,7 +1350,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
*/
*/
public
int
getDefaultTransactionIsolation
()
throws
SQLException
public
int
getDefaultTransactionIsolation
()
throws
SQLException
{
{
return
Connection
.
TRANSACTION_
SERIALIZABLE
;
return
Connection
.
TRANSACTION_
READ_COMMITTED
;
}
}
/**
/**
...
@@ -1368,7 +1368,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
...
@@ -1368,7 +1368,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
/**
/**
* Does the database support the given transaction isolation level?
* Does the database support the given transaction isolation level?
* We only support TRANSACTION_SERIALIZABLE
* We only support TRANSACTION_SERIALIZABLE
and TRANSACTION_READ_COMMITTED
*
*
* @param level the values are defined in java.sql.Connection
* @param level the values are defined in java.sql.Connection
* @return true if so
* @return true if so
...
@@ -1377,10 +1377,11 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
...
@@ -1377,10 +1377,11 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
*/
*/
public
boolean
supportsTransactionIsolationLevel
(
int
level
)
throws
SQLException
public
boolean
supportsTransactionIsolationLevel
(
int
level
)
throws
SQLException
{
{
if
(
level
==
Connection
.
TRANSACTION_SERIALIZABLE
)
if
(
level
==
Connection
.
TRANSACTION_SERIALIZABLE
||
return
true
;
level
==
Connection
.
TRANSACTION_READ_COMMITTED
)
else
return
true
;
return
false
;
else
return
false
;
}
}
/**
/**
...
@@ -2151,21 +2152,19 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
...
@@ -2151,21 +2152,19 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
public
java
.
sql
.
ResultSet
getPrimaryKeys
(
String
catalog
,
String
schema
,
String
table
)
throws
SQLException
public
java
.
sql
.
ResultSet
getPrimaryKeys
(
String
catalog
,
String
schema
,
String
table
)
throws
SQLException
{
{
return
connection
.
createStatement
().
executeQuery
(
"SELECT "
+
return
connection
.
createStatement
().
executeQuery
(
"SELECT "
+
"'' as TABLE_CAT,"
+
" '' as TABLE_CAT,"
+
"'' AS TABLE_SCHEM,"
+
" '' AS TABLE_SCHEM,"
+
"bc.relname AS TABLE_NAME,"
+
" bc.relname AS TABLE_NAME,"
+
"ic.relname AS COLUMN_NAME,"
+
" a.attname AS COLUMN_NAME,"
+
"'1' as KEY_SEQ,"
+
// -- fake it as a String for now
" a.attnum as KEY_SEQ,"
+
"t.typname as PK_NAME "
+
" ic.relname as PK_NAME"
+
" FROM pg_class bc, pg_class ic, pg_index i, pg_attribute a, pg_type t "
+
" from pg_class bc, pg_class ic, pg_index i, pg_attribute a, pg_type t"
+
" WHERE bc.relkind = 'r' "
+
// -- not indices
" where bc.relkind = 'r'"
+
" and bc.relname ~ '"
+
table
+
"'"
+
" and upper(bc.relname) = upper('test')"
+
" and i.indrelid = bc.oid"
+
" and i.indrelid = bc.oid"
+
" and i.indexrelid = ic.oid"
+
" and i.indexrelid = ic.oid and a.attrelid = ic.oid"
+
" and i.indkey[0] = a.attnum"
+
" and i.indisprimary='t'"
+
" and i.indproc = '0'::oid"
+
" order by table_name, pk_name,key_seq;"
" and a.attrelid = bc.oid"
+
" ORDER BY TABLE_NAME, COLUMN_NAME;"
);
);
}
}
...
...
src/interfaces/jdbc/postgresql/jdbc2/Connection.java
View file @
24c82830
...
@@ -17,7 +17,7 @@ import postgresql.largeobject.*;
...
@@ -17,7 +17,7 @@ import postgresql.largeobject.*;
import
postgresql.util.*
;
import
postgresql.util.*
;
/**
/**
* $Id: Connection.java,v 1.
2 1999/05/18 23:17:26
peter Exp $
* $Id: Connection.java,v 1.
3 1999/09/14 05:50:44
peter Exp $
*
*
* A Connection represents a session with a specific database. Within the
* A Connection represents a session with a specific database. Within the
* context of a Connection, SQL statements are executed and results are
* context of a Connection, SQL statements are executed and results are
...
@@ -216,7 +216,7 @@ public class Connection extends postgresql.Connection implements java.sql.Connec
...
@@ -216,7 +216,7 @@ public class Connection extends postgresql.Connection implements java.sql.Connec
pg_stream
=
null
;
pg_stream
=
null
;
}
}
}
}
/**
/**
* Tests to see if a Connection is closed
* Tests to see if a Connection is closed
*
*
...
@@ -311,7 +311,21 @@ public class Connection extends postgresql.Connection implements java.sql.Connec
...
@@ -311,7 +311,21 @@ public class Connection extends postgresql.Connection implements java.sql.Connec
*/
*/
public
void
setTransactionIsolation
(
int
level
)
throws
SQLException
public
void
setTransactionIsolation
(
int
level
)
throws
SQLException
{
{
throw
postgresql
.
Driver
.
notImplemented
();
String
q
=
"SET TRANSACTION ISOLATION LEVEL"
;
switch
(
level
)
{
case
java
.
sql
.
Connection
.
TRANSACTION_READ_COMMITTED
:
ExecSQL
(
q
+
" READ COMMITTED"
);
return
;
case
java
.
sql
.
Connection
.
TRANSACTION_SERIALIZABLE
:
ExecSQL
(
q
+
" SERIALIZABLE"
);
return
;
default
:
throw
new
PSQLException
(
"postgresql.con.isolevel"
,
new
Integer
(
level
));
}
}
}
/**
/**
...
@@ -322,9 +336,18 @@ public class Connection extends postgresql.Connection implements java.sql.Connec
...
@@ -322,9 +336,18 @@ public class Connection extends postgresql.Connection implements java.sql.Connec
*/
*/
public
int
getTransactionIsolation
()
throws
SQLException
public
int
getTransactionIsolation
()
throws
SQLException
{
{
return
java
.
sql
.
Connection
.
TRANSACTION_SERIALIZABLE
;
ExecSQL
(
"show xactisolevel"
);
SQLWarning
w
=
getWarnings
();
if
(
w
!=
null
)
{
if
(
w
.
getMessage
().
indexOf
(
"READ COMMITTED"
)
!=
-
1
)
return
java
.
sql
.
Connection
.
TRANSACTION_READ_COMMITTED
;
else
if
(
w
.
getMessage
().
indexOf
(
"READ UNCOMMITTED"
)
!=
-
1
)
return
java
.
sql
.
Connection
.
TRANSACTION_READ_UNCOMMITTED
;
else
if
(
w
.
getMessage
().
indexOf
(
"REPEATABLE READ"
)
!=
-
1
)
return
java
.
sql
.
Connection
.
TRANSACTION_REPEATABLE_READ
;
else
if
(
w
.
getMessage
().
indexOf
(
"SERIALIZABLE"
)
!=
-
1
)
return
java
.
sql
.
Connection
.
TRANSACTION_SERIALIZABLE
;
}
return
java
.
sql
.
Connection
.
TRANSACTION_READ_COMMITTED
;
}
}
/**
/**
* The first warning reported by calls on this Connection is
* The first warning reported by calls on this Connection is
* returned.
* returned.
...
...
src/interfaces/jdbc/postgresql/jdbc2/DatabaseMetaData.java
View file @
24c82830
...
@@ -179,7 +179,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
...
@@ -179,7 +179,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
*/
*/
public
String
getDatabaseProductVersion
()
throws
SQLException
public
String
getDatabaseProductVersion
()
throws
SQLException
{
{
return
(
"6.
4
"
);
return
(
"6.
5.2
"
);
}
}
/**
/**
...
@@ -1350,7 +1350,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
...
@@ -1350,7 +1350,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
*/
*/
public
int
getDefaultTransactionIsolation
()
throws
SQLException
public
int
getDefaultTransactionIsolation
()
throws
SQLException
{
{
return
Connection
.
TRANSACTION_SERIALIZABLE
;
return
Connection
.
TRANSACTION_READ_COMMITTED
;
}
}
/**
/**
...
@@ -1368,7 +1368,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
...
@@ -1368,7 +1368,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
/**
/**
* Does the database support the given transaction isolation level?
* Does the database support the given transaction isolation level?
* We only support TRANSACTION_SERIALIZABLE
* We only support TRANSACTION_SERIALIZABLE
and TRANSACTION_READ_COMMITTED
*
*
* @param level the values are defined in java.sql.Connection
* @param level the values are defined in java.sql.Connection
* @return true if so
* @return true if so
...
@@ -1377,7 +1377,8 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
...
@@ -1377,7 +1377,8 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
*/
*/
public
boolean
supportsTransactionIsolationLevel
(
int
level
)
throws
SQLException
public
boolean
supportsTransactionIsolationLevel
(
int
level
)
throws
SQLException
{
{
if
(
level
==
Connection
.
TRANSACTION_SERIALIZABLE
)
if
(
level
==
Connection
.
TRANSACTION_SERIALIZABLE
||
level
==
Connection
.
TRANSACTION_READ_COMMITTED
)
return
true
;
return
true
;
else
else
return
false
;
return
false
;
...
@@ -2151,21 +2152,19 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
...
@@ -2151,21 +2152,19 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
public
java
.
sql
.
ResultSet
getPrimaryKeys
(
String
catalog
,
String
schema
,
String
table
)
throws
SQLException
public
java
.
sql
.
ResultSet
getPrimaryKeys
(
String
catalog
,
String
schema
,
String
table
)
throws
SQLException
{
{
return
connection
.
createStatement
().
executeQuery
(
"SELECT "
+
return
connection
.
createStatement
().
executeQuery
(
"SELECT "
+
"'' as TABLE_CAT,"
+
" '' as TABLE_CAT,"
+
"'' AS TABLE_SCHEM,"
+
" '' AS TABLE_SCHEM,"
+
"bc.relname AS TABLE_NAME,"
+
" bc.relname AS TABLE_NAME,"
+
"ic.relname AS COLUMN_NAME,"
+
" a.attname AS COLUMN_NAME,"
+
"'1' as KEY_SEQ,"
+
// -- fake it as a String for now
" a.attnum as KEY_SEQ,"
+
"t.typname as PK_NAME "
+
" ic.relname as PK_NAME"
+
" FROM pg_class bc, pg_class ic, pg_index i, pg_attribute a, pg_type t "
+
" from pg_class bc, pg_class ic, pg_index i, pg_attribute a, pg_type t"
+
" WHERE bc.relkind = 'r' "
+
// -- not indices
" where bc.relkind = 'r'"
+
" and bc.relname ~ '"
+
table
+
"'"
+
" and upper(bc.relname) = upper('test')"
+
" and i.indrelid = bc.oid"
+
" and i.indrelid = bc.oid"
+
" and i.indexrelid = ic.oid"
+
" and i.indexrelid = ic.oid and a.attrelid = ic.oid"
+
" and i.indkey[0] = a.attnum"
+
" and i.indisprimary='t'"
+
" and i.indproc = '0'::oid"
+
" order by table_name, pk_name,key_seq;"
" and a.attrelid = bc.oid"
+
" ORDER BY TABLE_NAME, COLUMN_NAME;"
);
);
}
}
...
...
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