~ubuntu-branches/ubuntu/maverick/libpgjava/maverick

« back to all changes in this revision

Viewing changes to src/interfaces/jdbc/org/postgresql/jdbc2/AbstractJdbc2Clob.java

  • Committer: Bazaar Package Importer
  • Author(s): Arnaud Vandyck
  • Date: 2006-04-25 00:07:07 UTC
  • mfrom: (1.3.1 upstream) (3.1.1 dapper)
  • Revision ID: james.westby@ubuntu.com-20060425000707-6lr2s0awuz4z48hm
* Drop support for the old jdbc2 driver (can be reverted if wanted)
  (closes: #358345).
* New upstream (thanks to Wolfgang Baer).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
package org.postgresql.jdbc2;
2
 
 
3
 
 
4
 
import org.postgresql.PGConnection;
5
 
import org.postgresql.largeobject.LargeObject;
6
 
import org.postgresql.largeobject.LargeObjectManager;
7
 
import java.io.InputStream;
8
 
import java.io.InputStreamReader;
9
 
import java.io.Reader;
10
 
import java.sql.Clob;
11
 
import java.sql.SQLException;
12
 
 
13
 
public class AbstractJdbc2Clob
14
 
{
15
 
        private int oid;
16
 
        private LargeObject lo;
17
 
 
18
 
        public AbstractJdbc2Clob(PGConnection conn, int oid) throws SQLException
19
 
        {
20
 
                this.oid = oid;
21
 
                LargeObjectManager lom = conn.getLargeObjectAPI();
22
 
                this.lo = lom.open(oid);
23
 
        }
24
 
 
25
 
        public long length() throws SQLException
26
 
        {
27
 
                return lo.size();
28
 
        }
29
 
 
30
 
        public InputStream getAsciiStream() throws SQLException
31
 
        {
32
 
                return lo.getInputStream();
33
 
        }
34
 
 
35
 
        public Reader getCharacterStream() throws SQLException
36
 
        {
37
 
                return new InputStreamReader(lo.getInputStream());
38
 
        }
39
 
 
40
 
        public String getSubString(long i, int j) throws SQLException
41
 
        {
42
 
                lo.seek((int)i - 1);
43
 
                return new String(lo.read(j));
44
 
        }
45
 
 
46
 
        /*
47
 
         * For now, this is not implemented.
48
 
         */
49
 
        public long position(String pattern, long start) throws SQLException
50
 
        {
51
 
                throw org.postgresql.Driver.notImplemented();
52
 
        }
53
 
 
54
 
        /*
55
 
         * This should be simply passing the byte value of the pattern Blob
56
 
         */
57
 
        public long position(Clob pattern, long start) throws SQLException
58
 
        {
59
 
                throw org.postgresql.Driver.notImplemented();
60
 
        }
61
 
 
62
 
}