001: /*
002:
003: Derby - Class org.apache.derby.jdbc.Driver40
004:
005: Licensed to the Apache Software Foundation (ASF) under one or more
006: contributor license agreements. See the NOTICE file distributed with
007: this work for additional information regarding copyright ownership.
008: The ASF licenses this file to You under the Apache License, Version 2.0
009: (the "License"); you may not use this file except in compliance with
010: the License. You may obtain a copy of the License at
011:
012: http://www.apache.org/licenses/LICENSE-2.0
013:
014: Unless required by applicable law or agreed to in writing, software
015: distributed under the License is distributed on an "AS IS" BASIS,
016: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
017: See the License for the specific language governing permissions and
018: limitations under the License.
019:
020: */
021:
022: package org.apache.derby.jdbc;
023:
024: import java.sql.DatabaseMetaData;
025: import org.apache.derby.iapi.jdbc.BrokeredConnection;
026: import org.apache.derby.iapi.jdbc.BrokeredConnectionControl;
027: import org.apache.derby.iapi.jdbc.BrokeredConnection40;
028: import org.apache.derby.iapi.sql.ResultSet;
029: import org.apache.derby.iapi.services.sanity.SanityManager;
030: import org.apache.derby.iapi.error.StandardException;
031: import org.apache.derby.impl.jdbc.EmbedConnection;
032: import org.apache.derby.impl.jdbc.EmbedConnection30;
033: import org.apache.derby.impl.jdbc.EmbedPreparedStatement40;
034: import org.apache.derby.impl.jdbc.EmbedCallableStatement40;
035: import org.apache.derby.impl.jdbc.EmbedConnection40;
036: import org.apache.derby.impl.jdbc.EmbedResultSet;
037: import org.apache.derby.impl.jdbc.EmbedResultSet40;
038: import org.apache.derby.impl.jdbc.EmbedDatabaseMetaData40;
039: import org.apache.derby.impl.jdbc.SQLExceptionFactory40;
040: import org.apache.derby.impl.jdbc.EmbedStatement40;
041: import org.apache.derby.impl.jdbc.EmbedResultSetMetaData40;
042: import org.apache.derby.impl.jdbc.Util;
043: import java.sql.Connection;
044: import java.sql.SQLException;
045: import java.sql.CallableStatement;
046: import java.sql.PreparedStatement;
047: import java.util.Properties;
048: import org.apache.derby.iapi.sql.ResultColumnDescriptor;
049:
050: public class Driver40 extends Driver30 {
051:
052: public Connection getNewNestedConnection(EmbedConnection conn) {
053: if (SanityManager.DEBUG) {
054: SanityManager.ASSERT(conn instanceof EmbedConnection30,
055: "conn expected to be instanceof EmbedConnection30");
056: }
057: return new EmbedConnection40(conn);
058: }
059:
060: public EmbedConnection getNewEmbedConnection(String url,
061: Properties info) throws SQLException {
062: return new EmbedConnection40(this , url, info);
063: }
064:
065: /**
066: * returns a new EmbedStatement
067: * @param conn the EmbedConnection class associated with
068: * this statement object
069: * @param forMetaData boolean
070: * @param resultSetType int
071: * @param resultSetConcurrency int
072: * @param resultSetHoldability int
073: * @return Statement a new java.sql.Statement implementation
074: *
075: */
076: public java.sql.Statement newEmbedStatement(EmbedConnection conn,
077: boolean forMetaData, int resultSetType,
078: int resultSetConcurrency, int resultSetHoldability) {
079: return new EmbedStatement40(conn, forMetaData, resultSetType,
080: resultSetConcurrency, resultSetHoldability);
081: }
082:
083: public PreparedStatement newEmbedPreparedStatement(
084: EmbedConnection conn, String stmt, boolean forMetaData,
085: int resultSetType, int resultSetConcurrency,
086: int resultSetHoldability, int autoGeneratedKeys,
087: int[] columnIndexes, String[] columnNames)
088: throws SQLException {
089: return new EmbedPreparedStatement40(conn, stmt, forMetaData,
090: resultSetType, resultSetConcurrency,
091: resultSetHoldability, autoGeneratedKeys, columnIndexes,
092: columnNames);
093: }
094:
095: public CallableStatement newEmbedCallableStatement(
096: EmbedConnection conn, String stmt, int resultSetType,
097: int resultSetConcurrency, int resultSetHoldability)
098: throws SQLException {
099: return new EmbedCallableStatement40(conn, stmt, resultSetType,
100: resultSetConcurrency, resultSetHoldability);
101: }
102:
103: public BrokeredConnection newBrokeredConnection(
104: BrokeredConnectionControl control) {
105:
106: return new BrokeredConnection40(control);
107: }
108:
109: public EmbedResultSet newEmbedResultSet(EmbedConnection conn,
110: ResultSet results, boolean forMetaData,
111: org.apache.derby.impl.jdbc.EmbedStatement statement,
112: boolean isAtomic) throws SQLException {
113: return new EmbedResultSet40(conn, results, forMetaData,
114: statement, isAtomic);
115: }
116:
117: /**
118: * Overwriting the super class boot method to set exception factory
119: * @see InternalDriver#boot
120: */
121:
122: public void boot(boolean create, Properties properties)
123: throws StandardException {
124: Util.setExceptionFactory(new SQLExceptionFactory40());
125: super .boot(create, properties);
126: }
127:
128: public DatabaseMetaData newEmbedDatabaseMetaData(
129: EmbedConnection conn, String dbname) throws SQLException {
130: return new EmbedDatabaseMetaData40(conn, dbname);
131: }
132:
133: /**
134: * Returns a new java.sql.ResultSetMetaData for this implementation
135: *
136: * @param columnInfo a ResultColumnDescriptor that stores information
137: * about the columns in a ResultSet
138: * @return ResultSetMetaData
139: */
140: public EmbedResultSetMetaData40 newEmbedResultSetMetaData(
141: ResultColumnDescriptor[] columnInfo) {
142: return new EmbedResultSetMetaData40(columnInfo);
143: }
144: }
|