1 package com.daffodilwoods.daffodildb.server.datasystem.persistentsystem; 2 3 import com.daffodilwoods.database.resource.*; 4 import java.io.*; 5 import java.sql.*; 6 import com.daffodilwoods.daffodildb.server.sql99.utils._Reference; 7 import com.daffodilwoods.daffodildb.server.datasystem.interfaces.Datatype; 8 9 13 public class DClobUpdatable extends DBlobUpdatable implements Clob{ 14 15 DClobUpdatable(DBlob blob) { 16 super(blob); 17 } 18 19 public DClobUpdatable(byte[] bytes) { 20 super(bytes); 21 } 22 23 28 29 public DClobUpdatable(InputStream stream0) { 30 super(stream0); 31 } 32 33 public DClobUpdatable(boolean isNull) { 34 super(isNull); 35 } 36 37 42 43 public DClobUpdatable(String inputString) { 44 this(inputString.getBytes()); 45 } 46 47 public DClobUpdatable() { 48 } 49 50 public long length() throws SQLException { 51 return super.length(); 52 } 53 54 62 63 public String getSubString(long pos, int length) throws SQLException{ 64 return new String (getBytes(pos,length)); 65 } 66 67 public Reader getCharacterStream() throws SQLException{ 68 return new java.io.InputStreamReader (getAsciiStream()); 69 } 70 71 public InputStream getAsciiStream() throws SQLException { 72 return getBinaryStream(); 73 } 74 75 public long position(String searchstr, long start) throws SQLException { 76 initialize(); 77 String targetString = new String (getBytes(start,lengthOfBlob-(int)start)); 78 return targetString.indexOf(searchstr); 79 } 80 81 public long position(Clob searchstr, long start) throws SQLException { 82 try { 83 return position(((DClob)searchstr).getSubString(start,(int)(searchstr.length()-start)),0); 84 }catch(DException ex){ 85 throw ex.getSqlException(null) ; 86 } 87 88 } 89 90 98 99 public int setString(long pos, String str) throws SQLException{ 100 return setBytes(pos,str.getBytes()); 101 } 102 103 public int setString(long pos, String str, int offset, int len) throws SQLException { 104 return setString(pos,str.substring(offset,len)); 105 } 106 107 public OutputStream setAsciiStream(long pos) throws SQLException { 108 return setBinaryStream(pos); 109 } 110 111 public Writer setCharacterStream(long pos) throws SQLException { 112 return new java.io.OutputStreamWriter (setAsciiStream(pos)); 113 } 114 115 public void setStream(InputStream stream) { 116 super.setStream(stream); 117 } 118 119 public String toString(){ 120 return "java.sql.Clob"; 121 } 122 123 124 public int getDatatype() throws DException{ 125 return Datatype.CLOB; 126 } 127 128 public int getLength(){ 129 try { 130 return (int) length(); 131 } 132 catch (SQLException ex) { 133 return -1; 134 } 135 } 136 } 137 | Popular Tags |