You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-commits@db.apache.org by ba...@apache.org on 2005/04/28 21:05:45 UTC
svn commit: r165178 [2/26] - in /incubator/derby/code/trunk: ./ java/client/
java/client/org/ java/client/org/apache/ java/client/org/apache/derby/
java/client/org/apache/derby/client/ java/client/org/apache/derby/client/am/
java/client/org/apache/derby/client/net/
java/client/org/apache/derby/client/resources/
java/client/org/apache/derby/jdbc/ tools/ant/properties/
Added: incubator/derby/code/trunk/java/client/org/apache/derby/client/am/Agent.java
URL: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/client/org/apache/derby/client/am/Agent.java?rev=165178&view=auto
==============================================================================
--- incubator/derby/code/trunk/java/client/org/apache/derby/client/am/Agent.java (added)
+++ incubator/derby/code/trunk/java/client/org/apache/derby/client/am/Agent.java Thu Apr 28 12:05:42 2005
@@ -0,0 +1,294 @@
+/*
+
+ Derby - Class org.apache.derby.client.am.Agent
+
+ Copyright (c) 2001, 2005 The Apache Software Foundation or its licensors, where applicable.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+*/
+
+package org.apache.derby.client.am;
+
+public abstract class Agent
+{
+ public SqlException accumulatedReadExceptions_ = null;
+
+ private boolean enableBatchedExceptionTracking_;
+ private int batchedExceptionLabelIndex_;
+ private boolean[] batchedExceptionGenerated_;
+
+ Connection connection_; // made friendly for lobs only, refactor !!
+ public SectionManager sectionManager_ = null; // temporarily public, make friendly at least !!
+
+ public LogWriter logWriter_ = null;
+
+ final CrossConverters crossConverters_;
+
+ // Exceptions that occur on dnc's implementation of SqlException.getMessage() via stored proc
+ // cannot be thrown on the getMessage() invocation because the signature of getMessage() does not
+ // allow for throwing an exception.
+ // Therefore, we must save the exception and throw it at our very first opportunity.
+ SqlException deferredException_;
+ void checkForDeferredExceptions() throws SqlException
+ {
+ if (deferredException_ != null) {
+ SqlException temp = deferredException_;
+ deferredException_ = null;
+ throw temp;
+ }
+ }
+ public void accumulateDeferredException (SqlException e)
+ {
+ if (deferredException_ == null)
+ deferredException_ = e;
+ else
+ deferredException_.setNextException (e);
+ }
+
+ protected Agent (Connection connection, LogWriter logWriter)
+ {
+ connection_ = connection;
+ logWriter_ = logWriter;
+ crossConverters_ = new CrossConverters (this);
+ }
+
+ protected void resetAgent ( LogWriter logWriter)
+ {
+ // sectionManager_ is set elsewhere
+ accumulatedReadExceptions_ = null;
+ enableBatchedExceptionTracking_ = false;
+ batchedExceptionLabelIndex_ = 0;
+ batchedExceptionGenerated_ = null;
+ logWriter_ = logWriter;
+ deferredException_ = null;
+ }
+
+ public void resetAgent (Connection connection, LogWriter logWriter, int loginTimeout, String server,int port) throws SqlException
+ {
+ resetAgent (logWriter);
+ resetAgent_ (logWriter, loginTimeout, server, port);
+ }
+
+ abstract protected void resetAgent_(LogWriter logWriter, int loginTimeout, String server,int port) throws SqlException;
+
+ //-------------------- entry points ------------------------------------------
+
+ public final boolean loggingEnabled () { return !org.apache.derby.client.am.Configuration.traceSuspended__ && logWriter_ != null; }
+
+ public final void setLogWriter (LogWriter logWriter)
+ {
+ synchronized (connection_) {
+ if (logWriter_ != null) logWriter_.close();
+ logWriter_ = logWriter;
+ }
+ }
+
+ public final java.io.PrintWriter getLogWriter ()
+ { return (logWriter_ == null) ? null : logWriter_.printWriter_; }
+
+ abstract public LogWriter newLogWriter_ (java.io.PrintWriter printWriter, int traceLevel);
+
+ //----------------------------------------------------------------------------
+
+
+ public final void accumulateReadException (SqlException e)
+ {
+ if (enableBatchedExceptionTracking_) {
+ batchedExceptionGenerated_ [batchedExceptionLabelIndex_] = true;
+ labelAsBatchedException (e, batchedExceptionLabelIndex_);
+ }
+ if (accumulatedReadExceptions_ == null)
+ accumulatedReadExceptions_ = e;
+ else
+ accumulatedReadExceptions_.setNextException (e);
+ }
+
+ // Called only for disconnect event
+ public final void accumulateDisconnectException (DisconnectException e)
+ {
+ if (enableBatchedExceptionTracking_) {
+ batchedExceptionGenerated_ [batchedExceptionLabelIndex_] = true;
+ labelAsBatchedException (e, batchedExceptionLabelIndex_);
+ }
+ if (accumulatedReadExceptions_ != null)
+ e.setNextException (accumulatedReadExceptions_);
+
+ accumulatedReadExceptions_ = null;
+ }
+
+ // For now, it looks like the only time we accumulate chain breaking exceptions
+ // is for disconnect exceptions.
+ public final void accumulateChainBreakingReadExceptionAndThrow (DisconnectException e) throws DisconnectException
+ {
+ accumulateDisconnectException (e); // tacks disconnect exc to end of chain
+ markChainBreakingException_(); // sets a severity code in the NET agent
+ throw e; // disconnect will be caught in Reply classes, and front of original chain thrown
+ }
+
+ abstract protected void markChainBreakingException_ ();
+ abstract public void checkForChainBreakingException_ () throws SqlException;
+
+ private final void enableBatchedExceptionTracking (int batchSize)
+ {
+ enableBatchedExceptionTracking_ = true;
+ batchedExceptionGenerated_ = new boolean[batchSize];
+ batchedExceptionLabelIndex_ = 0;
+ }
+
+ final void disableBatchedExceptionTracking()
+ {
+ enableBatchedExceptionTracking_ = false;
+ }
+
+ public final void setBatchedExceptionLabelIndex (int index)
+ {
+ batchedExceptionLabelIndex_ = index;
+ }
+
+ private final SqlException labelAsBatchedException (SqlException e, int index)
+ {
+ SqlException firstInChain = e;
+ while (e != null) {
+ e.setBatchPositionLabel (index);
+ e = (SqlException) e.getNextException();
+ }
+ return firstInChain;
+ }
+
+ protected final void checkForExceptions () throws SqlException
+ {
+ if (accumulatedReadExceptions_ != null) {
+ SqlException e = accumulatedReadExceptions_;
+ accumulatedReadExceptions_ = null;
+ throw e;
+ }
+ }
+
+ // precondition: all batch execute reads have occurred
+ final boolean batchUpdateExceptionGenerated ()
+ {
+ return batchedExceptionGenerated_ [batchedExceptionLabelIndex_];
+ }
+
+ public final void flow (Statement statement) throws SqlException
+ {
+ endWriteChain();
+ flush_();
+ beginReadChain (statement);
+ }
+
+ public final void flowBatch (Statement statement, int batchSize) throws SqlException
+ {
+ endBatchedWriteChain();
+ flush_();
+ beginBatchedReadChain (statement, batchSize);
+ }
+
+ public final void flowOutsideUOW () throws SqlException
+ {
+ endWriteChain();
+ flush_();
+ beginReadChainOutsideUOW ();
+ }
+
+ // flush() means to send all chained requests.
+ abstract public void flush_() throws DisconnectException;
+
+ // Close client resources associated with this agent, such as socket and streams for the net.
+ abstract public void close_ () throws SqlException;
+
+ public void close () throws SqlException
+ {
+ close_();
+ if (logWriter_ != null) logWriter_.close();
+ }
+
+ public final void disconnectEvent ()
+ {
+ // closes client-side resources associated with database connection
+ try { close(); } catch (SqlException doNothing) {}
+ connection_.completeChainBreakingDisconnect ();
+ }
+
+ public void beginWriteChainOutsideUOW () throws SqlException
+ {
+ }
+
+ public void beginWriteChain (Statement statement) throws SqlException
+ {
+ connection_.writeTransactionStart(statement);
+ }
+
+ public final void beginBatchedWriteChain (Statement statement) throws SqlException
+ {
+ beginWriteChain (statement);
+ }
+
+ protected void endWriteChain ()
+ {
+ }
+
+ protected final void endBatchedWriteChain ()
+ {
+ }
+
+ protected void beginReadChain (Statement statement) throws SqlException
+ {
+ connection_.readTransactionStart();
+ }
+
+ protected final void beginBatchedReadChain (Statement statement, int batchSize) throws SqlException
+ {
+ enableBatchedExceptionTracking (batchSize);
+ beginReadChain (statement);
+ }
+
+ protected void beginReadChainOutsideUOW () throws SqlException
+ {
+ }
+
+ public void endReadChain () throws SqlException
+ {
+ checkForExceptions();
+ }
+
+ public final void endBatchedReadChain (int[] updateCounts, SqlException accumulatedExceptions) throws BatchUpdateException
+ {
+ disableBatchedExceptionTracking();
+ for (int i=0; i < batchedExceptionGenerated_.length; i++) {
+ if (batchedExceptionGenerated_[i])
+ updateCounts[i] = -3;
+ }
+ if (accumulatedExceptions == null) {
+ try {
+ endReadChain();
+ }
+ catch (SqlException e) {
+ accumulatedExceptions = e;
+ }
+ }
+ if (accumulatedExceptions != null) {
+ BatchUpdateException bue =
+ new BatchUpdateException (logWriter_,
+ "Non-atomic batch failure. The batch was submitted, but " +
+ "at least one exception occurred on an individual member of the batch. " +
+ "Use getNextException() to retrieve the exceptions for specific batched elements.",
+ updateCounts);
+ bue.setNextException (accumulatedExceptions);
+ throw bue;
+ }
+ }
+}
+
+
Propchange: incubator/derby/code/trunk/java/client/org/apache/derby/client/am/Agent.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/derby/code/trunk/java/client/org/apache/derby/client/am/AsciiStream.java
URL: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/client/org/apache/derby/client/am/AsciiStream.java?rev=165178&view=auto
==============================================================================
--- incubator/derby/code/trunk/java/client/org/apache/derby/client/am/AsciiStream.java (added)
+++ incubator/derby/code/trunk/java/client/org/apache/derby/client/am/AsciiStream.java Thu Apr 28 12:05:42 2005
@@ -0,0 +1,48 @@
+/*
+
+ Derby - Class org.apache.derby.client.am.AsciiStream
+
+ Copyright (c) 2001, 2005 The Apache Software Foundation or its licensors, where applicable.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+*/
+package org.apache.derby.client.am;
+
+public class AsciiStream extends java.io.InputStream
+{
+ private java.io.Reader reader_;
+ private String materializedString_;
+ private int charsRead_ = 0;
+
+ public AsciiStream (String materializedString, java.io.Reader reader)
+ {
+ reader_ = reader;
+ materializedString_ = materializedString;
+ }
+
+ public int read () throws java.io.IOException
+ {
+ int oneChar = reader_.read();
+ ++charsRead_;
+ if (oneChar != -1) // if not eos
+ return 0x00ff & oneChar;
+ else
+ return -1; // end of stream
+ }
+
+ public int available()
+ {
+ return materializedString_.length() - charsRead_;
+ }
+}
Propchange: incubator/derby/code/trunk/java/client/org/apache/derby/client/am/AsciiStream.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/derby/code/trunk/java/client/org/apache/derby/client/am/BatchUpdateException.java
URL: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/client/org/apache/derby/client/am/BatchUpdateException.java?rev=165178&view=auto
==============================================================================
--- incubator/derby/code/trunk/java/client/org/apache/derby/client/am/BatchUpdateException.java (added)
+++ incubator/derby/code/trunk/java/client/org/apache/derby/client/am/BatchUpdateException.java Thu Apr 28 12:05:42 2005
@@ -0,0 +1,91 @@
+/*
+
+ Derby - Class org.apache.derby.client.am.BatchUpdateException
+
+ Copyright (c) 2001, 2005 The Apache Software Foundation or its licensors, where applicable.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+*/
+
+package org.apache.derby.client.am;
+
+import org.apache.derby.client.resources.ResourceKeys;
+
+
+public class BatchUpdateException extends java.sql.BatchUpdateException
+{
+
+ //-----------------constructors-----------------------------------------------
+
+ public BatchUpdateException (LogWriter logWriter, ErrorKey errorKey, int[] updateCounts)
+ {
+ super (ResourceUtilities.getResource (ResourceKeys.driverOriginationIndicator) +
+ ResourceUtilities.getResource (errorKey.getResourceKey()),
+ errorKey.getSQLState(),
+ errorKey.getErrorCode(),
+ updateCounts);
+ if (logWriter != null) logWriter.traceDiagnosable (this);
+ }
+
+ public BatchUpdateException (LogWriter logWriter, ErrorKey errorKey, Object[] args, int[] updateCounts)
+ {
+ super (ResourceUtilities.getResource (ResourceKeys.driverOriginationIndicator) +
+ ResourceUtilities.getResource (errorKey.getResourceKey(), args),
+ errorKey.getSQLState(),
+ errorKey.getErrorCode(),
+ updateCounts);
+ if (logWriter != null) logWriter.traceDiagnosable (this);
+ }
+
+ public BatchUpdateException (LogWriter logWriter, ErrorKey errorKey, Object arg, int[] updateCounts)
+ {
+ this (logWriter, errorKey, new Object[] {arg}, updateCounts);
+ }
+
+ // Temporary constructor until all error keys are defined.
+ public BatchUpdateException (LogWriter logWriter)
+ {
+ super (null, null, -99999, null);
+ if (logWriter != null) logWriter.traceDiagnosable (this);
+ }
+
+ // Temporary constructor until all error keys are defined.
+ public BatchUpdateException (LogWriter logWriter, int[] updateCounts)
+ {
+ super (null, null, -99999, updateCounts);
+ if (logWriter != null) logWriter.traceDiagnosable (this);
+ }
+
+ // Temporary constructor until all error keys are defined.
+ public BatchUpdateException (LogWriter logWriter, String reason, int[] updateCounts)
+ {
+ super (reason, null, -99999, updateCounts);
+ if (logWriter != null) logWriter.traceDiagnosable (this);
+ }
+
+ // Temporary constructor until all error keys are defined.
+ public BatchUpdateException (LogWriter logWriter, String reason, String sqlState, int[] updateCounts)
+ {
+ super (reason, sqlState, -99999, updateCounts);
+ if (logWriter != null) logWriter.traceDiagnosable (this);
+ }
+
+ // Temporary constructor until all error keys are defined.
+ public BatchUpdateException (LogWriter logWriter, String reason, String sqlState, int errorCode, int[] updateCounts)
+ {
+ super (reason, sqlState, errorCode, updateCounts);
+ if (logWriter != null) logWriter.traceDiagnosable (this);
+ }
+}
+
Propchange: incubator/derby/code/trunk/java/client/org/apache/derby/client/am/BatchUpdateException.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/derby/code/trunk/java/client/org/apache/derby/client/am/Blob.java
URL: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/client/org/apache/derby/client/am/Blob.java?rev=165178&view=auto
==============================================================================
--- incubator/derby/code/trunk/java/client/org/apache/derby/client/am/Blob.java (added)
+++ incubator/derby/code/trunk/java/client/org/apache/derby/client/am/Blob.java Thu Apr 28 12:05:42 2005
@@ -0,0 +1,276 @@
+/*
+
+ Derby - Class org.apache.derby.client.am.Blob
+
+ Copyright (c) 2001, 2005 The Apache Software Foundation or its licensors, where applicable.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+*/
+
+package org.apache.derby.client.am;
+
+public class Blob extends Lob implements java.sql.Blob
+{
+ //-----------------------------state------------------------------------------
+
+ byte[] binaryString_ = null;
+
+ // Only used for input purposes. For output, each getBinaryStream call
+ // must generate an independent stream.
+ java.io.InputStream binaryStream_ = null;
+ int dataOffset_;
+
+ //---------------------constructors/finalizer---------------------------------
+
+ public Blob (byte[] binaryString,
+ Agent agent,
+ int dataOffset)
+ {
+ super (agent);
+ binaryString_ = binaryString;
+ dataType_ |= BINARY_STRING;
+ sqlLength_ = binaryString.length - dataOffset;
+ lengthObtained_ = true;
+ dataOffset_ = dataOffset;
+ }
+
+ // CTOR for input:
+ public Blob (Agent agent,
+ java.io.InputStream binaryStream,
+ int length)
+ {
+ super (agent);
+ binaryStream_ = binaryStream;
+ dataType_ |= BINARY_STREAM;
+ sqlLength_ = length;
+ lengthObtained_ = true;
+ }
+
+ // ---------------------------jdbc 2------------------------------------------
+
+ public long length () throws SqlException
+ {
+ synchronized (agent_.connection_) {
+ if (agent_.loggingEnabled()) agent_.logWriter_.traceEntry (this, "length");
+ long retVal = super.sqlLength();
+ if (agent_.loggingEnabled()) agent_.logWriter_.traceExit (this, "length", retVal);
+ return retVal;
+ }
+ }
+
+ // can return an array that may be have a length shorter than the supplied
+ // length (no padding occurs)
+ public byte[] getBytes (long pos, int length) throws SqlException
+ {
+ synchronized (agent_.connection_) {
+ if (agent_.loggingEnabled()) agent_.logWriter_.traceEntry (this, "getBytes", (int) pos, length);
+ if ((pos <= 0) || (length < 0))
+ throw new SqlException (agent_.logWriter_, "Invalid position " + pos +" or length " + length);
+ byte[] retVal = getBytesX (pos, length);
+ if (agent_.loggingEnabled()) agent_.logWriter_.traceExit (this, "getBytes", retVal);
+ return retVal;
+ }
+ }
+
+ private byte[] getBytesX (long pos, int length) throws SqlException
+ {
+ checkForClosedConnection ();
+
+ // we may need to check for overflow on this cast
+ long actualLength = Math.min (this.length() - pos + 1, (long) length);
+
+ byte[] retVal = new byte[(int) actualLength];
+ System.arraycopy (binaryString_, (int) pos + dataOffset_ - 1, retVal, 0, (int) actualLength);
+ return retVal;
+ }
+
+
+ public java.io.InputStream getBinaryStream () throws SqlException
+ {
+ synchronized (agent_.connection_) {
+ if (agent_.loggingEnabled()) agent_.logWriter_.traceEntry (this, "getBinaryStream");
+ java.io.InputStream retVal = getBinaryStreamX();
+ if (agent_.loggingEnabled()) agent_.logWriter_.traceExit (this, "getBinaryStream", retVal);
+ return retVal;
+ }
+ }
+
+ private java.io.InputStream getBinaryStreamX () throws SqlException
+ {
+ checkForClosedConnection ();
+
+ if (isBinaryStream ()) // this Lob is used for input
+ return binaryStream_;
+
+ return new java.io.ByteArrayInputStream (binaryString_, dataOffset_, binaryString_.length - dataOffset_);
+ }
+
+ public long position (byte[] pattern, long start) throws SqlException
+ {
+ synchronized (agent_.connection_) {
+ if (agent_.loggingEnabled()) agent_.logWriter_.traceEntry (this, "position(byte[], long)", pattern, start);
+ if (pattern == null) throw new SqlException (agent_.logWriter_, "Search pattern cannot be null.");
+ long pos = positionX (pattern, start);
+ if (agent_.loggingEnabled()) agent_.logWriter_.traceExit (this, "position(byte[], long)", pos);
+ return pos;
+ }
+ }
+
+ private long positionX (byte[] pattern, long start) throws SqlException
+ {
+ checkForClosedConnection ();
+
+ return binaryStringPosition(pattern, start);
+ }
+
+ public long position (java.sql.Blob pattern, long start) throws SqlException
+ {
+ synchronized (agent_.connection_) {
+ if (agent_.loggingEnabled()) agent_.logWriter_.traceEntry (this, "position(Blob, long)", pattern, start);
+ if (pattern == null) throw new SqlException (agent_.logWriter_, "Search pattern cannot be null.");
+ long pos = positionX (pattern, start);
+ if (agent_.loggingEnabled()) agent_.logWriter_.traceExit (this, "position(Blob, long)", pos);
+ return pos;
+ }
+ }
+
+ private long positionX (java.sql.Blob pattern, long start) throws SqlException
+ {
+ checkForClosedConnection ();
+
+ try {
+ return binaryStringPosition(pattern.getBytes(1L, (int)pattern.length()) , start);
+ }
+ catch (java.sql.SQLException e) {
+ throw new SqlException (agent_.logWriter_, e.getMessage());
+ }
+ }
+
+ // -------------------------- JDBC 3.0 -----------------------------------
+
+
+ public int setBytes (long pos, byte[] bytes) throws SqlException
+ {
+ synchronized (agent_.connection_) {
+ if (agent_.loggingEnabled()) agent_.logWriter_.traceEntry (this, "setBytes", (int) pos, bytes);
+ int length = setBytesX (pos, bytes, 0, bytes.length);
+ if (agent_.loggingEnabled()) agent_.logWriter_.traceExit (this, "setBytes", length);
+ return length;
+ }
+ }
+
+ public int setBytes (long pos, byte[] bytes, int offset, int len) throws SqlException
+ {
+ synchronized (agent_.connection_) {
+ if (agent_.loggingEnabled()) agent_.logWriter_.traceEntry (this, "setBytes", (int) pos, bytes, offset, len);
+ int length = setBytesX (pos, bytes, offset, len);
+ if (agent_.loggingEnabled()) agent_.logWriter_.traceExit (this, "setBytes", length);
+ return length;
+ }
+ }
+
+ public int setBytesX (long pos, byte[] bytes, int offset, int len) throws SqlException
+ {
+ int length = 0;
+ if ( (int) pos <= 0 || pos > binaryString_.length - dataOffset_)
+ throw new SqlException(agent_.logWriter_, "Invalid position " + pos
+ + " , offset " + offset + " or length " + len);
+ if ( (offset < 0) || offset > bytes.length || len < 0 )
+ throw new SqlException(agent_.logWriter_, "Invalid position " + pos
+ + " , offset " + offset + " or length " + len);
+ if (len == 0)
+ return 0;
+ length = Math.min((bytes.length - offset ),len);
+ if ((binaryString_.length - dataOffset_ - (int) pos + 1) < length) {
+ byte newbuf[] = new byte[(int)pos + length + dataOffset_-1];
+ System.arraycopy(binaryString_,0,newbuf,0,binaryString_.length);
+ binaryString_ = newbuf;
+ }
+
+ System.arraycopy(bytes,offset, binaryString_, (int)pos + dataOffset_ -1, length);
+ binaryStream_ = new java.io.ByteArrayInputStream(binaryString_);
+ sqlLength_ = binaryString_.length - dataOffset_;
+ return length;
+ }
+
+ public java.io.OutputStream setBinaryStream (long pos) throws SqlException
+ {
+ synchronized (agent_.connection_) {
+ if (agent_.loggingEnabled()) agent_.logWriter_.traceEntry (this, "setBinaryStream", (int) pos);
+ BlobOutputStream outStream = new BlobOutputStream (this,pos);
+
+ if (agent_.loggingEnabled()) agent_.logWriter_.traceExit (this, "setBinaryStream", outStream);
+ return outStream;
+ }
+ }
+
+ public void truncate (long len) throws SqlException
+ {
+ synchronized (agent_.connection_) {
+ if (agent_.loggingEnabled()) agent_.logWriter_.traceEntry (this, " truncate", (int) len);
+ if (len < 0 || len > this.length())
+ throw new SqlException (agent_.logWriter_, "Invalid length " + len);
+ if (len == this.length())
+ return;
+ long newLength = (int)len + dataOffset_;
+ byte newbuf[] = new byte[(int)len + dataOffset_];
+ System.arraycopy(binaryString_,0,newbuf,0,(int)newLength);
+ binaryString_ = newbuf;
+ binaryStream_ = new java.io.ByteArrayInputStream(binaryString_);
+ sqlLength_ = binaryString_.length - dataOffset_;
+ }
+ }
+
+ //------------------ Material layer event callback methods -------------------
+
+ //---------------------------- helper methods --------------------------------
+ public boolean isBinaryString ()
+ {
+ return ((dataType_ & BINARY_STRING) == BINARY_STRING);
+ }
+
+ public boolean isBinaryStream ()
+ {
+ return ((dataType_ & BINARY_STREAM) == BINARY_STREAM);
+ }
+
+ public byte[] getBinaryString ()
+ {
+ return binaryString_;
+ }
+
+ protected long binaryStringPosition (byte[] pattern, long start)
+ {
+ // perform a local byte string search, starting at start
+ // check that the range of comparison is valid
+ int index = (int) start + dataOffset_ - 1; // api start begins at 1
+
+ while (index + pattern.length <= binaryString_.length) {
+ if (isSubString (pattern, index))
+ return (long)(index - dataOffset_ + 1); // readjust for api indexing
+ index++;
+ }
+ return -1L; // not found
+ }
+
+ // precondition: binaryString_ is long enough for the comparison
+ protected boolean isSubString (byte[] pattern, int index)
+ {
+ for (int i = 0; i < pattern.length; i++, index++)
+ if (pattern[i] != binaryString_[index])
+ return false;
+
+ return true;
+ }
+}
Propchange: incubator/derby/code/trunk/java/client/org/apache/derby/client/am/Blob.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/derby/code/trunk/java/client/org/apache/derby/client/am/BlobOutputStream.java
URL: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/client/org/apache/derby/client/am/BlobOutputStream.java?rev=165178&view=auto
==============================================================================
--- incubator/derby/code/trunk/java/client/org/apache/derby/client/am/BlobOutputStream.java (added)
+++ incubator/derby/code/trunk/java/client/org/apache/derby/client/am/BlobOutputStream.java Thu Apr 28 12:05:42 2005
@@ -0,0 +1,68 @@
+/*
+
+ Derby - Class org.apache.derby.client.am.BlobOutputStream
+
+ Copyright (c) 2001, 2005 The Apache Software Foundation or its licensors, where applicable.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+*/
+
+package org.apache.derby.client.am;
+
+
+public class BlobOutputStream extends java.io.OutputStream
+{
+ private Blob blob_;
+ private long offset_;
+
+ public BlobOutputStream (Blob blob, long offset)
+ {
+ blob_ = blob;
+ offset_ = offset;
+ if (offset_ > (blob_.binaryString_.length - blob_.dataOffset_))
+ throw new IndexOutOfBoundsException();
+ }
+ public void write (int b) throws java.io.IOException
+ {
+
+ byte[] newbuf = new byte[(int)offset_ + blob_.dataOffset_];
+ System.arraycopy (blob_.binaryString_, 0, newbuf, 0, (int) offset_ -1 + blob_.dataOffset_);
+ blob_.binaryString_ = newbuf;
+ blob_.binaryString_[(int)offset_ + blob_.dataOffset_ - 1] = (byte)b;
+ blob_.binaryStream_ = new java.io.ByteArrayInputStream (blob_.binaryString_);
+ blob_.sqlLength_ = blob_.binaryString_.length - blob_.dataOffset_;
+ }
+
+ public void write (byte b[], int off, int len) throws java.io.IOException
+ {
+ if (b == null) {
+ throw new NullPointerException();
+ }
+ else if ((off < 0) || (off > b.length) || (len < 0) ||
+ ((off + len) > b.length) || ((off + len) < 0)) {
+ throw new IndexOutOfBoundsException();
+ }
+ else if (len == 0) {
+ return;
+ }
+ byte [] newbuf = new byte[(int)offset_ -1 + len + blob_.dataOffset_];
+ System.arraycopy(blob_.binaryString_,0,newbuf,0,(int)offset_-1 + blob_.dataOffset_);
+ blob_.binaryString_ = newbuf;
+ for (int i=0; i<len; i++)
+ blob_.binaryString_[(int)offset_ + i + blob_.dataOffset_ - 1 ] = b[off + i];
+ blob_.binaryStream_ = new java.io.ByteArrayInputStream(blob_.binaryString_);
+ blob_.sqlLength_ = blob_.binaryString_.length - blob_.dataOffset_;
+ }
+}
+
Propchange: incubator/derby/code/trunk/java/client/org/apache/derby/client/am/BlobOutputStream.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/derby/code/trunk/java/client/org/apache/derby/client/am/CallableStatement.java
URL: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/client/org/apache/derby/client/am/CallableStatement.java?rev=165178&view=auto
==============================================================================
--- incubator/derby/code/trunk/java/client/org/apache/derby/client/am/CallableStatement.java (added)
+++ incubator/derby/code/trunk/java/client/org/apache/derby/client/am/CallableStatement.java Thu Apr 28 12:05:42 2005
@@ -0,0 +1,1116 @@
+/*
+
+ Derby - Class org.apache.derby.client.am.CallableStatement
+
+ Copyright (c) 2001, 2005 The Apache Software Foundation or its licensors, where applicable.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+*/
+
+package org.apache.derby.client.am;
+
+import org.apache.derby.client.am.Section;
+
+public class CallableStatement extends PreparedStatement
+ implements java.sql.PreparedStatement,
+ java.sql.CallableStatement,
+ PreparedStatementCallbackInterface
+{
+ //---------------------navigational members-----------------------------------
+
+ //---------------------navigational cheat-links-------------------------------
+ // Cheat-links are for convenience only, and are not part of the conceptual model.
+ // Warning:
+ // Cheat-links should only be defined for invariant state data.
+ // That is, the state data is set by the constructor and never changes.
+
+ public MaterialPreparedStatement materialCallableStatement_ = null;
+
+ //-----------------------------state------------------------------------------
+
+ // last retrieved result was a sql NULL, NOT_NULL, or UNSET.
+ private int wasNull_ = WAS_NULL_UNSET;
+ static final private int WAS_NULL = 1;
+ static final private int WAS_NOT_NULL = 2;
+ static final private int WAS_NULL_UNSET = 0;
+
+ //---------------------constructors/finalizer---------------------------------
+
+ private void initCallableStatement ()
+ {
+ materialCallableStatement_ = null;
+ wasNull_ = WAS_NULL_UNSET;
+ }
+
+ public void reset (boolean fullReset) throws SqlException
+ {
+ if (fullReset)
+ connection_.resetPrepareCall (this);
+ else
+ super.reset (fullReset);
+ wasNull_ = WAS_NULL_UNSET;
+ }
+
+ // Common constructor for jdbc 2 callable statements with scroll attributes.
+ // Called by material statement constructor.
+ public CallableStatement (Agent agent,
+ Connection connection,
+ String sql,
+ int type, int concurrency, int holdability) throws SqlException
+ {
+ super (agent, connection, sql, type, concurrency, holdability, java.sql.Statement.NO_GENERATED_KEYS, null);
+ initCallableStatement();
+ }
+
+ public void resetCallableStatement (Agent agent,
+ Connection connection,
+ String sql,
+ int type, int concurrency, int holdability) throws SqlException
+ {
+ super.resetPreparedStatement(agent, connection, sql, type, concurrency, holdability, java.sql.Statement.NO_GENERATED_KEYS, null);
+ initCallableStatement();
+ }
+
+ public void resetCallableStatement (Agent agent,
+ Connection connection,
+ String sql,
+ Section section) throws SqlException
+ {
+ super.resetPreparedStatement(agent, connection, sql, section);
+ initCallableStatement();
+ }
+
+
+ public void resetCallableStatement (Agent agent,
+ Connection connection,
+ String sql,
+ Section section,
+ ColumnMetaData parameterMetaData,
+ ColumnMetaData resultSetMetaData) throws SqlException
+ {
+ super.resetPreparedStatement(agent, connection, sql, section, parameterMetaData, resultSetMetaData);
+ initCallableStatement();
+ }
+
+ protected void finalize () throws java.lang.Throwable
+ {
+ if (agent_.loggingEnabled()) agent_.logWriter_.traceEntry (this, "finalize");
+ super.finalize();
+ }
+
+ //---------------------------entry points-------------------------------------
+
+ public boolean execute () throws SqlException
+ {
+ synchronized (connection_) {
+ if (agent_.loggingEnabled()) agent_.logWriter_.traceEntry (this, "execute");
+ boolean b = executeX();
+ if (agent_.loggingEnabled()) agent_.logWriter_.traceExit (this, "execute", b);
+ return b;
+ }
+ }
+
+ // also used by SQLCA
+ boolean executeX () throws SqlException
+ {
+ super.flowExecute (executeMethod__);
+ return resultSet_ != null;
+ }
+
+ public java.sql.ResultSet executeQuery () throws SqlException
+ {
+ synchronized (connection_) {
+ if (agent_.loggingEnabled()) agent_.logWriter_.traceEntry (this, "executeQuery");
+ ResultSet resultSet = executeQueryX();
+ if (agent_.loggingEnabled()) agent_.logWriter_.traceExit (this, "executeQuery", resultSet);
+ return resultSet;
+ }
+ }
+
+ // also used by DBMD methods
+ ResultSet executeQueryX () throws SqlException
+ {
+ super.flowExecute (executeQueryMethod__);
+ super.checkExecuteQueryPostConditions ("java.sql.CallableStatement");
+ return resultSet_;
+ }
+
+ public int executeUpdate () throws SqlException
+ {
+ synchronized (connection_) {
+ if (agent_.loggingEnabled()) agent_.logWriter_.traceEntry (this, "executeUpdate");
+ int updateValue = executeUpdateX();
+ if (agent_.loggingEnabled()) agent_.logWriter_.traceExit (this, "executeUpdate", updateValue);
+ return updateValue;
+ }
+ }
+
+ int executeUpdateX () throws SqlException
+ {
+ super.flowExecute (executeUpdateMethod__);
+
+ super.checkExecuteUpdatePostConditions ("java.sql.CallableStatement");
+ // make sure update count >= 0 even if derby don't support update count for call
+ //return (updateCount_ < 0) ? 0 : updateCount_;
+ return updateCount_;
+ }
+
+
+ public void clearParameters () throws SqlException
+ {
+ synchronized (connection_) {
+ if (agent_.loggingEnabled()) agent_.logWriter_.traceEntry (this, "clearParameters");
+ super.clearParameters();
+ outputRegistered_ = false; // this variable is only used by Batch
+ }
+ }
+
+ public void registerOutParameter (int parameterIndex, int jdbcType) throws SqlException
+ {
+ synchronized (connection_) {
+ if (agent_.loggingEnabled()) agent_.logWriter_.traceEntry (this, "registerOutParameter", parameterIndex, jdbcType);
+ registerOutParameterX (parameterIndex, jdbcType);
+ }
+ }
+
+ // also used by Sqlca
+ void registerOutParameterX (int parameterIndex, int jdbcType) throws SqlException
+ {
+ super.checkForClosedStatement();
+ int scale = 0; // default scale to 0 for non numeric and non decimal type
+ registerOutParameterX (parameterIndex, jdbcType, scale);
+ }
+
+ private int guessScaleForDecimalOrNumeric (int parameterIndex) throws SqlException
+ {
+ parameterIndex = checkForEscapedCallWithResult (parameterIndex);
+ // Types.DECIMAL with no supplied scale will use the scale supplied by the setter method if input BigDecimal is not null
+ if (parameterMetaData_.types_[parameterIndex - 1] == Types.DECIMAL &&
+ parameters_[parameterIndex - 1] != null) {
+ return parameterMetaData_.sqlScale_[parameterIndex - 1];
+ }
+ return 8; // default to scale of 8 if not specified
+ }
+
+ public void registerOutParameter (int parameterIndex, int jdbcType, int scale) throws SqlException
+ {
+ synchronized (connection_) {
+ if (agent_.loggingEnabled()) agent_.logWriter_.traceEntry (this, "registerOutParameter", parameterIndex, jdbcType, scale);
+ super.checkForClosedStatement();
+ registerOutParameterX (parameterIndex, jdbcType, scale);
+ }
+ }
+
+ private void registerOutParameterX (int parameterIndex, int jdbcType, int scale) throws SqlException
+ {
+ parameterIndex = checkForEscapedCallWithResult (parameterIndex, jdbcType);
+ // if the parameter is the return clause of the call statement
+ if (parameterIndex == 0 && escapedProcedureCallWithResult_) return;
+ super.checkForValidParameterIndex (parameterIndex);
+ checkForValidScale (scale);
+ outputRegistered_ = true; // this variable is only used by Batch
+ //parameterSetOrRegistered_[parameterIndex - 1] = true;
+ parameterRegistered_[parameterIndex - 1] = true;
+ }
+
+ public void registerOutParameter (int parameterIndex, int jdbcType, String typeName) throws SqlException
+ {
+ synchronized (connection_) {
+ if (agent_.loggingEnabled()) agent_.logWriter_.traceEntry (this, "registerOutParameter", parameterIndex, jdbcType, typeName);
+ super.checkForClosedStatement();
+ }
+ }
+
+ public boolean wasNull () throws SqlException
+ {
+ if (agent_.loggingEnabled()) agent_.logWriter_.traceEntry (this, "wasNull");
+ boolean result = wasNullX();
+ if (agent_.loggingEnabled()) agent_.logWriter_.traceExit (this, "wasNull", result);
+ return result;
+ }
+
+ private boolean wasNullX () throws SqlException
+ {
+ super.checkForClosedStatement ();
+ if (wasNull_ == WAS_NULL_UNSET)
+ throw new SqlException (agent_.logWriter_, "Invalid operation: wasNull() called with no data retrieved.");
+ return wasNull_ == WAS_NULL;
+ }
+
+ //--------------------------------getter methods------------------------------
+
+ public boolean getBoolean (int parameterIndex) throws SqlException
+ {
+ synchronized (connection_) {
+ if (agent_.loggingEnabled()) agent_.logWriter_.traceEntry (this, "getBoolean", parameterIndex);
+ super.checkForClosedStatement();
+ parameterIndex = checkForEscapedCallWithResult (parameterIndex);
+ boolean result;
+ if (parameterIndex == 0 && escapedProcedureCallWithResult_) {
+ result = agent_.crossConverters_.getBooleanFromInt (returnValueFromProcedure_);
+ this.wasNull_ = this.WAS_NOT_NULL;
+ if (agent_.loggingEnabled()) agent_.logWriter_.traceExit (this, "getBoolean", result);
+ return result;
+ }
+ checkGetterPreconditions (parameterIndex);
+ setWasNull (parameterIndex);
+ result = wasNullX() ? false : singletonRowData_.getBoolean (parameterIndex);
+ if (agent_.loggingEnabled()) agent_.logWriter_.traceExit (this, "getBoolean", result);
+ return result;
+ }
+ }
+
+ public byte getByte (int parameterIndex) throws SqlException
+ {
+ synchronized (connection_) {
+ if (agent_.loggingEnabled()) agent_.logWriter_.traceEntry (this, "getByte", parameterIndex);
+ super.checkForClosedStatement();
+ parameterIndex = checkForEscapedCallWithResult (parameterIndex);
+ byte result;
+ if (parameterIndex == 0 && escapedProcedureCallWithResult_) {
+ result = agent_.crossConverters_.getByteFromInt (returnValueFromProcedure_);
+ this.wasNull_ = this.WAS_NOT_NULL;
+ if (agent_.loggingEnabled()) agent_.logWriter_.traceExit (this, "getByte", result);
+ return result;
+ }
+ checkGetterPreconditions (parameterIndex);
+ setWasNull (parameterIndex);
+ result = wasNullX() ? 0 : singletonRowData_.getByte (parameterIndex);
+ if (agent_.loggingEnabled()) agent_.logWriter_.traceExit (this, "getByte", result);
+ return result;
+ }
+ }
+
+ public short getShort (int parameterIndex) throws SqlException
+ {
+ synchronized (connection_) {
+ if (agent_.loggingEnabled()) agent_.logWriter_.traceEntry (this, "getShort", parameterIndex);
+ super.checkForClosedStatement();
+ parameterIndex = checkForEscapedCallWithResult (parameterIndex);
+ short result;
+ if (parameterIndex == 0 && escapedProcedureCallWithResult_) {
+ result = agent_.crossConverters_.getShortFromInt (returnValueFromProcedure_);
+ this.wasNull_ = this.WAS_NOT_NULL;
+ if (agent_.loggingEnabled()) agent_.logWriter_.traceExit (this, "getShort", result);
+ return result;
+ }
+ checkGetterPreconditions (parameterIndex);
+ setWasNull (parameterIndex);
+ result = wasNullX() ? 0 : singletonRowData_.getShort (parameterIndex);
+ if (agent_.loggingEnabled()) agent_.logWriter_.traceExit (this, "getShort", result);
+ return result;
+ }
+ }
+
+ public int getInt (int parameterIndex) throws SqlException
+ {
+ synchronized (connection_) {
+ if (agent_.loggingEnabled()) agent_.logWriter_.traceEntry (this, "getInt", parameterIndex);
+ int result = getIntX (parameterIndex);
+ if (agent_.loggingEnabled()) agent_.logWriter_.traceExit (this, "getInt", result);
+ return result;
+ }
+ }
+
+ // also used by SQLCA
+ int getIntX (int parameterIndex) throws SqlException
+ {
+ super.checkForClosedStatement();
+ parameterIndex = checkForEscapedCallWithResult (parameterIndex);
+ if (parameterIndex == 0 && escapedProcedureCallWithResult_) {
+ this.wasNull_ = this.WAS_NOT_NULL;
+ return returnValueFromProcedure_;
+ }
+ checkGetterPreconditions (parameterIndex);
+ setWasNull (parameterIndex);
+ return wasNullX() ? 0 : singletonRowData_.getInt (parameterIndex);
+ }
+
+ public long getLong (int parameterIndex) throws SqlException
+ {
+ synchronized (connection_) {
+ if (agent_.loggingEnabled()) agent_.logWriter_.traceEntry (this, "getLong", parameterIndex);
+ super.checkForClosedStatement();
+ parameterIndex = checkForEscapedCallWithResult (parameterIndex);
+ long result;
+ if (parameterIndex == 0 && escapedProcedureCallWithResult_) {
+ result = (long) returnValueFromProcedure_;
+ this.wasNull_ = this.WAS_NOT_NULL;
+ if (agent_.loggingEnabled()) agent_.logWriter_.traceExit (this, "getLong", result);
+ return result;
+ }
+ checkGetterPreconditions (parameterIndex);
+ setWasNull (parameterIndex);
+ result = wasNullX() ? 0 : singletonRowData_.getLong (parameterIndex);
+ if (agent_.loggingEnabled()) agent_.logWriter_.traceExit (this, "getLong", result);
+ return result;
+ }
+ }
+
+ public float getFloat (int parameterIndex) throws SqlException
+ {
+ synchronized (connection_) {
+ if (agent_.loggingEnabled()) agent_.logWriter_.traceEntry (this, "getFloat", parameterIndex);
+ super.checkForClosedStatement();
+ parameterIndex = checkForEscapedCallWithResult (parameterIndex);
+ float result;
+ if (parameterIndex == 0 && escapedProcedureCallWithResult_) {
+ result = (float) returnValueFromProcedure_;
+ this.wasNull_ = this.WAS_NOT_NULL;
+ if (agent_.loggingEnabled()) agent_.logWriter_.traceExit (this, "getFloat", result);
+ return result;
+ }
+ checkGetterPreconditions (parameterIndex);
+ setWasNull (parameterIndex);
+ result = wasNullX() ? 0 : singletonRowData_.getFloat (parameterIndex);
+ if (agent_.loggingEnabled()) agent_.logWriter_.traceExit (this, "getFloat", result);
+ return result;
+ }
+ }
+
+ public double getDouble (int parameterIndex) throws SqlException
+ {
+ synchronized (connection_) {
+ if (agent_.loggingEnabled()) agent_.logWriter_.traceEntry (this, "getDouble", parameterIndex);
+ super.checkForClosedStatement();
+ parameterIndex = checkForEscapedCallWithResult (parameterIndex);
+ double result;
+ if (parameterIndex == 0 && escapedProcedureCallWithResult_) {
+ result = (double) returnValueFromProcedure_;
+ this.wasNull_ = this.WAS_NOT_NULL;
+ if (agent_.loggingEnabled()) agent_.logWriter_.traceExit (this, "getDouble", result);
+ return result;
+ }
+ checkGetterPreconditions (parameterIndex);
+ setWasNull (parameterIndex);
+ result = wasNullX() ? 0 : singletonRowData_.getDouble (parameterIndex);
+ if (agent_.loggingEnabled()) agent_.logWriter_.traceExit (this, "getDouble", result);
+ return result;
+ }
+ }
+
+ public java.math.BigDecimal getBigDecimal (int parameterIndex, int scale) throws SqlException, ArithmeticException
+ {
+ synchronized (connection_) {
+ if (agent_.loggingEnabled()) agent_.logWriter_.traceDeprecatedEntry (this, "getBigDecimal", parameterIndex, scale);
+ super.checkForClosedStatement();
+ checkForValidScale (scale);
+ parameterIndex = checkForEscapedCallWithResult (parameterIndex);
+ java.math.BigDecimal result;
+ if (parameterIndex == 0 && escapedProcedureCallWithResult_) {
+ result = java.math.BigDecimal.valueOf (returnValueFromProcedure_).setScale (scale);
+ this.wasNull_ = this.WAS_NOT_NULL;
+ if (agent_.loggingEnabled()) agent_.logWriter_.traceDeprecatedExit (this, "getBigDecimal", result);
+ return result;
+ }
+ checkGetterPreconditions (parameterIndex);
+ setWasNull (parameterIndex);
+ result = wasNullX() ? null : singletonRowData_.getBigDecimal (parameterIndex);
+ if (result != null) {
+ result = result.setScale (scale, java.math.BigDecimal.ROUND_DOWN);
+ }
+ if (agent_.loggingEnabled()) agent_.logWriter_.traceDeprecatedExit (this, "getBigDecimal", result);
+ return result;
+ }
+ }
+
+ public java.math.BigDecimal getBigDecimal (int parameterIndex) throws SqlException
+ {
+ synchronized (connection_) {
+ if (agent_.loggingEnabled()) agent_.logWriter_.traceEntry (this, "getBigDecimal", parameterIndex);
+ super.checkForClosedStatement();
+ parameterIndex = checkForEscapedCallWithResult (parameterIndex);
+ java.math.BigDecimal result;
+ if (parameterIndex == 0 && escapedProcedureCallWithResult_) {
+ result = java.math.BigDecimal.valueOf (returnValueFromProcedure_);
+ this.wasNull_ = this.WAS_NOT_NULL;
+ if (agent_.loggingEnabled()) agent_.logWriter_.traceExit (this, "getBigDecimal", result);
+ return result;
+ }
+ checkGetterPreconditions (parameterIndex);
+ setWasNull (parameterIndex);
+ result = wasNullX() ? null : singletonRowData_.getBigDecimal (parameterIndex);
+ if (agent_.loggingEnabled()) agent_.logWriter_.traceExit (this, "getBigDecimal", result);
+ return result;
+ }
+ }
+
+ public java.sql.Date getDate (int parameterIndex) throws SqlException
+ {
+ synchronized (connection_) {
+ if (agent_.loggingEnabled()) agent_.logWriter_.traceEntry (this, "getDate", parameterIndex);
+ super.checkForClosedStatement();
+ parameterIndex = checkForEscapedCallWithResult (parameterIndex);
+ if (parameterIndex == 0 && escapedProcedureCallWithResult_)
+ throw new SqlException (agent_.logWriter_, "Invalid method call: parameter 1 is an integer OUT parameter returned by the stored procedure, use getInt call.");
+ checkGetterPreconditions (parameterIndex);
+ setWasNull (parameterIndex);
+ java.sql.Date result = wasNullX() ? null : singletonRowData_.getDate (parameterIndex);
+ if (agent_.loggingEnabled()) agent_.logWriter_.traceExit (this, "getDate", result);
+ return result;
+ }
+ }
+
+ public java.sql.Date getDate (int parameterIndex, java.util.Calendar cal) throws SqlException
+ {
+ synchronized (connection_) {
+ if (agent_.loggingEnabled()) agent_.logWriter_.traceEntry (this, "getDate", parameterIndex, cal);
+ if (cal == null) throw new SqlException (agent_.logWriter_, "Invalid parameter: calendar is null");
+ java.sql.Date result = getDate (parameterIndex);
+ if (result != null) {
+ java.util.Calendar targetCalendar = java.util.Calendar.getInstance(cal.getTimeZone());
+ targetCalendar.clear();
+ targetCalendar.setTime(result);
+ java.util.Calendar defaultCalendar = java.util.Calendar.getInstance();
+ defaultCalendar.clear();
+ defaultCalendar.setTime(result);
+ long timeZoneOffset =
+ targetCalendar.get(java.util.Calendar.ZONE_OFFSET) - defaultCalendar.get(java.util.Calendar.ZONE_OFFSET) +
+ targetCalendar.get(java.util.Calendar.DST_OFFSET) - defaultCalendar.get(java.util.Calendar.DST_OFFSET);
+ result.setTime (result.getTime() - timeZoneOffset);
+ }
+ if (agent_.loggingEnabled()) agent_.logWriter_.traceExit (this, "getDate", result);
+ return result;
+ }
+ }
+
+ public java.sql.Time getTime (int parameterIndex) throws SqlException
+ {
+ synchronized (connection_) {
+ if (agent_.loggingEnabled()) agent_.logWriter_.traceEntry (this, "getTime", parameterIndex);
+ super.checkForClosedStatement();
+ parameterIndex = checkForEscapedCallWithResult (parameterIndex);
+ if (parameterIndex == 0 && escapedProcedureCallWithResult_)
+ throw new SqlException (agent_.logWriter_, "Invalid method call: parameter 1 is an integer OUT parameter returned by the stored procedure, use getInt call.");
+ checkGetterPreconditions (parameterIndex);
+ setWasNull (parameterIndex);
+ java.sql.Time result = wasNullX() ? null : singletonRowData_.getTime (parameterIndex);
+ if (agent_.loggingEnabled()) agent_.logWriter_.traceExit (this, "getTime", result);
+ return result;
+ }
+ }
+
+ public java.sql.Time getTime (int parameterIndex, java.util.Calendar cal) throws SqlException
+ {
+ synchronized (connection_) {
+ if (agent_.loggingEnabled()) agent_.logWriter_.traceEntry (this, "getTime", parameterIndex, cal);
+ if (cal == null) throw new SqlException (agent_.logWriter_, "Invalid parameter: calendar is null");
+ java.sql.Time result = getTime(parameterIndex);
+ if (result != null) {
+ java.util.Calendar targetCalendar = java.util.Calendar.getInstance(cal.getTimeZone());
+ targetCalendar.clear();
+ targetCalendar.setTime(result);
+ java.util.Calendar defaultCalendar = java.util.Calendar.getInstance();
+ defaultCalendar.clear();
+ defaultCalendar.setTime(result);
+ long timeZoneOffset =
+ targetCalendar.get(java.util.Calendar.ZONE_OFFSET) - defaultCalendar.get(java.util.Calendar.ZONE_OFFSET) +
+ targetCalendar.get(java.util.Calendar.DST_OFFSET) - defaultCalendar.get(java.util.Calendar.DST_OFFSET);
+ result.setTime (result.getTime() - timeZoneOffset);
+ }
+ if (agent_.loggingEnabled()) agent_.logWriter_.traceExit (this, "getTime", result);
+ return result;
+ }
+ }
+
+ public java.sql.Timestamp getTimestamp (int parameterIndex) throws SqlException
+ {
+ synchronized (connection_) {
+ if (agent_.loggingEnabled()) agent_.logWriter_.traceEntry (this, "getTimestamp", parameterIndex);
+ super.checkForClosedStatement();
+ parameterIndex = checkForEscapedCallWithResult (parameterIndex);
+ if (parameterIndex == 0 && escapedProcedureCallWithResult_)
+ throw new SqlException (agent_.logWriter_, "Invalid method call: parameter 1 is an integer OUT parameter returned by the stored procedure, use getInt call.");
+ checkGetterPreconditions (parameterIndex);
+ setWasNull (parameterIndex);
+ java.sql.Timestamp result = wasNullX() ? null : singletonRowData_.getTimestamp (parameterIndex);
+ if (agent_.loggingEnabled()) agent_.logWriter_.traceExit (this, "getTimestamp", result);
+ return result;
+ }
+ }
+
+ public java.sql.Timestamp getTimestamp (int parameterIndex, java.util.Calendar cal) throws SqlException
+ {
+ synchronized (connection_) {
+ if (agent_.loggingEnabled()) agent_.logWriter_.traceEntry (this, "getTimestamp", parameterIndex, cal);
+ if (cal == null) throw new SqlException (agent_.logWriter_, "Invalid parameter: calendar is null");
+ java.sql.Timestamp result = getTimestamp (parameterIndex);
+ if (result != null) {
+ int nano = result.getNanos();
+ java.util.Calendar targetCalendar = java.util.Calendar.getInstance(cal.getTimeZone());
+ targetCalendar.clear();
+ targetCalendar.setTime(result);
+ java.util.Calendar defaultCalendar = java.util.Calendar.getInstance();
+ defaultCalendar.clear();
+ defaultCalendar.setTime(result);
+ long timeZoneOffset =
+ targetCalendar.get(java.util.Calendar.ZONE_OFFSET) - defaultCalendar.get(java.util.Calendar.ZONE_OFFSET) +
+ targetCalendar.get(java.util.Calendar.DST_OFFSET) - defaultCalendar.get(java.util.Calendar.DST_OFFSET);
+ result.setTime (result.getTime() - timeZoneOffset);
+ result.setNanos (nano);
+ }
+ if (agent_.loggingEnabled()) agent_.logWriter_.traceExit (this, "getTimestamp", result);
+ return result;
+ }
+ }
+
+ public String getString (int parameterIndex) throws SqlException
+ {
+ synchronized (connection_) {
+ if (agent_.loggingEnabled()) agent_.logWriter_.traceEntry (this, "getString", parameterIndex);
+ String result = getStringX (parameterIndex);
+ if (agent_.loggingEnabled()) agent_.logWriter_.traceExit (this, "getString", result);
+ return result;
+ }
+ }
+
+ // also used by SQLCA
+ String getStringX (int parameterIndex) throws SqlException
+ {
+ super.checkForClosedStatement();
+ parameterIndex = checkForEscapedCallWithResult (parameterIndex);
+ if (parameterIndex == 0 && escapedProcedureCallWithResult_) {
+ this.wasNull_ = this.WAS_NOT_NULL;
+ return Integer.toString (returnValueFromProcedure_);
+ }
+ checkGetterPreconditions (parameterIndex);
+ setWasNull (parameterIndex);
+ return wasNullX() ? null : singletonRowData_.getString (parameterIndex);
+ }
+
+ public byte[] getBytes (int parameterIndex) throws SqlException
+ {
+ synchronized (connection_) {
+ if (agent_.loggingEnabled()) agent_.logWriter_.traceEntry (this, "getBytes", parameterIndex);
+ super.checkForClosedStatement();
+ parameterIndex = checkForEscapedCallWithResult (parameterIndex);
+ if (parameterIndex == 0 && escapedProcedureCallWithResult_)
+ throw new SqlException (agent_.logWriter_, "Invalid method call: parameter 1 is an integer OUT parameter returned by the stored procedure, use getInt call.");
+ checkGetterPreconditions (parameterIndex);
+ setWasNull (parameterIndex);
+ byte[] result = wasNullX() ? null : singletonRowData_.getBytes (parameterIndex);
+ if (agent_.loggingEnabled()) agent_.logWriter_.traceExit (this, "getBytes", result);
+ return result;
+ }
+ }
+
+ public java.sql.Blob getBlob (int parameterIndex) throws SqlException
+ {
+ synchronized (connection_) {
+ if (agent_.loggingEnabled()) agent_.logWriter_.traceEntry (this, "getBlob", parameterIndex);
+ super.checkForClosedStatement();
+ parameterIndex = checkForEscapedCallWithResult (parameterIndex);
+ if (parameterIndex == 0 && escapedProcedureCallWithResult_)
+ throw new SqlException (agent_.logWriter_, "Invalid method call: parameter 1 is an integer OUT parameter returned by the stored procedure, use getInt call.");
+ checkGetterPreconditions (parameterIndex);
+ setWasNull (parameterIndex);
+ java.sql.Blob result = wasNullX() ? null : singletonRowData_.getBlob (parameterIndex);
+ if (agent_.loggingEnabled()) agent_.logWriter_.traceExit (this, "getBlob", result);
+ return result;
+ }
+ }
+
+ public java.sql.Clob getClob (int parameterIndex) throws SqlException
+ {
+ synchronized (connection_) {
+ if (agent_.loggingEnabled()) agent_.logWriter_.traceEntry (this, "getClob", parameterIndex);
+ super.checkForClosedStatement();
+ parameterIndex = checkForEscapedCallWithResult (parameterIndex);
+ if (parameterIndex == 0 && escapedProcedureCallWithResult_)
+ throw new SqlException (agent_.logWriter_, "Invalid method call: parameter 1 is an integer OUT parameter returned by the stored procedure, use getInt call.");
+ checkGetterPreconditions (parameterIndex);
+ setWasNull (parameterIndex);
+ java.sql.Clob result = wasNullX() ? null : singletonRowData_.getClob (parameterIndex);
+ if (agent_.loggingEnabled()) agent_.logWriter_.traceExit (this, "getClob", result);
+ return result;
+ }
+ }
+
+ public java.sql.Array getArray (int parameterIndex) throws SqlException
+ {
+ synchronized (connection_) {
+ if (agent_.loggingEnabled()) agent_.logWriter_.traceEntry (this, "getArray", parameterIndex);
+ super.checkForClosedStatement();
+ parameterIndex = checkForEscapedCallWithResult (parameterIndex);
+ if (parameterIndex == 0 && escapedProcedureCallWithResult_)
+ throw new SqlException (agent_.logWriter_, "Invalid method call: parameter 1 is an integer OUT parameter returned by the stored procedure, use getInt call.");
+ checkGetterPreconditions (parameterIndex);
+ setWasNull (parameterIndex);
+ java.sql.Array result = wasNullX() ? null : singletonRowData_.getArray (parameterIndex);
+ if (true) throw new SqlException (agent_.logWriter_, "jdbc 2 method is not yet implemented");
+ if (agent_.loggingEnabled()) agent_.logWriter_.traceExit (this, "getArray", result);
+ return result;
+ }
+ }
+
+ public java.sql.Ref getRef (int parameterIndex) throws SqlException
+ {
+ synchronized (connection_) {
+ if (agent_.loggingEnabled()) agent_.logWriter_.traceEntry (this, "getRef", parameterIndex);
+ super.checkForClosedStatement();
+ parameterIndex = checkForEscapedCallWithResult (parameterIndex);
+ if (parameterIndex == 0 && escapedProcedureCallWithResult_)
+ throw new SqlException (agent_.logWriter_, "Invalid method call: parameter 1 is an integer OUT parameter returned by the stored procedure, use getInt call.");
+ checkGetterPreconditions (parameterIndex);
+ setWasNull (parameterIndex);
+ java.sql.Ref result = wasNullX() ? null : singletonRowData_.getRef (parameterIndex);
+ if (true) throw new SqlException (agent_.logWriter_, "jdbc 2 method is not yet implemented");
+ if (agent_.loggingEnabled()) agent_.logWriter_.traceExit (this, "getRef", result);
+ return result;
+ }
+ }
+
+ public Object getObject (int parameterIndex) throws SqlException
+ {
+ synchronized (connection_) {
+ if (agent_.loggingEnabled()) agent_.logWriter_.traceEntry (this, "getObject", parameterIndex);
+ super.checkForClosedStatement();
+ parameterIndex = checkForEscapedCallWithResult (parameterIndex);
+ Object result;
+ if (parameterIndex == 0 && escapedProcedureCallWithResult_) {
+ result = new Integer (returnValueFromProcedure_);
+ this.wasNull_ = this.WAS_NOT_NULL;
+ if (agent_.loggingEnabled()) agent_.logWriter_.traceExit (this, "getObject", result);
+ return result;
+ }
+ checkGetterPreconditions (parameterIndex);
+ setWasNull (parameterIndex);
+ result = wasNullX() ? null : singletonRowData_.getObject (parameterIndex);
+ if (agent_.loggingEnabled()) agent_.logWriter_.traceExit (this, "getObject", result);
+ return result;
+ }
+ }
+
+ public Object getObject (int parameterIndex, java.util.Map map) throws SqlException
+ {
+ synchronized (connection_) {
+ if (agent_.loggingEnabled()) agent_.logWriter_.traceEntry (this, "getObject", parameterIndex, map);
+ super.checkForClosedStatement();
+ parameterIndex = checkForEscapedCallWithResult (parameterIndex);
+ Object result;
+ checkGetterPreconditions (parameterIndex);
+ if (true) throw new SqlException (agent_.logWriter_, "jdbc 2 method is not yet implemented.");
+ if (agent_.loggingEnabled()) agent_.logWriter_.traceExit (this, "getObject", result);
+ return result;
+ }
+ }
+
+ //--------------------------JDBC 3.0------------------------------------------
+
+ public void registerOutParameter (String parameterName, int sqlType) throws SqlException
+ {
+ if (agent_.loggingEnabled()) agent_.logWriter_.traceEntry (this, "registerOutParameter", parameterName, sqlType);
+ super.checkForClosedStatement();
+ throw new SqlException (agent_.logWriter_, "JDBC 3 method called - not yet supported");
+ }
+
+ public void registerOutParameter (String parameterName, int sqlType, int scale) throws SqlException
+ {
+ if (agent_.loggingEnabled()) agent_.logWriter_.traceEntry (this, "registerOutParameter", parameterName, sqlType, scale);
+ super.checkForClosedStatement();
+ throw new SqlException (agent_.logWriter_, "JDBC 3 method called - not yet supported");
+ }
+
+ public void registerOutParameter (String parameterName, int sqlType, String typeName) throws SqlException
+ {
+ if (agent_.loggingEnabled()) agent_.logWriter_.traceEntry (this, "registerOutParameter", parameterName, sqlType, typeName);
+ super.checkForClosedStatement();
+ throw new SqlException (agent_.logWriter_, "JDBC 3 method called - not yet supported");
+ }
+
+ public java.net.URL getURL (int parameterIndex) throws SqlException
+ {
+ if (agent_.loggingEnabled()) agent_.logWriter_.traceEntry (this, "getURL", parameterIndex);
+ super.checkForClosedStatement();
+ throw new SqlException (agent_.logWriter_, "JDBC 3 method called - not yet supported");
+ }
+
+ public void setURL (String parameterName, java.net.URL x) throws SqlException
+ {
+ if (agent_.loggingEnabled()) agent_.logWriter_.traceEntry (this, "setURL", parameterName, x);
+ super.checkForClosedStatement();
+ throw new SqlException (agent_.logWriter_, "JDBC 3 method called - not yet supported");
+ }
+
+ public void setNull (String parameterName, int sqlType) throws SqlException
+ {
+ if (agent_.loggingEnabled()) agent_.logWriter_.traceEntry (this, "setNull", parameterName, sqlType);
+ super.checkForClosedStatement();
+ throw new SqlException (agent_.logWriter_, "JDBC 3 method called - not yet supported");
+ }
+
+ public void setBoolean (String parameterName, boolean x) throws SqlException
+ {
+ if (agent_.loggingEnabled()) agent_.logWriter_.traceEntry (this, "setBoolean", parameterName, x);
+ super.checkForClosedStatement();
+ throw new SqlException (agent_.logWriter_, "JDBC 3 method called - not yet supported");
+ }
+
+ public void setByte (String parameterName, byte x) throws SqlException
+ {
+ if (agent_.loggingEnabled()) agent_.logWriter_.traceEntry (this, "setByte", parameterName, x);
+ super.checkForClosedStatement();
+ throw new SqlException (agent_.logWriter_, "JDBC 3 method called - not yet supported");
+ }
+
+ public void setShort (String parameterName, short x) throws SqlException
+ {
+ if (agent_.loggingEnabled()) agent_.logWriter_.traceEntry (this, "setShort", parameterName, x);
+ super.checkForClosedStatement();
+ throw new SqlException (agent_.logWriter_, "JDBC 3 method called - not yet supported");
+ }
+
+ public void setInt (String parameterName, int x) throws SqlException
+ {
+ if (agent_.loggingEnabled()) agent_.logWriter_.traceEntry (this, "setInt", parameterName, x);
+ super.checkForClosedStatement();
+ throw new SqlException (agent_.logWriter_, "JDBC 3 method called - not yet supported");
+ }
+
+ public void setLong (String parameterName, long x) throws SqlException
+ {
+ if (agent_.loggingEnabled()) agent_.logWriter_.traceEntry (this, "setLong", parameterName, x);
+ super.checkForClosedStatement();
+ throw new SqlException (agent_.logWriter_, "JDBC 3 method called - not yet supported");
+ }
+
+ public void setFloat (String parameterName, float x) throws SqlException
+ {
+ if (agent_.loggingEnabled()) agent_.logWriter_.traceEntry (this, "setFloat", parameterName, x);
+ super.checkForClosedStatement();
+ throw new SqlException (agent_.logWriter_, "JDBC 3 method called - not yet supported");
+ }
+
+ public void setDouble (String parameterName, double x) throws SqlException
+ {
+ if (agent_.loggingEnabled()) agent_.logWriter_.traceEntry (this, "setDouble", parameterName, x);
+ super.checkForClosedStatement();
+ throw new SqlException (agent_.logWriter_, "JDBC 3 method called - not yet supported");
+ }
+
+ public void setBigDecimal (String parameterName, java.math.BigDecimal x) throws SqlException
+ {
+ if (agent_.loggingEnabled()) agent_.logWriter_.traceEntry (this, "setBigDecimal", parameterName, x);
+ super.checkForClosedStatement();
+ throw new SqlException (agent_.logWriter_, "JDBC 3 method called - not yet supported");
+ }
+
+ public void setString (String parameterName, String x) throws SqlException
+ {
+ if (agent_.loggingEnabled()) agent_.logWriter_.traceEntry (this, "setString", parameterName, x);
+ super.checkForClosedStatement();
+ throw new SqlException (agent_.logWriter_, "JDBC 3 method called - not yet supported");
+ }
+
+ public void setBytes (String parameterName, byte x[]) throws SqlException
+ {
+ if (agent_.loggingEnabled()) agent_.logWriter_.traceEntry (this, "setBytes", parameterName, x);
+ super.checkForClosedStatement();
+ throw new SqlException (agent_.logWriter_, "JDBC 3 method called - not yet supported");
+ }
+
+ public void setDate (String parameterName, java.sql.Date x) throws SqlException
+ {
+ if (agent_.loggingEnabled()) agent_.logWriter_.traceEntry (this, "setDate", parameterName, x);
+ super.checkForClosedStatement();
+ throw new SqlException (agent_.logWriter_, "JDBC 3 method called - not yet supported");
+ }
+
+ public void setTime (String parameterName, java.sql.Time x) throws SqlException
+ {
+ if (agent_.loggingEnabled()) agent_.logWriter_.traceEntry (this, "setTime", parameterName, x);
+ super.checkForClosedStatement();
+ throw new SqlException (agent_.logWriter_, "JDBC 3 method called - not yet supported");
+ }
+
+ public void setTimestamp (String parameterName, java.sql.Timestamp x) throws SqlException
+ {
+ if (agent_.loggingEnabled()) agent_.logWriter_.traceEntry (this, "setTimestamp", parameterName, x);
+ super.checkForClosedStatement();
+ throw new SqlException (agent_.logWriter_, "JDBC 3 method called - not yet supported");
+ }
+
+ public void setAsciiStream (String parameterName, java.io.InputStream x, int length) throws SqlException
+ {
+ if (agent_.loggingEnabled()) agent_.logWriter_.traceEntry (this, "setAsciiStream", parameterName, x, length);
+ super.checkForClosedStatement();
+ throw new SqlException (agent_.logWriter_, "JDBC 3 method called - not yet supported");
+ }
+
+ public void setBinaryStream (String parameterName, java.io.InputStream x, int length) throws SqlException
+ {
+ if (agent_.loggingEnabled()) agent_.logWriter_.traceEntry (this, "setBinaryStream", parameterName, x, length);
+ super.checkForClosedStatement();
+ throw new SqlException (agent_.logWriter_, "JDBC 3 method called - not yet supported");
+ }
+
+ public void setObject (String parameterName, Object x, int targetSqlType, int scale) throws SqlException
+ {
+ if (agent_.loggingEnabled()) agent_.logWriter_.traceEntry (this, "setObject", parameterName, x, targetSqlType, scale);
+ super.checkForClosedStatement();
+ throw new SqlException (agent_.logWriter_, "JDBC 3 method called - not yet supported");
+ }
+
+ public void setObject (String parameterName, Object x, int targetSqlType) throws SqlException
+ {
+ if (agent_.loggingEnabled()) agent_.logWriter_.traceEntry (this, "setObject", parameterName, x, targetSqlType);
+ super.checkForClosedStatement();
+ throw new SqlException (agent_.logWriter_, "JDBC 3 method called - not yet supported");
+ }
+
+ public void setObject (String parameterName, Object x) throws SqlException
+ {
+ if (agent_.loggingEnabled()) agent_.logWriter_.traceEntry (this, "setObject", parameterName, x);
+ super.checkForClosedStatement();
+ throw new SqlException (agent_.logWriter_, "JDBC 3 method called - not yet supported");
+ }
+
+ public void setCharacterStream (String parameterName, java.io.Reader reader, int length) throws SqlException
+ {
+ if (agent_.loggingEnabled()) agent_.logWriter_.traceEntry (this, "setCharacterStream", parameterName, reader, length);
+ super.checkForClosedStatement();
+ throw new SqlException (agent_.logWriter_, "JDBC 3 method called - not yet supported");
+ }
+
+ public void setDate (String parameterName, java.sql.Date x, java.util.Calendar calendar) throws SqlException
+ {
+ if (agent_.loggingEnabled()) agent_.logWriter_.traceEntry (this, "setDate", parameterName, x, calendar);
+ super.checkForClosedStatement();
+ throw new SqlException (agent_.logWriter_, "JDBC 3 method called - not yet supported");
+ }
+
+ public void setTime (String parameterName, java.sql.Time x, java.util.Calendar calendar) throws SqlException
+ {
+ if (agent_.loggingEnabled()) agent_.logWriter_.traceEntry (this, "setTime", parameterName, x, calendar);
+ super.checkForClosedStatement();
+ throw new SqlException (agent_.logWriter_, "JDBC 3 method called - not yet supported");
+ }
+
+ public void setTimestamp (String parameterName, java.sql.Timestamp x, java.util.Calendar calendar) throws SqlException
+ {
+ if (agent_.loggingEnabled()) agent_.logWriter_.traceEntry (this, "setTimestamp", parameterName, x, calendar);
+ super.checkForClosedStatement();
+ throw new SqlException (agent_.logWriter_, "JDBC 3 method called - not yet supported");
+ }
+
+ public void setNull (String parameterName, int sqlType, String typeName) throws SqlException
+ {
+ if (agent_.loggingEnabled()) agent_.logWriter_.traceEntry (this, "setNull", parameterName, sqlType, typeName);
+ super.checkForClosedStatement();
+ throw new SqlException (agent_.logWriter_, "JDBC 3 method called - not yet supported");
+ }
+
+ public String getString (String parameterName) throws SqlException
+ {
+ if (agent_.loggingEnabled()) agent_.logWriter_.traceEntry (this, "getString", parameterName);
+ super.checkForClosedStatement();
+ throw new SqlException (agent_.logWriter_, "JDBC 3 method called - not yet supported");
+ }
+
+ public boolean getBoolean (String parameterName) throws SqlException
+ {
+ if (agent_.loggingEnabled()) agent_.logWriter_.traceEntry (this, "getBoolean", parameterName);
+ super.checkForClosedStatement();
+ throw new SqlException (agent_.logWriter_, "JDBC 3 method called - not yet supported");
+ }
+
+ public byte getByte (String parameterName) throws SqlException
+ {
+ if (agent_.loggingEnabled()) agent_.logWriter_.traceEntry (this, "getByte", parameterName);
+ super.checkForClosedStatement();
+ throw new SqlException (agent_.logWriter_, "JDBC 3 method called - not yet supported");
+ }
+
+ public short getShort (String parameterName) throws SqlException
+ {
+ if (agent_.loggingEnabled()) agent_.logWriter_.traceEntry (this, "getShort", parameterName);
+ super.checkForClosedStatement();
+ throw new SqlException (agent_.logWriter_, "JDBC 3 method called - not yet supported");
+ }
+
+ public int getInt (String parameterName) throws SqlException
+ {
+ if (agent_.loggingEnabled()) agent_.logWriter_.traceEntry (this, "getInt", parameterName);
+ super.checkForClosedStatement();
+ throw new SqlException (agent_.logWriter_, "JDBC 3 method called - not yet supported");
+ }
+
+ public long getLong (String parameterName) throws SqlException
+ {
+ if (agent_.loggingEnabled()) agent_.logWriter_.traceEntry (this, "getLong", parameterName);
+ super.checkForClosedStatement();
+ throw new SqlException (agent_.logWriter_, "JDBC 3 method called - not yet supported");
+ }
+
+ public float getFloat (String parameterName) throws SqlException
+ {
+ if (agent_.loggingEnabled()) agent_.logWriter_.traceEntry (this, "getFloat", parameterName);
+ super.checkForClosedStatement();
+ throw new SqlException (agent_.logWriter_, "JDBC 3 method called - not yet supported");
+ }
+
+ public double getDouble (String parameterName) throws SqlException
+ {
+ if (agent_.loggingEnabled()) agent_.logWriter_.traceEntry (this, "getDouble", parameterName);
+ super.checkForClosedStatement();
+ throw new SqlException (agent_.logWriter_, "JDBC 3 method called - not yet supported");
+ }
+
+ public byte[] getBytes (String parameterName) throws SqlException
+ {
+ if (agent_.loggingEnabled()) agent_.logWriter_.traceEntry (this, "getBytes", parameterName);
+ super.checkForClosedStatement();
+ throw new SqlException (agent_.logWriter_, "JDBC 3 method called - not yet supported");
+ }
+
+ public java.sql.Date getDate (String parameterName) throws SqlException
+ {
+ if (agent_.loggingEnabled()) agent_.logWriter_.traceEntry (this, "getDate", parameterName);
+ super.checkForClosedStatement();
+ throw new SqlException (agent_.logWriter_, "JDBC 3 method called - not yet supported");
+ }
+
+ public java.sql.Time getTime (String parameterName) throws SqlException
+ {
+ if (agent_.loggingEnabled()) agent_.logWriter_.traceEntry (this, "getTime", parameterName);
+ super.checkForClosedStatement();
+ throw new SqlException (agent_.logWriter_, "JDBC 3 method called - not yet supported");
+ }
+
+ public java.sql.Timestamp getTimestamp (String parameterName) throws SqlException
+ {
+ if (agent_.loggingEnabled()) agent_.logWriter_.traceEntry (this, "getTimestamp", parameterName);
+ super.checkForClosedStatement();
+ throw new SqlException (agent_.logWriter_, "JDBC 3 method called - not yet supported");
+ }
+
+ public Object getObject (String parameterName) throws SqlException
+ {
+ if (agent_.loggingEnabled()) agent_.logWriter_.traceEntry (this, "getObject", parameterName);
+ super.checkForClosedStatement();
+ throw new SqlException (agent_.logWriter_, "JDBC 3 method called - not yet supported");
+ }
+
+ public java.math.BigDecimal getBigDecimal (String parameterName) throws SqlException
+ {
+ if (agent_.loggingEnabled()) agent_.logWriter_.traceEntry (this, "getBigDecimal", parameterName);
+ super.checkForClosedStatement();
+ throw new SqlException (agent_.logWriter_, "JDBC 3 method called - not yet supported");
+ }
+
+ public Object getObject (String parameterName, java.util.Map map) throws SqlException
+ {
+ if (agent_.loggingEnabled()) agent_.logWriter_.traceEntry (this, "getObject", parameterName, map);
+ super.checkForClosedStatement();
+ throw new SqlException (agent_.logWriter_, "JDBC 3 method called - not yet supported");
+ }
+
+ public java.sql.Ref getRef (String parameterName) throws SqlException
+ {
+ if (agent_.loggingEnabled()) agent_.logWriter_.traceEntry (this, "getRef", parameterName);
+ super.checkForClosedStatement();
+ throw new SqlException (agent_.logWriter_, "JDBC 3 method called - not yet supported");
+ }
+
+ public java.sql.Blob getBlob (String parameterName) throws SqlException
+ {
+ if (agent_.loggingEnabled()) agent_.logWriter_.traceEntry (this, "getBlob", parameterName);
+ super.checkForClosedStatement();
+ throw new SqlException (agent_.logWriter_, "JDBC 3 method called - not yet supported");
+ }
+
+ public java.sql.Clob getClob (String parameterName) throws SqlException
+ {
+ if (agent_.loggingEnabled()) agent_.logWriter_.traceEntry (this, "getClob", parameterName);
+ super.checkForClosedStatement();
+ throw new SqlException (agent_.logWriter_, "JDBC 3 method called - not yet supported");
+ }
+
+ public java.sql.Array getArray (String parameterName) throws SqlException
+ {
+ if (agent_.loggingEnabled()) agent_.logWriter_.traceEntry (this, "getArray", parameterName);
+ super.checkForClosedStatement();
+ throw new SqlException (agent_.logWriter_, "JDBC 3 method called - not yet supported");
+ }
+
+ public java.sql.Date getDate (String parameterName, java.util.Calendar calendar) throws SqlException
+ {
+ if (agent_.loggingEnabled()) agent_.logWriter_.traceEntry (this, "getDate", parameterName, calendar);
+ super.checkForClosedStatement();
+ throw new SqlException (agent_.logWriter_, "JDBC 3 method called - not yet supported");
+ }
+
+ public java.sql.Time getTime (String parameterName, java.util.Calendar calendar) throws SqlException
+ {
+ if (agent_.loggingEnabled()) agent_.logWriter_.traceEntry (this, "getTime", parameterName, calendar);
+ super.checkForClosedStatement();
+ throw new SqlException (agent_.logWriter_, "JDBC 3 method called - not yet supported");
+ }
+
+ public java.sql.Timestamp getTimestamp (String parameterName, java.util.Calendar calendar) throws SqlException
+ {
+ if (agent_.loggingEnabled()) agent_.logWriter_.traceEntry (this, "getTimestamp", parameterName, calendar);
+ super.checkForClosedStatement();
+ throw new SqlException (agent_.logWriter_, "JDBC 3 method called - not yet supported");
+ }
+
+ public java.net.URL getURL (String parameterName) throws SqlException
+ {
+ if (agent_.loggingEnabled()) agent_.logWriter_.traceEntry (this, "getURL", parameterName);
+ super.checkForClosedStatement();
+ throw new SqlException (agent_.logWriter_, "JDBC 3 method called - not yet supported");
+ }
+
+ //----------------------------helper methods----------------------------------
+
+ private int checkForEscapedCallWithResult (int parameterIndex) throws SqlException
+ {
+ if (escapedProcedureCallWithResult_)
+ parameterIndex--;
+ return parameterIndex;
+ }
+
+ private int checkForEscapedCallWithResult (int parameterIndex, int jdbcType) throws SqlException
+ {
+ if (escapedProcedureCallWithResult_) {
+ if (parameterIndex == 1 && jdbcType != java.sql.Types.INTEGER)
+ throw new SqlException (agent_.logWriter_, "Parameter 1 is the return caluse of the stored procedure call, it can only be registered as an integer type");
+ else
+ parameterIndex--;
+ }
+ return parameterIndex;
+ }
+
+ private void checkGetterPreconditions (int parameterIndex) throws SqlException
+ {
+ super.checkForValidParameterIndex (parameterIndex);
+ checkForValidOutParameter (parameterIndex);
+ }
+
+ private void checkForValidOutParameter (int parameterIndex) throws SqlException
+ {
+ if (parameterMetaData_ == null || parameterMetaData_.sqlxParmmode_[parameterIndex - 1] < java.sql.ParameterMetaData.parameterModeInOut)
+ throw new SqlException (agent_.logWriter_, "Invalid argument: parameter index " + parameterIndex +
+ " is not an OUT or INOUT parameter.");
+ }
+
+ private void setWasNull (int parameterIndex)
+ {
+ if (singletonRowData_ == null)
+ wasNull_ = WAS_NULL_UNSET;
+ else
+ wasNull_ = singletonRowData_.isNull_[parameterIndex - 1] ? WAS_NULL : WAS_NOT_NULL ;
+ }
+}
+
Propchange: incubator/derby/code/trunk/java/client/org/apache/derby/client/am/CallableStatement.java
------------------------------------------------------------------------------
svn:eol-style = native