Package java.sql

Examples of java.sql.PreparedStatement.addBatch()


               if (!bucket.isEmpty()) {
                  ByteBuffer byteBuffer = JdbcUtil.marshall(getMarshaller(), bucket);
                  ps.setBinaryStream(1, byteBuffer.getStream(), byteBuffer.getLength());
                  ps.setLong(2, bucket.timestampOfFirstEntryToExpire());
                  ps.setString(3, bucket.getBucketIdAsString());
                  ps.addBatch();
                  updateCount++;
                  if (updateCount % batchSize == 0) {
                     ps.executeBatch();
                     if (log.isTraceEnabled()) {
                        log.tracef("Flushing batch, update count is: %d", updateCount);
View Full Code Here


            String sql = tableManipulation.getDeleteRowSql();
            ps = conn.prepareStatement(sql);
            int deletionCount = 0;
            for (Bucket bucket : emptyBuckets) {
               ps.setString(1, bucket.getBucketIdAsString());
               ps.addBatch();
               deletionCount++;
               if (deletionCount % batchSize == 0) {
                  if (log.isTraceEnabled()) {
                     log.tracef("Flushing deletion batch, total deletion count so far is %d", deletionCount);
                  }
View Full Code Here

  public void addToBatch(Expectation expectation) throws SQLException, HibernateException {
    if ( !expectation.canBeBatched() ) {
      throw new HibernateException( "attempting to batch an operation which cannot be batched" );
    }
    PreparedStatement batchUpdate = getStatement();
    batchUpdate.addBatch();
    expectations[ batchSize++ ] = expectation;
    if ( batchSize == getFactory().getSettings().getJdbcBatchSize() ) {
      doExecuteBatch( batchUpdate );
    }
  }
View Full Code Here

  public void addToBatch(Expectation expectation) throws SQLException, HibernateException {
    if ( !expectation.canBeBatched() ) {
      throw new HibernateException( "attempting to batch an operation which cannot be batched" );
    }
    PreparedStatement batchUpdate = getStatement();
    batchUpdate.addBatch();
    expectations[ batchSize++ ] = expectation;
    if ( batchSize == getFactory().getSettings().getJdbcBatchSize() ) {
      doExecuteBatch( batchUpdate );
    }
  }
View Full Code Here

         int readCount = 0;
         int batchSize = tableManipulation.getBatchSize();

         Object objFromStream = marshaller.objectFromObjectStream(objectInput);
         while (fromStreamProcess(objFromStream, ps, objectInput)) {
            ps.addBatch();
            readCount++;
            if (readCount % batchSize == 0) {
               ps.executeBatch();
               if (log.isTraceEnabled()) {
                  log.trace("Executing batch " + readCount / batchSize + ", batch size is " + batchSize);
View Full Code Here

            if (!bucket.isEmpty()) {
               ByteBuffer byteBuffer = JdbcUtil.marshall(getMarshaller(), bucket);
               ps.setBinaryStream(1, byteBuffer.getStream(), byteBuffer.getLength());
               ps.setLong(2, bucket.timestampOfFirstEntryToExpire());
               ps.setString(3, bucket.getBucketName());
               ps.addBatch();
               updateCount++;
               if (updateCount % batchSize == 0) {
                  ps.executeBatch();
                  if (log.isTraceEnabled()) log.trace("Flushing batch, update count is: " + updateCount);
               }
View Full Code Here

         String sql = tableManipulation.getDeleteRowSql();
         ps = conn.prepareStatement(sql);
         int deletionCount = 0;
         for (Bucket bucket : emptyBuckets) {
            ps.setString(1, bucket.getBucketName());
            ps.addBatch();
            deletionCount++;
            if (deletionCount % batchSize == 0) {
               if (log.isTraceEnabled())
                  log.trace("Flushing deletion batch, total deletion count so far is " + deletionCount);
               ps.executeBatch();
View Full Code Here

        ps.setString(10, trans.getSp_tid());
        ps.setString(11, trans.getTrace1());
        ps.setString(12, trans.getRrn());
        ps.setString(13, trans.getTxn_date());
        ps.setString(14, trans.getArea());
        ps.addBatch();
      }
      ps.executeBatch();
      conn.commit();
    } catch (SQLException e) {
      e.printStackTrace();
View Full Code Here

          if (reader.length() > NCCONST.COLUMN_SIZE_READER) {
            reader = reader.substring(0, NCCONST.COLUMN_SIZE_READER);
          }
          pstmt.setString(1, reader);
          pstmt.setLong(2, docid);
          pstmt.addBatch();
        }
        pstmt.executeBatch();
        pstmt.close();
       
        // Insert attachment names
View Full Code Here

                + "(attachment_unid, docid) values(?,?)");
            for (int i = 0; i < attachmentIds.size(); i++) {
              String attachmentId = (String) attachmentIds.get(i);
              pstmt.setString(1, attachmentId);
              pstmt.setLong(2, docid);
              pstmt.addBatch();
              LOGGER.log(Level.FINEST,
                  "Insert attachment: {0}", attachmentId);
            }
            pstmt.executeBatch();
            pstmt.close();
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.