Package java.sql

Examples of java.sql.PreparedStatement.addBatch()


        for (short i = 0; i < strRep.length; i++) {
          insertExceptionStatement.setInt(1, eventId);
          insertExceptionStatement.setShort(2, i);
          insertExceptionStatement.setString(3, strRep[i]);
          if(cnxSupportsBatchUpdates) {
            insertExceptionStatement.addBatch();
          } else {
            insertExceptionStatement.execute();
          }
        }
        if(cnxSupportsBatchUpdates) {
View Full Code Here


        insertStatement.setString(10, li.getClassName());
        insertStatement.setString(11, li.getMethodName());
        insertStatement.setString(12, li.getLineNumber());

        //LogLog.info("*** performing insertion.");
        insertStatement.addBatch();
      }

      int[] r = insertStatement.executeBatch();
     
      if(r != null) {
View Full Code Here

            //LogLog.info(
            //  "id " + eventIDArray[i] + ", key " + key + ", value " + value);
            insertPropertiesStatement.setInt(1, eventIDArray[i]);
            insertPropertiesStatement.setString(2, key);
            insertPropertiesStatement.setString(3, value);
            insertPropertiesStatement.addBatch();
          }
        }
      }

      // now that all properties for all events have been inserted, we can
View Full Code Here

          for (short k = 0; k < strRep.length; k++) {
            insertExceptionStatement.setInt(1, eventIDArray[i]);
            insertExceptionStatement.setShort(2, k);
            insertExceptionStatement.setString(3, strRep[k]);
            insertExceptionStatement.addBatch();
          }
        }
      }

      insertExceptionStatement.executeBatch();
View Full Code Here

      System.out.println("set first values");
      pstmt.setInt(1,1);
      pstmt.setString(2, "Continue-1");
      pstmt.setString(3, "STRING-1");
      System.out.println("add first to batch");
      pstmt.addBatch();
 
      System.out.println("set second values - illegal update - forces unique constr violation");
      pstmt.setInt(1,1);
      pstmt.setString(2,"Invalid");
      pstmt.setString(3,"STRING-3");
View Full Code Here

      System.out.println("set second values - illegal update - forces unique constr violation");
      pstmt.setInt(1,1);
      pstmt.setString(2,"Invalid");
      pstmt.setString(3,"STRING-3");
      System.out.println("add second to batch");
      pstmt.addBatch();

      System.out.println("set third values; legal update again");
      pstmt.setInt(1,2);
      pstmt.setString(2,"Continue-2");
      pstmt.setString(3,"STRING-2");
View Full Code Here

      System.out.println("set third values; legal update again");
      pstmt.setInt(1,2);
      pstmt.setString(2,"Continue-2");
      pstmt.setString(3,"STRING-2");
      System.out.println("add third to batch");
      pstmt.addBatch();

      System.out.println("execute the executeBatch method");
      System.out.println("expecting batchupdateexception");
      updateCount = pstmt.executeBatch();
View Full Code Here

        pstmt.setInt(1, tableId);
        pstmt.setString(2, CatalogUtil.extractSimpleName(col.getName()));
        pstmt.setInt(3, i);
        pstmt.setString(4, col.getDataType().getType().name());
        pstmt.setInt(5, (col.getDataType().hasLength() ? col.getDataType().getLength() : 0));
        pstmt.addBatch();
        pstmt.clearParameters();
      }
      pstmt.executeBatch();
      pstmt.close();
View Full Code Here

        pstmt = conn.prepareStatement(propSQL);
        for (CatalogProtos.KeyValueProto entry : table.getMeta().getParams().getKeyvalList()) {
          pstmt.setInt(1, tableId);
          pstmt.setString(2, entry.getKey());
          pstmt.setString(3, entry.getValue());
          pstmt.addBatch();
          pstmt.clearParameters();
        }
        pstmt.executeBatch();
        pstmt.close();
      }
View Full Code Here

         
            if (batchThisRequest){
              if (pstmtBatch != null){
                pstmtBatch.addBatch(pstmt);
              } else {
                pstmt.addBatch();
              }
                // return -1 to indicate batch mode
                return -1;
               
            } else {
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.