1 21 22 package org.continuent.sequoia.common.sql; 23 24 import java.io.IOException ; 25 26 import org.continuent.sequoia.common.stream.DriverBufferedInputStream; 27 import org.continuent.sequoia.common.stream.DriverBufferedOutputStream; 28 29 37 public class RequestWithResultSetParameters extends Request 38 { 39 40 43 private int maxRows = 0; 44 private int fetchSize = 0; 45 private String cursorName = null; 46 47 51 61 public RequestWithResultSetParameters(String sqlTemplate, String parameters, 62 boolean escapeProcessing, int timeoutInSeconds) 63 { 64 super(sqlTemplate, parameters, escapeProcessing, timeoutInSeconds); 65 } 66 67 71 79 public RequestWithResultSetParameters(DriverBufferedInputStream in) 80 throws IOException 81 { 82 super(in); 83 this.maxRows = in.readInt(); 84 this.fetchSize = in.readInt(); 85 86 if (in.readBoolean()) this.cursorName = in.readLongUTF(); 88 } 89 90 96 public void sendToStream(DriverBufferedOutputStream out) throws IOException 97 { 98 super.sendToStream(out); 99 100 out.writeInt(maxRows); 101 out.writeInt(fetchSize); 102 103 if (this.cursorName != null) { 105 out.writeBoolean(true); 106 out.writeLongUTF(cursorName); 107 } 108 else 109 out.writeBoolean(false); 110 } 111 112 116 121 public final String getCursorName() 122 { 123 return cursorName; 124 } 125 126 131 public final void setCursorName(String cursorName) 132 { 133 this.cursorName = cursorName; 134 } 135 136 141 public final int getFetchSize() 142 { 143 return fetchSize; 144 } 145 146 151 public final void setFetchSize(int fetchSize) 152 { 153 this.fetchSize = fetchSize; 154 } 155 156 161 public final int getMaxRows() 162 { 163 return maxRows; 164 } 165 166 171 public final void setMaxRows(int maxRows) 172 { 173 this.maxRows = maxRows; 174 } 175 176 } 177 | Popular Tags |