Source Code Cross Referenced for EmbedCallableStatement20.java in  » Database-DBMS » db-derby-10.2 » org » apache » derby » impl » jdbc » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Database DBMS » db derby 10.2 » org.apache.derby.impl.jdbc 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


0001:        /*
0002:
0003:           Derby - Class org.apache.derby.impl.jdbc.EmbedCallableStatement20
0004:
0005:           Licensed to the Apache Software Foundation (ASF) under one or more
0006:           contributor license agreements.  See the NOTICE file distributed with
0007:           this work for additional information regarding copyright ownership.
0008:           The ASF licenses this file to you under the Apache License, Version 2.0
0009:           (the "License"); you may not use this file except in compliance with
0010:           the License.  You may obtain a copy of the License at
0011:
0012:              http://www.apache.org/licenses/LICENSE-2.0
0013:
0014:           Unless required by applicable law or agreed to in writing, software
0015:           distributed under the License is distributed on an "AS IS" BASIS,
0016:           WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
0017:           See the License for the specific language governing permissions and
0018:           limitations under the License.
0019:
0020:         */
0021:
0022:        package org.apache.derby.impl.jdbc;
0023:
0024:        import java.math.BigDecimal;
0025:        import java.sql.CallableStatement;
0026:        import java.sql.SQLException;
0027:        import java.sql.Date;
0028:        import java.sql.Time;
0029:        import java.sql.Timestamp;
0030:        import java.sql.Types;
0031:
0032:        /* ---- New jdbc 2.0 types ----- */
0033:        import java.sql.Array;
0034:        import java.sql.Blob;
0035:        import java.sql.Clob;
0036:        import java.sql.Ref;
0037:
0038:        import java.net.URL;
0039:        import java.util.Map;
0040:
0041:        import java.io.ByteArrayInputStream;
0042:        import java.io.InputStream;
0043:        import java.io.InputStreamReader;
0044:        import java.io.Reader;
0045:        import java.io.StringReader;
0046:        import java.io.UnsupportedEncodingException;
0047:
0048:        import java.util.Calendar;
0049:
0050:        import org.apache.derby.iapi.error.StandardException;
0051:
0052:        import org.apache.derby.iapi.services.io.StreamStorable;
0053:        import org.apache.derby.iapi.sql.conn.StatementContext;
0054:        import org.apache.derby.iapi.reference.JDBC30Translation;
0055:        import org.apache.derby.iapi.reference.SQLState;
0056:        import org.apache.derby.iapi.types.DataValueDescriptor;
0057:
0058:        import org.apache.derby.impl.jdbc.Util;
0059:        import org.apache.derby.impl.jdbc.EmbedConnection;
0060:        import org.apache.derby.impl.jdbc.EmbedResultSet;
0061:
0062:        /**
0063:         * This class extends the EmbedCallableStatement class in order to support new
0064:         * methods and classes that come with JDBC 2.0.
0065:         *
0066:         *	@see org.apache.derby.impl.jdbc.EmbedCallableStatement
0067:         *
0068:         *	@author francois
0069:         */
0070:        public class EmbedCallableStatement20 extends
0071:                org.apache.derby.impl.jdbc.EmbedCallableStatement {
0072:
0073:            //////////////////////////////////////////////////////////////
0074:            //
0075:            // CONSTRUCTORS
0076:            //
0077:            //////////////////////////////////////////////////////////////
0078:            public EmbedCallableStatement20(EmbedConnection conn, String sql,
0079:                    int resultSetType, int resultSetConcurrency,
0080:                    int resultSetHoldability) throws SQLException {
0081:                super (conn, sql, resultSetType, resultSetConcurrency,
0082:                        resultSetHoldability);
0083:            }
0084:
0085:            /////////////////////////////////////////////////////////////////////////
0086:            //
0087:            //	JDBC 2.0	-	New public methods
0088:            //
0089:            /////////////////////////////////////////////////////////////////////////
0090:
0091:            /**
0092:             * JDBC 2.0
0093:             *
0094:             * Get the value of a NUMERIC parameter as a java.math.BigDecimal object.
0095:             *
0096:             * @param parameterIndex the first parameter is 1, the second is 2, ...
0097:             * @return the parameter value (full precision); if the value is SQL NULL, 
0098:             * the result is null 
0099:             * @exception SQLException if a database-access error occurs.
0100:             */
0101:            public BigDecimal getBigDecimal(int parameterIndex)
0102:                    throws SQLException {
0103:                checkStatus();
0104:                try {
0105:                    DataValueDescriptor dvd = getParms().getParameterForGet(
0106:                            parameterIndex - 1);
0107:                    if (wasNull = dvd.isNull())
0108:                        return null;
0109:
0110:                    return org.apache.derby.iapi.types.SQLDecimal
0111:                            .getBigDecimal(dvd);
0112:
0113:                } catch (StandardException e) {
0114:                    throw EmbedResultSet.noStateChangeException(e);
0115:                }
0116:            }
0117:
0118:            /**
0119:             * JDBC 2.0
0120:             *
0121:             * Returns an object representing the value of OUT parameter @i.
0122:             * Use the @map to determine the class from which to construct 
0123:             * data of SQL structured and distinct types.
0124:             *
0125:             * @param i the first parameter is 1, the second is 2, ...
0126:             * @param map the mapping from SQL type names to Java classes
0127:             * @return a java.lang.Object holding the OUT parameter value.
0128:             * @exception SQLException if a database-access error occurs.
0129:             */
0130:            public Object getObject(int i, java.util.Map map)
0131:                    throws SQLException {
0132:                checkStatus();
0133:                if (map == null)
0134:                    throw Util.generateCsSQLException(
0135:                            SQLState.INVALID_API_PARAMETER, map, "map",
0136:                            "java.sql.CallableStatement.getObject");
0137:                if (!(map.isEmpty()))
0138:                    throw Util.notImplemented();
0139:                // Map is empty call the normal getObject method.
0140:                return getObject(i);
0141:            }
0142:
0143:            /**
0144:             * JDBC 2.0
0145:             *
0146:             * Get a REF(<structured-type>) OUT parameter.
0147:             *
0148:             * @param i the first parameter is 1, the second is 2, ...
0149:             * @return an object representing data of an SQL REF Type
0150:             * @exception SQLException if a database-access error occurs.
0151:             */
0152:            public Ref getRef(int i) throws SQLException {
0153:                throw Util.notImplemented();
0154:            }
0155:
0156:            /**
0157:             * JDBC 2.0
0158:             *
0159:             * Get an Array OUT parameter.
0160:             *
0161:             * @param i the first parameter is 1, the second is 2, ...
0162:             * @return an object representing an SQL array
0163:             * @exception SQLException if a database-access error occurs.
0164:             */
0165:            public Array getArray(int i) throws SQLException {
0166:                throw Util.notImplemented();
0167:            }
0168:
0169:            /*
0170:             * Note: all the JDBC 2.0 Prepared statement methods are duplicated in here
0171:             * because this class inherits from Local/EmbedCallableStatement, which
0172:             * inherits from local/PreparedStatement.  This class should inherit from a
0173:             * local20/PreparedStatement.  Since java does not allow multiple inheritance,
0174:             * duplicate the code here.
0175:             */
0176:
0177:            /**
0178:             * JDBC 2.0
0179:             *
0180:             * Set a REF(<structured-type>) parameter.
0181:             *
0182:             * @param i the first parameter is 1, the second is 2, ...
0183:             * @param x an object representing data of an SQL REF Type
0184:             * @exception SQLException Feature not implemented for now.
0185:             */
0186:            public void setRef(int i, Ref x) throws SQLException {
0187:                throw Util.notImplemented();
0188:            }
0189:
0190:            /**
0191:             * JDBC 2.0
0192:             *
0193:             * Set an Array parameter.
0194:             *
0195:             * @param i the first parameter is 1, the second is 2, ...
0196:             * @param x an object representing an SQL array
0197:             * @exception SQLException Feature not implemented for now.
0198:             */
0199:            public void setArray(int i, Array x) throws SQLException {
0200:                throw Util.notImplemented();
0201:            }
0202:
0203:            /////////////////////////////////////////////////////////////////////////
0204:            //
0205:            //	JDBC 3.0	-	New public methods
0206:            //
0207:            /////////////////////////////////////////////////////////////////////////
0208:
0209:            /**
0210:             * JDBC 3.0
0211:             *
0212:             * Registers the OUT parameter named parameterName to the JDBC type sqlType.
0213:             * All OUT parameters must be registered before a stored procedure is executed.
0214:             *
0215:             * @param parameterName - the name of the parameter
0216:             * @param sqlType - the JDBC type code defined by java.sql.Types. If the
0217:             * parameter is of JDBC type NUMERIC or DECIMAL, the version of registerOutParameter
0218:             * that accepts a scale value should be used.
0219:             * @exception SQLException Feature not implemented for now.
0220:             */
0221:            public void registerOutParameter(String parameterName, int sqlType)
0222:                    throws SQLException {
0223:                throw Util.notImplemented();
0224:            }
0225:
0226:            /**
0227:             * JDBC 3.0
0228:             *
0229:             * Registers the designated output parameter. This version of the method
0230:             * registerOutParameter should be used for a user-named or REF output parameter.
0231:             *
0232:             * @param parameterName - the name of the parameter
0233:             * @param sqlType - the SQL type code defined by java.sql.Types.
0234:             * @param typeName - the fully-qualified name of an SQL structure type
0235:             * @exception SQLException Feature not implemented for now.
0236:             */
0237:            public void registerOutParameter(String parameterName, int sqlType,
0238:                    String typeName) throws SQLException {
0239:                throw Util.notImplemented();
0240:            }
0241:
0242:            /**
0243:             * JDBC 3.0
0244:             *
0245:             * Registers the parameter named parameterName to the JDBC type sqlType.
0246:             * This method must be called before a stored procedure is executed.
0247:             *
0248:             * @param parameterName - the name of the parameter
0249:             * @param sqlType - the SQL type code defined by java.sql.Types.
0250:             * @param scale - the desired number of digits to the right of the decimal point.
0251:             * It must be greater than or equal to zero.
0252:             * @exception SQLException Feature not implemented for now.
0253:             */
0254:            public void registerOutParameter(String parameterName, int sqlType,
0255:                    int scale) throws SQLException {
0256:                throw Util.notImplemented();
0257:            }
0258:
0259:            /**
0260:             * JDBC 3.0
0261:             *
0262:             * Retrieves the value of a JDBC REF (<structured-type) parameter as a Ref object
0263:             * in the Java programming language.
0264:             *
0265:             * @param parameterName - the name of the parameter
0266:             * @return the parameter value as a Ref object in the Java Programming language.
0267:             * If the value is SQL NULL, the result is null.
0268:             * @exception SQLException Feature not implemented for now.
0269:             */
0270:            public Ref getRef(String parameterName) throws SQLException {
0271:                throw Util.notImplemented();
0272:            }
0273:
0274:            /**
0275:             * JDBC 3.0
0276:             *
0277:             * Retrieves the value of a JDBC BLOB parameter as a Blob object
0278:             * in the Java programming language.
0279:             *
0280:             * @param parameterName - the name of the parameter
0281:             * @return the parameter value as a Blob object in the Java Programming language.
0282:             * If the value is SQL NULL, the result is null.
0283:             * @exception SQLException Feature not implemented for now.
0284:             */
0285:            public Blob getBlob(String parameterName) throws SQLException {
0286:                throw Util.notImplemented();
0287:            }
0288:
0289:            /**
0290:             * JDBC 3.0
0291:             *
0292:             * Retrieves the value of a JDBC CLOB parameter as a Clob object
0293:             * in the Java programming language.
0294:             *
0295:             * @param parameterName - the name of the parameter
0296:             * @return the parameter value as a Clob object in the Java Programming language.
0297:             * If the value is SQL NULL, the result is null.
0298:             * @exception SQLException Feature not implemented for now.
0299:             */
0300:            public Clob getClob(String parameterName) throws SQLException {
0301:                throw Util.notImplemented();
0302:            }
0303:
0304:            /**
0305:             * JDBC 3.0
0306:             *
0307:             * Retrieves the value of a JDBC ARRAY parameter as an Array object
0308:             * in the Java programming language.
0309:             *
0310:             * @param parameterName - the name of the parameter
0311:             * @return the parameter value as a Array object in the Java Programming language.
0312:             * If the value is SQL NULL, the result is null.
0313:             * @exception SQLException Feature not implemented for now.
0314:             */
0315:            public Array getArray(String parameterName) throws SQLException {
0316:                throw Util.notImplemented();
0317:            }
0318:
0319:            /**
0320:             * JDBC 3.0
0321:             *
0322:             * Sets the designated parameter to SQL NULL.
0323:             *
0324:             * @param parameterName - the name of the parameter
0325:             * @param sqlType - the SQL type code defined in java.sql.Types
0326:             * @exception SQLException Feature not implemented for now.
0327:             */
0328:            public void setNull(String parameterName, int sqlType)
0329:                    throws SQLException {
0330:                throw Util.notImplemented();
0331:            }
0332:
0333:            /**
0334:             * JDBC 3.0
0335:             *
0336:             * Sets the designated parameter to SQL NULL.
0337:             *
0338:             * @param parameterName - the name of the parameter
0339:             * @param sqlType - the SQL type code defined in java.sql.Types
0340:             * @param typeName - the fully-qualified name of an SQL user-defined type
0341:             * @exception SQLException Feature not implemented for now.
0342:             */
0343:            public void setNull(String parameterName, int sqlType,
0344:                    String typeName) throws SQLException {
0345:                throw Util.notImplemented();
0346:            }
0347:
0348:            /**
0349:             * JDBC 3.0
0350:             *
0351:             * Sets the designated parameter to the given Java boolean value. The driver
0352:             * converts this to an SQL BIT value when it sends it to the database.
0353:             *
0354:             * @param parameterName - the name of the parameter
0355:             * @param x - the parameter value
0356:             * @exception SQLException Feature not implemented for now.
0357:             */
0358:            public void setBoolean(String parameterName, boolean x)
0359:                    throws SQLException {
0360:                throw Util.notImplemented();
0361:            }
0362:
0363:            /**
0364:             * JDBC 3.0
0365:             *
0366:             * Retrieves the value of a JDBC BIT parameter as a boolean in the Java
0367:             * programming language.
0368:             *
0369:             * @param parameterName - the name of the parameter
0370:             * @return the parameter value. If the value is SQL NULL, the result is false.
0371:             * @exception SQLException Feature not implemented for now.
0372:             */
0373:            public boolean getBoolean(String parameterName) throws SQLException {
0374:                throw Util.notImplemented();
0375:            }
0376:
0377:            /**
0378:             * JDBC 3.0
0379:             *
0380:             * Sets the designated parameter to the given Java byte value. The driver
0381:             * converts this to an SQL TINYINT value when it sends it to the database.
0382:             *
0383:             * @param parameterName - the name of the parameter
0384:             * @param x - the parameter value
0385:             * @exception SQLException Feature not implemented for now.
0386:             */
0387:            public void setByte(String parameterName, byte x)
0388:                    throws SQLException {
0389:                throw Util.notImplemented();
0390:            }
0391:
0392:            /**
0393:             * JDBC 3.0
0394:             *
0395:             * Retrieves the value of a JDBC TINYINT parameter as a byte in the Java
0396:             * programming language.
0397:             *
0398:             * @param parameterName - the name of the parameter
0399:             * @return the parameter value. If the value is SQL NULL, the result is 0.
0400:             * @exception SQLException Feature not implemented for now.
0401:             */
0402:            public byte getByte(String parameterName) throws SQLException {
0403:                throw Util.notImplemented();
0404:            }
0405:
0406:            /**
0407:             * JDBC 3.0
0408:             *
0409:             * Sets the designated parameter to the given Java short value. The driver
0410:             * converts this to an SQL SMALLINT value when it sends it to the database.
0411:             *
0412:             * @param parameterName - the name of the parameter
0413:             * @param x - the parameter value
0414:             * @exception SQLException Feature not implemented for now.
0415:             */
0416:            public void setShort(String parameterName, short x)
0417:                    throws SQLException {
0418:                throw Util.notImplemented();
0419:            }
0420:
0421:            /**
0422:             * JDBC 3.0
0423:             *
0424:             * Retrieves the value of a JDBC SMALLINT parameter as a short in the Java
0425:             * programming language.
0426:             *
0427:             * @param parameterName - the name of the parameter
0428:             * @return the parameter value. If the value is SQL NULL, the result is 0.
0429:             * @exception SQLException Feature not implemented for now.
0430:             */
0431:            public short getShort(String parameterName) throws SQLException {
0432:                throw Util.notImplemented();
0433:            }
0434:
0435:            /**
0436:             * JDBC 3.0
0437:             *
0438:             * Sets the designated parameter to the given Java int value. The driver
0439:             * converts this to an SQL INTEGER value when it sends it to the database.
0440:             *
0441:             * @param parameterName - the name of the parameter
0442:             * @param x - the parameter value
0443:             * @exception SQLException Feature not implemented for now.
0444:             */
0445:            public void setInt(String parameterName, int x) throws SQLException {
0446:                throw Util.notImplemented();
0447:            }
0448:
0449:            /**
0450:             * JDBC 3.0
0451:             *
0452:             * Retrieves the value of a JDBC INTEGER parameter as a int in the Java
0453:             * programming language.
0454:             *
0455:             * @param parameterName - the name of the parameter
0456:             * @return the parameter value. If the value is SQL NULL, the result is 0.
0457:             * @exception SQLException Feature not implemented for now.
0458:             */
0459:            public int getInt(String parameterName) throws SQLException {
0460:                throw Util.notImplemented();
0461:            }
0462:
0463:            /**
0464:             * JDBC 3.0
0465:             *
0466:             * Sets the designated parameter to the given Java long value. The driver
0467:             * converts this to an SQL BIGINT value when it sends it to the database.
0468:             *
0469:             * @param parameterName - the name of the parameter
0470:             * @param x - the parameter value
0471:             * @exception SQLException Feature not implemented for now.
0472:             */
0473:            public void setLong(String parameterName, long x)
0474:                    throws SQLException {
0475:                throw Util.notImplemented();
0476:            }
0477:
0478:            /**
0479:             * JDBC 3.0
0480:             *
0481:             * Retrieves the value of a JDBC BIGINT parameter as a long in the Java
0482:             * programming language.
0483:             *
0484:             * @param parameterName - the name of the parameter
0485:             * @return the parameter value. If the value is SQL NULL, the result is 0.
0486:             * @exception SQLException Feature not implemented for now.
0487:             */
0488:            public long getLong(String parameterName) throws SQLException {
0489:                throw Util.notImplemented();
0490:            }
0491:
0492:            /**
0493:             * JDBC 3.0
0494:             *
0495:             * Sets the designated parameter to the given Java float value. The driver
0496:             * converts this to an SQL FLOAT value when it sends it to the database.
0497:             *
0498:             * @param parameterName - the name of the parameter
0499:             * @param x - the parameter value
0500:             * @exception SQLException Feature not implemented for now.
0501:             */
0502:            public void setFloat(String parameterName, float x)
0503:                    throws SQLException {
0504:                throw Util.notImplemented();
0505:            }
0506:
0507:            /**
0508:             * JDBC 3.0
0509:             *
0510:             * Retrieves the value of a JDBC FLOAT parameter as a float in the Java
0511:             * programming language.
0512:             *
0513:             * @param parameterName - the name of the parameter
0514:             * @return the parameter value. If the value is SQL NULL, the result is 0.
0515:             * @exception SQLException Feature not implemented for now.
0516:             */
0517:            public float getFloat(String parameterName) throws SQLException {
0518:                throw Util.notImplemented();
0519:            }
0520:
0521:            /**
0522:             * JDBC 3.0
0523:             *
0524:             * Sets the designated parameter to the given Java double value. The driver
0525:             * converts this to an SQL DOUBLE value when it sends it to the database.
0526:             *
0527:             * @param parameterName - the name of the parameter
0528:             * @param x - the parameter value
0529:             * @exception SQLException Feature not implemented for now.
0530:             */
0531:            public void setDouble(String parameterName, double x)
0532:                    throws SQLException {
0533:                throw Util.notImplemented();
0534:            }
0535:
0536:            /**
0537:             * JDBC 3.0
0538:             *
0539:             * Retrieves the value of a JDBC DOUBLE parameter as a double in the Java
0540:             * programming language.
0541:             *
0542:             * @param parameterName - the name of the parameter
0543:             * @return the parameter value. If the value is SQL NULL, the result is 0.
0544:             * @exception SQLException Feature not implemented for now.
0545:             */
0546:            public double getDouble(String parameterName) throws SQLException {
0547:                throw Util.notImplemented();
0548:            }
0549:
0550:            /**
0551:             * JDBC 3.0
0552:             *
0553:             * Sets the designated parameter to the given java.math.BigDecimal value. The driver
0554:             * converts this to an SQL NUMERIC value when it sends it to the database.
0555:             *
0556:             * @param parameterName - the name of the parameter
0557:             * @param x - the parameter value
0558:             * @exception SQLException Feature not implemented for now.
0559:             */
0560:            public void setBigDecimal(String parameterName, BigDecimal x)
0561:                    throws SQLException {
0562:                throw Util.notImplemented();
0563:            }
0564:
0565:            /**
0566:             * JDBC 3.0
0567:             *
0568:             * Retrieves the value of a JDBC NUMERIC parameter as a java.math.BigDecimal
0569:             * object with as many digits to the right of the decimal point as the value contains
0570:             *
0571:             * @param parameterName - the name of the parameter
0572:             * @return the parameter value. If the value is SQL NULL, the result is 0.
0573:             * @exception SQLException Feature not implemented for now.
0574:             */
0575:            public BigDecimal getBigDecimal(String parameterName)
0576:                    throws SQLException {
0577:                throw Util.notImplemented();
0578:            }
0579:
0580:            /**
0581:             * JDBC 3.0
0582:             *
0583:             * Sets the designated parameter to the given Java String value. The driver
0584:             * converts this to an SQL VARCHAR OR LONGVARCHAR value (depending on the
0585:             * argument's size relative the driver's limits on VARCHAR values) when it
0586:             * sends it to the database.
0587:             *
0588:             * @param parameterName - the name of the parameter
0589:             * @param x - the parameter value
0590:             * @exception SQLException Feature not implemented for now.
0591:             */
0592:            public void setString(String parameterName, String x)
0593:                    throws SQLException {
0594:                throw Util.notImplemented();
0595:            }
0596:
0597:            /**
0598:             * JDBC 3.0
0599:             *
0600:             * Retrieves the value of a JDBC CHAR, VARCHAR, or LONGVARCHAR parameter as
0601:             * a String in the Java programming language.
0602:             *
0603:             * @param parameterName - the name of the parameter
0604:             * @return the parameter value. If the value is SQL NULL, the result is null.
0605:             * @exception SQLException Feature not implemented for now.
0606:             */
0607:            public String getString(String parameterName) throws SQLException {
0608:                throw Util.notImplemented();
0609:            }
0610:
0611:            /**
0612:             * JDBC 3.0
0613:             *
0614:             * Sets the designated parameter to the given Java array of bytes. The driver
0615:             * converts this to an SQL VARBINARY OR LONGVARBINARY (depending on the argument's
0616:             * size relative to the driver's limits on VARBINARY values)when it sends it to
0617:             * the database.
0618:             *
0619:             * @param parameterName - the name of the parameter
0620:             * @param x - the parameter value
0621:             * @exception SQLException Feature not implemented for now.
0622:             */
0623:            public void setBytes(String parameterName, byte[] x)
0624:                    throws SQLException {
0625:                throw Util.notImplemented();
0626:            }
0627:
0628:            /**
0629:             * JDBC 3.0
0630:             *
0631:             * Retrieves the value of a JDBC BINARY or VARBINARY parameter as an array
0632:             * of byte values in the Java programming language.
0633:             *
0634:             * @param parameterName - the name of the parameter
0635:             * @return the parameter value. If the value is SQL NULL, the result is null.
0636:             * @exception SQLException Feature not implemented for now.
0637:             */
0638:            public byte[] getBytes(String parameterName) throws SQLException {
0639:                throw Util.notImplemented();
0640:            }
0641:
0642:            /**
0643:             * JDBC 3.0
0644:             *
0645:             * Sets the designated parameter to the given java.sql.Date value. The driver
0646:             * converts this to an SQL DATE value when it sends it to the database.
0647:             *
0648:             * @param parameterName - the name of the parameter
0649:             * @param x - the parameter value
0650:             * @exception SQLException Feature not implemented for now.
0651:             */
0652:            public void setDate(String parameterName, Date x)
0653:                    throws SQLException {
0654:                throw Util.notImplemented();
0655:            }
0656:
0657:            /**
0658:             * JDBC 3.0
0659:             *
0660:             * Sets the designated parameter to the given java.sql.Date value, using the given
0661:             * Calendar object.
0662:             *
0663:             * @param parameterName - the name of the parameter
0664:             * @param x - the parameter value
0665:             * @param cal - the Calendar object the driver will use to construct the date
0666:             * @exception SQLException Feature not implemented for now.
0667:             */
0668:            public void setDate(String parameterName, Date x, Calendar cal)
0669:                    throws SQLException {
0670:                throw Util.notImplemented();
0671:            }
0672:
0673:            /**
0674:             * JDBC 3.0
0675:             *
0676:             * Retrieves the value of a JDBC DATE parameter as ajava.sql.Date object
0677:             *
0678:             * @param parameterName - the name of the parameter
0679:             * @return the parameter value. If the value is SQL NULL, the result is null.
0680:             * @exception SQLException Feature not implemented for now.
0681:             */
0682:            public Date getDate(String parameterName) throws SQLException {
0683:                throw Util.notImplemented();
0684:            }
0685:
0686:            /**
0687:             * JDBC 3.0
0688:             *
0689:             * Retrieves the value of a JDBC DATE parameter as a java.sql.Date object,
0690:             * using the given Calendar object to construct the date object.
0691:             *
0692:             * @param parameterName - the name of the parameter
0693:             * @param cal - the Calendar object the driver will use to construct the date
0694:             * @return the parameter value. If the value is SQL NULL, the result is null.
0695:             * @exception SQLException Feature not implemented for now.
0696:             */
0697:            public Date getDate(String parameterName, Calendar cal)
0698:                    throws SQLException {
0699:                throw Util.notImplemented();
0700:            }
0701:
0702:            /**
0703:             * JDBC 3.0
0704:             *
0705:             * Sets the designated parameter to the given java.sql.Time value. The driver
0706:             * converts this to an SQL TIME value when it sends it to the database.
0707:             *
0708:             * @param parameterName - the name of the parameter
0709:             * @param x - the parameter value
0710:             * @exception SQLException Feature not implemented for now.
0711:             */
0712:            public void setTime(String parameterName, Time x)
0713:                    throws SQLException {
0714:                throw Util.notImplemented();
0715:            }
0716:
0717:            /**
0718:             * JDBC 3.0
0719:             *
0720:             * Retrieves the value of a JDBC TIME parameter as ajava.sql.Time object
0721:             *
0722:             * @param parameterName - the name of the parameter
0723:             * @return the parameter value. If the value is SQL NULL, the result is null.
0724:             * @exception SQLException Feature not implemented for now.
0725:             */
0726:            public Time getTime(String parameterName) throws SQLException {
0727:                throw Util.notImplemented();
0728:            }
0729:
0730:            /**
0731:             * JDBC 3.0
0732:             *
0733:             * Retrieves the value of a JDBC TIME parameter as a java.sql.Time object,
0734:             * using the given Calendar object to construct the time object.
0735:             *
0736:             * @param parameterName - the name of the parameter
0737:             * @param cal - the Calendar object the driver will use to construct the time
0738:             * @return the parameter value. If the value is SQL NULL, the result is null.
0739:             * @exception SQLException Feature not implemented for now.
0740:             */
0741:            public Time getTime(String parameterName, Calendar cal)
0742:                    throws SQLException {
0743:                throw Util.notImplemented();
0744:            }
0745:
0746:            /**
0747:             * JDBC 3.0
0748:             *
0749:             * Sets the designated parameter to the given java.sql.Time value using the
0750:             * Calendar object
0751:             *
0752:             * @param parameterName - the name of the parameter
0753:             * @param x - the parameter value
0754:             * @param cal - the Calendar object the driver will use to construct the time
0755:             * @exception SQLException Feature not implemented for now.
0756:             */
0757:            public void setTime(String parameterName, Time x, Calendar cal)
0758:                    throws SQLException {
0759:                throw Util.notImplemented();
0760:            }
0761:
0762:            /**
0763:             * JDBC 3.0
0764:             *
0765:             * Sets the designated parameter to the given java.sql.Timestamp value. The driver
0766:             * converts this to an SQL TIMESTAMP value when it sends it to the database.
0767:             *
0768:             * @param parameterName - the name of the parameter
0769:             * @param x - the parameter value
0770:             * @exception SQLException Feature not implemented for now.
0771:             */
0772:            public void setTimestamp(String parameterName, Timestamp x)
0773:                    throws SQLException {
0774:                throw Util.notImplemented();
0775:            }
0776:
0777:            /**
0778:             * JDBC 3.0
0779:             *
0780:             * Sets the designated parameter to the given java.sql.Timestamp value, using the
0781:             * given Calendar object
0782:             *
0783:             * @param parameterName - the name of the parameter
0784:             * @param x - the parameter value
0785:             * @param cal - the Calendar object the driver will use to construct the timestamp.
0786:             * @exception SQLException Feature not implemented for now.
0787:             */
0788:            public void setTimestamp(String parameterName, Timestamp x,
0789:                    Calendar cal) throws SQLException {
0790:                throw Util.notImplemented();
0791:            }
0792:
0793:            /**
0794:             * JDBC 3.0
0795:             *
0796:             * Retrieves the value of a JDBC TIMESTAMP parameter as a java.sql.Timestamp object
0797:             *
0798:             * @param parameterName - the name of the parameter
0799:             * @return the parameter value. If the value is SQL NULL, the result is null.
0800:             * @exception SQLException Feature not implemented for now.
0801:             */
0802:            public Timestamp getTimestamp(String parameterName)
0803:                    throws SQLException {
0804:                throw Util.notImplemented();
0805:            }
0806:
0807:            /**
0808:             * JDBC 3.0
0809:             *
0810:             * Retrieves the value of a JDBC TIMESTAMP parameter as a java.sql.Timestamp object,
0811:             * using the given Calendar object to construct the Timestamp object.
0812:             *
0813:             * @param parameterName - the name of the parameter
0814:             * @param cal - the Calendar object the driver will use to construct the Timestamp
0815:             * @return the parameter value. If the value is SQL NULL, the result is null.
0816:             * @exception SQLException Feature not implemented for now.
0817:             */
0818:            public Timestamp getTimestamp(String parameterName, Calendar cal)
0819:                    throws SQLException {
0820:                throw Util.notImplemented();
0821:            }
0822:
0823:            /**
0824:             * JDBC 3.0
0825:             *
0826:             * Sets the designated parameter to the given input stream, which will have the
0827:             * specified number of bytes.
0828:             *
0829:             * @param parameterName - the name of the parameter
0830:             * @param x - the Java input stream that contains the ASCII parameter value
0831:             * @param length - the number of bytes in the stream
0832:             * @exception SQLException Feature not implemented for now.
0833:             */
0834:            public void setAsciiStream(String parameterName, InputStream x,
0835:                    int length) throws SQLException {
0836:                throw Util.notImplemented();
0837:            }
0838:
0839:            /**
0840:             * JDBC 3.0
0841:             *
0842:             * Sets the designated parameter to the given input stream, which will have the
0843:             * specified number of bytes.
0844:             *
0845:             * @param parameterName - the name of the parameter
0846:             * @param x - the Java input stream that contains the binary parameter value
0847:             * @param length - the number of bytes in the stream
0848:             * @exception SQLException Feature not implemented for now.
0849:             */
0850:            public void setBinaryStream(String parameterName, InputStream x,
0851:                    int length) throws SQLException {
0852:                throw Util.notImplemented();
0853:            }
0854:
0855:            /**
0856:             * JDBC 3.0
0857:             *
0858:             * Sets the designated parameter to the given Reader object, which is the given
0859:             * number of characters long.
0860:             *
0861:             * @param parameterName - the name of the parameter
0862:             * @param reader - the java.io.Reader object that contains the UNICODE data
0863:             * @param length - the number of characters in the stream
0864:             * @exception SQLException Feature not implemented for now.
0865:             */
0866:            public void setCharacterStream(String parameterName, Reader reader,
0867:                    int length) throws SQLException {
0868:                throw Util.notImplemented();
0869:            }
0870:
0871:            /**
0872:             * JDBC 3.0
0873:             *
0874:             * Sets the value of the designated parameter with the given object. The second
0875:             * argument must be an object type; for integral values, the java.lang equivalent
0876:             * objects should be used.
0877:             *
0878:             * @param parameterName - the name of the parameter
0879:             * @param x - the object containing the input parameter value
0880:             * @param targetSqlType - the SQL type (as defined in java.sql.Types) to be sent to
0881:             * the database. The scale argument may further qualify this type.
0882:             * @param scale - for java.sql.Types.DECIMAL or java.sql.Types.NUMERIC types, this
0883:             * is the number of digits after the decimal point. For all other types, this value
0884:             * will be ignored.
0885:             * @exception SQLException Feature not implemented for now.
0886:             */
0887:            public void setObject(String parameterName, Object x,
0888:                    int targetSqlType, int scale) throws SQLException {
0889:                throw Util.notImplemented();
0890:            }
0891:
0892:            /**
0893:             * JDBC 3.0
0894:             *
0895:             * Retrieves the value of a parameter as an Object in the java programming language.
0896:             *
0897:             * @param parameterName - the name of the parameter
0898:             * @return a java.lang.Object holding the OUT parameter value
0899:             * @exception SQLException Feature not implemented for now.
0900:             */
0901:            public Object getObject(String parameterName) throws SQLException {
0902:                throw Util.notImplemented();
0903:            }
0904:
0905:            /**
0906:             * JDBC 3.0
0907:             *
0908:             * Returns an object representing the value of OUT parameter i and uses map for
0909:             * the custom mapping of the parameter value.
0910:             *
0911:             * @param parameterName - the name of the parameter
0912:             * @param map - the mapping from SQL type names to Java classes
0913:             * @return a java.lang.Object holding the OUT parameter value
0914:             * @exception SQLException Feature not implemented for now.
0915:             */
0916:            public Object getObject(String parameterName, Map map)
0917:                    throws SQLException {
0918:                checkStatus();
0919:                if (map == null)
0920:                    throw Util.generateCsSQLException(
0921:                            SQLState.INVALID_API_PARAMETER, map, "map",
0922:                            "java.sql.CallableStatement.getObject");
0923:                if (!(map.isEmpty()))
0924:                    throw Util.notImplemented();
0925:
0926:                // Map is empty so call the normal getObject method.
0927:                return getObject(parameterName);
0928:            }
0929:
0930:            /**
0931:             * JDBC 3.0
0932:             *
0933:             * Sets the value of the designated parameter with the given object. This method
0934:             * is like the method setObject above, except that it assumes a scale of zero.
0935:             *
0936:             * @param parameterName - the name of the parameter
0937:             * @param x - the object containing the input parameter value
0938:             * @param targetSqlType - the SQL type (as defined in java.sql.Types) to be sent to
0939:             * the database. 
0940:             * @exception SQLException Feature not implemented for now.
0941:             */
0942:            public void setObject(String parameterName, Object x,
0943:                    int targetSqlType) throws SQLException {
0944:                throw Util.notImplemented();
0945:            }
0946:
0947:            /**
0948:             * JDBC 3.0
0949:             *
0950:             * Sets the value of the designated parameter with the given object. The second
0951:             * parameter must be of type Object; therefore, the java.lang equivalent objects
0952:             * should be used for built-in types.
0953:             *
0954:             * @param parameterName - the name of the parameter
0955:             * @param x - the object containing the input parameter value
0956:             * @exception SQLException Feature not implemented for now.
0957:             */
0958:            public void setObject(String parameterName, Object x)
0959:                    throws SQLException {
0960:                throw Util.notImplemented();
0961:            }
0962:
0963:            /*
0964:             ** Methods using BigDecimal, moved out of EmbedPreparedStatement
0965:             ** to allow that class to support JSR169.
0966:             */
0967:            /**
0968:             * Set a parameter to a java.lang.BigDecimal value.  
0969:             * The driver converts this to a SQL NUMERIC value when
0970:             * it sends it to the database.
0971:             *
0972:             * @param parameterIndex the first parameter is 1, the second is 2, ...
0973:             * @param x the parameter value
0974:             * @exception SQLException thrown on failure.
0975:             */
0976:            public final void setBigDecimal(int parameterIndex, BigDecimal x)
0977:                    throws SQLException {
0978:                checkStatus();
0979:                try {
0980:                    /* JDBC is one-based, DBMS is zero-based */
0981:                    getParms().getParameterForSet(parameterIndex - 1)
0982:                            .setBigDecimal(x);
0983:
0984:                } catch (Throwable t) {
0985:                    throw EmbedResultSet.noStateChangeException(t);
0986:                }
0987:            }
0988:
0989:            /**
0990:             * @see CallableStatement#getBigDecimal
0991:             * @exception SQLException NoOutputParameters thrown.
0992:             */
0993:            public final BigDecimal getBigDecimal(int parameterIndex, int scale)
0994:                    throws SQLException {
0995:                BigDecimal v = getBigDecimal(parameterIndex);
0996:                if (v != null)
0997:                    v = v.setScale(scale, BigDecimal.ROUND_HALF_DOWN);
0998:                return v;
0999:            }
1000:
1001:            /**
1002:            	Allow explict setObject conversions by sub-classes for classes
1003:            	not supported by this variant. In this case handle BigDecimal.
1004:            	@return true if the object was set successfully, false if no valid
1005:            	conversion exists.
1006:
1007:            	@exception SQLException value could not be set.
1008:             */
1009:            boolean setObjectConvert(int parameterIndex, Object x)
1010:                    throws SQLException {
1011:                if (x instanceof  BigDecimal) {
1012:                    setBigDecimal(parameterIndex, (BigDecimal) x);
1013:                    return true;
1014:                }
1015:                return false;
1016:            }
1017:
1018:            /////////////////////////////////////////////////////////////////////////
1019:            //
1020:            //	JDBC 4.0	-	New public methods
1021:            //
1022:            /////////////////////////////////////////////////////////////////////////
1023:
1024:            /**
1025:             * Retrieves the value of the designated parameter as a 
1026:             * <code>java.io.Reader</code> object in the Java programming language.
1027:             * Introduced in JDBC 4.0.
1028:             *
1029:             * @param parameterIndex the first parameter is 1, the second is 2, ...
1030:             * @return a <code>java.io.Reader</code> object that contains the parameter
1031:             *         value; if the value is SQL <code>NULL</code>, the value returned
1032:             *         is <code>null</code> in the Java programming language.
1033:             * @throws SQLException if a database access error occurs or this method is
1034:             *                      called on a closed <code>CallableStatement</code>
1035:             */
1036:            public Reader getCharacterStream(int parameterIndex)
1037:                    throws SQLException {
1038:                checkStatus();
1039:                // Make sure the specified parameter has mode OUT or IN/OUT.
1040:                switch (getParms().getParameterMode(parameterIndex)) {
1041:                case JDBC30Translation.PARAMETER_MODE_IN:
1042:                case JDBC30Translation.PARAMETER_MODE_UNKNOWN:
1043:                    throw newSQLException(SQLState.LANG_NOT_OUTPUT_PARAMETER,
1044:                            Integer.toString(parameterIndex));
1045:                }
1046:                Reader reader = null;
1047:                int paramType = getParameterJDBCType(parameterIndex);
1048:                switch (paramType) {
1049:                // Handle character/string types.
1050:                case Types.CHAR:
1051:                case Types.VARCHAR:
1052:                case Types.LONGVARCHAR:
1053:                case Types.CLOB:
1054:                    boolean pushStack = false;
1055:                    Object syncObject = getConnectionSynchronization();
1056:                    synchronized (syncObject) {
1057:                        try {
1058:                            DataValueDescriptor param = getParms()
1059:                                    .getParameterForGet(parameterIndex - 1);
1060:                            if (param.isNull()) {
1061:                                break;
1062:                            }
1063:                            pushStack = true;
1064:                            setupContextStack();
1065:
1066:                            StreamStorable ss = (StreamStorable) param;
1067:                            InputStream stream = ss.returnStream();
1068:                            if (stream == null) {
1069:                                reader = new StringReader(param.getString());
1070:                            } else {
1071:                                reader = new UTF8Reader(stream, 0, this ,
1072:                                        syncObject);
1073:                            }
1074:                        } catch (Throwable t) {
1075:                            throw EmbedResultSet.noStateChangeException(t);
1076:                        } finally {
1077:                            if (pushStack) {
1078:                                restoreContextStack();
1079:                            }
1080:                        }
1081:                    } // End synchronized block
1082:                    break;
1083:
1084:                // Handle binary types.
1085:                // JDBC says to support these, but no defintion exists for the output.
1086:                // Match JCC which treats the bytes as a UTF-16BE stream.
1087:                case Types.BINARY:
1088:                case Types.VARBINARY:
1089:                case Types.LONGVARBINARY:
1090:                case Types.BLOB:
1091:                    try {
1092:                        InputStream is = getBinaryStream(parameterIndex);
1093:                        if (is != null) {
1094:                            reader = new InputStreamReader(is, "UTF-16BE");
1095:                        }
1096:                        break;
1097:                    } catch (UnsupportedEncodingException uee) {
1098:                        throw newSQLException(uee.getMessage());
1099:                    }
1100:
1101:                default:
1102:                    throw newSQLException(SQLState.LANG_DATA_TYPE_GET_MISMATCH,
1103:                            "java.io.Reader", Util.typeName(paramType));
1104:                }
1105:                // Update wasNull. 
1106:                wasNull = (reader == null);
1107:                return reader;
1108:            }
1109:
1110:            // Private utility classes
1111:
1112:            /**
1113:             * Get binary stream for a parameter.
1114:             *
1115:             * @param parameterIndex first parameter is 1, second is 2 etc.
1116:             * @return a stream for the binary parameter, or <code>null</code>.
1117:             *
1118:             * @throws SQLException if a database access error occurs.
1119:             */
1120:            private InputStream getBinaryStream(int parameterIndex)
1121:                    throws SQLException {
1122:                int paramType = getParameterJDBCType(parameterIndex);
1123:                switch (paramType) {
1124:                case Types.BINARY:
1125:                case Types.VARBINARY:
1126:                case Types.LONGVARBINARY:
1127:                case Types.BLOB:
1128:                    break;
1129:                default:
1130:                    throw newSQLException(SQLState.LANG_DATA_TYPE_GET_MISMATCH,
1131:                            "java.io.InputStream", Util.typeName(paramType));
1132:                }
1133:
1134:                boolean pushStack = false;
1135:                synchronized (getConnectionSynchronization()) {
1136:                    try {
1137:                        DataValueDescriptor param = getParms()
1138:                                .getParameterForGet(parameterIndex - 1);
1139:                        wasNull = param.isNull();
1140:                        if (wasNull) {
1141:                            return null;
1142:                        }
1143:                        pushStack = true;
1144:                        setupContextStack();
1145:
1146:                        StreamStorable ss = (StreamStorable) param;
1147:                        InputStream stream = ss.returnStream();
1148:                        if (stream == null) {
1149:                            stream = new ByteArrayInputStream(param.getBytes());
1150:                        } else {
1151:                            stream = new BinaryToRawStream(stream, param);
1152:                        }
1153:                        return stream;
1154:                    } catch (Throwable t) {
1155:                        throw EmbedResultSet.noStateChangeException(t);
1156:                    } finally {
1157:                        if (pushStack) {
1158:                            restoreContextStack();
1159:                        }
1160:                    }
1161:                } // End synchronized block
1162:            }
1163:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.