~ubuntu-branches/ubuntu/wily/libpgjava/wily

« 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: 2005-04-21 14:25:11 UTC
  • mfrom: (1.2.1 upstream) (2.1.1 warty)
  • Revision ID: james.westby@ubuntu.com-20050421142511-wibh5vc31fkrorx7
Tags: 7.4.7-3
Built with sources...

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
}