- Notifications
You must be signed in to change notification settings - Fork5
Commitec0ad67
committed
Attached is a patch to add bytea support to JDBC.
This patch does the following:- Adds binary datatype support (bytea)- Changes getXXXStream()/setXXXStream() methods to be spec compliant- Adds ability to revert to old behaviorDetails:Adds support for the binary type bytea. The ResultSet.getBytes() andPreparedStatement.setBytes() methods now work against columns of byteatype. This is a change in behavior from the previous code which assumedthe column type was OID and thus a LargeObject. The new behavior ismore complient with the JDBC spec as BLOB/CLOB are to be used forLargeObjects and the getBytes()/setBytes() methods are for the databasesbinary datatype (which is bytea in postgres).Changes the behavior of the getBinaryStream(), getAsciiStream(),getCharacterStream(), getUnicodeStream() and their setXXXStream()counterparts. These methos now work against either the bytea type(BinaryStream) or the text types (AsciiStream, CharacterStream,UnicodeStream). The previous behavior was that these all assumed theunderlying column was of type OID and thus a LargeObject. Thespec/javadoc for these methods indicate that they are for LONGVARCHARand LONGVARBINARY datatypes, which are distinct from the BLOB/CLOBdatatypes. Given that the bytea and text types support upto 1G, theyare the LONGVARBINARY and LONGVARCHAR datatypes in postgres.Added support for turning off the above new functionality. Given thatthe changes above are not backwardly compatible (however they are morespec complient), I added the ability to revert back to the old behavior. The Connection now takes an optional parameter named 'compatible'. Ifthe value of '7.1' is passed, the driver reverts to the 7.1 behavior.If the parameter is not passed or the value '7.2' is passed the behavioris the new behavior. The mechanism put in place can be used in thefuture when/if similar needs arise to change behavior. This ispatterned after how Oracle does this (i.e. Oracle has a 'compatible'parameter that behaves in a similar manner).Misc fixes. Cleaned up a few things I encountered along the way.Note that in testing the patch I needed to ignore whitespace differencesin order to get it to apply cleanly (i.e. patch -l -i byteapatch.diff).Also this patch introduces a new file(src/interfaces/jdbc/org/postgresql/util/PGbytea.java).Barry Lind1 parent6b50f9a commitec0ad67
File tree
10 files changed
+557
-49
lines changed- src/interfaces/jdbc/org/postgresql
- jdbc1
- jdbc2
- util
10 files changed
+557
-49
lines changedLines changed: 24 additions & 4 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
11 | 11 |
| |
12 | 12 |
| |
13 | 13 |
| |
14 |
| - | |
| 14 | + | |
15 | 15 |
| |
16 | 16 |
| |
17 | 17 |
| |
| |||
22 | 22 |
| |
23 | 23 |
| |
24 | 24 |
| |
25 |
| - | |
26 |
| - | |
27 |
| - | |
28 | 25 |
| |
29 | 26 |
| |
30 | 27 |
| |
31 | 28 |
| |
32 | 29 |
| |
33 | 30 |
| |
| 31 | + | |
34 | 32 |
| |
35 | 33 |
| |
36 | 34 |
| |
| |||
123 | 121 |
| |
124 | 122 |
| |
125 | 123 |
| |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
126 | 129 |
| |
127 | 130 |
| |
128 | 131 |
| |
| |||
968 | 971 |
| |
969 | 972 |
| |
970 | 973 |
| |
| 974 | + | |
| 975 | + | |
| 976 | + | |
| 977 | + | |
| 978 | + | |
| 979 | + | |
| 980 | + | |
| 981 | + | |
| 982 | + | |
| 983 | + | |
| 984 | + | |
| 985 | + | |
| 986 | + | |
| 987 | + | |
| 988 | + | |
| 989 | + | |
| 990 | + | |
971 | 991 |
| |
972 | 992 |
| |
973 | 993 |
| |
|
Lines changed: 19 additions & 5 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
85 | 85 |
| |
86 | 86 |
| |
87 | 87 |
| |
88 |
| - | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
89 | 106 |
| |
90 |
| - | |
91 |
| - | |
92 |
| - | |
93 |
| - | |
| 107 | + | |
94 | 108 |
| |
95 | 109 |
| |
96 | 110 |
| |
|
Lines changed: 2 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
192 | 192 |
| |
193 | 193 |
| |
194 | 194 |
| |
195 |
| - | |
| 195 | + | |
| 196 | + | |
196 | 197 |
| |
197 | 198 |
| |
198 | 199 |
| |
|
Lines changed: 3 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
17 | 17 |
| |
18 | 18 |
| |
19 | 19 |
| |
20 |
| - | |
| 20 | + | |
21 | 21 |
| |
22 | 22 |
| |
23 | 23 |
| |
| |||
174 | 174 |
| |
175 | 175 |
| |
176 | 176 |
| |
| 177 | + | |
177 | 178 |
| |
178 | 179 |
| |
179 | 180 |
| |
| |||
197 | 198 |
| |
198 | 199 |
| |
199 | 200 |
| |
| 201 | + | |
200 | 202 |
| |
201 | 203 |
| |
202 | 204 |
| |
|
Lines changed: 105 additions & 6 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
82 | 82 |
| |
83 | 83 |
| |
84 | 84 |
| |
85 |
| - | |
| 85 | + | |
86 | 86 |
| |
87 | 87 |
| |
88 | 88 |
| |
| |||
107 | 107 |
| |
108 | 108 |
| |
109 | 109 |
| |
110 |
| - | |
| 110 | + | |
111 | 111 |
| |
112 | 112 |
| |
113 | 113 |
| |
| |||
294 | 294 |
| |
295 | 295 |
| |
296 | 296 |
| |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
297 | 306 |
| |
298 | 307 |
| |
299 | 308 |
| |
300 | 309 |
| |
301 | 310 |
| |
302 | 311 |
| |
| 312 | + | |
303 | 313 |
| |
304 | 314 |
| |
305 | 315 |
| |
| |||
386 | 396 |
| |
387 | 397 |
| |
388 | 398 |
| |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
389 | 419 |
| |
390 | 420 |
| |
| 421 | + | |
391 | 422 |
| |
392 | 423 |
| |
393 | 424 |
| |
| |||
406 | 437 |
| |
407 | 438 |
| |
408 | 439 |
| |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
409 | 460 |
| |
410 | 461 |
| |
| 462 | + | |
411 | 463 |
| |
412 | 464 |
| |
413 | 465 |
| |
| |||
425 | 477 |
| |
426 | 478 |
| |
427 | 479 |
| |
428 |
| - | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
429 | 528 |
| |
430 | 529 |
| |
431 | 530 |
| |
| |||
460 | 559 |
| |
461 | 560 |
| |
462 | 561 |
| |
463 |
| - | |
464 |
| - | |
| 562 | + | |
| 563 | + | |
465 | 564 |
| |
466 | 565 |
| |
467 | 566 |
| |
| |||
572 | 671 |
| |
573 | 672 |
| |
574 | 673 |
| |
575 |
| - | |
| 674 | + | |
576 | 675 |
| |
577 | 676 |
| |
578 | 677 |
| |
|
0 commit comments
Comments
(0)