- Notifications
You must be signed in to change notification settings - Fork28
Commitd99794e
committed
Attached is a patch for current CVS, consisting of a cvs diff -c
for the changed files and a few new files:- test/jdbc2/BatchExecuteTest.java- util/MessageTranslator.java- jdbc2/PBatchUpdateException.javaAs an aside, is this the best way to submit a patch consistingof both changed and new files? Or is there a smarter cvs commandwhich gets them all in one patch file?This patch fixes batch processing in the JDBC driver to beJDBC-2 compliant. Specifically, the changes introduced by thispatch are:1) Statement.executeBatch() no longer commits or rolls back atransaction, as this is not prescribed by the JDBC spec. Its upto the application to disable autocommit and to commit orrollback the transaction. Where JDBC talks about "executing thestatements as a unit", it means executing the statements in oneround trip to the backend for better performance, it does notmean executing the statements in a transaction.2) Statement.executeBatch() now throws a BatchUpdateException()as required by the JDBC spec. The significance of this is thatthe receiver of the exception gets the updateCounts of thecommands that succeeded before the error occurred. In order forthe messages to be translatable, java.sql.BatchUpdateExceptionis extended by org.postgresql.jdbc2.PBatchUpdateException() andthe localization code is factored out fromorg.postgresql.util.PSQLException to a separate singleton classorg.postgresql.util.MessageTranslator.3) When there is no batch or there are 0 statements in the batchwhen Statement.executeBatch() is called, do not throw anSQLException, but silently do nothing and return an update countarray of length 0. The JDBC spec says "Throws an SQLException ifthe driver does not support batch statements", which is clearlynot the case. See testExecuteEmptyBatch() inBatchExecuteTest.java for an example. The messagepostgresql.stat.batch.empty is removed from the languagespecific properties files.4) When Statement.executeBatch() is performed, reset thestatement's list of batch commands to empty. The JDBC spec isn't100% clear about this. This behaviour is only documented in theJava tutorial(http://java.sun.com/docs/books/tutorial/jdbc/jdbc2dot0/batchupdates.html).Note that the Oracle JDBC driver also resets the statement'slist in executeBatch(), and this seems the most reasonableinterpretation.5) A new test case is added to the JDBC test suite which testsvarious aspects of batch processing. See the new fileBatchExecuteTest.java.Regards,Ren? Pijlman1 parente5d3df2 commitd99794e
File tree
6 files changed
+266
-43
lines changed- src/interfaces/jdbc/org/postgresql
- jdbc2
- test
- jdbc2
- util
6 files changed
+266
-43
lines changedLines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2836 | 2836 |
| |
2837 | 2837 |
| |
2838 | 2838 |
| |
2839 |
| - | |
| 2839 | + | |
2840 | 2840 |
| |
2841 | 2841 |
| |
2842 | 2842 |
| |
|
Lines changed: 13 additions & 7 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
179 | 179 |
| |
180 | 180 |
| |
181 | 181 |
| |
182 |
| - | |
183 |
| - | |
184 |
| - | |
| 182 | + | |
| 183 | + | |
185 | 184 |
| |
186 | 185 |
| |
187 | 186 |
| |
188 |
| - | |
189 | 187 |
| |
190 | 188 |
| |
191 | 189 |
| |
192 |
| - | |
193 | 190 |
| |
194 |
| - | |
195 |
| - | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
196 | 202 |
| |
197 | 203 |
| |
198 | 204 |
| |
|
Lines changed: 4 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
205 | 205 |
| |
206 | 206 |
| |
207 | 207 |
| |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
208 | 212 |
| |
209 | 213 |
| |
210 | 214 |
| |
|
Lines changed: 183 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + |
Lines changed: 63 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + |
Lines changed: 2 additions & 35 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2 | 2 |
| |
3 | 3 |
| |
4 | 4 |
| |
5 |
| - | |
6 |
| - | |
7 | 5 |
| |
8 | 6 |
| |
9 | 7 |
| |
| |||
12 | 10 |
| |
13 | 11 |
| |
14 | 12 |
| |
15 |
| - | |
16 |
| - | |
17 |
| - | |
18 | 13 |
| |
19 | 14 |
| |
20 | 15 |
| |
| |||
86 | 81 |
| |
87 | 82 |
| |
88 | 83 |
| |
89 |
| - | |
90 |
| - | |
91 |
| - | |
92 |
| - | |
93 |
| - | |
94 |
| - | |
95 |
| - | |
96 |
| - | |
97 |
| - | |
98 |
| - | |
99 |
| - | |
100 |
| - | |
| 84 | + | |
| 85 | + | |
101 | 86 |
| |
102 | 87 |
| |
103 |
| - | |
104 |
| - | |
105 |
| - | |
106 |
| - | |
107 |
| - | |
108 |
| - | |
109 |
| - | |
110 |
| - | |
111 |
| - | |
112 |
| - | |
113 |
| - | |
114 |
| - | |
115 |
| - | |
116 |
| - | |
117 |
| - | |
118 |
| - | |
119 |
| - | |
120 | 88 |
| |
121 | 89 |
| |
122 | 90 |
| |
| |||
140 | 108 |
| |
141 | 109 |
| |
142 | 110 |
| |
143 |
| - | |
144 | 111 |
|
0 commit comments
Comments
(0)