Package java.sql

Examples of java.sql.PreparedStatement.executeBatch()


        for (int i = 1; i <= 5; i++) {
            assertEquals(1, result[i - 1]);
        }

        ps.clearBatch();
        result = ps.executeBatch();
        assertEquals(0, result.length);

        ps.close();
    }
}
View Full Code Here


               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);
                  }
               }
            } else {
View Full Code Here

         //flush the batch
         if (updateCount % batchSize != 0) {
            if (log.isTraceEnabled()) {
               log.tracef("Flushing batch, update count is: %d", updateCount);
            }
            ps.executeBatch();
         }
         if (log.isTraceEnabled()) {
            log.tracef("Updated %d buckets.", updateCount);
         }
      } catch (SQLException ex) {
View Full Code Here

            deletionCount++;
            if (deletionCount % batchSize == 0) {
               if (log.isTraceEnabled()) {
                  log.tracef("Flushing deletion batch, total deletion count so far is %d", deletionCount);
               }
               ps.executeBatch();
            }
         }
         if (deletionCount % batchSize != 0) {
            int[] batchResult = ps.executeBatch();
            if (log.isTraceEnabled()) {
View Full Code Here

               }
               ps.executeBatch();
            }
         }
         if (deletionCount % batchSize != 0) {
            int[] batchResult = ps.executeBatch();
            if (log.isTraceEnabled()) {
               log.tracef("Flushed the batch and received following results: %s", Arrays.toString(batchResult));
            }
         }
      } catch (SQLException ex) {
View Full Code Here

               deletePs.setString(1, bucket.getBucketIdAsString());
               deletePs.addBatch();
               unlock(bucket.getBucketId());
            }
            log.tracef("Flushing deletion batch");
            deletePs.executeBatch();
            log.tracef("Flushed deletion batch");
         } catch (Exception ex) {
            // if something happens make sure buckets locks are being release
            log.failedClearingJdbcCacheStore(ex);
         } finally {
View Full Code Here

                  } else {
                     emptyBuckets.add(bucket);
                  }
               }
               log.trace("Flushing update batch");
               ps.executeBatch();
               log.trace("Flushed update batch");
            } catch (Exception ex) {
               log.failedClearingJdbcCacheStore(ex);
            } finally {
               JdbcUtil.safeClose(ps);
View Full Code Here

                  ps.addBatch();
                  deletionCount++;
                  purgedBuckets.add(bucket.getBucketId());
               }
               log.tracef("Flushing deletion batch");
               ps.executeBatch();
               log.tracef("Flushed deletion batch");
            } catch (Exception ex) {
               // if something happens make sure buckets locks are being release
               log.failedClearingJdbcCacheStore(ex);
            } finally {
View Full Code Here

          insertStatement.addBatch();
          statementCount += 1;
         
          if ((statementCount % this.maxBatchSize) == 0)
          {
            insertStatement.executeBatch();
            insertStatement.clearBatch();
          }
         
          insertStatement.clearParameters();
        }
View Full Code Here

          insertStatement.clearParameters();
        }
       
        if ((statementCount % this.maxBatchSize) > 0)
        {
          insertStatement.executeBatch();
        }
   
        logger.log(Level.INFO, Messages.INSERT_COUNT.getMessage(), statementCount, table);
      }
      catch (ExecutionException e)
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.