/[classpath]/classpath/java/sql/DataTruncation.java
ViewVC logotype

Diff of /classpath/java/sql/DataTruncation.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.6 by ericb, Sun Feb 24 04:25:17 2002 UTC revision 1.7 by bryce, Fri Jun 21 05:34:12 2002 UTC
# Line 1  Line 1 
1  /* DataTruncation.java -- warning when data has been truncated  /* DataTruncation.java -- Warning when data has been truncated.
2     Copyright (C) 1999, 2000, 2002 Free Software Foundation, Inc.     Copyright (C) 1999, 2000, 2002 Free Software Foundation, Inc.
3    
4  This file is part of GNU Classpath.  This file is part of GNU Classpath.
# Line 7  GNU Classpath is free software; you can Line 7  GNU Classpath is free software; you can
7  it under the terms of the GNU General Public License as published by  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation; either version 2, or (at your option)  the Free Software Foundation; either version 2, or (at your option)
9  any later version.  any later version.
10    
11  GNU Classpath is distributed in the hope that it will be useful, but  GNU Classpath is distributed in the hope that it will be useful, but
12  WITHOUT ANY WARRANTY; without even the implied warranty of  WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# Line 35  this exception to your version of the li Line 35  this exception to your version of the li
35  obligated to do so.  If you do not wish to do so, delete this  obligated to do so.  If you do not wish to do so, delete this
36  exception statement from your version. */  exception statement from your version. */
37    
   
38  package java.sql;  package java.sql;
39    
40  /**  /**
41   * This exception is thrown when a piece of data is unexpectedly    * This exception is thrown when a piece of data is unexpectedly
42   * truncated in JDBC. This has an SQLstate of <code>01004</code>.    * truncated in JDBC.
43   *    *
44   * @author Aaron M. Renn (arenn@urbanophile.com)    * @author Aaron M. Renn (arenn@urbanophile.com)
45   * @status updated to 1.4    */
46   */  public class DataTruncation extends SQLWarning
 public class DataTruncation extends SQLWarning  
47  {  {
48    /**    static final long serialVersionUID = 6464298989504059473L;
    * Compatible with JDK 1.1+.  
    */  
   private static final long serialVersionUID = 6464298989504059473L;  
49    
50    /**    /**
51     * The original size of the data.     * The original size of the data.
    *  
    * @serial the original data size  
52     */     */
53    private final int dataSize;    private int dataSize;
54    
55    /**    /**
56     * The index of the parameter or column whose value was truncated.     * The index of the parameter or column whose value was truncated.
    *  
    * @serial the index that was truncated  
57     */     */
58    private final int index;    private int index;
59    
60    /**    /**
61     * Indicates whether or not a parameter value was truncated.     * Indicates whether or not a parameter value was truncated.
    *  
    * @serial true if a parameter was truncated  
62     */     */
63    private final boolean parameter;    private boolean parameter;
64    
65    /**    /**
66     * Indicates whether or not a data column value was truncated.     * Indicates whether or not a data column value was truncated.
    *  
    * @serial true if a data column was read before truncation  
67     */     */
68    private final boolean read;    private boolean read;
69    
70    /**    /**
71     * This is the size of the data after truncation.     * This is the size of the data after truncation.
    *  
    * @serial the size actually transferred  
72     */     */
73    private final int transferSize;    private int transferSize;
74    
75    /**    /**
76     * Create a new instance with the specified values.  The descriptive error     * This method initializes a new instance of <code>DataTruncation</code>
77     * message for this exception will be "Data truncation", the SQL state     * with the specified values.  The descriptive error message for this
78     * will be "01004", and the vendor specific error code will be set to 0.     * exception will be "Data truncation", the SQL state will be "01004"
79     *     * and the vendor specific error code will be set to 0.
80     * @param index the index of the parameter or column that was truncated     *
81     * @param parameter <code>true</code> if a parameter was truncated     * @param index The index of the parameter or column that was truncated.
82     * @param read <code>true</code> if a data column was truncated     * @param parameter <code>true</code> if a parameter was truncated,
83     * @param dataSize the original size of the data     *        <code>false</code> otherwise.
84     * @param transferSize the size of the data after truncation     * @param read <code>true</code> if a data column was truncated,
85       *        <code>false</code> otherwise.
86       * @param dataSize The original size of the data.
87       * @param transferSize The size of the data after truncation.
88     */     */
89    public DataTruncation(int index, boolean parameter, boolean read,    public DataTruncation(int index, boolean parameter, boolean read, int
90                          int dataSize, int transferSize)      dataSize, int transferSize)
91    {    {
92      super("Data truncation", "01004");      super("Data truncation", "01004");
93    
94      this.index = index;      this.index = index;
95      this.parameter = parameter;      this.parameter = parameter;
96      this.read = read;      this.read = read;
# Line 110  public class DataTruncation extends SQLW Line 99  public class DataTruncation extends SQLW
99    }    }
100    
101    /**    /**
102     * Get the index of the column or parameter that was truncated.     * This method returns the index of the column or parameter that was
103       * truncated.
104     *     *
105     * @return the index of the column or parameter that was truncated     * @return The index of the column or parameter that was truncated.
106     */     */
107    public int getIndex()    public int getIndex()
108    {    {
# Line 120  public class DataTruncation extends SQLW Line 110  public class DataTruncation extends SQLW
110    }    }
111    
112    /**    /**
113     * Return true if it was a parameter that was truncated.     * This method determines whether or not it was a parameter that was
114       * truncated.
115     *     *
116     * @return <code>true</code> if a parameter was truncated     * @return <code>true</code> if a parameter was truncated, <code>false</code>
117       * otherwise.
118     */     */
119    public boolean getParameter()    public boolean getParameter()
120    {    {
# Line 130  public class DataTruncation extends SQLW Line 122  public class DataTruncation extends SQLW
122    }    }
123    
124    /**    /**
125     * Return true if it was a column that was truncated.     * This method determines whether or not it was a column that was
126       * truncated.
127     *     *
128     * @return <code>true</code> if a column was truncated     * @return <code>true</code> if a column was truncated, <code>false</code>
129       * otherwise.
130     */     */
131    public boolean getRead()    public boolean getRead()
132    {    {
# Line 143  public class DataTruncation extends SQLW Line 137  public class DataTruncation extends SQLW
137     * This method returns the original size of the parameter or column that     * This method returns the original size of the parameter or column that
138     * was truncated.     * was truncated.
139     *     *
140     * @return the original size     * @return The original size of the parameter or column that was truncated.
141     */     */
142    public int getDataSize()    public int getDataSize()
143    {    {
# Line 154  public class DataTruncation extends SQLW Line 148  public class DataTruncation extends SQLW
148     * This method returns the size of the parameter or column after it was     * This method returns the size of the parameter or column after it was
149     * truncated.     * truncated.
150     *     *
151     * @return the truncated size     * @return The size of the parameter or column after it was truncated.
152     */     */
153    public int getTransferSize()    public int getTransferSize()
154    {    {
155      return transferSize;      return transferSize;
156    }    }
157  } // class DataTruncation  }

Legend:
Removed from v.1.6  
changed lines
  Added in v.1.7

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26