0001: /*
0002:
0003: Derby - Class org.apache.derby.client.am.CallableStatement
0004:
0005: Licensed to the Apache Software Foundation (ASF) under one or more
0006: contributor license agreements. See the NOTICE file distributed with
0007: this work for additional information regarding copyright ownership.
0008: The ASF licenses this file to You under the Apache License, Version 2.0
0009: (the "License"); you may not use this file except in compliance with
0010: the License. You may obtain a copy of the License at
0011:
0012: http://www.apache.org/licenses/LICENSE-2.0
0013:
0014: Unless required by applicable law or agreed to in writing, software
0015: distributed under the License is distributed on an "AS IS" BASIS,
0016: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
0017: See the License for the specific language governing permissions and
0018: limitations under the License.
0019:
0020: */
0021:
0022: package org.apache.derby.client.am;
0023:
0024: import org.apache.derby.client.ClientPooledConnection;
0025: import org.apache.derby.shared.common.reference.SQLState;
0026:
0027: import java.io.Reader;
0028: import java.sql.SQLException;
0029:
0030: public class CallableStatement extends PreparedStatement implements
0031: java.sql.PreparedStatement, java.sql.CallableStatement,
0032: PreparedStatementCallbackInterface {
0033: //---------------------navigational members-----------------------------------
0034:
0035: //---------------------navigational cheat-links-------------------------------
0036: // Cheat-links are for convenience only, and are not part of the conceptual model.
0037: // Warning:
0038: // Cheat-links should only be defined for invariant state data.
0039: // That is, the state data is set by the constructor and never changes.
0040:
0041: public MaterialPreparedStatement materialCallableStatement_ = null;
0042:
0043: //-----------------------------state------------------------------------------
0044:
0045: // last retrieved result was a sql NULL, NOT_NULL, or UNSET.
0046: private int wasNull_ = WAS_NULL_UNSET;
0047: static final private int WAS_NULL = 1;
0048: static final private int WAS_NOT_NULL = 2;
0049: static final private int WAS_NULL_UNSET = 0;
0050:
0051: //---------------------constructors/finalizer---------------------------------
0052:
0053: private void initCallableStatement() {
0054: materialCallableStatement_ = null;
0055: wasNull_ = WAS_NULL_UNSET;
0056: }
0057:
0058: public void reset(boolean fullReset) throws SqlException {
0059: if (fullReset) {
0060: connection_.resetPrepareCall(this );
0061: } else {
0062: super .reset(fullReset);
0063: }
0064: wasNull_ = WAS_NULL_UNSET;
0065: }
0066:
0067: /**
0068: * Common constructor for jdbc 2 callable statements with scroll attributes.
0069: * Called by material statement constructor.
0070: *
0071: * @param agent The instance of NetAgent associated with this
0072: * CallableStatement object.
0073: * @param connection The connection object associated with this
0074: * PreparedStatement Object.
0075: * @param sql A String object that is the SQL statement to be sent
0076: * to the database.
0077: * @param type One of the ResultSet type constants
0078: * @param concurrency One of the ResultSet concurrency constants
0079: * @param holdability One of the ResultSet holdability constants
0080: * @param cpc The PooledConnection object that will be used to
0081: * notify the PooledConnection reference of the Error
0082: * Occurred and the Close events.
0083: * @throws SqlException
0084: */
0085: public CallableStatement(Agent agent, Connection connection,
0086: String sql, int type, int concurrency, int holdability,
0087: ClientPooledConnection cpc) throws SqlException {
0088: super (agent, connection, sql, type, concurrency, holdability,
0089: java.sql.Statement.NO_GENERATED_KEYS, null, cpc);
0090: initCallableStatement();
0091: }
0092:
0093: public void resetCallableStatement(Agent agent,
0094: Connection connection, String sql, int type,
0095: int concurrency, int holdability) throws SqlException {
0096: super .resetPreparedStatement(agent, connection, sql, type,
0097: concurrency, holdability,
0098: java.sql.Statement.NO_GENERATED_KEYS, null);
0099: initCallableStatement();
0100: }
0101:
0102: public void resetCallableStatement(Agent agent,
0103: Connection connection, String sql, Section section)
0104: throws SqlException {
0105: super .resetPreparedStatement(agent, connection, sql, section);
0106: initCallableStatement();
0107: }
0108:
0109: public void resetCallableStatement(Agent agent,
0110: Connection connection, String sql, Section section,
0111: ColumnMetaData parameterMetaData,
0112: ColumnMetaData resultSetMetaData) throws SqlException {
0113: super .resetPreparedStatement(agent, connection, sql, section,
0114: parameterMetaData, resultSetMetaData);
0115: initCallableStatement();
0116: }
0117:
0118: protected void finalize() throws java.lang.Throwable {
0119: if (agent_.loggingEnabled()) {
0120: agent_.logWriter_.traceEntry(this , "finalize");
0121: }
0122: super .finalize();
0123: }
0124:
0125: //---------------------------entry points-------------------------------------
0126:
0127: public void clearParameters() throws SQLException {
0128: synchronized (connection_) {
0129: if (agent_.loggingEnabled()) {
0130: agent_.logWriter_.traceEntry(this , "clearParameters");
0131: }
0132: super .clearParameters();
0133: outputRegistered_ = false; // this variable is only used by Batch
0134: }
0135: }
0136:
0137: public void registerOutParameter(int parameterIndex, int jdbcType)
0138: throws SQLException {
0139: try {
0140: synchronized (connection_) {
0141: if (agent_.loggingEnabled()) {
0142: agent_.logWriter_.traceEntry(this ,
0143: "registerOutParameter", parameterIndex,
0144: jdbcType);
0145: }
0146: registerOutParameterX(parameterIndex, jdbcType);
0147: }
0148: } catch (SqlException se) {
0149: throw se.getSQLException();
0150: }
0151: }
0152:
0153: // also used by Sqlca
0154: void registerOutParameterX(int parameterIndex, int jdbcType)
0155: throws SqlException {
0156: super .checkForClosedStatement();
0157: int scale = 0; // default scale to 0 for non numeric and non decimal type
0158: registerOutParameterX(parameterIndex, jdbcType, scale);
0159: }
0160:
0161: private int guessScaleForDecimalOrNumeric(int parameterIndex)
0162: throws SqlException {
0163: parameterIndex = checkForEscapedCallWithResult(parameterIndex);
0164: // Types.DECIMAL with no supplied scale will use the scale supplied by the setter method if input BigDecimal is not null
0165: if (parameterMetaData_.types_[parameterIndex - 1] == Types.DECIMAL
0166: && parameters_[parameterIndex - 1] != null) {
0167: return parameterMetaData_.sqlScale_[parameterIndex - 1];
0168: }
0169: return 8; // default to scale of 8 if not specified
0170: }
0171:
0172: public void registerOutParameter(int parameterIndex, int jdbcType,
0173: int scale) throws SQLException {
0174: try {
0175: synchronized (connection_) {
0176: if (agent_.loggingEnabled()) {
0177: agent_.logWriter_.traceEntry(this ,
0178: "registerOutParameter", parameterIndex,
0179: jdbcType, scale);
0180: }
0181: super .checkForClosedStatement();
0182: registerOutParameterX(parameterIndex, jdbcType, scale);
0183: }
0184: } catch (SqlException se) {
0185: throw se.getSQLException();
0186: }
0187: }
0188:
0189: private void registerOutParameterX(int parameterIndex,
0190: int jdbcType, int scale) throws SqlException {
0191: parameterIndex = checkForEscapedCallWithResult(parameterIndex,
0192: jdbcType);
0193: // if the parameter is the return clause of the call statement
0194: if (parameterIndex == 0 && escapedProcedureCallWithResult_) {
0195: return;
0196: }
0197: super .checkForValidParameterIndex(parameterIndex);
0198: checkForValidScale(scale);
0199: outputRegistered_ = true; // this variable is only used by Batch
0200: //parameterSetOrRegistered_[parameterIndex - 1] = true;
0201: parameterRegistered_[parameterIndex - 1] = true;
0202: }
0203:
0204: public void registerOutParameter(int parameterIndex, int jdbcType,
0205: String typeName) throws SQLException {
0206: if (agent_.loggingEnabled()) {
0207: agent_.logWriter_.traceEntry(this , "registerOutParameter",
0208: parameterIndex, jdbcType, typeName);
0209: }
0210: throw jdbcMethodNotImplemented();
0211: }
0212:
0213: public boolean wasNull() throws SQLException {
0214: try {
0215: if (agent_.loggingEnabled()) {
0216: agent_.logWriter_.traceEntry(this , "wasNull");
0217: }
0218: boolean result = wasNullX();
0219: if (agent_.loggingEnabled()) {
0220: agent_.logWriter_.traceExit(this , "wasNull", result);
0221: }
0222: return result;
0223: } catch (SqlException se) {
0224: throw se.getSQLException();
0225: }
0226: }
0227:
0228: private boolean wasNullX() throws SqlException {
0229: super .checkForClosedStatement();
0230: if (wasNull_ == WAS_NULL_UNSET) {
0231: throw new SqlException(agent_.logWriter_,
0232: new ClientMessageId(SQLState.WASNULL_INVALID));
0233: }
0234: return wasNull_ == WAS_NULL;
0235: }
0236:
0237: //--------------------------------getter methods------------------------------
0238:
0239: public boolean getBoolean(int parameterIndex) throws SQLException {
0240: try {
0241: synchronized (connection_) {
0242: if (agent_.loggingEnabled()) {
0243: agent_.logWriter_.traceEntry(this , "getBoolean",
0244: parameterIndex);
0245: }
0246: super .checkForClosedStatement();
0247: parameterIndex = checkForEscapedCallWithResult(parameterIndex);
0248: boolean result;
0249: if (parameterIndex == 0
0250: && escapedProcedureCallWithResult_) {
0251: result = agent_.crossConverters_
0252: .getBooleanFromInt(returnValueFromProcedure_);
0253: this .wasNull_ = this .WAS_NOT_NULL;
0254: if (agent_.loggingEnabled()) {
0255: agent_.logWriter_.traceExit(this , "getBoolean",
0256: result);
0257: }
0258: return result;
0259: }
0260: checkGetterPreconditions(parameterIndex);
0261: setWasNull(parameterIndex);
0262: result = wasNullX() ? false : singletonRowData_
0263: .getBoolean(parameterIndex);
0264: if (agent_.loggingEnabled()) {
0265: agent_.logWriter_.traceExit(this , "getBoolean",
0266: result);
0267: }
0268: return result;
0269: }
0270: } catch (SqlException se) {
0271: throw se.getSQLException();
0272: }
0273: }
0274:
0275: public byte getByte(int parameterIndex) throws SQLException {
0276: try {
0277: synchronized (connection_) {
0278: if (agent_.loggingEnabled()) {
0279: agent_.logWriter_.traceEntry(this , "getByte",
0280: parameterIndex);
0281: }
0282: super .checkForClosedStatement();
0283: parameterIndex = checkForEscapedCallWithResult(parameterIndex);
0284: byte result;
0285: if (parameterIndex == 0
0286: && escapedProcedureCallWithResult_) {
0287: result = agent_.crossConverters_
0288: .getByteFromInt(returnValueFromProcedure_);
0289: this .wasNull_ = this .WAS_NOT_NULL;
0290: if (agent_.loggingEnabled()) {
0291: agent_.logWriter_.traceExit(this , "getByte",
0292: result);
0293: }
0294: return result;
0295: }
0296: checkGetterPreconditions(parameterIndex);
0297: setWasNull(parameterIndex);
0298: result = wasNullX() ? 0 : singletonRowData_
0299: .getByte(parameterIndex);
0300: if (agent_.loggingEnabled()) {
0301: agent_.logWriter_
0302: .traceExit(this , "getByte", result);
0303: }
0304: return result;
0305: }
0306: } catch (SqlException se) {
0307: throw se.getSQLException();
0308: }
0309: }
0310:
0311: public short getShort(int parameterIndex) throws SQLException {
0312: try {
0313: synchronized (connection_) {
0314: if (agent_.loggingEnabled()) {
0315: agent_.logWriter_.traceEntry(this , "getShort",
0316: parameterIndex);
0317: }
0318: super .checkForClosedStatement();
0319: parameterIndex = checkForEscapedCallWithResult(parameterIndex);
0320: short result;
0321: if (parameterIndex == 0
0322: && escapedProcedureCallWithResult_) {
0323: result = agent_.crossConverters_
0324: .getShortFromInt(returnValueFromProcedure_);
0325: this .wasNull_ = this .WAS_NOT_NULL;
0326: if (agent_.loggingEnabled()) {
0327: agent_.logWriter_.traceExit(this , "getShort",
0328: result);
0329: }
0330: return result;
0331: }
0332: checkGetterPreconditions(parameterIndex);
0333: setWasNull(parameterIndex);
0334: result = wasNullX() ? 0 : singletonRowData_
0335: .getShort(parameterIndex);
0336: if (agent_.loggingEnabled()) {
0337: agent_.logWriter_.traceExit(this , "getShort",
0338: result);
0339: }
0340: return result;
0341: }
0342: } catch (SqlException se) {
0343: throw se.getSQLException();
0344: }
0345: }
0346:
0347: public int getInt(int parameterIndex) throws SQLException {
0348: try {
0349: synchronized (connection_) {
0350: if (agent_.loggingEnabled()) {
0351: agent_.logWriter_.traceEntry(this , "getInt",
0352: parameterIndex);
0353: }
0354: int result = getIntX(parameterIndex);
0355: if (agent_.loggingEnabled()) {
0356: agent_.logWriter_.traceExit(this , "getInt", result);
0357: }
0358: return result;
0359: }
0360: } catch (SqlException se) {
0361: throw se.getSQLException();
0362: }
0363: }
0364:
0365: // also used by SQLCA
0366: int getIntX(int parameterIndex) throws SqlException {
0367: super .checkForClosedStatement();
0368: parameterIndex = checkForEscapedCallWithResult(parameterIndex);
0369: if (parameterIndex == 0 && escapedProcedureCallWithResult_) {
0370: this .wasNull_ = this .WAS_NOT_NULL;
0371: return returnValueFromProcedure_;
0372: }
0373: checkGetterPreconditions(parameterIndex);
0374: setWasNull(parameterIndex);
0375: return wasNullX() ? 0 : singletonRowData_
0376: .getInt(parameterIndex);
0377: }
0378:
0379: public long getLong(int parameterIndex) throws SQLException {
0380: try {
0381: synchronized (connection_) {
0382: if (agent_.loggingEnabled()) {
0383: agent_.logWriter_.traceEntry(this , "getLong",
0384: parameterIndex);
0385: }
0386: super .checkForClosedStatement();
0387: parameterIndex = checkForEscapedCallWithResult(parameterIndex);
0388: long result;
0389: if (parameterIndex == 0
0390: && escapedProcedureCallWithResult_) {
0391: result = (long) returnValueFromProcedure_;
0392: this .wasNull_ = this .WAS_NOT_NULL;
0393: if (agent_.loggingEnabled()) {
0394: agent_.logWriter_.traceExit(this , "getLong",
0395: result);
0396: }
0397: return result;
0398: }
0399: checkGetterPreconditions(parameterIndex);
0400: setWasNull(parameterIndex);
0401: result = wasNullX() ? 0 : singletonRowData_
0402: .getLong(parameterIndex);
0403: if (agent_.loggingEnabled()) {
0404: agent_.logWriter_
0405: .traceExit(this , "getLong", result);
0406: }
0407: return result;
0408: }
0409: } catch (SqlException se) {
0410: throw se.getSQLException();
0411: }
0412: }
0413:
0414: public float getFloat(int parameterIndex) throws SQLException {
0415: try {
0416: synchronized (connection_) {
0417: if (agent_.loggingEnabled()) {
0418: agent_.logWriter_.traceEntry(this , "getFloat",
0419: parameterIndex);
0420: }
0421: super .checkForClosedStatement();
0422: parameterIndex = checkForEscapedCallWithResult(parameterIndex);
0423: float result;
0424: if (parameterIndex == 0
0425: && escapedProcedureCallWithResult_) {
0426: result = (float) returnValueFromProcedure_;
0427: this .wasNull_ = this .WAS_NOT_NULL;
0428: if (agent_.loggingEnabled()) {
0429: agent_.logWriter_.traceExit(this , "getFloat",
0430: result);
0431: }
0432: return result;
0433: }
0434: checkGetterPreconditions(parameterIndex);
0435: setWasNull(parameterIndex);
0436: result = wasNullX() ? 0 : singletonRowData_
0437: .getFloat(parameterIndex);
0438: if (agent_.loggingEnabled()) {
0439: agent_.logWriter_.traceExit(this , "getFloat",
0440: result);
0441: }
0442: return result;
0443: }
0444: } catch (SqlException se) {
0445: throw se.getSQLException();
0446: }
0447: }
0448:
0449: public double getDouble(int parameterIndex) throws SQLException {
0450: try {
0451: synchronized (connection_) {
0452: if (agent_.loggingEnabled()) {
0453: agent_.logWriter_.traceEntry(this , "getDouble",
0454: parameterIndex);
0455: }
0456: super .checkForClosedStatement();
0457: parameterIndex = checkForEscapedCallWithResult(parameterIndex);
0458: double result;
0459: if (parameterIndex == 0
0460: && escapedProcedureCallWithResult_) {
0461: result = (double) returnValueFromProcedure_;
0462: this .wasNull_ = this .WAS_NOT_NULL;
0463: if (agent_.loggingEnabled()) {
0464: agent_.logWriter_.traceExit(this , "getDouble",
0465: result);
0466: }
0467: return result;
0468: }
0469: checkGetterPreconditions(parameterIndex);
0470: setWasNull(parameterIndex);
0471: result = wasNullX() ? 0 : singletonRowData_
0472: .getDouble(parameterIndex);
0473: if (agent_.loggingEnabled()) {
0474: agent_.logWriter_.traceExit(this , "getDouble",
0475: result);
0476: }
0477: return result;
0478: }
0479: } catch (SqlException se) {
0480: throw se.getSQLException();
0481: }
0482: }
0483:
0484: public java.math.BigDecimal getBigDecimal(int parameterIndex,
0485: int scale) throws SQLException, ArithmeticException {
0486: try {
0487: synchronized (connection_) {
0488: if (agent_.loggingEnabled()) {
0489: agent_.logWriter_.traceDeprecatedEntry(this ,
0490: "getBigDecimal", parameterIndex, scale);
0491: }
0492: super .checkForClosedStatement();
0493: checkForValidScale(scale);
0494: parameterIndex = checkForEscapedCallWithResult(parameterIndex);
0495: java.math.BigDecimal result;
0496: if (parameterIndex == 0
0497: && escapedProcedureCallWithResult_) {
0498: result = java.math.BigDecimal.valueOf(
0499: returnValueFromProcedure_).setScale(scale);
0500: this .wasNull_ = this .WAS_NOT_NULL;
0501: if (agent_.loggingEnabled()) {
0502: agent_.logWriter_.traceDeprecatedExit(this ,
0503: "getBigDecimal", result);
0504: }
0505: return result;
0506: }
0507: checkGetterPreconditions(parameterIndex);
0508: setWasNull(parameterIndex);
0509: result = wasNullX() ? null : singletonRowData_
0510: .getBigDecimal(parameterIndex);
0511: if (result != null) {
0512: result = result.setScale(scale,
0513: java.math.BigDecimal.ROUND_DOWN);
0514: }
0515: if (agent_.loggingEnabled()) {
0516: agent_.logWriter_.traceDeprecatedExit(this ,
0517: "getBigDecimal", result);
0518: }
0519: return result;
0520: }
0521: } catch (SqlException se) {
0522: throw se.getSQLException();
0523: }
0524: }
0525:
0526: public java.math.BigDecimal getBigDecimal(int parameterIndex)
0527: throws SQLException {
0528: try {
0529: synchronized (connection_) {
0530: if (agent_.loggingEnabled()) {
0531: agent_.logWriter_.traceEntry(this , "getBigDecimal",
0532: parameterIndex);
0533: }
0534: super .checkForClosedStatement();
0535: parameterIndex = checkForEscapedCallWithResult(parameterIndex);
0536: java.math.BigDecimal result;
0537: if (parameterIndex == 0
0538: && escapedProcedureCallWithResult_) {
0539: result = java.math.BigDecimal
0540: .valueOf(returnValueFromProcedure_);
0541: this .wasNull_ = this .WAS_NOT_NULL;
0542: if (agent_.loggingEnabled()) {
0543: agent_.logWriter_.traceExit(this ,
0544: "getBigDecimal", result);
0545: }
0546: return result;
0547: }
0548: checkGetterPreconditions(parameterIndex);
0549: setWasNull(parameterIndex);
0550: result = wasNullX() ? null : singletonRowData_
0551: .getBigDecimal(parameterIndex);
0552: if (agent_.loggingEnabled()) {
0553: agent_.logWriter_.traceExit(this , "getBigDecimal",
0554: result);
0555: }
0556: return result;
0557: }
0558: } catch (SqlException se) {
0559: throw se.getSQLException();
0560: }
0561: }
0562:
0563: public java.sql.Date getDate(int parameterIndex)
0564: throws SQLException {
0565: try {
0566: synchronized (connection_) {
0567: if (agent_.loggingEnabled()) {
0568: agent_.logWriter_.traceEntry(this , "getDate",
0569: parameterIndex);
0570: }
0571: super .checkForClosedStatement();
0572: parameterIndex = checkForEscapedCallWithResult(parameterIndex);
0573: if (parameterIndex == 0
0574: && escapedProcedureCallWithResult_) {
0575: throw new SqlException(agent_.logWriter_,
0576: new ClientMessageId(
0577: SQLState.INVALID_PARAM_USE_GETINT));
0578: }
0579: checkGetterPreconditions(parameterIndex);
0580: setWasNull(parameterIndex);
0581: java.sql.Date result = wasNullX() ? null
0582: : singletonRowData_.getDate(parameterIndex);
0583: if (agent_.loggingEnabled()) {
0584: agent_.logWriter_
0585: .traceExit(this , "getDate", result);
0586: }
0587: return result;
0588: }
0589: } catch (SqlException se) {
0590: throw se.getSQLException();
0591: }
0592: }
0593:
0594: public java.sql.Date getDate(int parameterIndex,
0595: java.util.Calendar cal) throws SQLException {
0596: synchronized (connection_) {
0597: if (agent_.loggingEnabled()) {
0598: agent_.logWriter_.traceEntry(this , "getDate",
0599: parameterIndex, cal);
0600: }
0601: java.sql.Date result = getDate(parameterIndex);
0602: if (cal == null) {
0603: throw new SqlException(agent_.logWriter_,
0604: new ClientMessageId(SQLState.CALENDAR_IS_NULL))
0605: .getSQLException();
0606: }
0607: if (result != null) {
0608: java.util.Calendar targetCalendar = java.util.Calendar
0609: .getInstance(cal.getTimeZone());
0610: targetCalendar.clear();
0611: targetCalendar.setTime(result);
0612: java.util.Calendar defaultCalendar = java.util.Calendar
0613: .getInstance();
0614: defaultCalendar.clear();
0615:
0616: defaultCalendar.setTime(result);
0617: long timeZoneOffset = targetCalendar
0618: .get(java.util.Calendar.ZONE_OFFSET)
0619: - defaultCalendar
0620: .get(java.util.Calendar.ZONE_OFFSET)
0621: + targetCalendar
0622: .get(java.util.Calendar.DST_OFFSET)
0623: - defaultCalendar
0624: .get(java.util.Calendar.DST_OFFSET);
0625: result.setTime(result.getTime() - timeZoneOffset);
0626: }
0627: if (agent_.loggingEnabled()) {
0628: agent_.logWriter_.traceExit(this , "getDate", result);
0629: }
0630: return result;
0631: }
0632: }
0633:
0634: public java.sql.Time getTime(int parameterIndex)
0635: throws SQLException {
0636: try {
0637: synchronized (connection_) {
0638: if (agent_.loggingEnabled()) {
0639: agent_.logWriter_.traceEntry(this , "getTime",
0640: parameterIndex);
0641: }
0642: super .checkForClosedStatement();
0643: parameterIndex = checkForEscapedCallWithResult(parameterIndex);
0644: if (parameterIndex == 0
0645: && escapedProcedureCallWithResult_) {
0646: throw new SqlException(agent_.logWriter_,
0647: new ClientMessageId(
0648: SQLState.INVALID_PARAM_USE_GETINT));
0649: }
0650: checkGetterPreconditions(parameterIndex);
0651: setWasNull(parameterIndex);
0652: java.sql.Time result = wasNullX() ? null
0653: : singletonRowData_.getTime(parameterIndex);
0654: if (agent_.loggingEnabled()) {
0655: agent_.logWriter_
0656: .traceExit(this , "getTime", result);
0657: }
0658: return result;
0659: }
0660: } catch (SqlException se) {
0661: throw se.getSQLException();
0662: }
0663: }
0664:
0665: public java.sql.Time getTime(int parameterIndex,
0666: java.util.Calendar cal) throws SQLException {
0667: synchronized (connection_) {
0668: if (agent_.loggingEnabled()) {
0669: agent_.logWriter_.traceEntry(this , "getTime",
0670: parameterIndex, cal);
0671: }
0672: java.sql.Time result = getTime(parameterIndex);
0673: if (cal == null) {
0674: throw new SqlException(agent_.logWriter_,
0675: new ClientMessageId(SQLState.CALENDAR_IS_NULL))
0676: .getSQLException();
0677: }
0678: if (result != null) {
0679: java.util.Calendar targetCalendar = java.util.Calendar
0680: .getInstance(cal.getTimeZone());
0681: targetCalendar.clear();
0682: targetCalendar.setTime(result);
0683: java.util.Calendar defaultCalendar = java.util.Calendar
0684: .getInstance();
0685: defaultCalendar.clear();
0686: defaultCalendar.setTime(result);
0687: long timeZoneOffset = targetCalendar
0688: .get(java.util.Calendar.ZONE_OFFSET)
0689: - defaultCalendar
0690: .get(java.util.Calendar.ZONE_OFFSET)
0691: + targetCalendar
0692: .get(java.util.Calendar.DST_OFFSET)
0693: - defaultCalendar
0694: .get(java.util.Calendar.DST_OFFSET);
0695: result.setTime(result.getTime() - timeZoneOffset);
0696: }
0697: if (agent_.loggingEnabled()) {
0698: agent_.logWriter_.traceExit(this , "getTime", result);
0699: }
0700: return result;
0701: }
0702: }
0703:
0704: public java.sql.Timestamp getTimestamp(int parameterIndex)
0705: throws SQLException {
0706: try {
0707: synchronized (connection_) {
0708: if (agent_.loggingEnabled()) {
0709: agent_.logWriter_.traceEntry(this , "getTimestamp",
0710: parameterIndex);
0711: }
0712: super .checkForClosedStatement();
0713: parameterIndex = checkForEscapedCallWithResult(parameterIndex);
0714: if (parameterIndex == 0
0715: && escapedProcedureCallWithResult_) {
0716: throw new SqlException(agent_.logWriter_,
0717: new ClientMessageId(
0718: SQLState.INVALID_PARAM_USE_GETINT));
0719: }
0720: checkGetterPreconditions(parameterIndex);
0721: setWasNull(parameterIndex);
0722: java.sql.Timestamp result = wasNullX() ? null
0723: : singletonRowData_
0724: .getTimestamp(parameterIndex);
0725: if (agent_.loggingEnabled()) {
0726: agent_.logWriter_.traceExit(this , "getTimestamp",
0727: result);
0728: }
0729: return result;
0730: }
0731: } catch (SqlException se) {
0732: throw se.getSQLException();
0733: }
0734: }
0735:
0736: public java.sql.Timestamp getTimestamp(int parameterIndex,
0737: java.util.Calendar cal) throws SQLException {
0738: synchronized (connection_) {
0739: if (agent_.loggingEnabled()) {
0740: agent_.logWriter_.traceEntry(this , "getTimestamp",
0741: parameterIndex, cal);
0742: }
0743: java.sql.Timestamp result = getTimestamp(parameterIndex);
0744: if (cal == null) {
0745: throw new SqlException(agent_.logWriter_,
0746: new ClientMessageId(SQLState.CALENDAR_IS_NULL))
0747: .getSQLException();
0748: }
0749: if (result != null) {
0750: int nano = result.getNanos();
0751: java.util.Calendar targetCalendar = java.util.Calendar
0752: .getInstance(cal.getTimeZone());
0753: targetCalendar.clear();
0754: targetCalendar.setTime(result);
0755: java.util.Calendar defaultCalendar = java.util.Calendar
0756: .getInstance();
0757: defaultCalendar.clear();
0758: defaultCalendar.setTime(result);
0759: long timeZoneOffset = targetCalendar
0760: .get(java.util.Calendar.ZONE_OFFSET)
0761: - defaultCalendar
0762: .get(java.util.Calendar.ZONE_OFFSET)
0763: + targetCalendar
0764: .get(java.util.Calendar.DST_OFFSET)
0765: - defaultCalendar
0766: .get(java.util.Calendar.DST_OFFSET);
0767: result.setTime(result.getTime() - timeZoneOffset);
0768: result.setNanos(nano);
0769: }
0770: if (agent_.loggingEnabled()) {
0771: agent_.logWriter_.traceExit(this , "getTimestamp",
0772: result);
0773: }
0774: return result;
0775: }
0776: }
0777:
0778: public String getString(int parameterIndex) throws SQLException {
0779: try {
0780: synchronized (connection_) {
0781: if (agent_.loggingEnabled()) {
0782: agent_.logWriter_.traceEntry(this , "getString",
0783: parameterIndex);
0784: }
0785: String result = getStringX(parameterIndex);
0786: if (agent_.loggingEnabled()) {
0787: agent_.logWriter_.traceExit(this , "getString",
0788: result);
0789: }
0790: return result;
0791: }
0792: } catch (SqlException se) {
0793: throw se.getSQLException();
0794: }
0795: }
0796:
0797: // also used by SQLCA
0798: String getStringX(int parameterIndex) throws SqlException {
0799: super .checkForClosedStatement();
0800: parameterIndex = checkForEscapedCallWithResult(parameterIndex);
0801: if (parameterIndex == 0 && escapedProcedureCallWithResult_) {
0802: this .wasNull_ = this .WAS_NOT_NULL;
0803: return Integer.toString(returnValueFromProcedure_);
0804: }
0805: checkGetterPreconditions(parameterIndex);
0806: setWasNull(parameterIndex);
0807: return wasNullX() ? null : singletonRowData_
0808: .getString(parameterIndex);
0809: }
0810:
0811: public byte[] getBytes(int parameterIndex) throws SQLException {
0812: try {
0813: synchronized (connection_) {
0814: if (agent_.loggingEnabled()) {
0815: agent_.logWriter_.traceEntry(this , "getBytes",
0816: parameterIndex);
0817: }
0818: super .checkForClosedStatement();
0819: parameterIndex = checkForEscapedCallWithResult(parameterIndex);
0820: if (parameterIndex == 0
0821: && escapedProcedureCallWithResult_) {
0822: throw new SqlException(agent_.logWriter_,
0823: new ClientMessageId(
0824: SQLState.INVALID_PARAM_USE_GETINT));
0825: }
0826: checkGetterPreconditions(parameterIndex);
0827: setWasNull(parameterIndex);
0828: byte[] result = wasNullX() ? null : singletonRowData_
0829: .getBytes(parameterIndex);
0830: if (agent_.loggingEnabled()) {
0831: agent_.logWriter_.traceExit(this , "getBytes",
0832: result);
0833: }
0834: return result;
0835: }
0836: } catch (SqlException se) {
0837: throw se.getSQLException();
0838: }
0839: }
0840:
0841: public java.sql.Blob getBlob(int parameterIndex)
0842: throws SQLException {
0843: try {
0844: synchronized (connection_) {
0845: if (agent_.loggingEnabled()) {
0846: agent_.logWriter_.traceEntry(this , "getBlob",
0847: parameterIndex);
0848: }
0849: super .checkForClosedStatement();
0850: parameterIndex = checkForEscapedCallWithResult(parameterIndex);
0851: if (parameterIndex == 0
0852: && escapedProcedureCallWithResult_) {
0853: throw new SqlException(agent_.logWriter_,
0854: new ClientMessageId(
0855: SQLState.INVALID_PARAM_USE_GETINT));
0856: }
0857: checkGetterPreconditions(parameterIndex);
0858: setWasNull(parameterIndex);
0859: java.sql.Blob result = wasNullX() ? null
0860: : singletonRowData_.getBlob(parameterIndex);
0861: if (agent_.loggingEnabled()) {
0862: agent_.logWriter_
0863: .traceExit(this , "getBlob", result);
0864: }
0865: return result;
0866: }
0867: } catch (SqlException se) {
0868: throw se.getSQLException();
0869: }
0870: }
0871:
0872: public java.sql.Clob getClob(int parameterIndex)
0873: throws SQLException {
0874: try {
0875: synchronized (connection_) {
0876: super .checkForClosedStatement();
0877: parameterIndex = checkForEscapedCallWithResult(parameterIndex);
0878: if (parameterIndex == 0
0879: && escapedProcedureCallWithResult_) {
0880: throw new SqlException(agent_.logWriter_,
0881: new ClientMessageId(
0882: SQLState.INVALID_PARAM_USE_GETINT));
0883: }
0884: checkGetterPreconditions(parameterIndex);
0885: setWasNull(parameterIndex);
0886: java.sql.Clob result = wasNullX() ? null
0887: : singletonRowData_.getClob(parameterIndex);
0888: if (agent_.loggingEnabled()) {
0889: agent_.logWriter_
0890: .traceExit(this , "getClob", result);
0891: }
0892: return result;
0893: }
0894: } catch (SqlException se) {
0895: throw se.getSQLException();
0896: }
0897: }
0898:
0899: public java.sql.Array getArray(int parameterIndex)
0900: throws SQLException {
0901: try {
0902: synchronized (connection_) {
0903: if (agent_.loggingEnabled()) {
0904: agent_.logWriter_.traceEntry(this , "getArray",
0905: parameterIndex);
0906: }
0907: super .checkForClosedStatement();
0908: parameterIndex = checkForEscapedCallWithResult(parameterIndex);
0909: if (parameterIndex == 0
0910: && escapedProcedureCallWithResult_) {
0911: throw new SqlException(agent_.logWriter_,
0912: new ClientMessageId(
0913: SQLState.INVALID_PARAM_USE_GETINT));
0914: }
0915: checkGetterPreconditions(parameterIndex);
0916: setWasNull(parameterIndex);
0917: java.sql.Array result = wasNullX() ? null
0918: : singletonRowData_.getArray(parameterIndex);
0919: if (true) {
0920: throw new SqlException(
0921: agent_.logWriter_,
0922: new ClientMessageId(
0923: SQLState.JDBC_METHOD_NOT_IMPLEMENTED));
0924: }
0925: if (agent_.loggingEnabled()) {
0926: agent_.logWriter_.traceExit(this , "getArray",
0927: result);
0928: }
0929: return result;
0930: }
0931: } catch (SqlException se) {
0932: throw se.getSQLException();
0933: }
0934: }
0935:
0936: public java.sql.Ref getRef(int parameterIndex) throws SQLException {
0937: try {
0938: synchronized (connection_) {
0939: if (agent_.loggingEnabled()) {
0940: agent_.logWriter_.traceEntry(this , "getRef",
0941: parameterIndex);
0942: }
0943: super .checkForClosedStatement();
0944: parameterIndex = checkForEscapedCallWithResult(parameterIndex);
0945: if (parameterIndex == 0
0946: && escapedProcedureCallWithResult_) {
0947: throw new SqlException(agent_.logWriter_,
0948: new ClientMessageId(
0949: SQLState.INVALID_PARAM_USE_GETINT));
0950: }
0951: checkGetterPreconditions(parameterIndex);
0952: setWasNull(parameterIndex);
0953: java.sql.Ref result = wasNullX() ? null
0954: : singletonRowData_.getRef(parameterIndex);
0955: if (true) {
0956: throw new SqlException(
0957: agent_.logWriter_,
0958: new ClientMessageId(
0959: SQLState.JDBC_METHOD_NOT_IMPLEMENTED));
0960: }
0961: if (agent_.loggingEnabled()) {
0962: agent_.logWriter_.traceExit(this , "getRef", result);
0963: }
0964: return result;
0965: }
0966: } catch (SqlException se) {
0967: throw se.getSQLException();
0968: }
0969: }
0970:
0971: public Object getObject(int parameterIndex) throws SQLException {
0972: try {
0973: synchronized (connection_) {
0974: if (agent_.loggingEnabled()) {
0975: agent_.logWriter_.traceEntry(this , "getObject",
0976: parameterIndex);
0977: }
0978: super .checkForClosedStatement();
0979: parameterIndex = checkForEscapedCallWithResult(parameterIndex);
0980: Object result;
0981: if (parameterIndex == 0
0982: && escapedProcedureCallWithResult_) {
0983: result = new Integer(returnValueFromProcedure_);
0984: this .wasNull_ = this .WAS_NOT_NULL;
0985: if (agent_.loggingEnabled()) {
0986: agent_.logWriter_.traceExit(this , "getObject",
0987: result);
0988: }
0989: return result;
0990: }
0991: checkGetterPreconditions(parameterIndex);
0992: setWasNull(parameterIndex);
0993: result = wasNullX() ? null : singletonRowData_
0994: .getObject(parameterIndex);
0995: if (agent_.loggingEnabled()) {
0996: agent_.logWriter_.traceExit(this , "getObject",
0997: result);
0998: }
0999: return result;
1000: }
1001: } catch (SqlException se) {
1002: throw se.getSQLException();
1003: }
1004: }
1005:
1006: public Object getObject(int parameterIndex, java.util.Map map)
1007: throws SQLException {
1008: try {
1009: synchronized (connection_) {
1010: if (agent_.loggingEnabled()) {
1011: agent_.logWriter_.traceEntry(this , "getObject",
1012: parameterIndex, map);
1013: }
1014: super .checkForClosedStatement();
1015: parameterIndex = checkForEscapedCallWithResult(parameterIndex);
1016: Object result;
1017: checkGetterPreconditions(parameterIndex);
1018: if (true) {
1019: throw new SqlException(
1020: agent_.logWriter_,
1021: new ClientMessageId(
1022: SQLState.JDBC_METHOD_NOT_IMPLEMENTED));
1023: }
1024: if (agent_.loggingEnabled()) {
1025: agent_.logWriter_.traceExit(this , "getObject",
1026: result);
1027: }
1028: return result;
1029: }
1030: } catch (SqlException se) {
1031: throw se.getSQLException();
1032: }
1033: }
1034:
1035: //--------------------------JDBC 3.0------------------------------------------
1036:
1037: public void registerOutParameter(String parameterName, int sqlType)
1038: throws SQLException {
1039: if (agent_.loggingEnabled()) {
1040: agent_.logWriter_.traceEntry(this , "registerOutParameter",
1041: parameterName, sqlType);
1042: }
1043: throw jdbcMethodNotImplemented();
1044: }
1045:
1046: public void registerOutParameter(String parameterName, int sqlType,
1047: int scale) throws SQLException {
1048: if (agent_.loggingEnabled()) {
1049: agent_.logWriter_.traceEntry(this , "registerOutParameter",
1050: parameterName, sqlType, scale);
1051: }
1052: throw jdbcMethodNotImplemented();
1053: }
1054:
1055: public void registerOutParameter(String parameterName, int sqlType,
1056: String typeName) throws SQLException {
1057: if (agent_.loggingEnabled()) {
1058: agent_.logWriter_.traceEntry(this , "registerOutParameter",
1059: parameterName, sqlType, typeName);
1060: }
1061: throw jdbcMethodNotImplemented();
1062: }
1063:
1064: public java.net.URL getURL(int parameterIndex) throws SQLException {
1065: if (agent_.loggingEnabled()) {
1066: agent_.logWriter_
1067: .traceEntry(this , "getURL", parameterIndex);
1068: }
1069: throw jdbcMethodNotImplemented();
1070: }
1071:
1072: public void setURL(String parameterName, java.net.URL x)
1073: throws SQLException {
1074: if (agent_.loggingEnabled()) {
1075: agent_.logWriter_.traceEntry(this , "setURL", parameterName,
1076: x);
1077: }
1078: throw jdbcMethodNotImplemented();
1079: }
1080:
1081: public void setNull(String parameterName, int sqlType)
1082: throws SQLException {
1083: if (agent_.loggingEnabled()) {
1084: agent_.logWriter_.traceEntry(this , "setNull",
1085: parameterName, sqlType);
1086: }
1087: throw jdbcMethodNotImplemented();
1088: }
1089:
1090: public void setBoolean(String parameterName, boolean x)
1091: throws SQLException {
1092: if (agent_.loggingEnabled()) {
1093: agent_.logWriter_.traceEntry(this , "setBoolean",
1094: parameterName, x);
1095: }
1096: throw jdbcMethodNotImplemented();
1097: }
1098:
1099: public void setByte(String parameterName, byte x)
1100: throws SQLException {
1101: if (agent_.loggingEnabled()) {
1102: agent_.logWriter_.traceEntry(this , "setByte",
1103: parameterName, x);
1104: }
1105: throw jdbcMethodNotImplemented();
1106: }
1107:
1108: public void setShort(String parameterName, short x)
1109: throws SQLException {
1110: if (agent_.loggingEnabled()) {
1111: agent_.logWriter_.traceEntry(this , "setShort",
1112: parameterName, x);
1113: }
1114: throw jdbcMethodNotImplemented();
1115: }
1116:
1117: public void setInt(String parameterName, int x) throws SQLException {
1118: if (agent_.loggingEnabled()) {
1119: agent_.logWriter_.traceEntry(this , "setInt", parameterName,
1120: x);
1121: }
1122: throw jdbcMethodNotImplemented();
1123: }
1124:
1125: public void setLong(String parameterName, long x)
1126: throws SQLException {
1127: if (agent_.loggingEnabled()) {
1128: agent_.logWriter_.traceEntry(this , "setLong",
1129: parameterName, x);
1130: }
1131: throw jdbcMethodNotImplemented();
1132: }
1133:
1134: public void setFloat(String parameterName, float x)
1135: throws SQLException {
1136: if (agent_.loggingEnabled()) {
1137: agent_.logWriter_.traceEntry(this , "setFloat",
1138: parameterName, x);
1139: }
1140: throw jdbcMethodNotImplemented();
1141: }
1142:
1143: public void setDouble(String parameterName, double x)
1144: throws SQLException {
1145: if (agent_.loggingEnabled()) {
1146: agent_.logWriter_.traceEntry(this , "setDouble",
1147: parameterName, x);
1148: }
1149: throw jdbcMethodNotImplemented();
1150: }
1151:
1152: public void setBigDecimal(String parameterName,
1153: java.math.BigDecimal x) throws SQLException {
1154: if (agent_.loggingEnabled()) {
1155: agent_.logWriter_.traceEntry(this , "setBigDecimal",
1156: parameterName, x);
1157: }
1158: throw jdbcMethodNotImplemented();
1159: }
1160:
1161: public void setString(String parameterName, String x)
1162: throws SQLException {
1163: if (agent_.loggingEnabled()) {
1164: agent_.logWriter_.traceEntry(this , "setString",
1165: parameterName, x);
1166: }
1167: throw jdbcMethodNotImplemented();
1168: }
1169:
1170: public void setBytes(String parameterName, byte x[])
1171: throws SQLException {
1172: if (agent_.loggingEnabled()) {
1173: agent_.logWriter_.traceEntry(this , "setBytes",
1174: parameterName, x);
1175: }
1176: throw jdbcMethodNotImplemented();
1177: }
1178:
1179: public void setDate(String parameterName, java.sql.Date x)
1180: throws SQLException {
1181: if (agent_.loggingEnabled()) {
1182: agent_.logWriter_.traceEntry(this , "setDate",
1183: parameterName, x);
1184: }
1185: throw jdbcMethodNotImplemented();
1186: }
1187:
1188: public void setTime(String parameterName, java.sql.Time x)
1189: throws SQLException {
1190: if (agent_.loggingEnabled()) {
1191: agent_.logWriter_.traceEntry(this , "setTime",
1192: parameterName, x);
1193: }
1194: throw jdbcMethodNotImplemented();
1195: }
1196:
1197: public void setTimestamp(String parameterName, java.sql.Timestamp x)
1198: throws SQLException {
1199: if (agent_.loggingEnabled()) {
1200: agent_.logWriter_.traceEntry(this , "setTimestamp",
1201: parameterName, x);
1202: }
1203: throw jdbcMethodNotImplemented();
1204: }
1205:
1206: public void setAsciiStream(String parameterName,
1207: java.io.InputStream x, int length) throws SQLException {
1208: if (agent_.loggingEnabled()) {
1209: agent_.logWriter_.traceEntry(this , "setAsciiStream",
1210: parameterName, x, length);
1211: }
1212: throw jdbcMethodNotImplemented();
1213: }
1214:
1215: public void setBinaryStream(String parameterName,
1216: java.io.InputStream x, int length) throws SQLException {
1217: if (agent_.loggingEnabled()) {
1218: agent_.logWriter_.traceEntry(this , "setBinaryStream",
1219: parameterName, x, length);
1220: }
1221: throw jdbcMethodNotImplemented();
1222: }
1223:
1224: public void setObject(String parameterName, Object x,
1225: int targetSqlType, int scale) throws SQLException {
1226: if (agent_.loggingEnabled()) {
1227: agent_.logWriter_.traceEntry(this , "setObject",
1228: parameterName, x, targetSqlType, scale);
1229: }
1230: throw jdbcMethodNotImplemented();
1231: }
1232:
1233: public void setObject(String parameterName, Object x,
1234: int targetSqlType) throws SQLException {
1235: if (agent_.loggingEnabled()) {
1236: agent_.logWriter_.traceEntry(this , "setObject",
1237: parameterName, x, targetSqlType);
1238: }
1239: throw jdbcMethodNotImplemented();
1240: }
1241:
1242: public void setObject(String parameterName, Object x)
1243: throws SQLException {
1244: if (agent_.loggingEnabled()) {
1245: agent_.logWriter_.traceEntry(this , "setObject",
1246: parameterName, x);
1247: }
1248: throw jdbcMethodNotImplemented();
1249: }
1250:
1251: public void setCharacterStream(String parameterName,
1252: java.io.Reader reader, int length) throws SQLException {
1253: if (agent_.loggingEnabled()) {
1254: agent_.logWriter_.traceEntry(this , "setCharacterStream",
1255: parameterName, reader, length);
1256: }
1257: throw jdbcMethodNotImplemented();
1258: }
1259:
1260: public void setDate(String parameterName, java.sql.Date x,
1261: java.util.Calendar calendar) throws SQLException {
1262: if (agent_.loggingEnabled()) {
1263: agent_.logWriter_.traceEntry(this , "setDate",
1264: parameterName, x, calendar);
1265: }
1266: throw jdbcMethodNotImplemented();
1267: }
1268:
1269: public void setTime(String parameterName, java.sql.Time x,
1270: java.util.Calendar calendar) throws SQLException {
1271: if (agent_.loggingEnabled()) {
1272: agent_.logWriter_.traceEntry(this , "setTime",
1273: parameterName, x, calendar);
1274: }
1275: throw jdbcMethodNotImplemented();
1276: }
1277:
1278: public void setTimestamp(String parameterName,
1279: java.sql.Timestamp x, java.util.Calendar calendar)
1280: throws SQLException {
1281: if (agent_.loggingEnabled()) {
1282: agent_.logWriter_.traceEntry(this , "setTimestamp",
1283: parameterName, x, calendar);
1284: }
1285: throw jdbcMethodNotImplemented();
1286: }
1287:
1288: public void setNull(String parameterName, int sqlType,
1289: String typeName) throws SQLException {
1290: if (agent_.loggingEnabled()) {
1291: agent_.logWriter_.traceEntry(this , "setNull",
1292: parameterName, sqlType, typeName);
1293: }
1294: throw jdbcMethodNotImplemented();
1295: }
1296:
1297: public String getString(String parameterName) throws SQLException {
1298: if (agent_.loggingEnabled()) {
1299: agent_.logWriter_.traceEntry(this , "getString",
1300: parameterName);
1301: }
1302: throw jdbcMethodNotImplemented();
1303: }
1304:
1305: public boolean getBoolean(String parameterName) throws SQLException {
1306: if (agent_.loggingEnabled()) {
1307: agent_.logWriter_.traceEntry(this , "getBoolean",
1308: parameterName);
1309: }
1310: throw jdbcMethodNotImplemented();
1311: }
1312:
1313: public byte getByte(String parameterName) throws SQLException {
1314: if (agent_.loggingEnabled()) {
1315: agent_.logWriter_
1316: .traceEntry(this , "getByte", parameterName);
1317: }
1318: throw jdbcMethodNotImplemented();
1319: }
1320:
1321: public short getShort(String parameterName) throws SQLException {
1322: if (agent_.loggingEnabled()) {
1323: agent_.logWriter_.traceEntry(this , "getShort",
1324: parameterName);
1325: }
1326: throw jdbcMethodNotImplemented();
1327: }
1328:
1329: public int getInt(String parameterName) throws SQLException {
1330: if (agent_.loggingEnabled()) {
1331: agent_.logWriter_.traceEntry(this , "getInt", parameterName);
1332: }
1333: throw jdbcMethodNotImplemented();
1334: }
1335:
1336: public long getLong(String parameterName) throws SQLException {
1337: if (agent_.loggingEnabled()) {
1338: agent_.logWriter_
1339: .traceEntry(this , "getLong", parameterName);
1340: }
1341: throw jdbcMethodNotImplemented();
1342: }
1343:
1344: public float getFloat(String parameterName) throws SQLException {
1345: if (agent_.loggingEnabled()) {
1346: agent_.logWriter_.traceEntry(this , "getFloat",
1347: parameterName);
1348: }
1349: throw jdbcMethodNotImplemented();
1350: }
1351:
1352: public double getDouble(String parameterName) throws SQLException {
1353: if (agent_.loggingEnabled()) {
1354: agent_.logWriter_.traceEntry(this , "getDouble",
1355: parameterName);
1356: }
1357: throw jdbcMethodNotImplemented();
1358: }
1359:
1360: public byte[] getBytes(String parameterName) throws SQLException {
1361: if (agent_.loggingEnabled()) {
1362: agent_.logWriter_.traceEntry(this , "getBytes",
1363: parameterName);
1364: }
1365: throw jdbcMethodNotImplemented();
1366: }
1367:
1368: public java.sql.Date getDate(String parameterName)
1369: throws SQLException {
1370: if (agent_.loggingEnabled()) {
1371: agent_.logWriter_
1372: .traceEntry(this , "getDate", parameterName);
1373: }
1374: throw jdbcMethodNotImplemented();
1375: }
1376:
1377: public java.sql.Time getTime(String parameterName)
1378: throws SQLException {
1379: if (agent_.loggingEnabled()) {
1380: agent_.logWriter_
1381: .traceEntry(this , "getTime", parameterName);
1382: }
1383: throw jdbcMethodNotImplemented();
1384: }
1385:
1386: public java.sql.Timestamp getTimestamp(String parameterName)
1387: throws SQLException {
1388: if (agent_.loggingEnabled()) {
1389: agent_.logWriter_.traceEntry(this , "getTimestamp",
1390: parameterName);
1391: }
1392: throw jdbcMethodNotImplemented();
1393: }
1394:
1395: public Object getObject(String parameterName) throws SQLException {
1396: if (agent_.loggingEnabled()) {
1397: agent_.logWriter_.traceEntry(this , "getObject",
1398: parameterName);
1399: }
1400: throw jdbcMethodNotImplemented();
1401: }
1402:
1403: public java.math.BigDecimal getBigDecimal(String parameterName)
1404: throws SQLException {
1405: if (agent_.loggingEnabled()) {
1406: agent_.logWriter_.traceEntry(this , "getBigDecimal",
1407: parameterName);
1408: }
1409: throw jdbcMethodNotImplemented();
1410: }
1411:
1412: public Object getObject(String parameterName, java.util.Map map)
1413: throws SQLException {
1414: if (agent_.loggingEnabled()) {
1415: agent_.logWriter_.traceEntry(this , "getObject",
1416: parameterName, map);
1417: }
1418: throw jdbcMethodNotImplemented();
1419: }
1420:
1421: public java.sql.Ref getRef(String parameterName)
1422: throws SQLException {
1423: if (agent_.loggingEnabled()) {
1424: agent_.logWriter_.traceEntry(this , "getRef", parameterName);
1425: }
1426: throw jdbcMethodNotImplemented();
1427: }
1428:
1429: public java.sql.Blob getBlob(String parameterName)
1430: throws SQLException {
1431: if (agent_.loggingEnabled()) {
1432: agent_.logWriter_
1433: .traceEntry(this , "getBlob", parameterName);
1434: }
1435: throw jdbcMethodNotImplemented();
1436: }
1437:
1438: public java.sql.Clob getClob(String parameterName)
1439: throws SQLException {
1440: if (agent_.loggingEnabled()) {
1441: agent_.logWriter_
1442: .traceEntry(this , "getClob", parameterName);
1443: }
1444: throw jdbcMethodNotImplemented();
1445: }
1446:
1447: public java.sql.Array getArray(String parameterName)
1448: throws SQLException {
1449: if (agent_.loggingEnabled()) {
1450: agent_.logWriter_.traceEntry(this , "getArray",
1451: parameterName);
1452: }
1453: throw jdbcMethodNotImplemented();
1454: }
1455:
1456: public java.sql.Date getDate(String parameterName,
1457: java.util.Calendar calendar) throws SQLException {
1458: if (agent_.loggingEnabled()) {
1459: agent_.logWriter_.traceEntry(this , "getDate",
1460: parameterName, calendar);
1461: }
1462: throw jdbcMethodNotImplemented();
1463: }
1464:
1465: public java.sql.Time getTime(String parameterName,
1466: java.util.Calendar calendar) throws SQLException {
1467: if (agent_.loggingEnabled()) {
1468: agent_.logWriter_.traceEntry(this , "getTime",
1469: parameterName, calendar);
1470: }
1471: throw jdbcMethodNotImplemented();
1472: }
1473:
1474: public java.sql.Timestamp getTimestamp(String parameterName,
1475: java.util.Calendar calendar) throws SQLException {
1476: if (agent_.loggingEnabled()) {
1477: agent_.logWriter_.traceEntry(this , "getTimestamp",
1478: parameterName, calendar);
1479: }
1480: throw jdbcMethodNotImplemented();
1481: }
1482:
1483: public java.net.URL getURL(String parameterName)
1484: throws SQLException {
1485: if (agent_.loggingEnabled()) {
1486: agent_.logWriter_.traceEntry(this , "getURL", parameterName);
1487: }
1488: throw jdbcMethodNotImplemented();
1489: }
1490:
1491: //-------------------------- JDBC 4.0 methods --------------------------------
1492:
1493: public Reader getCharacterStream(int parameterIndex)
1494: throws SQLException {
1495: try {
1496: synchronized (connection_) {
1497: if (agent_.loggingEnabled()) {
1498: agent_.logWriter_.traceEntry(this ,
1499: "getCharacterStream", parameterIndex);
1500: }
1501: super .checkForClosedStatement();
1502: parameterIndex = checkForEscapedCallWithResult(parameterIndex);
1503: checkGetterPreconditions(parameterIndex);
1504: setWasNull(parameterIndex);
1505: Reader reader = null;
1506: if (this .wasNull_ == WAS_NOT_NULL) {
1507: reader = singletonRowData_
1508: .getCharacterStream(parameterIndex);
1509: }
1510: if (agent_.loggingEnabled()) {
1511: agent_.logWriter_.traceExit(this ,
1512: "getCharacterStream", reader);
1513: }
1514: return reader;
1515: }
1516:
1517: } catch (SqlException se) {
1518: throw se.getSQLException();
1519: }
1520: }
1521:
1522: //----------------------------helper methods----------------------------------
1523:
1524: /**
1525: * Returns the name of the java.sql interface implemented by this class.
1526: * @return name of java.sql interface
1527: */
1528: protected String getJdbcStatementInterfaceName() {
1529: return "java.sql.CallableStatement";
1530: }
1531:
1532: private int checkForEscapedCallWithResult(int parameterIndex)
1533: throws SqlException {
1534: if (escapedProcedureCallWithResult_) {
1535: parameterIndex--;
1536: }
1537: return parameterIndex;
1538: }
1539:
1540: private int checkForEscapedCallWithResult(int parameterIndex,
1541: int jdbcType) throws SqlException {
1542: if (escapedProcedureCallWithResult_) {
1543: if (parameterIndex == 1
1544: && jdbcType != java.sql.Types.INTEGER) {
1545: throw new SqlException(agent_.logWriter_,
1546: new ClientMessageId(
1547: SQLState.RETURN_PARAM_MUST_BE_INT));
1548: } else {
1549: parameterIndex--;
1550: }
1551: }
1552: return parameterIndex;
1553: }
1554:
1555: private void checkGetterPreconditions(int parameterIndex)
1556: throws SqlException {
1557: super .checkForValidParameterIndex(parameterIndex);
1558: checkForValidOutParameter(parameterIndex);
1559: }
1560:
1561: private void checkForValidOutParameter(int parameterIndex)
1562: throws SqlException {
1563: if (parameterMetaData_ == null
1564: || parameterMetaData_.sqlxParmmode_[parameterIndex - 1] < java.sql.ParameterMetaData.parameterModeInOut) {
1565: throw new SqlException(
1566: agent_.logWriter_,
1567: new ClientMessageId(SQLState.PARAM_NOT_OUT_OR_INOUT),
1568: new Integer(parameterIndex));
1569: }
1570: }
1571:
1572: private void setWasNull(int parameterIndex) {
1573: if (singletonRowData_ == null) {
1574: wasNull_ = WAS_NULL_UNSET;
1575: } else {
1576: wasNull_ = singletonRowData_.isNull_[parameterIndex - 1] ? WAS_NULL
1577: : WAS_NOT_NULL;
1578: }
1579: }
1580:
1581: private SQLException jdbcMethodNotImplemented() throws SQLException {
1582: try {
1583: super .checkForClosedStatement();
1584: } catch (SqlException se) {
1585: throw se.getSQLException();
1586: }
1587: return new SqlException(agent_.logWriter_, new ClientMessageId(
1588: SQLState.JDBC_METHOD_NOT_IMPLEMENTED))
1589: .getSQLException();
1590: }
1591: }
|