Package org.springframework.jdbc.support.nativejdbc

Examples of org.springframework.jdbc.support.nativejdbc.NativeJdbcExtractor


      super.initializeWithTableColumnMetaData(databaseMetaData, catalogName, schemaName, tableName);
      return;
    }

    Connection con = databaseMetaData.getConnection();
    NativeJdbcExtractor nativeJdbcExtractor = getNativeJdbcExtractor();
    if (nativeJdbcExtractor != null) {
      con = nativeJdbcExtractor.getNativeConnection(con);
    }
    boolean isOracleCon;
    try {
      Class<?> oracleConClass = getClass().getClassLoader().loadClass("oracle.jdbc.OracleConnection");
      isOracleCon = oracleConClass.isInstance(con);
View Full Code Here


    mockConnection.createStatement();
    ctrlConnection.setReturnValue(mockStatement, 1);
    replay();

    JdbcTemplate template = new JdbcTemplate(mockDataSource);
    template.setNativeJdbcExtractor(new NativeJdbcExtractor() {
      public boolean isNativeConnectionNecessaryForNativeStatements() {
        return false;
      }
      public boolean isNativeConnectionNecessaryForNativePreparedStatements() {
        return false;
View Full Code Here

      super.initializeWithTableColumnMetaData(databaseMetaData, catalogName, schemaName, tableName);
      return;
    }

    Connection con = databaseMetaData.getConnection();
    NativeJdbcExtractor nativeJdbcExtractor = getNativeJdbcExtractor();
    if (nativeJdbcExtractor != null) {
      con = nativeJdbcExtractor.getNativeConnection(con);
    }
    boolean isOracleCon;
    try {
      Class<?> oracleConClass = con.getClass().getClassLoader().loadClass("oracle.jdbc.OracleConnection");
      isOracleCon = oracleConClass.isInstance(con);
View Full Code Here

    given(callableStatement2.getResultSet()).willReturn(returnResultSet);
    given(callableStatement2.getUpdateCount()).willReturn(-1);

    given(this.connection.createStatement()).willReturn(this.statement);

    this.template.setNativeJdbcExtractor(new NativeJdbcExtractor() {
      @Override
      public boolean isNativeConnectionNecessaryForNativeStatements() {
        return false;
      }
      @Override
View Full Code Here

        Connection con = DataSourceUtils.getConnection(ds);
        Statement stmt = null;
        ResultSet rs = null;
        try {
            Connection conToUse = con;
            NativeJdbcExtractor nje = getNativeJdbcExtractor();
            if(nje != null && nje.isNativeConnectionNecessaryForNativeStatements()) {
                conToUse = nje.getNativeConnection(con);
            }
            stmt = conToUse.createStatement();
            applyStatementSettings(stmt);
            Statement stmtToUse = stmt;
            if(nje != null) {
                stmtToUse = nje.getNativeStatement(stmt);
            }
            rs = stmtToUse.executeQuery(sql);
            ResultSet rsToUse = rs;
            if(nje != null) {
                rsToUse = nje.getNativeResultSet(rs);
            }
            // warnings are handled after query execution but before data access
            handleWarnings(stmt);
            return new StatementCloseableIterator<T>(ds, con, stmt, rs, rsToUse, rowMapper);
        } catch(SQLException ex) {
View Full Code Here

        Connection con = DataSourceUtils.getConnection(ds);
        PreparedStatement ps = null;
        ResultSet rs = null;
        try {
            Connection conToUse = con;
            NativeJdbcExtractor nje = getNativeJdbcExtractor();
            if(nje != null && nje.isNativeConnectionNecessaryForNativePreparedStatements()) {
                conToUse = nje.getNativeConnection(con);
            }
            ps = psc.createPreparedStatement(conToUse);
            applyStatementSettings(ps);
            PreparedStatement psToUse = ps;
            if(nje != null) {
                psToUse = nje.getNativePreparedStatement(ps);
            }
            if(pss != null) {
                pss.setValues(psToUse);
            }
            rs = psToUse.executeQuery();
            ResultSet rsToUse = rs;
            if(nje != null) {
                rsToUse = nje.getNativeResultSet(rs);
            }
            // warnings are handled after query execution but before data access
            handleWarnings(ps);
            return new PreparedStatementCloseableIterator<T>(ds, con, psc, pss, ps, rs, rsToUse, rowMapper);
        } catch(SQLException ex) {
View Full Code Here

        Connection con = DataSourceUtils.getConnection(ds);
        PreparedStatement ps = null;
        ResultSet rs = null;
        try {
            Connection conToUse = con;
            NativeJdbcExtractor nje = getNativeJdbcExtractor();
            if(nje != null && nje.isNativeConnectionNecessaryForNativePreparedStatements()) {
                conToUse = nje.getNativeConnection(con);
            }
            ps = psc.createPreparedStatement(conToUse);
            applyStatementSettings(ps);
            PreparedStatement psToUse = ps;
            if(nje != null) {
                psToUse = nje.getNativePreparedStatement(ps);
            }
            if(pss != null) {
                pss.setValues(psToUse);
            }
            rs = psToUse.executeQuery();
            ResultSet rsToUse = rs;
            if(nje != null) {
                rsToUse = nje.getNativeResultSet(rs);
            }
            // warnings are handled after query execution but before data access
            handleWarnings(ps);
            return new PreparedStatementCloseableIterator<T>(ds, con, psc, pss, ps, rs, rsToUse, rowMapper);
        } catch(SQLException ex) {
View Full Code Here

        Connection con = DataSourceUtils.getConnection(ds);
        Statement stmt = null;
        ResultSet rs = null;
        try {
            Connection conToUse = con;
            NativeJdbcExtractor nje = getNativeJdbcExtractor();
            if(nje != null && nje.isNativeConnectionNecessaryForNativeStatements()) {
                conToUse = nje.getNativeConnection(con);
            }
            stmt = conToUse.createStatement();
            applyStatementSettings(stmt);
            Statement stmtToUse = stmt;
            if(nje != null) {
                stmtToUse = nje.getNativeStatement(stmt);
            }
            rs = stmtToUse.executeQuery(sql);
            ResultSet rsToUse = rs;
            if(nje != null) {
                rsToUse = nje.getNativeResultSet(rs);
            }
            // warnings are handled after query execution but before data access
            handleWarnings(stmt);
            return new StatementCloseableIterator<T>(ds, con, stmt, rs, rsToUse, rowMapper);
        } catch(SQLException ex) {
View Full Code Here

            "check canUnwrap before calling unwrap");
    }

    private Connection unwrapInternal(Connection conn) {
        for (int i = 0; i < EXTRACTORS.size(); i++) {
            NativeJdbcExtractor extractor = EXTRACTORS.get(i);
            try {
                // the contract is that the original connection is returned
                // if unwrapping was not possible
                Connection unwrapped = extractor.getNativeConnection(conn);
               
                if(conn != unwrapped) {
                    if(i != 0) {
                        // move the extractor to the top, so that we don't do
                        // many useless attempts at unwrapping with the others
View Full Code Here

                "check canUnwrap before calling unwrap");
    }
   
    private Statement unwrapInternal(Statement st) {
        for (int i = 0; i < EXTRACTORS.size(); i++) {
            NativeJdbcExtractor extractor = EXTRACTORS.get(i);
            try {
                // the contract is that the original connection is returned
                // if unwrapping was not possible
                Statement unwrapped = extractor.getNativeStatement(st);
                if(st != unwrapped) {
                    if(i != 0) {
                        // move the extractor to the beginning, so that we don't do
                        // many useless attempts at unwrapping with the others
                        // (this code is typically executed for each feature)
View Full Code Here

TOP

Related Classes of org.springframework.jdbc.support.nativejdbc.NativeJdbcExtractor

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.