1 /*
2 * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
462 * @since 1.8
463 */
464 public long[] getLargeUpdateCounts() {
465 return (longUpdateCounts == null) ? null :
466 Arrays.copyOf(longUpdateCounts, longUpdateCounts.length);
467 }
468
469 /**
470 * The array that describes the outcome of a batch execution.
471 * @serial
472 * @since 1.2
473 */
474 private int[] updateCounts;
475
476 /*
477 * Starting with Java SE 8, JDBC has added support for returning an update
478 * count > Integer.MAX_VALUE. Because of this the following changes were made
479 * to BatchUpdateException:
480 * <ul>
481 * <li>Add field longUpdateCounts</li>
482 * <li>Add Constructorr which takes long[] for update counts</li>
483 * <li>Add getLargeUpdateCounts method</li>
484 * </ul>
485 * When any of the constructors are called, the int[] and long[] updateCount
486 * fields are populated by copying the one array to each other.
487 *
488 * As the JDBC driver passes in the updateCounts, there has always been the
489 * possiblity for overflow and BatchUpdateException does not need to account
490 * for that, it simply copies the arrays.
491 *
492 * JDBC drivers should always use the constructor that specifies long[] and
493 * JDBC application developers should call getLargeUpdateCounts.
494 */
495
496 /**
497 * The array that describes the outcome of a batch execution.
498 * @serial
499 * @since 1.8
500 */
501 private long[] longUpdateCounts;
502
503 private static final long serialVersionUID = 5977529877145521757L;
504
505 /*
506 * Utility method to copy int[] updateCount to long[] updateCount
507 */
508 private static long[] copyUpdateCount(int[] uc) {
509 long[] copy = new long[uc.length];
|
1 /*
2 * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
462 * @since 1.8
463 */
464 public long[] getLargeUpdateCounts() {
465 return (longUpdateCounts == null) ? null :
466 Arrays.copyOf(longUpdateCounts, longUpdateCounts.length);
467 }
468
469 /**
470 * The array that describes the outcome of a batch execution.
471 * @serial
472 * @since 1.2
473 */
474 private int[] updateCounts;
475
476 /*
477 * Starting with Java SE 8, JDBC has added support for returning an update
478 * count > Integer.MAX_VALUE. Because of this the following changes were made
479 * to BatchUpdateException:
480 * <ul>
481 * <li>Add field longUpdateCounts</li>
482 * <li>Add Constructor which takes long[] for update counts</li>
483 * <li>Add getLargeUpdateCounts method</li>
484 * </ul>
485 * When any of the constructors are called, the int[] and long[] updateCount
486 * fields are populated by copying the one array to each other.
487 *
488 * As the JDBC driver passes in the updateCounts, there has always been the
489 * possibility for overflow and BatchUpdateException does not need to account
490 * for that, it simply copies the arrays.
491 *
492 * JDBC drivers should always use the constructor that specifies long[] and
493 * JDBC application developers should call getLargeUpdateCounts.
494 */
495
496 /**
497 * The array that describes the outcome of a batch execution.
498 * @serial
499 * @since 1.8
500 */
501 private long[] longUpdateCounts;
502
503 private static final long serialVersionUID = 5977529877145521757L;
504
505 /*
506 * Utility method to copy int[] updateCount to long[] updateCount
507 */
508 private static long[] copyUpdateCount(int[] uc) {
509 long[] copy = new long[uc.length];
|