Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Gpdb
提交
8d600a7d
G
Gpdb
项目概览
Greenplum
/
Gpdb
通知
7
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
Gpdb
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
8d600a7d
编写于
7月 24, 2002
作者:
B
Barry Lind
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Second phase of restructuring to add jdbc3 support.
上级
43515ba3
变更
13
展开全部
隐藏空白更改
内联
并排
Showing
13 changed file
with
1072 addition
and
1950 deletion
+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
未找到文件。
src/interfaces/jdbc/org/postgresql/jdbc1/AbstractJdbc1Statement.java
浏览文件 @
8d600a7d
此差异已折叠。
点击以展开。
src/interfaces/jdbc/org/postgresql/jdbc1/CallableStatement.java
浏览文件 @
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
浏览文件 @
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
浏览文件 @
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
浏览文件 @
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
已删除
100644 → 0
浏览文件 @
43515ba3
此差异已折叠。
点击以展开。
src/interfaces/jdbc/org/postgresql/jdbc2/AbstractJdbc2ResultSet.java
浏览文件 @
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
浏览文件 @
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
浏览文件 @
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
浏览文件 @
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
浏览文件 @
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
浏览文件 @
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
已删除
100644 → 0
浏览文件 @
43515ba3
此差异已折叠。
点击以展开。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录