equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
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 |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. Oracle designates this |
7 * published by the Free Software Foundation. Oracle designates this |
23 * questions. |
23 * questions. |
24 */ |
24 */ |
25 |
25 |
26 package javax.sql.rowset.serial; |
26 package javax.sql.rowset.serial; |
27 |
27 |
|
28 import java.io.BufferedReader; |
|
29 import java.io.IOException; |
|
30 import java.io.InputStreamReader; |
28 import java.sql.*; |
31 import java.sql.*; |
29 import javax.sql.*; |
|
30 import java.io.*; |
|
31 import java.lang.String; |
|
32 import java.math.*; |
|
33 import java.util.Map; |
32 import java.util.Map; |
34 import java.util.Vector; |
33 import java.util.Vector; |
35 |
34 |
36 /** |
35 /** |
37 * The output stream for writing the attributes of a |
36 * The output stream for writing the attributes of a |
442 * |
441 * |
443 * Note: this means that the class defining SQLData |
442 * Note: this means that the class defining SQLData |
444 * will need to track if a field is SQL null for itself |
443 * will need to track if a field is SQL null for itself |
445 */ |
444 */ |
446 if (x == null) { |
445 if (x == null) { |
447 attribs.add(x); |
446 attribs.add(null); |
448 return; |
447 } else { |
449 } |
448 /* |
450 |
449 * We have to write out a SerialStruct that contains |
451 /* |
450 * the name of this class otherwise we don't know |
452 * We have to write out a SerialStruct that contains |
451 * what to re-instantiate during readSQL() |
453 * the name of this class otherwise we don't know |
452 */ |
454 * what to re-instantiate during readSQL() |
453 attribs.add(new SerialStruct(x, map)); |
455 */ |
454 } |
456 attribs.add(new SerialStruct(x, map)); |
|
457 } |
455 } |
458 |
456 |
459 /** |
457 /** |
460 * Writes a <code>Ref</code> object in the Java programming language |
458 * Writes a <code>Ref</code> object in the Java programming language |
461 * to this <code>SQLOutputImpl</code> object. The driver converts |
459 * to this <code>SQLOutputImpl</code> object. The driver converts |
468 * values of a UDT to the database. |
466 * values of a UDT to the database. |
469 */ |
467 */ |
470 @SuppressWarnings("unchecked") |
468 @SuppressWarnings("unchecked") |
471 public void writeRef(Ref x) throws SQLException { |
469 public void writeRef(Ref x) throws SQLException { |
472 if (x == null) { |
470 if (x == null) { |
473 attribs.add(x); |
471 attribs.add(null); |
474 return; |
472 } else { |
475 } |
473 attribs.add(new SerialRef(x)); |
476 attribs.add(new SerialRef(x)); |
474 } |
477 } |
475 } |
478 |
476 |
479 /** |
477 /** |
480 * Writes a <code>Blob</code> object in the Java programming language |
478 * Writes a <code>Blob</code> object in the Java programming language |
481 * to this <code>SQLOutputImpl</code> object. The driver converts |
479 * to this <code>SQLOutputImpl</code> object. The driver converts |
488 * values of a UDT to the database. |
486 * values of a UDT to the database. |
489 */ |
487 */ |
490 @SuppressWarnings("unchecked") |
488 @SuppressWarnings("unchecked") |
491 public void writeBlob(Blob x) throws SQLException { |
489 public void writeBlob(Blob x) throws SQLException { |
492 if (x == null) { |
490 if (x == null) { |
493 attribs.add(x); |
491 attribs.add(null); |
494 return; |
492 } else { |
495 } |
493 attribs.add(new SerialBlob(x)); |
496 attribs.add(new SerialBlob(x)); |
494 } |
497 } |
495 } |
498 |
496 |
499 /** |
497 /** |
500 * Writes a <code>Clob</code> object in the Java programming language |
498 * Writes a <code>Clob</code> object in the Java programming language |
501 * to this <code>SQLOutputImpl</code> object. The driver converts |
499 * to this <code>SQLOutputImpl</code> object. The driver converts |
508 * values of a UDT to the database. |
506 * values of a UDT to the database. |
509 */ |
507 */ |
510 @SuppressWarnings("unchecked") |
508 @SuppressWarnings("unchecked") |
511 public void writeClob(Clob x) throws SQLException { |
509 public void writeClob(Clob x) throws SQLException { |
512 if (x == null) { |
510 if (x == null) { |
513 attribs.add(x); |
511 attribs.add(null); |
514 return; |
512 } else { |
515 } |
513 attribs.add(new SerialClob(x)); |
516 attribs.add(new SerialClob(x)); |
514 } |
517 } |
515 } |
518 |
516 |
519 /** |
517 /** |
520 * Writes a <code>Struct</code> object in the Java |
518 * Writes a <code>Struct</code> object in the Java |
521 * programming language to this <code>SQLOutputImpl</code> |
519 * programming language to this <code>SQLOutputImpl</code> |
552 * values of a UDT to the database. |
550 * values of a UDT to the database. |
553 */ |
551 */ |
554 @SuppressWarnings("unchecked") |
552 @SuppressWarnings("unchecked") |
555 public void writeArray(Array x) throws SQLException { |
553 public void writeArray(Array x) throws SQLException { |
556 if (x == null) { |
554 if (x == null) { |
557 attribs.add(x); |
555 attribs.add(null); |
558 return; |
556 } else { |
559 } |
557 attribs.add(new SerialArray(x, map)); |
560 attribs.add(new SerialArray(x, map)); |
558 } |
561 } |
559 } |
562 |
560 |
563 /** |
561 /** |
564 * Writes an <code>java.sql.Type.DATALINK</code> object in the Java |
562 * Writes an <code>java.sql.Type.DATALINK</code> object in the Java |
565 * programming language to this <code>SQLOutputImpl</code> object. The |
563 * programming language to this <code>SQLOutputImpl</code> object. The |
572 * values of a UDT to the database. |
570 * values of a UDT to the database. |
573 */ |
571 */ |
574 @SuppressWarnings("unchecked") |
572 @SuppressWarnings("unchecked") |
575 public void writeURL(java.net.URL url) throws SQLException { |
573 public void writeURL(java.net.URL url) throws SQLException { |
576 if (url == null) { |
574 if (url == null) { |
577 attribs.add(url); |
575 attribs.add(null); |
578 return; |
576 } else { |
579 } |
577 attribs.add(new SerialDatalink(url)); |
580 attribs.add(new SerialDatalink(url)); |
578 } |
581 |
|
582 } |
579 } |
583 |
580 |
584 |
581 |
585 /** |
582 /** |
586 * Writes the next attribute to the stream as a <code>String</code> |
583 * Writes the next attribute to the stream as a <code>String</code> |