KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > derby > client > am > CallableStatement


1 /*
2
3    Derby - Class org.apache.derby.client.am.CallableStatement
4
5    Licensed to the Apache Software Foundation (ASF) under one or more
6    contributor license agreements. See the NOTICE file distributed with
7    this work for additional information regarding copyright ownership.
8    The ASF licenses this file to You under the Apache License, Version 2.0
9    (the "License"); you may not use this file except in compliance with
10    the License. You may obtain a copy of the License at
11
12       http://www.apache.org/licenses/LICENSE-2.0
13
14    Unless required by applicable law or agreed to in writing, software
15    distributed under the License is distributed on an "AS IS" BASIS,
16    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17    See the License for the specific language governing permissions and
18    limitations under the License.
19
20 */

21
22 package org.apache.derby.client.am;
23
24 import org.apache.derby.client.ClientPooledConnection;
25 import org.apache.derby.shared.common.reference.SQLState;
26
27 import java.io.Reader JavaDoc;
28 import java.sql.SQLException JavaDoc;
29
30 public class CallableStatement extends PreparedStatement
31         implements java.sql.PreparedStatement JavaDoc,
32         java.sql.CallableStatement JavaDoc,
33         PreparedStatementCallbackInterface {
34     //---------------------navigational members-----------------------------------
35

36     //---------------------navigational cheat-links-------------------------------
37
// Cheat-links are for convenience only, and are not part of the conceptual model.
38
// Warning:
39
// Cheat-links should only be defined for invariant state data.
40
// That is, the state data is set by the constructor and never changes.
41

42     public MaterialPreparedStatement materialCallableStatement_ = null;
43
44     //-----------------------------state------------------------------------------
45

46     // last retrieved result was a sql NULL, NOT_NULL, or UNSET.
47
private int wasNull_ = WAS_NULL_UNSET;
48     static final private int WAS_NULL = 1;
49     static final private int WAS_NOT_NULL = 2;
50     static final private int WAS_NULL_UNSET = 0;
51
52     //---------------------constructors/finalizer---------------------------------
53

54     private void initCallableStatement() {
55         materialCallableStatement_ = null;
56         wasNull_ = WAS_NULL_UNSET;
57     }
58
59     public void reset(boolean fullReset) throws SqlException {
60         if (fullReset) {
61             connection_.resetPrepareCall(this);
62         } else {
63             super.reset(fullReset);
64         }
65         wasNull_ = WAS_NULL_UNSET;
66     }
67
68     /**
69      * Common constructor for jdbc 2 callable statements with scroll attributes.
70      * Called by material statement constructor.
71      *
72      * @param agent The instance of NetAgent associated with this
73      * CallableStatement object.
74      * @param connection The connection object associated with this
75      * PreparedStatement Object.
76      * @param sql A String object that is the SQL statement to be sent
77      * to the database.
78      * @param type One of the ResultSet type constants
79      * @param concurrency One of the ResultSet concurrency constants
80      * @param holdability One of the ResultSet holdability constants
81      * @param cpc The PooledConnection object that will be used to
82      * notify the PooledConnection reference of the Error
83      * Occurred and the Close events.
84      * @throws SqlException
85      */

86     public CallableStatement(Agent agent,
87                              Connection connection,
88                              String JavaDoc sql,
89                              int type, int concurrency, int holdability,
90                              ClientPooledConnection cpc) throws SqlException {
91         super(agent, connection, sql, type, concurrency, holdability, java.sql.Statement.NO_GENERATED_KEYS, null,cpc);
92         initCallableStatement();
93     }
94
95     public void resetCallableStatement(Agent agent,
96                                        Connection connection,
97                                        String JavaDoc sql,
98                                        int type, int concurrency, int holdability) throws SqlException {
99         super.resetPreparedStatement(agent, connection, sql, type, concurrency, holdability, java.sql.Statement.NO_GENERATED_KEYS, null);
100         initCallableStatement();
101     }
102
103     public void resetCallableStatement(Agent agent,
104                                        Connection connection,
105                                        String JavaDoc sql,
106                                        Section section) throws SqlException {
107         super.resetPreparedStatement(agent, connection, sql, section);
108         initCallableStatement();
109     }
110
111
112     public void resetCallableStatement(Agent agent,
113                                        Connection connection,
114                                        String JavaDoc sql,
115                                        Section section,
116                                        ColumnMetaData parameterMetaData,
117                                        ColumnMetaData resultSetMetaData) throws SqlException {
118         super.resetPreparedStatement(agent, connection, sql, section, parameterMetaData, resultSetMetaData);
119         initCallableStatement();
120     }
121
122     protected void finalize() throws java.lang.Throwable JavaDoc {
123         if (agent_.loggingEnabled()) {
124             agent_.logWriter_.traceEntry(this, "finalize");
125         }
126         super.finalize();
127     }
128
129     //---------------------------entry points-------------------------------------
130

131     public void clearParameters() throws SQLException JavaDoc {
132         synchronized (connection_) {
133             if (agent_.loggingEnabled()) {
134                 agent_.logWriter_.traceEntry(this, "clearParameters");
135             }
136             super.clearParameters();
137             outputRegistered_ = false; // this variable is only used by Batch
138
}
139     }
140
141     public void registerOutParameter(int parameterIndex, int jdbcType) throws SQLException JavaDoc {
142         try
143         {
144             synchronized (connection_) {
145                 if (agent_.loggingEnabled()) {
146                     agent_.logWriter_.traceEntry(this, "registerOutParameter", parameterIndex, jdbcType);
147                 }
148                 registerOutParameterX(parameterIndex, jdbcType);
149             }
150         }
151         catch ( SqlException se )
152         {
153             throw se.getSQLException();
154         }
155     }
156
157     // also used by Sqlca
158
void registerOutParameterX(int parameterIndex, int jdbcType) throws SqlException {
159         super.checkForClosedStatement();
160         int scale = 0; // default scale to 0 for non numeric and non decimal type
161
registerOutParameterX(parameterIndex, jdbcType, scale);
162     }
163
164     private int guessScaleForDecimalOrNumeric(int parameterIndex) throws SqlException {
165         parameterIndex = checkForEscapedCallWithResult(parameterIndex);
166         // Types.DECIMAL with no supplied scale will use the scale supplied by the setter method if input BigDecimal is not null
167
if (parameterMetaData_.types_[parameterIndex - 1] == Types.DECIMAL &&
168                 parameters_[parameterIndex - 1] != null) {
169             return parameterMetaData_.sqlScale_[parameterIndex - 1];
170         }
171         return 8; // default to scale of 8 if not specified
172
}
173
174     public void registerOutParameter(int parameterIndex, int jdbcType, int scale) throws SQLException JavaDoc {
175         try
176         {
177             synchronized (connection_) {
178                 if (agent_.loggingEnabled()) {
179                     agent_.logWriter_.traceEntry(this, "registerOutParameter", parameterIndex, jdbcType, scale);
180                 }
181                 super.checkForClosedStatement();
182                 registerOutParameterX(parameterIndex, jdbcType, scale);
183             }
184         }
185         catch ( SqlException se )
186         {
187             throw se.getSQLException();
188         }
189     }
190
191     private void registerOutParameterX(int parameterIndex, int jdbcType, int scale) throws SqlException {
192         parameterIndex = checkForEscapedCallWithResult(parameterIndex, jdbcType);
193         // if the parameter is the return clause of the call statement
194
if (parameterIndex == 0 && escapedProcedureCallWithResult_) {
195             return;
196         }
197         super.checkForValidParameterIndex(parameterIndex);
198         checkForValidScale(scale);
199         outputRegistered_ = true; // this variable is only used by Batch
200
//parameterSetOrRegistered_[parameterIndex - 1] = true;
201
parameterRegistered_[parameterIndex - 1] = true;
202     }
203
204     public void registerOutParameter(int parameterIndex, int jdbcType, String JavaDoc typeName) throws SQLException JavaDoc {
205         if (agent_.loggingEnabled()) {
206             agent_.logWriter_.traceEntry(this, "registerOutParameter", parameterIndex, jdbcType, typeName);
207         }
208         throw jdbcMethodNotImplemented();
209     }
210
211     public boolean wasNull() throws SQLException JavaDoc {
212         try
213         {
214             if (agent_.loggingEnabled()) {
215                 agent_.logWriter_.traceEntry(this, "wasNull");
216             }
217             boolean result = wasNullX();
218             if (agent_.loggingEnabled()) {
219                 agent_.logWriter_.traceExit(this, "wasNull", result);
220             }
221             return result;
222         }
223         catch ( SqlException se )
224         {
225             throw se.getSQLException();
226         }
227     }
228
229     private boolean wasNullX() throws SqlException {
230         super.checkForClosedStatement();
231         if (wasNull_ == WAS_NULL_UNSET) {
232             throw new SqlException(agent_.logWriter_,
233                 new ClientMessageId(SQLState.WASNULL_INVALID));
234         }
235         return wasNull_ == WAS_NULL;
236     }
237
238     //--------------------------------getter methods------------------------------
239

240     public boolean getBoolean(int parameterIndex) throws SQLException JavaDoc {
241         try
242         {
243             synchronized (connection_) {
244                 if (agent_.loggingEnabled()) {
245                     agent_.logWriter_.traceEntry(this, "getBoolean", parameterIndex);
246                 }
247                 super.checkForClosedStatement();
248                 parameterIndex = checkForEscapedCallWithResult(parameterIndex);
249                 boolean result;
250                 if (parameterIndex == 0 && escapedProcedureCallWithResult_) {
251                     result = agent_.crossConverters_.getBooleanFromInt(returnValueFromProcedure_);
252                     this.wasNull_ = this.WAS_NOT_NULL;
253                     if (agent_.loggingEnabled()) {
254                         agent_.logWriter_.traceExit(this, "getBoolean", result);
255                     }
256                     return result;
257                 }
258                 checkGetterPreconditions(parameterIndex);
259                 setWasNull(parameterIndex);
260                 result = wasNullX() ? false : singletonRowData_.getBoolean(parameterIndex);
261                 if (agent_.loggingEnabled()) {
262                     agent_.logWriter_.traceExit(this, "getBoolean", result);
263                 }
264                 return result;
265             }
266         }
267         catch ( SqlException se )
268         {
269             throw se.getSQLException();
270         }
271     }
272
273     public byte getByte(int parameterIndex) throws SQLException JavaDoc {
274         try
275         {
276             synchronized (connection_) {
277                 if (agent_.loggingEnabled()) {
278                     agent_.logWriter_.traceEntry(this, "getByte", parameterIndex);
279                 }
280                 super.checkForClosedStatement();
281                 parameterIndex = checkForEscapedCallWithResult(parameterIndex);
282                 byte result;
283                 if (parameterIndex == 0 && escapedProcedureCallWithResult_) {
284                     result = agent_.crossConverters_.getByteFromInt(returnValueFromProcedure_);
285                     this.wasNull_ = this.WAS_NOT_NULL;
286                     if (agent_.loggingEnabled()) {
287                         agent_.logWriter_.traceExit(this, "getByte", result);
288                     }
289                     return result;
290                 }
291                 checkGetterPreconditions(parameterIndex);
292                 setWasNull(parameterIndex);
293                 result = wasNullX() ? 0 : singletonRowData_.getByte(parameterIndex);
294                 if (agent_.loggingEnabled()) {
295                     agent_.logWriter_.traceExit(this, "getByte", result);
296                 }
297                 return result;
298             }
299         }
300         catch ( SqlException se )
301         {
302             throw se.getSQLException();
303         }
304     }
305
306     public short getShort(int parameterIndex) throws SQLException JavaDoc {
307         try
308         {
309             synchronized (connection_) {
310                 if (agent_.loggingEnabled()) {
311                     agent_.logWriter_.traceEntry(this, "getShort", parameterIndex);
312                 }
313                 super.checkForClosedStatement();
314                 parameterIndex = checkForEscapedCallWithResult(parameterIndex);
315                 short result;
316                 if (parameterIndex == 0 && escapedProcedureCallWithResult_) {
317                     result = agent_.crossConverters_.getShortFromInt(returnValueFromProcedure_);
318                     this.wasNull_ = this.WAS_NOT_NULL;
319                     if (agent_.loggingEnabled()) {
320                         agent_.logWriter_.traceExit(this, "getShort", result);
321                     }
322                     return result;
323                 }
324                 checkGetterPreconditions(parameterIndex);
325                 setWasNull(parameterIndex);
326                 result = wasNullX() ? 0 : singletonRowData_.getShort(parameterIndex);
327                 if (agent_.loggingEnabled()) {
328                     agent_.logWriter_.traceExit(this, "getShort", result);
329                 }
330                 return result;
331             }
332         }
333         catch ( SqlException se )
334         {
335             throw se.getSQLException();
336         }
337     }
338
339     public int getInt(int parameterIndex) throws SQLException JavaDoc {
340         try
341         {
342             synchronized (connection_) {
343                 if (agent_.loggingEnabled()) {
344                     agent_.logWriter_.traceEntry(this, "getInt", parameterIndex);
345                 }
346                 int result = getIntX(parameterIndex);
347                 if (agent_.loggingEnabled()) {
348                     agent_.logWriter_.traceExit(this, "getInt", result);
349                 }
350                 return result;
351             }
352         }
353         catch ( SqlException se )
354         {
355             throw se.getSQLException();
356         }
357     }
358
359     // also used by SQLCA
360
int getIntX(int parameterIndex) throws SqlException {
361         super.checkForClosedStatement();
362         parameterIndex = checkForEscapedCallWithResult(parameterIndex);
363         if (parameterIndex == 0 && escapedProcedureCallWithResult_) {
364             this.wasNull_ = this.WAS_NOT_NULL;
365             return returnValueFromProcedure_;
366         }
367         checkGetterPreconditions(parameterIndex);
368         setWasNull(parameterIndex);
369         return wasNullX() ? 0 : singletonRowData_.getInt(parameterIndex);
370     }
371
372     public long getLong(int parameterIndex) throws SQLException JavaDoc {
373         try
374         {
375             synchronized (connection_) {
376                 if (agent_.loggingEnabled()) {
377                     agent_.logWriter_.traceEntry(this, "getLong", parameterIndex);
378                 }
379                 super.checkForClosedStatement();
380                 parameterIndex = checkForEscapedCallWithResult(parameterIndex);
381                 long result;
382                 if (parameterIndex == 0 && escapedProcedureCallWithResult_) {
383                     result = (long) returnValueFromProcedure_;
384                     this.wasNull_ = this.WAS_NOT_NULL;
385                     if (agent_.loggingEnabled()) {
386                         agent_.logWriter_.traceExit(this, "getLong", result);
387                     }
388                     return result;
389                 }
390                 checkGetterPreconditions(parameterIndex);
391                 setWasNull(parameterIndex);
392                 result = wasNullX() ? 0 : singletonRowData_.getLong(parameterIndex);
393                 if (agent_.loggingEnabled()) {
394                     agent_.logWriter_.traceExit(this, "getLong", result);
395                 }
396                 return result;
397             }
398         }
399         catch ( SqlException se )
400         {
401             throw se.getSQLException();
402         }
403     }
404
405     public float getFloat(int parameterIndex) throws SQLException JavaDoc {
406         try
407         {
408             synchronized (connection_) {
409                 if (agent_.loggingEnabled()) {
410                     agent_.logWriter_.traceEntry(this, "getFloat", parameterIndex);
411                 }
412                 super.checkForClosedStatement();
413                 parameterIndex = checkForEscapedCallWithResult(parameterIndex);
414                 float result;
415                 if (parameterIndex == 0 && escapedProcedureCallWithResult_) {
416                     result = (float) returnValueFromProcedure_;
417                     this.wasNull_ = this.WAS_NOT_NULL;
418                     if (agent_.loggingEnabled()) {
419                         agent_.logWriter_.traceExit(this, "getFloat", result);
420                     }
421                     return result;
422                 }
423                 checkGetterPreconditions(parameterIndex);
424                 setWasNull(parameterIndex);
425                 result = wasNullX() ? 0 : singletonRowData_.getFloat(parameterIndex);
426                 if (agent_.loggingEnabled()) {
427                     agent_.logWriter_.traceExit(this, "getFloat", result);
428                 }
429                 return result;
430             }
431         }
432         catch ( SqlException se )
433         {
434             throw se.getSQLException();
435         }
436     }
437
438     public double getDouble(int parameterIndex) throws SQLException JavaDoc {
439         try
440         {
441             synchronized (connection_) {
442                 if (agent_.loggingEnabled()) {
443                     agent_.logWriter_.traceEntry(this, "getDouble", parameterIndex);
444                 }
445                 super.checkForClosedStatement();
446                 parameterIndex = checkForEscapedCallWithResult(parameterIndex);
447                 double result;
448                 if (parameterIndex == 0 && escapedProcedureCallWithResult_) {
449                     result = (double) returnValueFromProcedure_;
450                     this.wasNull_ = this.WAS_NOT_NULL;
451                     if (agent_.loggingEnabled()) {
452                         agent_.logWriter_.traceExit(this, "getDouble", result);
453                     }
454                     return result;
455                 }
456                 checkGetterPreconditions(parameterIndex);
457                 setWasNull(parameterIndex);
458                 result = wasNullX() ? 0 : singletonRowData_.getDouble(parameterIndex);
459                 if (agent_.loggingEnabled()) {
460                     agent_.logWriter_.traceExit(this, "getDouble", result);
461                 }
462                 return result;
463             }
464         }
465         catch ( SqlException se )
466         {
467             throw se.getSQLException();
468         }
469     }
470
471     public java.math.BigDecimal JavaDoc getBigDecimal(int parameterIndex, int scale) throws SQLException JavaDoc, ArithmeticException JavaDoc {
472         try
473         {
474             synchronized (connection_) {
475                 if (agent_.loggingEnabled()) {
476                     agent_.logWriter_.traceDeprecatedEntry(this, "getBigDecimal", parameterIndex, scale);
477                 }
478                 super.checkForClosedStatement();
479                 checkForValidScale(scale);
480                 parameterIndex = checkForEscapedCallWithResult(parameterIndex);
481                 java.math.BigDecimal JavaDoc result;
482                 if (parameterIndex == 0 && escapedProcedureCallWithResult_) {
483                     result = java.math.BigDecimal.valueOf(returnValueFromProcedure_).setScale(scale);
484                     this.wasNull_ = this.WAS_NOT_NULL;
485                     if (agent_.loggingEnabled()) {
486                         agent_.logWriter_.traceDeprecatedExit(this, "getBigDecimal", result);
487                     }
488                     return result;
489                 }
490                 checkGetterPreconditions(parameterIndex);
491                 setWasNull(parameterIndex);
492                 result = wasNullX() ? null : singletonRowData_.getBigDecimal(parameterIndex);
493                 if (result != null) {
494                     result = result.setScale(scale, java.math.BigDecimal.ROUND_DOWN);
495                 }
496                 if (agent_.loggingEnabled()) {
497                     agent_.logWriter_.traceDeprecatedExit(this, "getBigDecimal", result);
498                 }
499                 return result;
500             }
501         }
502         catch ( SqlException se )
503         {
504             throw se.getSQLException();
505         }
506     }
507
508     public java.math.BigDecimal JavaDoc getBigDecimal(int parameterIndex) throws SQLException JavaDoc {
509         try
510         {
511             synchronized (connection_) {
512                 if (agent_.loggingEnabled()) {
513                     agent_.logWriter_.traceEntry(this, "getBigDecimal", parameterIndex);
514                 }
515                 super.checkForClosedStatement();
516                 parameterIndex = checkForEscapedCallWithResult(parameterIndex);
517                 java.math.BigDecimal JavaDoc result;
518                 if (parameterIndex == 0 && escapedProcedureCallWithResult_) {
519                     result = java.math.BigDecimal.valueOf(returnValueFromProcedure_);
520                     this.wasNull_ = this.WAS_NOT_NULL;
521                     if (agent_.loggingEnabled()) {
522                         agent_.logWriter_.traceExit(this, "getBigDecimal", result);
523                     }
524                     return result;
525                 }
526                 checkGetterPreconditions(parameterIndex);
527                 setWasNull(parameterIndex);
528                 result = wasNullX() ? null : singletonRowData_.getBigDecimal(parameterIndex);
529                 if (agent_.loggingEnabled()) {
530                     agent_.logWriter_.traceExit(this, "getBigDecimal", result);
531                 }
532                 return result;
533             }
534         }
535         catch ( SqlException se )
536         {
537             throw se.getSQLException();
538         }
539     }
540
541     public java.sql.Date JavaDoc getDate(int parameterIndex) throws SQLException JavaDoc {
542         try
543         {
544             synchronized (connection_) {
545                 if (agent_.loggingEnabled()) {
546                     agent_.logWriter_.traceEntry(this, "getDate", parameterIndex);
547                 }
548                 super.checkForClosedStatement();
549                 parameterIndex = checkForEscapedCallWithResult(parameterIndex);
550                 if (parameterIndex == 0 && escapedProcedureCallWithResult_) {
551                     throw new SqlException(agent_.logWriter_,
552                         new ClientMessageId(SQLState.INVALID_PARAM_USE_GETINT));
553                 }
554                 checkGetterPreconditions(parameterIndex);
555                 setWasNull(parameterIndex);
556                 java.sql.Date JavaDoc result = wasNullX() ? null : singletonRowData_.getDate(parameterIndex);
557                 if (agent_.loggingEnabled()) {
558                     agent_.logWriter_.traceExit(this, "getDate", result);
559                 }
560                 return result;
561             }
562         }
563         catch ( SqlException se )
564         {
565             throw se.getSQLException();
566         }
567     }
568
569     public java.sql.Date JavaDoc getDate(int parameterIndex, java.util.Calendar JavaDoc cal) throws SQLException JavaDoc {
570         synchronized (connection_) {
571             if (agent_.loggingEnabled()) {
572                 agent_.logWriter_.traceEntry(this, "getDate", parameterIndex, cal);
573             }
574             java.sql.Date JavaDoc result = getDate(parameterIndex);
575             if (cal == null) {
576                 throw new SqlException(agent_.logWriter_,
577                     new ClientMessageId(SQLState.CALENDAR_IS_NULL)).getSQLException();
578             }
579             if (result != null) {
580                 java.util.Calendar JavaDoc targetCalendar = java.util.Calendar.getInstance(cal.getTimeZone());
581                 targetCalendar.clear();
582                 targetCalendar.setTime(result);
583                 java.util.Calendar JavaDoc defaultCalendar = java.util.Calendar.getInstance();
584                 defaultCalendar.clear();
585
586                 defaultCalendar.setTime(result);
587                 long timeZoneOffset =
588                         targetCalendar.get(java.util.Calendar.ZONE_OFFSET) - defaultCalendar.get(java.util.Calendar.ZONE_OFFSET) +
589                         targetCalendar.get(java.util.Calendar.DST_OFFSET) - defaultCalendar.get(java.util.Calendar.DST_OFFSET);
590                 result.setTime(result.getTime() - timeZoneOffset);
591             }
592             if (agent_.loggingEnabled()) {
593                 agent_.logWriter_.traceExit(this, "getDate", result);
594             }
595             return result;
596         }
597     }
598
599     public java.sql.Time JavaDoc getTime(int parameterIndex) throws SQLException JavaDoc {
600         try
601         {
602             synchronized (connection_) {
603                 if (agent_.loggingEnabled()) {
604                     agent_.logWriter_.traceEntry(this, "getTime", parameterIndex);
605                 }
606                 super.checkForClosedStatement();
607                 parameterIndex = checkForEscapedCallWithResult(parameterIndex);
608                 if (parameterIndex == 0 && escapedProcedureCallWithResult_) {
609                     throw new SqlException(agent_.logWriter_,
610                         new ClientMessageId(SQLState.INVALID_PARAM_USE_GETINT));
611                 }
612                 checkGetterPreconditions(parameterIndex);
613                 setWasNull(parameterIndex);
614                 java.sql.Time JavaDoc result = wasNullX() ? null : singletonRowData_.getTime(parameterIndex);
615                 if (agent_.loggingEnabled()) {
616                     agent_.logWriter_.traceExit(this, "getTime", result);
617                 }
618                 return result;
619             }
620         }
621         catch ( SqlException se )
622         {
623             throw se.getSQLException();
624         }
625     }
626
627     public java.sql.Time JavaDoc getTime(int parameterIndex, java.util.Calendar JavaDoc cal) throws SQLException JavaDoc {
628         synchronized (connection_) {
629             if (agent_.loggingEnabled()) {
630                 agent_.logWriter_.traceEntry(this, "getTime", parameterIndex, cal);
631             }
632             java.sql.Time JavaDoc result = getTime(parameterIndex);
633             if (cal == null) {
634                 throw new SqlException(agent_.logWriter_,
635                     new ClientMessageId(SQLState.CALENDAR_IS_NULL)).getSQLException();
636             }
637             if (result != null) {
638                 java.util.Calendar JavaDoc targetCalendar = java.util.Calendar.getInstance(cal.getTimeZone());
639                 targetCalendar.clear();
640                 targetCalendar.setTime(result);
641                 java.util.Calendar JavaDoc defaultCalendar = java.util.Calendar.getInstance();
642                 defaultCalendar.clear();
643                 defaultCalendar.setTime(result);
644                 long timeZoneOffset =
645                         targetCalendar.get(java.util.Calendar.ZONE_OFFSET) - defaultCalendar.get(java.util.Calendar.ZONE_OFFSET) +
646                         targetCalendar.get(java.util.Calendar.DST_OFFSET) - defaultCalendar.get(java.util.Calendar.DST_OFFSET);
647                 result.setTime(result.getTime() - timeZoneOffset);
648             }
649             if (agent_.loggingEnabled()) {
650                 agent_.logWriter_.traceExit(this, "getTime", result);
651             }
652             return result;
653         }
654     }
655
656     public java.sql.Timestamp JavaDoc getTimestamp(int parameterIndex) throws SQLException JavaDoc {
657         try
658         {
659             synchronized (connection_) {
660                 if (agent_.loggingEnabled()) {
661                     agent_.logWriter_.traceEntry(this, "getTimestamp", parameterIndex);
662                 }
663                 super.checkForClosedStatement();
664                 parameterIndex = checkForEscapedCallWithResult(parameterIndex);
665                 if (parameterIndex == 0 && escapedProcedureCallWithResult_) {
666                     throw new SqlException(agent_.logWriter_,
667                         new ClientMessageId(SQLState.INVALID_PARAM_USE_GETINT));
668                 }
669                 checkGetterPreconditions(parameterIndex);
670                 setWasNull(parameterIndex);
671                 java.sql.Timestamp JavaDoc result = wasNullX() ? null : singletonRowData_.getTimestamp(parameterIndex);
672                 if (agent_.loggingEnabled()) {
673                     agent_.logWriter_.traceExit(this, "getTimestamp", result);
674                 }
675                 return result;
676             }
677         }
678         catch ( SqlException se )
679         {
680             throw se.getSQLException();
681         }
682     }
683
684     public java.sql.Timestamp JavaDoc getTimestamp(int parameterIndex, java.util.Calendar JavaDoc cal) throws SQLException JavaDoc {
685         synchronized (connection_) {
686             if (agent_.loggingEnabled()) {
687                 agent_.logWriter_.traceEntry(this, "getTimestamp", parameterIndex, cal);
688             }
689             java.sql.Timestamp JavaDoc result = getTimestamp(parameterIndex);
690             if (cal == null) {
691                 throw new SqlException(agent_.logWriter_,
692                     new ClientMessageId(SQLState.CALENDAR_IS_NULL)).getSQLException();
693             }
694             if (result != null) {
695                 int nano = result.getNanos();
696                 java.util.Calendar JavaDoc targetCalendar = java.util.Calendar.getInstance(cal.getTimeZone());
697                 targetCalendar.clear();
698                 targetCalendar.setTime(result);
699                 java.util.Calendar JavaDoc defaultCalendar = java.util.Calendar.getInstance();
700                 defaultCalendar.clear();
701                 defaultCalendar.setTime(result);
702                 long timeZoneOffset =
703                         targetCalendar.get(java.util.Calendar.ZONE_OFFSET) - defaultCalendar.get(java.util.Calendar.ZONE_OFFSET) +
704                         targetCalendar.get(java.util.Calendar.DST_OFFSET) - defaultCalendar.get(java.util.Calendar.DST_OFFSET);
705                 result.setTime(result.getTime() - timeZoneOffset);
706                 result.setNanos(nano);
707             }
708             if (agent_.loggingEnabled()) {
709                 agent_.logWriter_.traceExit(this, "getTimestamp", result);
710             }
711             return result;
712         }
713     }
714
715     public String JavaDoc getString(int parameterIndex) throws SQLException JavaDoc {
716         try
717         {
718             synchronized (connection_) {
719                 if (agent_.loggingEnabled()) {
720                     agent_.logWriter_.traceEntry(this, "getString", parameterIndex);
721                 }
722                 String JavaDoc result = getStringX(parameterIndex);
723                 if (agent_.loggingEnabled()) {
724                     agent_.logWriter_.traceExit(this, "getString", result);
725                 }
726                 return result;
727             }
728         }
729         catch ( SqlException se )
730         {
731             throw se.getSQLException();
732         }
733     }
734
735     // also used by SQLCA
736
String JavaDoc getStringX(int parameterIndex) throws SqlException {
737         super.checkForClosedStatement();
738         parameterIndex = checkForEscapedCallWithResult(parameterIndex);
739         if (parameterIndex == 0 && escapedProcedureCallWithResult_) {
740             this.wasNull_ = this.WAS_NOT_NULL;
741             return Integer.toString(returnValueFromProcedure_);
742         }
743         checkGetterPreconditions(parameterIndex);
744         setWasNull(parameterIndex);
745         return wasNullX() ? null : singletonRowData_.getString(parameterIndex);
746     }
747
748     public byte[] getBytes(int parameterIndex) throws SQLException JavaDoc {
749         try
750         {
751             synchronized (connection_) {
752                 if (agent_.loggingEnabled()) {
753                     agent_.logWriter_.traceEntry(this, "getBytes", parameterIndex);
754                 }
755                 super.checkForClosedStatement();
756                 parameterIndex = checkForEscapedCallWithResult(parameterIndex);
757                 if (parameterIndex == 0 && escapedProcedureCallWithResult_) {
758                     throw new SqlException(agent_.logWriter_,
759                         new ClientMessageId(SQLState.INVALID_PARAM_USE_GETINT));
760                 }
761                 checkGetterPreconditions(parameterIndex);
762                 setWasNull(parameterIndex);
763                 byte[] result = wasNullX() ? null : singletonRowData_.getBytes(parameterIndex);
764                 if (agent_.loggingEnabled()) {
765                     agent_.logWriter_.traceExit(this, "getBytes", result);
766                 }
767                 return result;
768             }
769         }
770         catch ( SqlException se )
771         {
772             throw se.getSQLException();
773         }
774     }
775
776     public java.sql.Blob JavaDoc getBlob(int parameterIndex) throws SQLException JavaDoc {
777         try
778         {
779             synchronized (connection_) {
780                 if (agent_.loggingEnabled()) {
781                     agent_.logWriter_.traceEntry(this, "getBlob", parameterIndex);
782                 }
783                 super.checkForClosedStatement();
784                 parameterIndex = checkForEscapedCallWithResult(parameterIndex);
785                 if (parameterIndex == 0 && escapedProcedureCallWithResult_) {
786                     throw new SqlException(agent_.logWriter_,
787                         new ClientMessageId(SQLState.INVALID_PARAM_USE_GETINT));
788                 }
789                 checkGetterPreconditions(parameterIndex);
790                 setWasNull(parameterIndex);
791                 java.sql.Blob JavaDoc result = wasNullX() ? null : singletonRowData_.getBlob(parameterIndex);
792                 if (agent_.loggingEnabled()) {
793                     agent_.logWriter_.traceExit(this, "getBlob", result);
794                 }
795                 return result;
796             }
797         }
798         catch ( SqlException se )
799         {
800             throw se.getSQLException();
801         }
802     }
803
804     public java.sql.Clob JavaDoc getClob(int parameterIndex) throws SQLException JavaDoc {
805         try
806         {
807             synchronized (connection_) {
808                 super.checkForClosedStatement();
809                 parameterIndex = checkForEscapedCallWithResult(parameterIndex);
810                 if (parameterIndex == 0 && escapedProcedureCallWithResult_) {
811                     throw new SqlException(agent_.logWriter_,
812                         new ClientMessageId(SQLState.INVALID_PARAM_USE_GETINT));
813                 }
814                 checkGetterPreconditions(parameterIndex);
815                 setWasNull(parameterIndex);
816                 java.sql.Clob JavaDoc result = wasNullX() ? null : singletonRowData_.getClob(parameterIndex);
817                 if (agent_.loggingEnabled()) {
818                     agent_.logWriter_.traceExit(this, "getClob", result);
819                 }
820                 return result;
821             }
822         }
823         catch ( SqlException se )
824         {
825             throw se.getSQLException();
826         }
827     }
828
829     public java.sql.Array JavaDoc getArray(int parameterIndex) throws SQLException JavaDoc {
830         try
831         {
832             synchronized (connection_) {
833                 if (agent_.loggingEnabled()) {
834                     agent_.logWriter_.traceEntry(this, "getArray", parameterIndex);
835                 }
836                 super.checkForClosedStatement();
837                 parameterIndex = checkForEscapedCallWithResult(parameterIndex);
838                 if (parameterIndex == 0 && escapedProcedureCallWithResult_) {
839                     throw new SqlException(agent_.logWriter_,
840                         new ClientMessageId(SQLState.INVALID_PARAM_USE_GETINT));
841                 }
842                 checkGetterPreconditions(parameterIndex);
843                 setWasNull(parameterIndex);
844                 java.sql.Array JavaDoc result = wasNullX() ? null : singletonRowData_.getArray(parameterIndex);
845                 if (true) {
846                     throw new SqlException(agent_.logWriter_,
847                         new ClientMessageId(SQLState.JDBC_METHOD_NOT_IMPLEMENTED));
848                 }
849                 if (agent_.loggingEnabled()) {
850                     agent_.logWriter_.traceExit(this, "getArray", result);
851                 }
852                 return result;
853             }
854         }
855         catch ( SqlException se )
856         {
857             throw se.getSQLException();
858         }
859     }
860
861     public java.sql.Ref JavaDoc getRef(int parameterIndex) throws SQLException JavaDoc {
862         try
863         {
864             synchronized (connection_) {
865                 if (agent_.loggingEnabled()) {
866                     agent_.logWriter_.traceEntry(this, "getRef", parameterIndex);
867                 }
868                 super.checkForClosedStatement();
869                 parameterIndex = checkForEscapedCallWithResult(parameterIndex);
870                 if (parameterIndex == 0 && escapedProcedureCallWithResult_) {
871                     throw new SqlException(agent_.logWriter_,
872                         new ClientMessageId(SQLState.INVALID_PARAM_USE_GETINT));
873                 }
874                 checkGetterPreconditions(parameterIndex);
875                 setWasNull(parameterIndex);
876                 java.sql.Ref JavaDoc result = wasNullX() ? null : singletonRowData_.getRef(parameterIndex);
877                 if (true) {
878                     throw new SqlException(agent_.logWriter_,
879                         new ClientMessageId(SQLState.JDBC_METHOD_NOT_IMPLEMENTED));
880                 }
881                 if (agent_.loggingEnabled()) {
882                     agent_.logWriter_.traceExit(this, "getRef", result);
883                 }
884                 return result;
885             }
886         }
887         catch ( SqlException se )
888         {
889             throw se.getSQLException();
890         }
891     }
892
893     public Object JavaDoc getObject(int parameterIndex) throws SQLException JavaDoc {
894         try
895         {
896             synchronized (connection_) {
897                 if (agent_.loggingEnabled()) {
898                     agent_.logWriter_.traceEntry(this, "getObject", parameterIndex);
899                 }
900                 super.checkForClosedStatement();
901                 parameterIndex = checkForEscapedCallWithResult(parameterIndex);
902                 Object JavaDoc result;
903                 if (parameterIndex == 0 && escapedProcedureCallWithResult_) {
904                     result = new Integer JavaDoc(returnValueFromProcedure_);
905                     this.wasNull_ = this.WAS_NOT_NULL;
906                     if (agent_.loggingEnabled()) {
907                         agent_.logWriter_.traceExit(this, "getObject", result);
908                     }
909                     return result;
910                 }
911                 checkGetterPreconditions(parameterIndex);
912                 setWasNull(parameterIndex);
913                 result = wasNullX() ? null : singletonRowData_.getObject(parameterIndex);
914                 if (agent_.loggingEnabled()) {
915                     agent_.logWriter_.traceExit(this, "getObject", result);
916                 }
917                 return result;
918             }
919         }
920         catch ( SqlException se )
921         {
922             throw se.getSQLException();
923         }
924     }
925
926     public Object JavaDoc getObject(int parameterIndex, java.util.Map JavaDoc map) throws SQLException JavaDoc {
927         try
928         {
929             synchronized (connection_) {
930                 if (agent_.loggingEnabled()) {
931                     agent_.logWriter_.traceEntry(this, "getObject", parameterIndex, map);
932                 }
933                 super.checkForClosedStatement();
934                 parameterIndex = checkForEscapedCallWithResult(parameterIndex);
935                 Object JavaDoc result;
936                 checkGetterPreconditions(parameterIndex);
937                 if (true) {
938                     throw new SqlException(agent_.logWriter_,
939                         new ClientMessageId(SQLState.JDBC_METHOD_NOT_IMPLEMENTED));
940                 }
941                 if (agent_.loggingEnabled()) {
942                     agent_.logWriter_.traceExit(this, "getObject", result);
943                 }
944                 return result;
945             }
946         }
947         catch ( SqlException se )
948         {
949             throw se.getSQLException();
950         }
951     }
952
953     //--------------------------JDBC 3.0------------------------------------------
954

955     public void registerOutParameter(String JavaDoc parameterName, int sqlType) throws SQLException JavaDoc {
956         if (agent_.loggingEnabled()) {
957             agent_.logWriter_.traceEntry(this, "registerOutParameter", parameterName, sqlType);
958         }
959         throw jdbcMethodNotImplemented();
960     }
961
962     public void registerOutParameter(String JavaDoc parameterName, int sqlType, int scale) throws SQLException JavaDoc {
963         if (agent_.loggingEnabled()) {
964             agent_.logWriter_.traceEntry(this, "registerOutParameter", parameterName, sqlType, scale);
965         }
966         throw jdbcMethodNotImplemented();
967     }
968
969     public void registerOutParameter(String JavaDoc parameterName, int sqlType, String JavaDoc typeName) throws SQLException JavaDoc {
970         if (agent_.loggingEnabled()) {
971             agent_.logWriter_.traceEntry(this, "registerOutParameter", parameterName, sqlType, typeName);
972         }
973         throw jdbcMethodNotImplemented();
974     }
975
976     public java.net.URL JavaDoc getURL(int parameterIndex) throws SQLException JavaDoc {
977         if (agent_.loggingEnabled()) {
978             agent_.logWriter_.traceEntry(this, "getURL", parameterIndex);
979         }
980         throw jdbcMethodNotImplemented();
981     }
982
983     public void setURL(String JavaDoc parameterName, java.net.URL JavaDoc x) throws SQLException JavaDoc {
984         if (agent_.loggingEnabled()) {
985             agent_.logWriter_.traceEntry(this, "setURL", parameterName, x);
986         }
987         throw jdbcMethodNotImplemented();
988     }
989
990     public void setNull(String JavaDoc parameterName, int sqlType) throws SQLException JavaDoc {
991         if (agent_.loggingEnabled()) {
992             agent_.logWriter_.traceEntry(this, "setNull", parameterName, sqlType);
993         }
994         throw jdbcMethodNotImplemented();
995     }
996
997     public void setBoolean(String JavaDoc parameterName, boolean x) throws SQLException JavaDoc {
998         if (agent_.loggingEnabled()) {
999             agent_.logWriter_.traceEntry(this, "setBoolean", parameterName, x);
1000        }
1001        throw jdbcMethodNotImplemented();
1002    }
1003
1004    public void setByte(String JavaDoc parameterName, byte x) throws SQLException JavaDoc {
1005        if (agent_.loggingEnabled()) {
1006            agent_.logWriter_.traceEntry(this, "setByte", parameterName, x);
1007        }
1008        throw jdbcMethodNotImplemented();
1009    }
1010
1011    public void setShort(String JavaDoc parameterName, short x) throws SQLException JavaDoc {
1012        if (agent_.loggingEnabled()) {
1013            agent_.logWriter_.traceEntry(this, "setShort", parameterName, x);
1014        }
1015        throw jdbcMethodNotImplemented();
1016    }
1017
1018    public void setInt(String JavaDoc parameterName, int x) throws SQLException JavaDoc {
1019        if (agent_.loggingEnabled()) {
1020            agent_.logWriter_.traceEntry(this, "setInt", parameterName, x);
1021        }
1022        throw jdbcMethodNotImplemented();
1023    }
1024
1025    public void setLong(String JavaDoc parameterName, long x) throws SQLException JavaDoc {
1026        if (agent_.loggingEnabled()) {
1027            agent_.logWriter_.traceEntry(this, "setLong", parameterName, x);
1028        }
1029        throw jdbcMethodNotImplemented();
1030    }
1031
1032    public void setFloat(String JavaDoc parameterName, float x) throws SQLException JavaDoc {
1033        if (agent_.loggingEnabled()) {
1034            agent_.logWriter_.traceEntry(this, "setFloat", parameterName, x);
1035        }
1036        throw jdbcMethodNotImplemented();
1037    }
1038
1039    public void setDouble(String JavaDoc parameterName, double x) throws SQLException JavaDoc {
1040        if (agent_.loggingEnabled()) {
1041            agent_.logWriter_.traceEntry(this, "setDouble", parameterName, x);
1042        }
1043        throw jdbcMethodNotImplemented();
1044    }
1045
1046    public void setBigDecimal(String JavaDoc parameterName, java.math.BigDecimal JavaDoc x) throws SQLException JavaDoc {
1047        if (agent_.loggingEnabled()) {
1048            agent_.logWriter_.traceEntry(this, "setBigDecimal", parameterName, x);
1049        }
1050        throw jdbcMethodNotImplemented();
1051    }
1052
1053    public void setString(String JavaDoc parameterName, String JavaDoc x) throws SQLException JavaDoc {
1054        if (agent_.loggingEnabled()) {
1055            agent_.logWriter_.traceEntry(this, "setString", parameterName, x);
1056        }
1057        throw jdbcMethodNotImplemented();
1058    }
1059
1060    public void setBytes(String JavaDoc parameterName, byte x[]) throws SQLException JavaDoc {
1061        if (agent_.loggingEnabled()) {
1062            agent_.logWriter_.traceEntry(this, "setBytes", parameterName, x);
1063        }
1064        throw jdbcMethodNotImplemented();
1065    }
1066
1067    public void setDate(String JavaDoc parameterName, java.sql.Date JavaDoc x) throws SQLException JavaDoc {
1068        if (agent_.loggingEnabled()) {
1069            agent_.logWriter_.traceEntry(this, "setDate", parameterName, x);
1070        }
1071        throw jdbcMethodNotImplemented();
1072    }
1073
1074    public void setTime(String JavaDoc parameterName, java.sql.Time JavaDoc x) throws SQLException JavaDoc {
1075        if (agent_.loggingEnabled()) {
1076            agent_.logWriter_.traceEntry(this, "setTime", parameterName, x);
1077        }
1078        throw jdbcMethodNotImplemented();
1079    }
1080
1081    public void setTimestamp(String JavaDoc parameterName, java.sql.Timestamp JavaDoc x) throws SQLException JavaDoc {
1082        if (agent_.loggingEnabled()) {
1083            agent_.logWriter_.traceEntry(this, "setTimestamp", parameterName, x);
1084        }
1085        throw jdbcMethodNotImplemented();
1086    }
1087
1088    public void setAsciiStream(String JavaDoc parameterName, java.io.InputStream JavaDoc x, int length) throws SQLException JavaDoc {
1089        if (agent_.loggingEnabled()) {
1090            agent_.logWriter_.traceEntry(this, "setAsciiStream", parameterName, x, length);
1091        }
1092        throw jdbcMethodNotImplemented();
1093    }
1094
1095    public void setBinaryStream(String JavaDoc parameterName, java.io.InputStream JavaDoc x, int length) throws SQLException JavaDoc {
1096        if (agent_.loggingEnabled()) {
1097            agent_.logWriter_.traceEntry(this, "setBinaryStream", parameterName, x, length);
1098        }
1099        throw jdbcMethodNotImplemented();
1100    }
1101
1102    public void setObject(String JavaDoc parameterName, Object JavaDoc x, int targetSqlType, int scale) throws SQLException JavaDoc {
1103        if (agent_.loggingEnabled()) {
1104            agent_.logWriter_.traceEntry(this, "setObject", parameterName, x, targetSqlType, scale);
1105        }
1106        throw jdbcMethodNotImplemented();
1107    }
1108
1109    public void setObject(String JavaDoc parameterName, Object JavaDoc x, int targetSqlType) throws SQLException JavaDoc {
1110        if (agent_.loggingEnabled()) {
1111            agent_.logWriter_.traceEntry(this, "setObject", parameterName, x, targetSqlType);
1112        }
1113        throw jdbcMethodNotImplemented();
1114    }
1115
1116    public void setObject(String JavaDoc parameterName, Object JavaDoc x) throws SQLException JavaDoc {
1117        if (agent_.loggingEnabled()) {
1118            agent_.logWriter_.traceEntry(this, "setObject", parameterName, x);
1119        }
1120        throw jdbcMethodNotImplemented();
1121    }
1122
1123    public void setCharacterStream(String JavaDoc parameterName, java.io.Reader JavaDoc reader, int length) throws SQLException JavaDoc {
1124        if (agent_.loggingEnabled()) {
1125            agent_.logWriter_.traceEntry(this, "setCharacterStream", parameterName, reader, length);
1126        }
1127        throw jdbcMethodNotImplemented();
1128    }
1129
1130    public void setDate(String JavaDoc parameterName, java.sql.Date JavaDoc x, java.util.Calendar JavaDoc calendar) throws SQLException JavaDoc {
1131        if (agent_.loggingEnabled()) {
1132            agent_.logWriter_.traceEntry(this, "setDate", parameterName, x, calendar);
1133        }
1134        throw jdbcMethodNotImplemented();
1135    }
1136
1137    public void setTime(String JavaDoc parameterName, java.sql.Time JavaDoc x, java.util.Calendar JavaDoc calendar) throws SQLException JavaDoc {
1138        if (agent_.loggingEnabled()) {
1139            agent_.logWriter_.traceEntry(this, "setTime", parameterName, x, calendar);
1140        }
1141        throw jdbcMethodNotImplemented();
1142    }
1143
1144    public void setTimestamp(String JavaDoc parameterName, java.sql.Timestamp JavaDoc x, java.util.Calendar JavaDoc calendar) throws SQLException JavaDoc {
1145        if (agent_.loggingEnabled()) {
1146            agent_.logWriter_.traceEntry(this, "setTimestamp", parameterName, x, calendar);
1147        }
1148        throw jdbcMethodNotImplemented();
1149    }
1150
1151    public void setNull(String JavaDoc parameterName, int sqlType, String JavaDoc typeName) throws SQLException JavaDoc {
1152        if (agent_.loggingEnabled()) {
1153            agent_.logWriter_.traceEntry(this, "setNull", parameterName, sqlType, typeName);
1154        }
1155        throw jdbcMethodNotImplemented();
1156    }
1157
1158    public String JavaDoc getString(String JavaDoc parameterName) throws SQLException JavaDoc {
1159        if (agent_.loggingEnabled()) {
1160            agent_.logWriter_.traceEntry(this, "getString", parameterName);
1161        }
1162        throw jdbcMethodNotImplemented();
1163    }
1164
1165    public boolean getBoolean(String JavaDoc parameterName) throws SQLException JavaDoc {
1166        if (agent_.loggingEnabled()) {
1167            agent_.logWriter_.traceEntry(this, "getBoolean", parameterName);
1168        }
1169        throw jdbcMethodNotImplemented();
1170    }
1171
1172    public byte getByte(String JavaDoc parameterName) throws SQLException JavaDoc {
1173        if (agent_.loggingEnabled()) {
1174            agent_.logWriter_.traceEntry(this, "getByte", parameterName);
1175        }
1176        throw jdbcMethodNotImplemented();
1177    }
1178
1179    public short getShort(String JavaDoc parameterName) throws SQLException JavaDoc {
1180        if (agent_.loggingEnabled()) {
1181            agent_.logWriter_.traceEntry(this, "getShort", parameterName);
1182        }
1183        throw jdbcMethodNotImplemented();
1184    }
1185
1186    public int getInt(String JavaDoc parameterName) throws SQLException JavaDoc {
1187        if (agent_.loggingEnabled()) {
1188            agent_.logWriter_.traceEntry(this, "getInt", parameterName);
1189        }
1190        throw jdbcMethodNotImplemented();
1191    }
1192
1193    public long getLong(String JavaDoc parameterName) throws SQLException JavaDoc {
1194        if (agent_.loggingEnabled()) {
1195            agent_.logWriter_.traceEntry(this, "getLong", parameterName);
1196        }
1197        throw jdbcMethodNotImplemented();
1198    }
1199
1200    public float getFloat(String JavaDoc parameterName) throws SQLException JavaDoc {
1201        if (agent_.loggingEnabled()) {
1202            agent_.logWriter_.traceEntry(this, "getFloat", parameterName);
1203        }
1204        throw jdbcMethodNotImplemented();
1205    }
1206
1207    public double getDouble(String JavaDoc parameterName) throws SQLException JavaDoc {
1208        if (agent_.loggingEnabled()) {
1209            agent_.logWriter_.traceEntry(this, "getDouble", parameterName);
1210        }
1211        throw jdbcMethodNotImplemented();
1212    }
1213
1214    public byte[] getBytes(String JavaDoc parameterName) throws SQLException JavaDoc {
1215        if (agent_.loggingEnabled()) {
1216            agent_.logWriter_.traceEntry(this, "getBytes", parameterName);
1217        }
1218        throw jdbcMethodNotImplemented();
1219    }
1220
1221    public java.sql.Date JavaDoc getDate(String JavaDoc parameterName) throws SQLException JavaDoc {
1222        if (agent_.loggingEnabled()) {
1223            agent_.logWriter_.traceEntry(this, "getDate", parameterName);
1224        }
1225        throw jdbcMethodNotImplemented();
1226    }
1227
1228    public java.sql.Time JavaDoc getTime(String JavaDoc parameterName) throws SQLException JavaDoc {
1229        if (agent_.loggingEnabled()) {
1230            agent_.logWriter_.traceEntry(this, "getTime", parameterName);
1231        }
1232        throw jdbcMethodNotImplemented();
1233    }
1234
1235    public java.sql.Timestamp JavaDoc getTimestamp(String JavaDoc parameterName) throws SQLException JavaDoc {
1236        if (agent_.loggingEnabled()) {
1237            agent_.logWriter_.traceEntry(this, "getTimestamp", parameterName);
1238        }
1239        throw jdbcMethodNotImplemented();
1240    }
1241
1242    public Object JavaDoc getObject(String JavaDoc parameterName) throws SQLException JavaDoc {
1243        if (agent_.loggingEnabled()) {
1244            agent_.logWriter_.traceEntry(this, "getObject", parameterName);
1245        }
1246        throw jdbcMethodNotImplemented();
1247    }
1248
1249    public java.math.BigDecimal JavaDoc getBigDecimal(String JavaDoc parameterName) throws SQLException JavaDoc {
1250        if (agent_.loggingEnabled()) {
1251            agent_.logWriter_.traceEntry(this, "getBigDecimal", parameterName);
1252        }
1253        throw jdbcMethodNotImplemented();
1254    }
1255
1256    public Object JavaDoc getObject(String JavaDoc parameterName, java.util.Map JavaDoc map) throws SQLException JavaDoc {
1257        if (agent_.loggingEnabled()) {
1258            agent_.logWriter_.traceEntry(this, "getObject", parameterName, map);
1259            }
1260        throw jdbcMethodNotImplemented();
1261    }
1262
1263    public java.sql.Ref JavaDoc getRef(String JavaDoc parameterName) throws SQLException JavaDoc {
1264        if (agent_.loggingEnabled()) {
1265            agent_.logWriter_.traceEntry(this, "getRef", parameterName);
1266        }
1267        throw jdbcMethodNotImplemented();
1268    }
1269
1270    public java.sql.Blob JavaDoc getBlob(String JavaDoc parameterName) throws SQLException JavaDoc {
1271        if (agent_.loggingEnabled()) {
1272            agent_.logWriter_.traceEntry(this, "getBlob", parameterName);
1273        }
1274        throw jdbcMethodNotImplemented();
1275    }
1276
1277    public java.sql.Clob JavaDoc getClob(String JavaDoc parameterName) throws SQLException JavaDoc {
1278        if (agent_.loggingEnabled()) {
1279            agent_.logWriter_.traceEntry(this, "getClob", parameterName);
1280        }
1281        throw jdbcMethodNotImplemented();
1282    }
1283
1284    public java.sql.Array JavaDoc getArray(String JavaDoc parameterName) throws SQLException JavaDoc {
1285        if (agent_.loggingEnabled()) {
1286            agent_.logWriter_.traceEntry(this, "getArray", parameterName);
1287        }
1288        throw jdbcMethodNotImplemented();
1289    }
1290
1291    public java.sql.Date JavaDoc getDate(String JavaDoc parameterName, java.util.Calendar JavaDoc calendar) throws SQLException JavaDoc {
1292        if (agent_.loggingEnabled()) {
1293            agent_.logWriter_.traceEntry(this, "getDate", parameterName, calendar);
1294        }
1295        throw jdbcMethodNotImplemented();
1296    }
1297
1298    public java.sql.Time JavaDoc getTime(String JavaDoc parameterName, java.util.Calendar JavaDoc calendar) throws SQLException JavaDoc {
1299        if (agent_.loggingEnabled()) {
1300            agent_.logWriter_.traceEntry(this, "getTime", parameterName, calendar);
1301        }
1302        throw jdbcMethodNotImplemented();
1303    }
1304
1305    public java.sql.Timestamp JavaDoc getTimestamp(String JavaDoc parameterName, java.util.Calendar JavaDoc calendar) throws SQLException JavaDoc {
1306        if (agent_.loggingEnabled()) {
1307            agent_.logWriter_.traceEntry(this, "getTimestamp", parameterName, calendar);
1308        }
1309        throw jdbcMethodNotImplemented();
1310    }
1311
1312    public java.net.URL JavaDoc getURL(String JavaDoc parameterName) throws SQLException JavaDoc {
1313        if (agent_.loggingEnabled()) {
1314            agent_.logWriter_.traceEntry(this, "getURL", parameterName);
1315        }
1316        throw jdbcMethodNotImplemented();
1317    }
1318
1319    //-------------------------- JDBC 4.0 methods --------------------------------
1320

1321    public Reader JavaDoc getCharacterStream(int parameterIndex)
1322        throws SQLException JavaDoc {
1323        try {
1324            synchronized (connection_) {
1325                if (agent_.loggingEnabled()) {
1326                    agent_.logWriter_.traceEntry(this, "getCharacterStream", parameterIndex);
1327                }
1328                super.checkForClosedStatement();
1329                parameterIndex = checkForEscapedCallWithResult(parameterIndex);
1330                checkGetterPreconditions(parameterIndex);
1331                setWasNull(parameterIndex);
1332                Reader JavaDoc reader = null;
1333                if (this.wasNull_ == WAS_NOT_NULL) {
1334                    reader = singletonRowData_.getCharacterStream(parameterIndex);
1335                }
1336                if (agent_.loggingEnabled()) {
1337                    agent_.logWriter_.traceExit(this, "getCharacterStream", reader);
1338                }
1339                return reader;
1340            }
1341             
1342        } catch (SqlException se) {
1343            throw se.getSQLException();
1344        }
1345    }
1346    
1347    //----------------------------helper methods----------------------------------
1348

1349    /**
1350     * Returns the name of the java.sql interface implemented by this class.
1351     * @return name of java.sql interface
1352     */

1353    protected String JavaDoc getJdbcStatementInterfaceName() {
1354        return "java.sql.CallableStatement";
1355    }
1356
1357    private int checkForEscapedCallWithResult(int parameterIndex) throws SqlException {
1358        if (escapedProcedureCallWithResult_) {
1359            parameterIndex--;
1360        }
1361        return parameterIndex;
1362    }
1363
1364    private int checkForEscapedCallWithResult(int parameterIndex, int jdbcType) throws SqlException {
1365        if (escapedProcedureCallWithResult_) {
1366            if (parameterIndex == 1 && jdbcType != java.sql.Types.INTEGER) {
1367                throw new SqlException(agent_.logWriter_,
1368                    new ClientMessageId(SQLState.RETURN_PARAM_MUST_BE_INT));
1369            } else {
1370                parameterIndex--;
1371            }
1372        }
1373        return parameterIndex;
1374    }
1375
1376    private void checkGetterPreconditions(int parameterIndex) throws SqlException {
1377        super.checkForValidParameterIndex(parameterIndex);
1378        checkForValidOutParameter(parameterIndex);
1379    }
1380
1381    private void checkForValidOutParameter(int parameterIndex) throws SqlException {
1382        if (parameterMetaData_ == null || parameterMetaData_.sqlxParmmode_[parameterIndex - 1] < java.sql.ParameterMetaData.parameterModeInOut) {
1383            throw new SqlException(agent_.logWriter_,
1384                new ClientMessageId(SQLState.PARAM_NOT_OUT_OR_INOUT),
1385                new Integer JavaDoc(parameterIndex));
1386        }
1387    }
1388
1389    private void setWasNull(int parameterIndex) {
1390        if (singletonRowData_ == null) {
1391            wasNull_ = WAS_NULL_UNSET;
1392        } else {
1393            wasNull_ = singletonRowData_.isNull_[parameterIndex - 1] ? WAS_NULL : WAS_NOT_NULL;
1394        }
1395    }
1396    
1397    private SQLException JavaDoc jdbcMethodNotImplemented() throws SQLException JavaDoc
1398    {
1399        try
1400        {
1401            super.checkForClosedStatement();
1402        }
1403        catch ( SqlException se )
1404        {
1405            throw se.getSQLException();
1406        }
1407        return new SqlException(agent_.logWriter_,
1408            new ClientMessageId(SQLState.JDBC_METHOD_NOT_IMPLEMENTED)).getSQLException();
1409    }
1410}
1411
1412
Popular Tags