mirror of
https://github.com/postgres/postgres.git
synced 2025-08-28 18:48:04 +03:00
of duplicated code between the jdbc1 and jdbc2. This checkin restructures the code so that the duplication is removed so that the jdbc3 support can be added without adding yet another copy of everything. Also many classes were renamed to avoid confusion with multiple different objects having the same name. The timestamp tests were also updated to add support for testing timestamp without time zone in addition to timestamp with time zone Modified Files: jdbc/Makefile jdbc/build.xml jdbc/example/ImageViewer.java jdbc/example/basic.java jdbc/example/blobtest.java jdbc/example/threadsafe.java jdbc/org/postgresql/Driver.java.in jdbc/org/postgresql/Field.java jdbc/org/postgresql/core/QueryExecutor.java jdbc/org/postgresql/fastpath/Fastpath.java jdbc/org/postgresql/jdbc1/CallableStatement.java jdbc/org/postgresql/jdbc1/DatabaseMetaData.java jdbc/org/postgresql/jdbc1/PreparedStatement.java jdbc/org/postgresql/jdbc2/Array.java jdbc/org/postgresql/jdbc2/CallableStatement.java jdbc/org/postgresql/jdbc2/DatabaseMetaData.java jdbc/org/postgresql/jdbc2/PreparedStatement.java jdbc/org/postgresql/jdbc2/UpdateableResultSet.java jdbc/org/postgresql/largeobject/LargeObjectManager.java jdbc/org/postgresql/largeobject/PGblob.java jdbc/org/postgresql/largeobject/PGclob.java jdbc/org/postgresql/test/jdbc2/BlobTest.java jdbc/org/postgresql/test/jdbc2/ConnectionTest.java jdbc/org/postgresql/test/jdbc2/DatabaseMetaDataTest.java jdbc/org/postgresql/test/jdbc2/TimestampTest.java jdbc/org/postgresql/test/jdbc2/UpdateableResultTest.java jdbc/org/postgresql/util/Serialize.java Added Files: jdbc/org/postgresql/PGConnection.java jdbc/org/postgresql/PGStatement.java jdbc/org/postgresql/jdbc1/AbstractJdbc1Connection.java jdbc/org/postgresql/jdbc1/AbstractJdbc1ResultSet.java jdbc/org/postgresql/jdbc1/AbstractJdbc1Statement.java jdbc/org/postgresql/jdbc1/Jdbc1Connection.java jdbc/org/postgresql/jdbc1/Jdbc1ResultSet.java jdbc/org/postgresql/jdbc1/Jdbc1Statement.java jdbc/org/postgresql/jdbc2/AbstractJdbc2Connection.java jdbc/org/postgresql/jdbc2/AbstractJdbc2ResultSet.java jdbc/org/postgresql/jdbc2/AbstractJdbc2Statement.java jdbc/org/postgresql/jdbc2/Jdbc2Connection.java jdbc/org/postgresql/jdbc2/Jdbc2ResultSet.java jdbc/org/postgresql/jdbc2/Jdbc2Statement.java Removed Files: jdbc/org/postgresql/Connection.java jdbc/org/postgresql/ResultSet.java jdbc/org/postgresql/Statement.java jdbc/org/postgresql/jdbc1/Connection.java jdbc/org/postgresql/jdbc1/ResultSet.java jdbc/org/postgresql/jdbc1/Statement.java jdbc/org/postgresql/jdbc2/Connection.java jdbc/org/postgresql/jdbc2/ResultSet.java jdbc/org/postgresql/jdbc2/Statement.java
76 lines
1.7 KiB
Java
76 lines
1.7 KiB
Java
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.4 2002/07/23 03:59:55 barry Exp $
|
|
*
|
|
*/
|
|
public class PGclob implements java.sql.Clob
|
|
{
|
|
private int oid;
|
|
private LargeObject lo;
|
|
|
|
public PGclob(org.postgresql.PGConnection conn, int oid) throws SQLException
|
|
{
|
|
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();
|
|
}
|
|
|
|
}
|