0001: /*
0002: * Copyright 2004-2008 H2 Group. Licensed under the H2 License, Version 1.0
0003: * (http://h2database.com/html/license.html).
0004: * Initial Developer: H2 Group
0005: */
0006: package org.h2.jdbc;
0007:
0008: import java.io.InputStream;
0009: import java.io.Reader;
0010: import java.math.BigDecimal;
0011: import java.net.URL;
0012: import java.sql.Array;
0013: import java.sql.Blob;
0014: import java.sql.Clob; //#ifdef JDK14
0015: import java.sql.ParameterMetaData;
0016: import java.sql.Statement; //#endif
0017: import java.sql.PreparedStatement;
0018: import java.sql.Ref;
0019: import java.sql.ResultSet;
0020: import java.sql.ResultSetMetaData;
0021: import java.sql.SQLException;
0022: import java.util.Calendar;
0023:
0024: import org.h2.command.CommandInterface;
0025: import org.h2.constant.ErrorCode;
0026: import org.h2.engine.SessionInterface;
0027: import org.h2.expression.ParameterInterface;
0028: import org.h2.message.Message;
0029: import org.h2.message.TraceObject;
0030: import org.h2.result.ResultInterface;
0031: import org.h2.util.DateTimeUtils;
0032: import org.h2.util.IOUtils;
0033: import org.h2.util.ObjectArray;
0034: import org.h2.value.DataType;
0035: import org.h2.value.Value;
0036: import org.h2.value.ValueBoolean;
0037: import org.h2.value.ValueByte;
0038: import org.h2.value.ValueBytes;
0039: import org.h2.value.ValueDate;
0040: import org.h2.value.ValueDecimal;
0041: import org.h2.value.ValueDouble;
0042: import org.h2.value.ValueFloat;
0043: import org.h2.value.ValueInt;
0044: import org.h2.value.ValueLong;
0045: import org.h2.value.ValueNull;
0046: import org.h2.value.ValueShort;
0047: import org.h2.value.ValueString;
0048: import org.h2.value.ValueTime;
0049: import org.h2.value.ValueTimestamp;
0050:
0051: //#ifdef JDK16
0052: /*
0053: import java.sql.RowId;
0054: import java.sql.NClob;
0055: import java.sql.SQLXML;
0056: */
0057: //#endif
0058: /**
0059: * Represents a prepared statement.
0060: *
0061: */
0062: public class JdbcPreparedStatement extends JdbcStatement implements
0063: PreparedStatement {
0064:
0065: private CommandInterface command;
0066: private ObjectArray batchParameters;
0067:
0068: /**
0069: * Executes a query (select statement) and returns the result set. If
0070: * another result set exists for this statement, this will be closed (even
0071: * if this statement fails).
0072: *
0073: * @return the result set
0074: * @throws SQLException if this object is closed or invalid
0075: */
0076: public ResultSet executeQuery() throws SQLException {
0077: try {
0078: int id = getNextId(TraceObject.RESULT_SET);
0079: if (debug()) {
0080: debugCodeAssign("ResultSet", TraceObject.RESULT_SET,
0081: id, "executeQuery()");
0082: }
0083: checkClosed();
0084: closeOld();
0085: ResultInterface result;
0086: boolean scrollable = resultSetType != ResultSet.TYPE_FORWARD_ONLY;
0087: synchronized (session) {
0088: try {
0089: setExecutingStatement(command);
0090: result = command.executeQuery(maxRows, scrollable);
0091: } finally {
0092: setExecutingStatement(null);
0093: }
0094: }
0095: resultSet = new JdbcResultSet(session, conn, this , result,
0096: id, closedByResultSet, scrollable);
0097: return resultSet;
0098: } catch (Throwable e) {
0099: throw logAndConvert(e);
0100: }
0101: }
0102:
0103: /**
0104: * Executes a statement (insert, update, delete, create, drop, commit,
0105: * rollback) and returns the update count. If another result set exists for
0106: * this statement, this will be closed (even if this statement fails).
0107: *
0108: * If the statement is a create or drop and does not throw an exception, the
0109: * current transaction (if any) is committed after executing the statement.
0110: * If auto commit is on, this statement will be committed.
0111: *
0112: * @return the update count (number of row affected by an insert, update or
0113: * delete, or 0 if no rows or the statement was a create, drop,
0114: * commit or rollback)
0115: * @throws SQLException if this object is closed or invalid
0116: */
0117: public int executeUpdate() throws SQLException {
0118: try {
0119: debugCodeCall("executeUpdate");
0120: checkClosed();
0121: return executeUpdateInternal();
0122: } catch (Throwable e) {
0123: throw logAndConvert(e);
0124: }
0125: }
0126:
0127: private int executeUpdateInternal() throws SQLException {
0128: closeOld();
0129: synchronized (session) {
0130: try {
0131: setExecutingStatement(command);
0132: updateCount = command.executeUpdate();
0133: } finally {
0134: setExecutingStatement(null);
0135: }
0136: }
0137: return updateCount;
0138: }
0139:
0140: /**
0141: * Executes an arbitrary statement. If another result set exists for this
0142: * statement, this will be closed (even if this statement fails). If auto
0143: * commit is on, and the statement is not a select, this statement will be
0144: * committed.
0145: *
0146: * @return true if a result set is available, false if not
0147: * @throws SQLException if this object is closed or invalid
0148: */
0149: public boolean execute() throws SQLException {
0150: try {
0151: int id = getNextId(TraceObject.RESULT_SET);
0152: if (debug()) {
0153: debugCodeCall("execute");
0154: }
0155: checkClosed();
0156: closeOld();
0157: boolean returnsResultSet;
0158: synchronized (session) {
0159: try {
0160: setExecutingStatement(command);
0161: if (command.isQuery()) {
0162: returnsResultSet = true;
0163: boolean scrollable = resultSetType != ResultSet.TYPE_FORWARD_ONLY;
0164: ResultInterface result = command.executeQuery(
0165: maxRows, scrollable);
0166: resultSet = new JdbcResultSet(session, conn,
0167: this , result, id, closedByResultSet,
0168: scrollable);
0169: } else {
0170: returnsResultSet = false;
0171: updateCount = command.executeUpdate();
0172: }
0173: } finally {
0174: setExecutingStatement(null);
0175: }
0176: }
0177: return returnsResultSet;
0178: } catch (Throwable e) {
0179: throw logAndConvert(e);
0180: }
0181: }
0182:
0183: /**
0184: * Clears all parameters.
0185: *
0186: * @throws SQLException if this object is closed or invalid
0187: */
0188: public void clearParameters() throws SQLException {
0189: try {
0190: debugCodeCall("clearParameters");
0191: checkClosed();
0192: ObjectArray parameters = command.getParameters();
0193: for (int i = 0; i < parameters.size(); i++) {
0194: ParameterInterface param = (ParameterInterface) parameters
0195: .get(i);
0196: param.setValue(null);
0197: }
0198: } catch (Throwable e) {
0199: throw logAndConvert(e);
0200: }
0201: }
0202:
0203: /**
0204: * Calling this method is not legal on a PreparedStatement.
0205: *
0206: * @throws SQLException Unsupported Feature
0207: */
0208: public ResultSet executeQuery(String sql) throws SQLException {
0209: try {
0210: debugCodeCall("executeQuery", sql);
0211: throw Message
0212: .getSQLException(ErrorCode.METHOD_NOT_ALLOWED_FOR_PREPARED_STATEMENT);
0213: } catch (Throwable e) {
0214: throw logAndConvert(e);
0215: }
0216: }
0217:
0218: /**
0219: * Calling this method is not legal on a PreparedStatement.
0220: *
0221: * @throws SQLException Unsupported Feature
0222: */
0223: public void addBatch(String sql) throws SQLException {
0224: try {
0225: debugCodeCall("addBatch", sql);
0226: throw Message
0227: .getSQLException(ErrorCode.METHOD_NOT_ALLOWED_FOR_PREPARED_STATEMENT);
0228: } catch (Throwable e) {
0229: throw logAndConvert(e);
0230: }
0231: }
0232:
0233: /**
0234: * Calling this method is not legal on a PreparedStatement.
0235: *
0236: * @throws SQLException Unsupported Feature
0237: */
0238: public int executeUpdate(String sql) throws SQLException {
0239: try {
0240: debugCodeCall("executeUpdate", sql);
0241: throw Message
0242: .getSQLException(ErrorCode.METHOD_NOT_ALLOWED_FOR_PREPARED_STATEMENT);
0243: } catch (Throwable e) {
0244: throw logAndConvert(e);
0245: }
0246: }
0247:
0248: /**
0249: * Calling this method is not legal on a PreparedStatement.
0250: *
0251: * @throws SQLException Unsupported Feature
0252: */
0253: public boolean execute(String sql) throws SQLException {
0254: try {
0255: debugCodeCall("execute", sql);
0256: throw Message
0257: .getSQLException(ErrorCode.METHOD_NOT_ALLOWED_FOR_PREPARED_STATEMENT);
0258: } catch (Throwable e) {
0259: throw logAndConvert(e);
0260: }
0261: }
0262:
0263: // =============================================================
0264:
0265: /**
0266: * Sets a parameter to null.
0267: *
0268: * @param parameterIndex the parameter index (1, 2, ...)
0269: * @param sqlType the data type (Types.x)
0270: * @throws SQLException if this object is closed
0271: */
0272: public void setNull(int parameterIndex, int sqlType)
0273: throws SQLException {
0274: try {
0275: if (debug()) {
0276: debugCode("setNull(" + parameterIndex + ", " + sqlType
0277: + ");");
0278: }
0279: setParameter(parameterIndex, ValueNull.INSTANCE);
0280: } catch (Throwable e) {
0281: throw logAndConvert(e);
0282: }
0283: }
0284:
0285: /**
0286: * Sets the value of a parameter.
0287: *
0288: * @param parameterIndex the parameter index (1, 2, ...)
0289: * @param x the value
0290: * @throws SQLException if this object is closed
0291: */
0292: public void setInt(int parameterIndex, int x) throws SQLException {
0293: try {
0294: if (debug()) {
0295: debugCode("setInt(" + parameterIndex + ", " + x + ");");
0296: }
0297: setParameter(parameterIndex, ValueInt.get(x));
0298: } catch (Throwable e) {
0299: throw logAndConvert(e);
0300: }
0301: }
0302:
0303: /**
0304: * Sets the value of a parameter.
0305: *
0306: * @param parameterIndex the parameter index (1, 2, ...)
0307: * @param x the value
0308: * @throws SQLException if this object is closed
0309: */
0310: public void setString(int parameterIndex, String x)
0311: throws SQLException {
0312: try {
0313: if (debug()) {
0314: debugCode("setString(" + parameterIndex + ", "
0315: + quote(x) + ");");
0316: }
0317: Value v = x == null ? (Value) ValueNull.INSTANCE
0318: : ValueString.get(x);
0319: setParameter(parameterIndex, v);
0320: } catch (Throwable e) {
0321: throw logAndConvert(e);
0322: }
0323: }
0324:
0325: /**
0326: * Sets the value of a parameter.
0327: *
0328: * @param parameterIndex the parameter index (1, 2, ...)
0329: * @param x the value
0330: * @throws SQLException if this object is closed
0331: */
0332: public void setBigDecimal(int parameterIndex, BigDecimal x)
0333: throws SQLException {
0334: try {
0335: if (debug()) {
0336: debugCode("setBigDecimal(" + parameterIndex + ", "
0337: + quoteBigDecimal(x) + ");");
0338: }
0339: Value v = x == null ? (Value) ValueNull.INSTANCE
0340: : ValueDecimal.get(x);
0341: setParameter(parameterIndex, v);
0342: } catch (Throwable e) {
0343: throw logAndConvert(e);
0344: }
0345: }
0346:
0347: /**
0348: * Sets the value of a parameter.
0349: *
0350: * @param parameterIndex the parameter index (1, 2, ...)
0351: * @param x the value
0352: * @throws SQLException if this object is closed
0353: */
0354: public void setDate(int parameterIndex, java.sql.Date x)
0355: throws SQLException {
0356: try {
0357: if (debug()) {
0358: debugCode("setDate(" + parameterIndex + ", "
0359: + quoteDate(x) + ");");
0360: }
0361: Value v = x == null ? (Value) ValueNull.INSTANCE
0362: : ValueDate.get(x);
0363: setParameter(parameterIndex, v);
0364: } catch (Throwable e) {
0365: throw logAndConvert(e);
0366: }
0367: }
0368:
0369: /**
0370: * Sets the value of a parameter.
0371: *
0372: * @param parameterIndex the parameter index (1, 2, ...)
0373: * @param x the value
0374: * @throws SQLException if this object is closed
0375: */
0376: public void setTime(int parameterIndex, java.sql.Time x)
0377: throws SQLException {
0378: try {
0379: if (debug()) {
0380: debugCode("setTime(" + parameterIndex + ", "
0381: + quoteTime(x) + ");");
0382: }
0383: Value v = x == null ? (Value) ValueNull.INSTANCE
0384: : ValueTime.get(x);
0385: setParameter(parameterIndex, v);
0386: } catch (Throwable e) {
0387: throw logAndConvert(e);
0388: }
0389: }
0390:
0391: /**
0392: * Sets the value of a parameter.
0393: *
0394: * @param parameterIndex the parameter index (1, 2, ...)
0395: * @param x the value
0396: * @throws SQLException if this object is closed
0397: */
0398: public void setTimestamp(int parameterIndex, java.sql.Timestamp x)
0399: throws SQLException {
0400: try {
0401: if (debug()) {
0402: debugCode("setTimestamp(" + parameterIndex + ", "
0403: + quoteTimestamp(x) + ");");
0404: }
0405: Value v = x == null ? (Value) ValueNull.INSTANCE
0406: : ValueTimestamp.get(x);
0407: setParameter(parameterIndex, v);
0408: } catch (Throwable e) {
0409: throw logAndConvert(e);
0410: }
0411: }
0412:
0413: /**
0414: * Sets the value of a parameter.
0415: *
0416: * @param parameterIndex the parameter index (1, 2, ...)
0417: * @param x the value
0418: * @throws SQLException if this object is closed
0419: */
0420: public void setObject(int parameterIndex, Object x)
0421: throws SQLException {
0422: try {
0423: if (debug()) {
0424: debugCode("setObject(" + parameterIndex + ", x);");
0425: }
0426: if (x == null) {
0427: // throw Errors.getInvalidValueException("null", "x");
0428: setParameter(parameterIndex, ValueNull.INSTANCE);
0429: } else {
0430: setParameter(parameterIndex, DataType.convertToValue(
0431: session, x, Value.UNKNOWN));
0432: }
0433: } catch (Throwable e) {
0434: throw logAndConvert(e);
0435: }
0436: }
0437:
0438: /**
0439: * Sets the value of a parameter. The object is converted, if required, to
0440: * the specified data type before sending to the database.
0441: *
0442: * @param parameterIndex the parameter index (1, 2, ...)
0443: * @param x the value, null is allowed
0444: * @param targetSqlType the type as defined in java.sql.Types
0445: * @throws SQLException if this object is closed
0446: */
0447: public void setObject(int parameterIndex, Object x,
0448: int targetSqlType) throws SQLException {
0449: try {
0450: if (debug()) {
0451: debugCode("setObject(" + parameterIndex + ", x, "
0452: + targetSqlType + ");");
0453: }
0454: int type = DataType
0455: .convertSQLTypeToValueType(targetSqlType);
0456: if (x == null) {
0457: setParameter(parameterIndex, ValueNull.INSTANCE);
0458: } else {
0459: Value v = DataType.convertToValue(session, x, type);
0460: setParameter(parameterIndex, v.convertTo(type));
0461: }
0462: } catch (Throwable e) {
0463: throw logAndConvert(e);
0464: }
0465: }
0466:
0467: /**
0468: * Sets the value of a parameter. The object is converted, if required, to
0469: * the specified data type before sending to the database.
0470: *
0471: * @param parameterIndex the parameter index (1, 2, ...)
0472: * @param x the value, null is allowed
0473: * @param targetSqlType the type as defined in java.sql.Types
0474: * @param scale is ignored
0475: * @throws SQLException if this object is closed
0476: */
0477: public void setObject(int parameterIndex, Object x,
0478: int targetSqlType, int scale) throws SQLException {
0479: try {
0480: if (debug()) {
0481: debugCode("setObject(" + parameterIndex + ", x, "
0482: + targetSqlType + ", " + scale + ");");
0483: }
0484: setObject(parameterIndex, x, targetSqlType);
0485: } catch (Throwable e) {
0486: throw logAndConvert(e);
0487: }
0488: }
0489:
0490: /**
0491: * Sets the value of a parameter.
0492: *
0493: * @param parameterIndex the parameter index (1, 2, ...)
0494: * @param x the value
0495: * @throws SQLException if this object is closed
0496: */
0497: public void setBoolean(int parameterIndex, boolean x)
0498: throws SQLException {
0499: try {
0500: if (debug()) {
0501: debugCode("setBoolean(" + parameterIndex + ", " + x
0502: + ");");
0503: }
0504: setParameter(parameterIndex, ValueBoolean.get(x));
0505: } catch (Throwable e) {
0506: throw logAndConvert(e);
0507: }
0508: }
0509:
0510: /**
0511: * Sets the value of a parameter.
0512: *
0513: * @param parameterIndex the parameter index (1, 2, ...)
0514: * @param x the value
0515: * @throws SQLException if this object is closed
0516: */
0517: public void setByte(int parameterIndex, byte x) throws SQLException {
0518: try {
0519: if (debug()) {
0520: debugCode("setByte(" + parameterIndex + ", " + x + ");");
0521: }
0522: setParameter(parameterIndex, ValueByte.get(x));
0523: } catch (Throwable e) {
0524: throw logAndConvert(e);
0525: }
0526: }
0527:
0528: /**
0529: * Sets the value of a parameter.
0530: *
0531: * @param parameterIndex the parameter index (1, 2, ...)
0532: * @param x the value
0533: * @throws SQLException if this object is closed
0534: */
0535: public void setShort(int parameterIndex, short x)
0536: throws SQLException {
0537: try {
0538: if (debug()) {
0539: debugCode("setShort(" + parameterIndex + ", (short) "
0540: + x + ");");
0541: }
0542: setParameter(parameterIndex, ValueShort.get(x));
0543: } catch (Throwable e) {
0544: throw logAndConvert(e);
0545: }
0546: }
0547:
0548: /**
0549: * Sets the value of a parameter.
0550: *
0551: * @param parameterIndex the parameter index (1, 2, ...)
0552: * @param x the value
0553: * @throws SQLException if this object is closed
0554: */
0555: public void setLong(int parameterIndex, long x) throws SQLException {
0556: try {
0557: if (debug()) {
0558: debugCode("setLong(" + parameterIndex + ", " + x
0559: + "L);");
0560: }
0561: setParameter(parameterIndex, ValueLong.get(x));
0562: } catch (Throwable e) {
0563: throw logAndConvert(e);
0564: }
0565: }
0566:
0567: /**
0568: * Sets the value of a parameter.
0569: *
0570: * @param parameterIndex the parameter index (1, 2, ...)
0571: * @param x the value
0572: * @throws SQLException if this object is closed
0573: */
0574: public void setFloat(int parameterIndex, float x)
0575: throws SQLException {
0576: try {
0577: if (debug()) {
0578: debugCode("setFloat(" + parameterIndex + ", " + x
0579: + "f);");
0580: }
0581: setParameter(parameterIndex, ValueFloat.get(x));
0582: } catch (Throwable e) {
0583: throw logAndConvert(e);
0584: }
0585: }
0586:
0587: /**
0588: * Sets the value of a parameter.
0589: *
0590: * @param parameterIndex the parameter index (1, 2, ...)
0591: * @param x the value
0592: * @throws SQLException if this object is closed
0593: */
0594: public void setDouble(int parameterIndex, double x)
0595: throws SQLException {
0596: try {
0597: if (debug()) {
0598: debugCode("setDouble(" + parameterIndex + ", " + x
0599: + "d);");
0600: }
0601: setParameter(parameterIndex, ValueDouble.get(x));
0602: } catch (Throwable e) {
0603: throw logAndConvert(e);
0604: }
0605: }
0606:
0607: /**
0608: * [Not supported] Sets the value of a column as a reference.
0609: */
0610: public void setRef(int parameterIndex, Ref x) throws SQLException {
0611: try {
0612: if (debug()) {
0613: debugCode("setRef(" + parameterIndex + ", x);");
0614: }
0615: throw Message.getUnsupportedException();
0616: } catch (Throwable e) {
0617: throw logAndConvert(e);
0618: }
0619: }
0620:
0621: /**
0622: * Sets the date using a specified timezone. The value will be converted to
0623: * the local timezone.
0624: *
0625: * @param parameterIndex the parameter index (1, 2, ...)
0626: * @param x the value
0627: * @param calendar the calendar
0628: * @throws SQLException if this object is closed
0629: */
0630: public void setDate(int parameterIndex, java.sql.Date x,
0631: Calendar calendar) throws SQLException {
0632: try {
0633: if (debug()) {
0634: debugCode("setDate(" + parameterIndex + ", "
0635: + quoteDate(x) + ", calendar);");
0636: }
0637: if (x == null) {
0638: setParameter(parameterIndex, ValueNull.INSTANCE);
0639: } else {
0640: setParameter(parameterIndex, DateTimeUtils
0641: .convertDateToUniversal(x, calendar));
0642: }
0643: } catch (Throwable e) {
0644: throw logAndConvert(e);
0645: }
0646: }
0647:
0648: /**
0649: * Sets the time using a specified timezone. The value will be converted to
0650: * the local timezone.
0651: *
0652: * @param parameterIndex the parameter index (1, 2, ...)
0653: * @param x the value
0654: * @param calendar the calendar
0655: * @throws SQLException if this object is closed
0656: */
0657: public void setTime(int parameterIndex, java.sql.Time x,
0658: Calendar calendar) throws SQLException {
0659: try {
0660: if (debug()) {
0661: debugCode("setTime(" + parameterIndex + ", "
0662: + quoteTime(x) + ", calendar);");
0663: }
0664: if (x == null) {
0665: setParameter(parameterIndex, ValueNull.INSTANCE);
0666: } else {
0667: setParameter(parameterIndex, DateTimeUtils
0668: .convertTimeToUniversal(x, calendar));
0669: }
0670: } catch (Throwable e) {
0671: throw logAndConvert(e);
0672: }
0673: }
0674:
0675: /**
0676: * Sets the timestamp using a specified timezone. The value will be
0677: * converted to the local timezone.
0678: *
0679: * @param parameterIndex the parameter index (1, 2, ...)
0680: * @param x the value
0681: * @param calendar the calendar
0682: * @throws SQLException if this object is closed
0683: */
0684: public void setTimestamp(int parameterIndex, java.sql.Timestamp x,
0685: Calendar calendar) throws SQLException {
0686: try {
0687: if (debug()) {
0688: debugCode("setTimestamp(" + parameterIndex + ", "
0689: + quoteTimestamp(x) + ", calendar);");
0690: }
0691: if (x == null) {
0692: setParameter(parameterIndex, ValueNull.INSTANCE);
0693: } else {
0694: setParameter(parameterIndex, DateTimeUtils
0695: .convertTimestampToUniversal(x, calendar));
0696: }
0697: } catch (Throwable e) {
0698: throw logAndConvert(e);
0699: }
0700: }
0701:
0702: /**
0703: * [Not supported] This feature is deprecated and not supported.
0704: * @deprecated
0705: */
0706: public void setUnicodeStream(int parameterIndex, InputStream x,
0707: int length) throws SQLException {
0708: try {
0709: if (debug()) {
0710: debugCode("setUnicodeStream(" + parameterIndex
0711: + ", x, " + length + ");");
0712: }
0713: throw Message.getUnsupportedException();
0714: } catch (Throwable e) {
0715: throw logAndConvert(e);
0716: }
0717: }
0718:
0719: /**
0720: * Sets a parameter to null.
0721: *
0722: * @param parameterIndex the parameter index (1, 2, ...)
0723: * @param sqlType the data type (Types.x)
0724: * @param typeName this parameter is ignored
0725: * @throws SQLException if this object is closed
0726: */
0727: public void setNull(int parameterIndex, int sqlType, String typeName)
0728: throws SQLException {
0729: try {
0730: if (debug()) {
0731: debugCode("setNull(" + parameterIndex + ", " + sqlType
0732: + ", " + quote(typeName) + ");");
0733: }
0734: setNull(parameterIndex, sqlType);
0735: } catch (Throwable e) {
0736: throw logAndConvert(e);
0737: }
0738: }
0739:
0740: /**
0741: * Sets the value of a parameter as a Blob.
0742: *
0743: * @param parameterIndex the parameter index (1, 2, ...)
0744: * @param x the value
0745: * @throws SQLException if this object is closed
0746: */
0747: public void setBlob(int parameterIndex, Blob x) throws SQLException {
0748: try {
0749: if (debug()) {
0750: debugCode("setBlob(" + parameterIndex + ", x);");
0751: }
0752: checkClosed();
0753: Value v;
0754: if (x == null) {
0755: v = ValueNull.INSTANCE;
0756: } else {
0757: v = conn.createBlob(x.getBinaryStream(), -1);
0758: }
0759: setParameter(parameterIndex, v);
0760: } catch (Throwable e) {
0761: throw logAndConvert(e);
0762: }
0763: }
0764:
0765: /**
0766: * Sets the value of a parameter as a Blob.
0767: *
0768: * @param parameterIndex the parameter index (1, 2, ...)
0769: * @param x the value
0770: * @throws SQLException if this object is closed
0771: */
0772: public void setBlob(int parameterIndex, InputStream x)
0773: throws SQLException {
0774: try {
0775: if (debug()) {
0776: debugCode("setBlob(" + parameterIndex + ", x);");
0777: }
0778: checkClosed();
0779: Value v = conn.createBlob(x, -1);
0780: setParameter(parameterIndex, v);
0781: } catch (Throwable e) {
0782: throw logAndConvert(e);
0783: }
0784: }
0785:
0786: /**
0787: * Sets the value of a parameter as a Clob.
0788: *
0789: * @param parameterIndex the parameter index (1, 2, ...)
0790: * @param x the value
0791: * @throws SQLException if this object is closed
0792: */
0793: public void setClob(int parameterIndex, Clob x) throws SQLException {
0794: try {
0795: if (debug()) {
0796: debugCode("setClob(" + parameterIndex + ", x);");
0797: }
0798: checkClosed();
0799: Value v;
0800: if (x == null) {
0801: v = ValueNull.INSTANCE;
0802: } else {
0803: v = conn.createClob(x.getCharacterStream(), -1);
0804: }
0805: setParameter(parameterIndex, v);
0806: } catch (Throwable e) {
0807: throw logAndConvert(e);
0808: }
0809: }
0810:
0811: /**
0812: * Sets the value of a parameter as a Clob.
0813: *
0814: * @param parameterIndex the parameter index (1, 2, ...)
0815: * @param x the value
0816: * @throws SQLException if this object is closed
0817: */
0818: public void setClob(int parameterIndex, Reader x)
0819: throws SQLException {
0820: try {
0821: if (debug()) {
0822: debugCode("setClob(" + parameterIndex + ", x);");
0823: }
0824: checkClosed();
0825: Value v;
0826: if (x == null) {
0827: v = ValueNull.INSTANCE;
0828: } else {
0829: v = conn.createClob(x, -1);
0830: }
0831: setParameter(parameterIndex, v);
0832: } catch (Throwable e) {
0833: throw logAndConvert(e);
0834: }
0835: }
0836:
0837: /**
0838: * [Not supported] Sets the value of a parameter as a Array.
0839: */
0840: public void setArray(int parameterIndex, Array x)
0841: throws SQLException {
0842: try {
0843: if (debug()) {
0844: debugCode("setArray(" + parameterIndex + ", x);");
0845: }
0846: throw Message.getUnsupportedException();
0847: } catch (Throwable e) {
0848: throw logAndConvert(e);
0849: }
0850: }
0851:
0852: /**
0853: * Sets the value of a parameter as a byte array.
0854: *
0855: * @param parameterIndex the parameter index (1, 2, ...)
0856: * @param x the value
0857: * @throws SQLException if this object is closed
0858: */
0859: public void setBytes(int parameterIndex, byte[] x)
0860: throws SQLException {
0861: try {
0862: if (debug()) {
0863: debugCode("setBytes(" + parameterIndex + ", "
0864: + quoteBytes(x) + ");");
0865: }
0866: // TODO clone the byte array (each array! maybe other objects)
0867: // by default (maybe use a setting?)
0868: Value v = x == null ? (Value) ValueNull.INSTANCE
0869: : ValueBytes.get(x);
0870: setParameter(parameterIndex, v);
0871: } catch (Throwable e) {
0872: throw logAndConvert(e);
0873: }
0874: }
0875:
0876: /**
0877: * Sets the value of a parameter as an input stream.
0878: *
0879: * @param parameterIndex the parameter index (1, 2, ...)
0880: * @param x the value
0881: * @param length the number of bytes
0882: * @throws SQLException if this object is closed
0883: */
0884: public void setBinaryStream(int parameterIndex, InputStream x,
0885: long length) throws SQLException {
0886: try {
0887: if (debug()) {
0888: debugCode("setBinaryStream(" + parameterIndex + ", x, "
0889: + length + "L);");
0890: }
0891: checkClosed();
0892: Value v = conn.createBlob(x, length);
0893: setParameter(parameterIndex, v);
0894: } catch (Throwable e) {
0895: throw logAndConvert(e);
0896: }
0897: }
0898:
0899: /**
0900: * Sets the value of a parameter as an input stream.
0901: *
0902: * @param parameterIndex the parameter index (1, 2, ...)
0903: * @param x the value
0904: * @param length the number of bytes
0905: * @throws SQLException if this object is closed
0906: */
0907: public void setBinaryStream(int parameterIndex, InputStream x,
0908: int length) throws SQLException {
0909: setBinaryStream(parameterIndex, x, (long) length);
0910: }
0911:
0912: /**
0913: * Sets the value of a parameter as an input stream.
0914: *
0915: * @param parameterIndex the parameter index (1, 2, ...)
0916: * @param x the value
0917: * @throws SQLException if this object is closed
0918: */
0919: public void setBinaryStream(int parameterIndex, InputStream x)
0920: throws SQLException {
0921: setBinaryStream(parameterIndex, x, -1);
0922: }
0923:
0924: /**
0925: * Sets the value of a parameter as an ASCII stream.
0926: *
0927: * @param parameterIndex the parameter index (1, 2, ...)
0928: * @param x the value
0929: * @param length the number of bytes
0930: * @throws SQLException if this object is closed
0931: */
0932: public void setAsciiStream(int parameterIndex, InputStream x,
0933: int length) throws SQLException {
0934: setAsciiStream(parameterIndex, x, (long) length);
0935: }
0936:
0937: /**
0938: * Sets the value of a parameter as an ASCII stream.
0939: *
0940: * @param parameterIndex the parameter index (1, 2, ...)
0941: * @param x the value
0942: * @param length the number of bytes
0943: * @throws SQLException if this object is closed
0944: */
0945: public void setAsciiStream(int parameterIndex, InputStream x,
0946: long length) throws SQLException {
0947: try {
0948: if (debug()) {
0949: debugCode("setAsciiStream(" + parameterIndex + ", x, "
0950: + length + "L);");
0951: }
0952: checkClosed();
0953: Value v = conn
0954: .createClob(IOUtils.getAsciiReader(x), length);
0955: setParameter(parameterIndex, v);
0956: } catch (Throwable e) {
0957: throw logAndConvert(e);
0958: }
0959: }
0960:
0961: /**
0962: * Sets the value of a parameter as an ASCII stream.
0963: *
0964: * @param parameterIndex the parameter index (1, 2, ...)
0965: * @param x the value
0966: * @throws SQLException if this object is closed
0967: */
0968: public void setAsciiStream(int parameterIndex, InputStream x)
0969: throws SQLException {
0970: setAsciiStream(parameterIndex, x, -1);
0971: }
0972:
0973: /**
0974: * Sets the value of a parameter as a character stream.
0975: *
0976: * @param parameterIndex the parameter index (1, 2, ...)
0977: * @param x the value
0978: * @param length the number of bytes
0979: * @throws SQLException if this object is closed
0980: */
0981: public void setCharacterStream(int parameterIndex, Reader x,
0982: int length) throws SQLException {
0983: setCharacterStream(parameterIndex, x, (long) length);
0984: }
0985:
0986: /**
0987: * Sets the value of a parameter as a character stream.
0988: *
0989: * @param parameterIndex the parameter index (1, 2, ...)
0990: * @param x the value
0991: * @throws SQLException if this object is closed
0992: */
0993: public void setCharacterStream(int parameterIndex, Reader x)
0994: throws SQLException {
0995: setCharacterStream(parameterIndex, x, -1);
0996: }
0997:
0998: /**
0999: * Sets the value of a parameter as a character stream.
1000: *
1001: * @param parameterIndex the parameter index (1, 2, ...)
1002: * @param x the value
1003: * @param length the number of bytes
1004: * @throws SQLException if this object is closed
1005: */
1006: public void setCharacterStream(int parameterIndex, Reader x,
1007: long length) throws SQLException {
1008: try {
1009: if (debug()) {
1010: debugCode("setCharacterStream(" + parameterIndex
1011: + ", x, " + length + "L);");
1012: }
1013: checkClosed();
1014: Value v = conn.createClob(x, length);
1015: setParameter(parameterIndex, v);
1016: } catch (Throwable e) {
1017: throw logAndConvert(e);
1018: }
1019: }
1020:
1021: /**
1022: * [Not supported]
1023: */
1024: public void setURL(int parameterIndex, URL x) throws SQLException {
1025: try {
1026: if (debug()) {
1027: debugCode("setURL(" + parameterIndex + ", x);");
1028: }
1029: throw Message.getUnsupportedException();
1030: } catch (Throwable e) {
1031: throw logAndConvert(e);
1032: }
1033: }
1034:
1035: /**
1036: * Gets the result set metadata of the query returned when the statement is
1037: * executed. If this is not a query, this method returns null.
1038: *
1039: * @return the meta data or null if this is not a query
1040: * @throws SQLException if this object is closed
1041: */
1042: public ResultSetMetaData getMetaData() throws SQLException {
1043: try {
1044: debugCodeCall("getMetaData");
1045: checkClosed();
1046: ResultInterface result = command.getMetaData();
1047: if (result == null) {
1048: return null;
1049: }
1050: int id = getNextId(TraceObject.RESULT_SET_META_DATA);
1051: if (debug()) {
1052: debugCodeAssign("ResultSetMetaData",
1053: TraceObject.RESULT_SET_META_DATA, id,
1054: "getMetaData()");
1055: }
1056: String catalog = conn.getCatalog();
1057: JdbcResultSetMetaData meta = new JdbcResultSetMetaData(
1058: null, this , result, catalog, session.getTrace(), id);
1059: return meta;
1060: } catch (Throwable e) {
1061: throw logAndConvert(e);
1062: }
1063: }
1064:
1065: /**
1066: * Clears the batch.
1067: */
1068: public void clearBatch() throws SQLException {
1069: try {
1070: debugCodeCall("clearBatch");
1071: checkClosed();
1072: batchParameters = null;
1073: } catch (Throwable e) {
1074: throw logAndConvert(e);
1075: }
1076: }
1077:
1078: /**
1079: * Closes this statement.
1080: * All result sets that where created by this statement
1081: * become invalid after calling this method.
1082: */
1083: public void close() throws SQLException {
1084: try {
1085: super .close();
1086: if (command != null) {
1087: command.close();
1088: command = null;
1089: }
1090: } catch (Throwable e) {
1091: throw logAndConvert(e);
1092: }
1093: }
1094:
1095: /**
1096: * Executes the batch.
1097: *
1098: * @return the array of update counts
1099: */
1100: public int[] executeBatch() throws SQLException {
1101: try {
1102: debugCodeCall("executeBatch");
1103: checkClosed();
1104: if (batchParameters == null) {
1105: // TODO batch: check what other database do if no parameters are set
1106: batchParameters = new ObjectArray();
1107: }
1108: int[] result = new int[batchParameters.size()];
1109: boolean error = false;
1110: SQLException next = null;
1111: for (int i = 0; i < batchParameters.size(); i++) {
1112: ObjectArray parameters = command.getParameters();
1113: Value[] set = (Value[]) batchParameters.get(i);
1114: for (int j = 0; j < set.length; j++) {
1115: Value value = set[j];
1116: ParameterInterface param = (ParameterInterface) parameters
1117: .get(j);
1118: param.setValue(value);
1119: }
1120: try {
1121: result[i] = executeUpdateInternal();
1122: } catch (SQLException e) {
1123: if (next == null) {
1124: next = e;
1125: } else {
1126: e.setNextException(next);
1127: next = e;
1128: }
1129: logAndConvert(e);
1130: //#ifdef JDK14
1131: result[i] = Statement.EXECUTE_FAILED;
1132: //#endif
1133: error = true;
1134: }
1135: }
1136: batchParameters = null;
1137: if (error) {
1138: JdbcBatchUpdateException e = new JdbcBatchUpdateException(
1139: next, result);
1140: e.setNextException(next);
1141: throw e;
1142: }
1143: return result;
1144: } catch (Throwable e) {
1145: throw logAndConvert(e);
1146: }
1147: }
1148:
1149: /**
1150: * Adds the current settings to the batch.
1151: */
1152: public void addBatch() throws SQLException {
1153: try {
1154: debugCodeCall("addBatch");
1155: checkClosed();
1156: ObjectArray parameters = command.getParameters();
1157: Value[] set = new Value[parameters.size()];
1158: for (int i = 0; i < parameters.size(); i++) {
1159: ParameterInterface param = (ParameterInterface) parameters
1160: .get(i);
1161: Value value = param.getParamValue();
1162: set[i] = value;
1163: }
1164: if (batchParameters == null) {
1165: batchParameters = new ObjectArray();
1166: }
1167: batchParameters.add(set);
1168: } catch (Throwable e) {
1169: throw logAndConvert(e);
1170: }
1171: }
1172:
1173: /**
1174: * Calling this method is not legal on a PreparedStatement.
1175: *
1176: * @throws SQLException Unsupported Feature
1177: */
1178: public int executeUpdate(String sql, int autoGeneratedKeys)
1179: throws SQLException {
1180: try {
1181: if (debug()) {
1182: debugCode("executeUpdate(" + quote(sql) + ", "
1183: + autoGeneratedKeys + ");");
1184: }
1185: throw Message
1186: .getSQLException(ErrorCode.METHOD_NOT_ALLOWED_FOR_PREPARED_STATEMENT);
1187: } catch (Throwable e) {
1188: throw logAndConvert(e);
1189: }
1190: }
1191:
1192: /**
1193: * Calling this method is not legal on a PreparedStatement.
1194: *
1195: * @throws SQLException Unsupported Feature
1196: */
1197: public int executeUpdate(String sql, int[] columnIndexes)
1198: throws SQLException {
1199: try {
1200: if (debug()) {
1201: debugCode("executeUpdate(" + quote(sql) + ", "
1202: + quoteIntArray(columnIndexes) + ");");
1203: }
1204: throw Message
1205: .getSQLException(ErrorCode.METHOD_NOT_ALLOWED_FOR_PREPARED_STATEMENT);
1206: } catch (Exception e) {
1207: throw logAndConvert(e);
1208: }
1209: }
1210:
1211: /**
1212: * Calling this method is not legal on a PreparedStatement.
1213: *
1214: * @throws SQLException Unsupported Feature
1215: */
1216: public int executeUpdate(String sql, String[] columnNames)
1217: throws SQLException {
1218: try {
1219: if (debug()) {
1220: debugCode("executeUpdate(" + quote(sql) + ", "
1221: + quoteArray(columnNames) + ");");
1222: }
1223: throw Message
1224: .getSQLException(ErrorCode.METHOD_NOT_ALLOWED_FOR_PREPARED_STATEMENT);
1225: } catch (Exception e) {
1226: throw logAndConvert(e);
1227: }
1228: }
1229:
1230: /**
1231: * Calling this method is not legal on a PreparedStatement.
1232: *
1233: * @throws SQLException Unsupported Feature
1234: */
1235: public boolean execute(String sql, int autoGeneratedKeys)
1236: throws SQLException {
1237: try {
1238: if (debug()) {
1239: debugCode("execute(" + quote(sql) + ", "
1240: + autoGeneratedKeys + ");");
1241: }
1242: throw Message
1243: .getSQLException(ErrorCode.METHOD_NOT_ALLOWED_FOR_PREPARED_STATEMENT);
1244: } catch (Exception e) {
1245: throw logAndConvert(e);
1246: }
1247: }
1248:
1249: /**
1250: * Calling this method is not legal on a PreparedStatement.
1251: *
1252: * @throws SQLException Unsupported Feature
1253: */
1254: public boolean execute(String sql, int[] columnIndexes)
1255: throws SQLException {
1256: try {
1257: if (debug()) {
1258: debugCode("execute(" + quote(sql) + ", "
1259: + quoteIntArray(columnIndexes) + ");");
1260: }
1261: throw Message
1262: .getSQLException(ErrorCode.METHOD_NOT_ALLOWED_FOR_PREPARED_STATEMENT);
1263: } catch (Exception e) {
1264: throw logAndConvert(e);
1265: }
1266: }
1267:
1268: /**
1269: * Calling this method is not legal on a PreparedStatement.
1270: *
1271: * @throws SQLException Unsupported Feature
1272: */
1273: public boolean execute(String sql, String[] columnNames)
1274: throws SQLException {
1275: try {
1276: if (debug()) {
1277: debugCode("execute(" + quote(sql) + ", "
1278: + quoteArray(columnNames) + ");");
1279: }
1280: throw Message
1281: .getSQLException(ErrorCode.METHOD_NOT_ALLOWED_FOR_PREPARED_STATEMENT);
1282: } catch (Exception e) {
1283: throw logAndConvert(e);
1284: }
1285: }
1286:
1287: /**
1288: * Get the parameter meta data of this prepared statement.
1289: *
1290: * @return the meta data
1291: */
1292: //#ifdef JDK14
1293: public ParameterMetaData getParameterMetaData() throws SQLException {
1294: try {
1295: int id = getNextId(TraceObject.PARAMETER_META_DATA);
1296: if (debug()) {
1297: debugCodeAssign("ParameterMetaData",
1298: TraceObject.PARAMETER_META_DATA, id,
1299: "getParameterMetaData()");
1300: }
1301: checkClosed();
1302: JdbcParameterMetaData meta = new JdbcParameterMetaData(
1303: session, this , command, id);
1304: return meta;
1305: } catch (Throwable e) {
1306: throw logAndConvert(e);
1307: }
1308: }
1309:
1310: //#endif
1311:
1312: // =============================================================
1313:
1314: JdbcPreparedStatement(SessionInterface session,
1315: JdbcConnection conn, String sql, int resultSetType, int id,
1316: boolean closeWithResultSet) throws SQLException {
1317: super (session, conn, resultSetType, id, closeWithResultSet);
1318: setTrace(session.getTrace(), TraceObject.PREPARED_STATEMENT, id);
1319: command = conn.prepareCommand(sql, fetchSize);
1320: }
1321:
1322: private void setParameter(int parameterIndex, Value value)
1323: throws SQLException {
1324: checkClosed();
1325: parameterIndex--;
1326: ObjectArray parameters = command.getParameters();
1327: if (parameterIndex < 0 || parameterIndex >= parameters.size()) {
1328: throw Message.getInvalidValueException(""
1329: + (parameterIndex + 1), "parameterIndex");
1330: }
1331: ParameterInterface param = (ParameterInterface) parameters
1332: .get(parameterIndex);
1333: param.setValue(value);
1334: }
1335:
1336: /**
1337: * [Not supported] Sets the value of a parameter as a row id.
1338: */
1339: //#ifdef JDK16
1340: /*
1341: public void setRowId(int parameterIndex, RowId x) throws SQLException {
1342: throw Message.getUnsupportedException();
1343: }
1344: */
1345: //#endif
1346: /**
1347: * Sets the value of a parameter.
1348: *
1349: * @param parameterIndex the parameter index (1, 2, ...)
1350: * @param x the value
1351: * @throws SQLException if this object is closed
1352: */
1353: public void setNString(int parameterIndex, String x)
1354: throws SQLException {
1355: try {
1356: if (debug()) {
1357: debugCode("setNString(" + parameterIndex + ", "
1358: + quote(x) + ");");
1359: }
1360: Value v = x == null ? (Value) ValueNull.INSTANCE
1361: : ValueString.get(x);
1362: setParameter(parameterIndex, v);
1363: } catch (Throwable e) {
1364: throw logAndConvert(e);
1365: }
1366: }
1367:
1368: /**
1369: * Sets the value of a parameter as a character stream.
1370: *
1371: * @param parameterIndex the parameter index (1, 2, ...)
1372: * @param x the value
1373: * @param length the number of bytes
1374: * @throws SQLException if this object is closed
1375: */
1376: public void setNCharacterStream(int parameterIndex, Reader x,
1377: long length) throws SQLException {
1378: try {
1379: if (debug()) {
1380: debugCode("setNCharacterStream(" + parameterIndex
1381: + ", x, " + length + "L);");
1382: }
1383: checkClosed();
1384: Value v = conn.createClob(x, length);
1385: setParameter(parameterIndex, v);
1386: } catch (Throwable e) {
1387: throw logAndConvert(e);
1388: }
1389: }
1390:
1391: /**
1392: * Sets the value of a parameter as a character stream.
1393: *
1394: * @param parameterIndex the parameter index (1, 2, ...)
1395: * @param x the value
1396: * @throws SQLException if this object is closed
1397: */
1398: public void setNCharacterStream(int parameterIndex, Reader x)
1399: throws SQLException {
1400: setNCharacterStream(parameterIndex, x, -1);
1401: }
1402:
1403: /**
1404: * Sets the value of a parameter as a Clob.
1405: *
1406: * @param parameterIndex the parameter index (1, 2, ...)
1407: * @param x the value
1408: * @throws SQLException if this object is closed
1409: */
1410: //#ifdef JDK16
1411: /*
1412: public void setNClob(int parameterIndex, NClob x) throws SQLException {
1413: try {
1414: if (debug()) {
1415: debugCode("setNClob("+parameterIndex+", x);");
1416: }
1417: checkClosed();
1418: Value v;
1419: if (x == null) {
1420: v = ValueNull.INSTANCE;
1421: } else {
1422: v = conn.createClob(x.getCharacterStream(), -1);
1423: }
1424: setParameter(parameterIndex, v);
1425: } catch (Throwable e) {
1426: throw logAndConvert(e);
1427: }
1428: }
1429: */
1430: //#endif
1431: /**
1432: * Sets the value of a parameter as a Clob.
1433: *
1434: * @param parameterIndex the parameter index (1, 2, ...)
1435: * @param x the value
1436: * @throws SQLException if this object is closed
1437: */
1438: public void setNClob(int parameterIndex, Reader x)
1439: throws SQLException {
1440: try {
1441: if (debug()) {
1442: debugCode("setNClob(" + parameterIndex + ", x);");
1443: }
1444: checkClosed();
1445: Value v = conn.createClob(x, -1);
1446: setParameter(parameterIndex, v);
1447: } catch (Throwable e) {
1448: throw logAndConvert(e);
1449: }
1450: }
1451:
1452: /**
1453: * Sets the value of a parameter as a Clob.
1454: *
1455: * @param parameterIndex the parameter index (1, 2, ...)
1456: * @param x the value
1457: * @throws SQLException if this object is closed
1458: */
1459: public void setClob(int parameterIndex, Reader x, long length)
1460: throws SQLException {
1461: try {
1462: if (debug()) {
1463: debugCode("setClob(" + parameterIndex + ", x, "
1464: + length + "L);");
1465: }
1466: checkClosed();
1467: Value v = conn.createClob(x, length);
1468: setParameter(parameterIndex, v);
1469: } catch (Throwable e) {
1470: throw logAndConvert(e);
1471: }
1472: }
1473:
1474: /**
1475: * Sets the value of a parameter as a Blob.
1476: *
1477: * @param parameterIndex the parameter index (1, 2, ...)
1478: * @param x the value
1479: * @throws SQLException if this object is closed
1480: */
1481: public void setBlob(int parameterIndex, InputStream x, long length)
1482: throws SQLException {
1483: try {
1484: if (debug()) {
1485: debugCode("setBlob(" + parameterIndex + ", x, "
1486: + length + "L);");
1487: }
1488: checkClosed();
1489: Value v = conn.createBlob(x, length);
1490: setParameter(parameterIndex, v);
1491: } catch (Throwable e) {
1492: throw logAndConvert(e);
1493: }
1494: }
1495:
1496: /**
1497: * Sets the value of a parameter as a Clob.
1498: *
1499: * @param parameterIndex the parameter index (1, 2, ...)
1500: * @param x the value
1501: * @throws SQLException if this object is closed
1502: */
1503: public void setNClob(int parameterIndex, Reader x, long length)
1504: throws SQLException {
1505: try {
1506: if (debug()) {
1507: debugCode("setNClob(" + parameterIndex + ", x, "
1508: + length + "L);");
1509: }
1510: checkClosed();
1511: Value v = conn.createClob(x, length);
1512: setParameter(parameterIndex, v);
1513: } catch (Throwable e) {
1514: throw logAndConvert(e);
1515: }
1516: }
1517:
1518: /**
1519: * [Not supported] Sets the value of a parameter as a SQLXML object.
1520: */
1521: //#ifdef JDK16
1522: /*
1523: public void setSQLXML(int parameterIndex, SQLXML x) throws SQLException {
1524: throw Message.getUnsupportedException();
1525: }
1526: */
1527: //#endif
1528: /**
1529: * INTERNAL
1530: */
1531: public String toString() {
1532: return getTraceObjectName() + ": " + command.toString();
1533: }
1534:
1535: }
|