summaryrefslogtreecommitdiff
path: root/src/interfaces/jdbc/org/postgresql/largeobject
diff options
context:
space:
mode:
authorPeter Mount <peter@retep.org.uk>2001-02-16 16:45:01 +0000
committerPeter Mount <peter@retep.org.uk>2001-02-16 16:45:01 +0000
commitcdbd27cb2359dad1baafb9ed5a80b309177476fe (patch)
tree5612cb86c8e4e378a3a5b54e2375cddfdb049b27 /src/interfaces/jdbc/org/postgresql/largeobject
parent016f0eed2441e5925c7c29f055bff3674ace2e53 (diff)
Some more updates...
Fri Feb 17 15:11:00 GMT 2001 peter@retep.org.uk - Reduced the object overhead in PreparedStatement by reusing the same StringBuffer object throughout. Similarly SimpleDateStamp's are alse reused in a thread save manner. - Implemented in PreparedStatement: setNull(), setDate/Time/Timestamp using Calendar, setBlob(), setCharacterStream() - Clob's are now implemented in ResultSet & PreparedStatement! - Implemented a lot of DatabaseMetaData & ResultSetMetaData methods. We have about 18 unimplemented methods left in JDBC2 at the current time.
Diffstat (limited to 'src/interfaces/jdbc/org/postgresql/largeobject')
-rw-r--r--src/interfaces/jdbc/org/postgresql/largeobject/PGclob.java70
1 files changed, 70 insertions, 0 deletions
diff --git a/src/interfaces/jdbc/org/postgresql/largeobject/PGclob.java b/src/interfaces/jdbc/org/postgresql/largeobject/PGclob.java
new file mode 100644
index 00000000000..ee3fff86d6e
--- /dev/null
+++ b/src/interfaces/jdbc/org/postgresql/largeobject/PGclob.java
@@ -0,0 +1,70 @@
+package org.postgresql.largeobject;
+
+// IMPORTANT NOTE: This file implements the JDBC 2 version of the driver.
+// If you make any modifications to this file, you must make sure that the
+// changes are also made (if relevent) to the related JDBC 1 class in the
+// org.postgresql.jdbc1 package.
+
+
+import java.lang.*;
+import java.io.*;
+import java.math.*;
+import java.text.*;
+import java.util.*;
+import java.sql.*;
+import org.postgresql.Field;
+import org.postgresql.largeobject.*;
+import org.postgresql.largeobject.*;
+
+/**
+ * This implements the Blob interface, which is basically another way to
+ * access a LargeObject.
+ *
+ * $Id: PGclob.java,v 1.1 2001/02/16 16:45:01 peter Exp $
+ *
+ */
+public class PGclob implements java.sql.Clob
+{
+ private org.postgresql.Connection conn;
+ private int oid;
+ private LargeObject lo;
+
+ public PGclob(org.postgresql.Connection conn,int oid) throws SQLException {
+ this.conn=conn;
+ this.oid=oid;
+ LargeObjectManager lom = conn.getLargeObjectAPI();
+ this.lo = lom.open(oid);
+ }
+
+ public long length() throws SQLException {
+ return lo.size();
+ }
+
+ public InputStream getAsciiStream() throws SQLException {
+ return lo.getInputStream();
+ }
+
+ public Reader getCharacterStream() throws SQLException {
+ return new InputStreamReader(lo.getInputStream());
+ }
+
+ public String getSubString(long i,int j) throws SQLException {
+ lo.seek((int)i-1);
+ return new String(lo.read(j));
+ }
+
+ /*
+ * For now, this is not implemented.
+ */
+ public long position(String pattern,long start) throws SQLException {
+ throw org.postgresql.Driver.notImplemented();
+ }
+
+ /*
+ * This should be simply passing the byte value of the pattern Blob
+ */
+ public long position(Clob pattern,long start) throws SQLException {
+ throw org.postgresql.Driver.notImplemented();
+ }
+
+}