Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Copyright (c) 1998, 2013 Oracle and/or its affiliates. All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 which accompanies this distribution. The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License is available at http://www.eclipse.org/org/documents/edl-v10.php. Contributors: Oracle - initial API and implementation from Oracle TopLink /
   
 package org.eclipse.persistence.platform.database.oracle;
 
 
 import  oracle.jdbc.OraclePreparedStatement;
 

Purpose: Supports usage of certain Oracle JDBC specific APIs.

 
 public class Oracle10Platform extends Oracle9Platform  {
     
     public Oracle10Platform(){
         super();
         //bug 374136: override setting the FIRST_ROWS hint as this is not needed on Oracle10g
          = "";
     }

    
Internal: This gets called on each batch statement execution Needs to be implemented so that it returns the number of rows successfully modified by this statement for optimistic locking purposes (if useNativeBatchWriting is enabled, and the call uses optimistic locking).

Parameters:
isStatementPrepared - flag is set to true if this statement is prepared
Returns:
- number of rows modified/deleted by this statement
 
     @Override
     public int executeBatch(Statement statementboolean isStatementPreparedthrows java.sql.SQLException {
         if (usesNativeBatchWriting() && isStatementPrepared) {
             int rowCount = 0;
             try {
                 rowCount = ((OraclePreparedStatement)statement).sendBatch();
             } finally {
                 ((OraclePreparedStatement) statement).setExecuteBatch(1);
             }
             return rowCount;
         } else {
             @SuppressWarnings("unused")
             int[] results = statement.executeBatch();
             return statement.getUpdateCount();
         }
     }

    
INTERNAL: Indicate whether app. server should unwrap connection to use lob locator. No need to unwrap connection because writeLob method doesn't use oracle proprietary classes.
 
     @Override
     public boolean isNativeConnectionRequiredForLobLocator() {
         return false;
     }
    
    
INTERNAL: Write LOB value - Oracle 10 deprecates some methods used in the superclass
 
     @Override
     public void writeLOB(DatabaseField fieldObject valueResultSet resultSetAbstractSession sessionthrows SQLException {
         if (isBlob(field.getType())) {
             //change for 338585 to use getName instead of getNameDelimited
             java.sql.Blob blob = (java.sql.Blob)resultSet.getObject(field.getName());
             blob.setBytes(1, (byte[])value);
             //impose the localization
             session.log(.."write_BLOB", Long.valueOf(blob.length()), field.getName());
         } else if (isClob(field.getType())) {
             //change for 338585 to use getName instead of getNameDelimited
             java.sql.Clob clob = (java.sql.Clob)resultSet.getObject(field.getName());
             clob.setString(1, (String)value);
             //impose the localization
             session.log(.."write_CLOB", Long.valueOf(clob.length()), field.getName());
         } else {
             //do nothing for now, open to BFILE or NCLOB types
         }
     }
    
    
INTERNAL: Supports Batch Writing with Optimistic Locking.
    @Override
    public boolean canBatchWriteWithOptimisticLocking(DatabaseCall call){
        return true;//usesNativeBatchWriting || !call.hasParameters();
    }
New to GrepCode? Check out our FAQ X