src/java.sql.rowset/share/classes/com/sun/rowset/internal/XmlReaderContentHandler.java
author kvn
Fri, 30 Mar 2018 07:47:20 -0700
changeset 49654 16f53c9c7493
parent 47216 71c04702a3d5
permissions -rw-r--r--
8200461: MeetIncompatibleInterfaceArrays test fails with -Xcomp Summary: Add requires to run test only in Xmixed mode. Reviewed-by: simonis
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
22301
43e72ecb53b9 8022904: Enhance JDBC Parsers
lancea
parents: 14342
diff changeset
     2
 * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    23
 * questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
package com.sun.rowset.internal;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
import java.util.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
import org.xml.sax.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
import org.xml.sax.helpers.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
import java.sql.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
import javax.sql.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
import javax.sql.rowset.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
import com.sun.rowset.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
import java.io.IOException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
import java.text.MessageFormat;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
 * The document handler that receives parse events that an XML parser sends while it
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
 * is parsing an XML document representing a <code>WebRowSet</code> object. The
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
 * parser sends strings to this <code>XmlReaderContentHandler</code> and then uses
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
 * these strings as arguments for the <code>XmlReaderContentHandler</code> methods
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
 * it invokes. The final goal of the SAX parser working with an
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
 * <code>XmlReaderContentHandler</code> object is to read an XML document that represents
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
 * a <code>RowSet</code> object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
 * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
 * A rowset consists of its properties, metadata, and data values. An XML document
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
 * representating a rowset includes the values in these three categories along with
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
 * appropriate XML tags to identify them.  It also includes a top-level XML tag for
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
 * the rowset and three section tags identifying the three categories of values.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
 * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
 * The tags in an XML document are hierarchical.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
 * This means that the top-level tag, <code>RowSet</code>, is
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
 * followed by the three sections with appropriate tags, which are in turn each
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
 * followed by their constituent elements. For example, the <code>properties</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
 * element will be followed by an element for each of the properties listed in
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
 * in this <code>XmlReaderContentHandler</code> object's <code>properties</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
 * field.  The content of the other two fields, <code>colDef</code>, which lists
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
 * the rowset's metadata elements, and <code>data</code>, which lists the rowset's data
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
 * elements, are handled similarly .
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
 * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
 * This implementation of <code>XmlReaderContentHandler</code> provides the means for the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
 * parser to determine which elements need to have a value set and then to set
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
 * those values. The methods in this class are all called by the parser; an
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
 * application programmer never calls them directly.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
public class XmlReaderContentHandler extends DefaultHandler {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
11129
f9ad1aadf3fa 7116445: Miscellaneous warnings in the JDBC/RowSet classes
lancea
parents: 7668
diff changeset
    74
    private HashMap <String, Integer> propMap;
f9ad1aadf3fa 7116445: Miscellaneous warnings in the JDBC/RowSet classes
lancea
parents: 7668
diff changeset
    75
    private HashMap <String, Integer> colDefMap;
f9ad1aadf3fa 7116445: Miscellaneous warnings in the JDBC/RowSet classes
lancea
parents: 7668
diff changeset
    76
    private HashMap <String, Integer> dataMap;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
11129
f9ad1aadf3fa 7116445: Miscellaneous warnings in the JDBC/RowSet classes
lancea
parents: 7668
diff changeset
    78
    private HashMap<String,Class<?>> typeMap;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
11129
f9ad1aadf3fa 7116445: Miscellaneous warnings in the JDBC/RowSet classes
lancea
parents: 7668
diff changeset
    80
    private Vector<Object[]> updates;
f9ad1aadf3fa 7116445: Miscellaneous warnings in the JDBC/RowSet classes
lancea
parents: 7668
diff changeset
    81
    private Vector<String> keyCols;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
    private String columnValue;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
    private String propertyValue;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
    private String metaDataValue;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
    private int tag;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
    private int state;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
    private WebRowSetImpl rs;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
    private boolean nullVal;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
    private boolean emptyStringVal;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
    private RowSetMetaData md;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
    private int idx;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
    private String lastval;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
    private String Key_map;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
    private String Value_map;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
    private String tempStr;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
    private String tempUpdate;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
    private String tempCommand;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
    private Object [] upd;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
     * A list of the properties for a rowset. There is a constant defined to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
     * correspond to each of these properties so that a <code>HashMap</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
     * object can be created to map the properties, which are strings, to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
     * the constants, which are integers.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
    private String [] properties = {"command", "concurrency", "datasource",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
                            "escape-processing", "fetch-direction", "fetch-size",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
                            "isolation-level", "key-columns", "map",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
                            "max-field-size", "max-rows", "query-timeout",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
                            "read-only", "rowset-type", "show-deleted",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
                            "table-name", "url", "null", "column", "type",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
                            "class", "sync-provider", "sync-provider-name",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
                             "sync-provider-vendor", "sync-provider-version",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
                             "sync-provider-grade","data-source-lock"};
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
     * A constant representing the tag for the command property.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
    private final static int CommandTag = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
     * A constant representing the tag for the concurrency property.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
    private final static int ConcurrencyTag = 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
     * A constant representing the tag for the datasource property.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
    private final static int DatasourceTag = 2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
     * A constant representing the tag for the escape-processing property.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
    private final static int EscapeProcessingTag = 3;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
     * A constant representing the tag for the fetch-direction property.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
    private final static int FetchDirectionTag = 4;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
     * A constant representing the tag for the fetch-size property.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
    private final static int FetchSizeTag = 5;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
     * A constant representing the tag for the isolation-level property
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
    private final static int IsolationLevelTag = 6;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
     * A constant representing the tag for the key-columns property.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
    private final static int KeycolsTag = 7;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
     * A constant representing the tag for the map property.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
     * This map is the type map that specifies the custom mapping
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
     * for an SQL user-defined type.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
    private final static int MapTag = 8;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
     * A constant representing the tag for the max-field-size property.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
    private final static int MaxFieldSizeTag = 9;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
     * A constant representing the tag for the max-rows property.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
    private final static int MaxRowsTag = 10;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
     * A constant representing the tag for the query-timeout property.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
    private final static int QueryTimeoutTag = 11;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
     * A constant representing the tag for the read-only property.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
    private final static int ReadOnlyTag = 12;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
     * A constant representing the tag for the rowset-type property.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
    private final static int RowsetTypeTag = 13;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
     * A constant representing the tag for the show-deleted property.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
    private final static int ShowDeletedTag = 14;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
     * A constant representing the tag for the table-name property.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
    private final static int TableNameTag = 15;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
     * A constant representing the tag for the URL property.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
    private final static int UrlTag = 16;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
     * A constant representing the tag for the null property.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
    private final static int PropNullTag = 17;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
     * A constant representing the tag for the column property.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
    private final static int PropColumnTag = 18;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
     * A constant representing the tag for the type property.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
    private final static int PropTypeTag = 19;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
     * A constant representing the tag for the class property.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
    private final static int PropClassTag = 20;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
     * A constant representing the tag for the sync-provider.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
    private final static int SyncProviderTag = 21;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
     * A constant representing the tag for the sync-provider
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
     * name
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
    private final static int SyncProviderNameTag = 22;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
     * A constant representing the tag for the sync-provider
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
     * vendor tag.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
    private final static int SyncProviderVendorTag = 23;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
     * A constant representing the tag for the sync-provider
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
     * version tag.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
    private final static int SyncProviderVersionTag = 24;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
     * A constant representing the tag for the sync-provider
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
     * grade tag.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
    private final static int SyncProviderGradeTag = 25;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
     * A constant representing the tag for the data source lock.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   257
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   258
    private final static int DataSourceLock = 26;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   259
90ce3da70b43 Initial load
duke
parents:
diff changeset
   260
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   261
     * A listing of the kinds of metadata information available about
90ce3da70b43 Initial load
duke
parents:
diff changeset
   262
     * the columns in a <code>WebRowSet</code> object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   263
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   264
    private String [] colDef = {"column-count", "column-definition", "column-index",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   265
                        "auto-increment", "case-sensitive", "currency",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   266
                        "nullable", "signed", "searchable",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   267
                        "column-display-size", "column-label", "column-name",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   268
                        "schema-name", "column-precision", "column-scale",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   269
                        "table-name", "catalog-name", "column-type",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   270
                        "column-type-name", "null"};
90ce3da70b43 Initial load
duke
parents:
diff changeset
   271
90ce3da70b43 Initial load
duke
parents:
diff changeset
   272
90ce3da70b43 Initial load
duke
parents:
diff changeset
   273
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   274
     * A constant representing the tag for column-count.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   275
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   276
    private final static int ColumnCountTag = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   277
90ce3da70b43 Initial load
duke
parents:
diff changeset
   278
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   279
     * A constant representing the tag for column-definition.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   280
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   281
    private final static int ColumnDefinitionTag = 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   282
90ce3da70b43 Initial load
duke
parents:
diff changeset
   283
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   284
     * A constant representing the tag for column-index.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   285
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   286
    private final static int ColumnIndexTag = 2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   287
90ce3da70b43 Initial load
duke
parents:
diff changeset
   288
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   289
     * A constant representing the tag for auto-increment.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   290
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   291
    private final static int AutoIncrementTag = 3;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   292
90ce3da70b43 Initial load
duke
parents:
diff changeset
   293
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   294
     * A constant representing the tag for case-sensitive.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   295
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   296
    private final static int CaseSensitiveTag = 4;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   297
90ce3da70b43 Initial load
duke
parents:
diff changeset
   298
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   299
     * A constant representing the tag for currency.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   300
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   301
    private final static int CurrencyTag = 5;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   302
90ce3da70b43 Initial load
duke
parents:
diff changeset
   303
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   304
     * A constant representing the tag for nullable.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   305
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   306
    private final static int NullableTag = 6;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   307
90ce3da70b43 Initial load
duke
parents:
diff changeset
   308
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   309
     * A constant representing the tag for signed.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   310
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   311
    private final static int SignedTag = 7;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   312
90ce3da70b43 Initial load
duke
parents:
diff changeset
   313
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   314
     * A constant representing the tag for searchable.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   315
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   316
    private final static int SearchableTag = 8;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   317
90ce3da70b43 Initial load
duke
parents:
diff changeset
   318
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   319
     * A constant representing the tag for column-display-size.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   320
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   321
    private final static int ColumnDisplaySizeTag = 9;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   322
90ce3da70b43 Initial load
duke
parents:
diff changeset
   323
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   324
     * A constant representing the tag for column-label.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   325
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   326
    private final static int ColumnLabelTag = 10;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   327
90ce3da70b43 Initial load
duke
parents:
diff changeset
   328
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   329
     * A constant representing the tag for column-name.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   330
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   331
    private final static int ColumnNameTag = 11;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   332
90ce3da70b43 Initial load
duke
parents:
diff changeset
   333
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   334
     * A constant representing the tag for schema-name.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   335
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   336
    private final static int SchemaNameTag = 12;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   337
90ce3da70b43 Initial load
duke
parents:
diff changeset
   338
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   339
     * A constant representing the tag for column-precision.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   340
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   341
    private final static int ColumnPrecisionTag = 13;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   342
90ce3da70b43 Initial load
duke
parents:
diff changeset
   343
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   344
     * A constant representing the tag for column-scale.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   345
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   346
    private final static int ColumnScaleTag = 14;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   347
90ce3da70b43 Initial load
duke
parents:
diff changeset
   348
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   349
     * A constant representing the tag for table-name.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   350
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   351
    private final static int MetaTableNameTag = 15;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   352
90ce3da70b43 Initial load
duke
parents:
diff changeset
   353
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   354
     * A constant representing the tag for catalog-name.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   355
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   356
    private final static int CatalogNameTag = 16;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   357
90ce3da70b43 Initial load
duke
parents:
diff changeset
   358
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   359
     * A constant representing the tag for column-type.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   360
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   361
    private final static int ColumnTypeTag = 17;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   362
90ce3da70b43 Initial load
duke
parents:
diff changeset
   363
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   364
     * A constant representing the tag for column-type-name.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   365
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   366
    private final static int ColumnTypeNameTag = 18;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   367
90ce3da70b43 Initial load
duke
parents:
diff changeset
   368
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   369
     * A constant representing the tag for null.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   370
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   371
    private final static int MetaNullTag = 19;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   372
90ce3da70b43 Initial load
duke
parents:
diff changeset
   373
    private String [] data = {"currentRow", "columnValue", "insertRow", "deleteRow", "insdel", "updateRow", "null" , "emptyString"};
90ce3da70b43 Initial load
duke
parents:
diff changeset
   374
90ce3da70b43 Initial load
duke
parents:
diff changeset
   375
    private final static int RowTag = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   376
    private final static int ColTag = 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   377
    private final static int InsTag = 2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   378
    private final static int DelTag = 3;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   379
    private final static int InsDelTag = 4;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   380
    private final static int UpdTag = 5;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   381
    private final static int NullTag = 6;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   382
    private final static int EmptyStringTag = 7;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   383
90ce3da70b43 Initial load
duke
parents:
diff changeset
   384
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   385
     * A constant indicating the state of this <code>XmlReaderContentHandler</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   386
     * object in which it has not yet been called by the SAX parser and therefore
90ce3da70b43 Initial load
duke
parents:
diff changeset
   387
     * has no indication of what type of input to expect from the parser next.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   388
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   389
     * The state is set to <code>INITIAL</code> at the end of each
90ce3da70b43 Initial load
duke
parents:
diff changeset
   390
     * section, which allows the sections to appear in any order and
90ce3da70b43 Initial load
duke
parents:
diff changeset
   391
     * still be parsed correctly (except that metadata must be
90ce3da70b43 Initial load
duke
parents:
diff changeset
   392
     * set before data values can be set).
90ce3da70b43 Initial load
duke
parents:
diff changeset
   393
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   394
    private final static int INITIAL = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   395
90ce3da70b43 Initial load
duke
parents:
diff changeset
   396
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   397
     * A constant indicating the state in which this <code>XmlReaderContentHandler</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   398
     * object expects the next input received from the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   399
     * SAX parser to be a string corresponding to one of the elements in
90ce3da70b43 Initial load
duke
parents:
diff changeset
   400
     * <code>properties</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   401
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   402
    private final static int PROPERTIES = 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   403
90ce3da70b43 Initial load
duke
parents:
diff changeset
   404
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   405
     * A constant indicating the state in which this <code>XmlReaderContentHandler</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   406
     * object expects the next input received from the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   407
     * SAX parser to be a string corresponding to one of the elements in
90ce3da70b43 Initial load
duke
parents:
diff changeset
   408
     * <code>colDef</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   409
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   410
    private final static int METADATA = 2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   411
90ce3da70b43 Initial load
duke
parents:
diff changeset
   412
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   413
     * A constant indicating the state in which this <code>XmlReaderContentHandler</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   414
     * object expects the next input received from the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   415
     * SAX parser to be a string corresponding to one of the elements in
90ce3da70b43 Initial load
duke
parents:
diff changeset
   416
     * <code>data</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   417
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   418
    private final static int DATA = 3;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   419
90ce3da70b43 Initial load
duke
parents:
diff changeset
   420
    private  JdbcRowSetResourceBundle resBundle;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   421
90ce3da70b43 Initial load
duke
parents:
diff changeset
   422
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   423
     * Constructs a new <code>XmlReaderContentHandler</code> object that will
90ce3da70b43 Initial load
duke
parents:
diff changeset
   424
     * assist the SAX parser in reading a <code>WebRowSet</code> object in the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   425
     * format of an XML document. In addition to setting some default values,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   426
     * this constructor creates three <code>HashMap</code> objects, one for
90ce3da70b43 Initial load
duke
parents:
diff changeset
   427
     * properties, one for metadata, and one for data.  These hash maps map the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   428
     * strings sent by the SAX parser to integer constants so that they can be
90ce3da70b43 Initial load
duke
parents:
diff changeset
   429
     * compared more efficiently in <code>switch</code> statements.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   430
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   431
     * @param r the <code>RowSet</code> object in XML format that will be read
90ce3da70b43 Initial load
duke
parents:
diff changeset
   432
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   433
    public XmlReaderContentHandler(RowSet r) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   434
        // keep the rowset we've been given
90ce3da70b43 Initial load
duke
parents:
diff changeset
   435
        rs = (WebRowSetImpl)r;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   436
90ce3da70b43 Initial load
duke
parents:
diff changeset
   437
        // set-up the token maps
90ce3da70b43 Initial load
duke
parents:
diff changeset
   438
        initMaps();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   439
90ce3da70b43 Initial load
duke
parents:
diff changeset
   440
        // allocate the collection for the updates
11129
f9ad1aadf3fa 7116445: Miscellaneous warnings in the JDBC/RowSet classes
lancea
parents: 7668
diff changeset
   441
        updates = new Vector<>();
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   442
90ce3da70b43 Initial load
duke
parents:
diff changeset
   443
        // start out with the empty string
6692
aef4e294026f 6988993: Address Findbugs warnings for the use of String Constructor
lancea
parents: 5506
diff changeset
   444
        columnValue = "";
aef4e294026f 6988993: Address Findbugs warnings for the use of String Constructor
lancea
parents: 5506
diff changeset
   445
        propertyValue = "";
aef4e294026f 6988993: Address Findbugs warnings for the use of String Constructor
lancea
parents: 5506
diff changeset
   446
        metaDataValue = "";
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   447
90ce3da70b43 Initial load
duke
parents:
diff changeset
   448
        nullVal = false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   449
        idx = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   450
        tempStr = "";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   451
        tempUpdate = "";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   452
        tempCommand = "";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   453
90ce3da70b43 Initial load
duke
parents:
diff changeset
   454
        try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   455
           resBundle = JdbcRowSetResourceBundle.getJdbcRowSetResourceBundle();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   456
        } catch(IOException ioe) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   457
            throw new RuntimeException(ioe);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   458
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   459
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   460
90ce3da70b43 Initial load
duke
parents:
diff changeset
   461
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   462
     * Creates and initializes three new <code>HashMap</code> objects that map
90ce3da70b43 Initial load
duke
parents:
diff changeset
   463
     * the strings returned by the SAX parser to <code>Integer</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   464
     * objects.  The strings returned by the parser will match the strings that
90ce3da70b43 Initial load
duke
parents:
diff changeset
   465
     * are array elements in this <code>XmlReaderContentHandler</code> object's
90ce3da70b43 Initial load
duke
parents:
diff changeset
   466
     * <code>properties</code>, <code>colDef</code>, or <code>data</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   467
     * fields. For each array element in these fields, there is a corresponding
90ce3da70b43 Initial load
duke
parents:
diff changeset
   468
     * constant defined. It is to these constants that the strings are mapped.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   469
     * In the <code>HashMap</code> objects, the string is the key, and the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   470
     * integer is the value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   471
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   472
     * The purpose of the mapping is to make comparisons faster.  Because comparing
90ce3da70b43 Initial load
duke
parents:
diff changeset
   473
     * numbers is more efficient than comparing strings, the strings returned
90ce3da70b43 Initial load
duke
parents:
diff changeset
   474
     * by the parser are mapped to integers, which can then be used in a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   475
     * <code>switch</code> statement.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   476
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   477
    private void initMaps() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   478
        int items, i;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   479
11129
f9ad1aadf3fa 7116445: Miscellaneous warnings in the JDBC/RowSet classes
lancea
parents: 7668
diff changeset
   480
        propMap = new HashMap<>();
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   481
        items = properties.length;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   482
90ce3da70b43 Initial load
duke
parents:
diff changeset
   483
        for (i=0;i<items;i++) {
6697
39929804f9d4 6989139: Address JDBC Findbugs where Number type Constructor are used
lancea
parents: 6692
diff changeset
   484
            propMap.put(properties[i], Integer.valueOf(i));
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   485
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   486
11129
f9ad1aadf3fa 7116445: Miscellaneous warnings in the JDBC/RowSet classes
lancea
parents: 7668
diff changeset
   487
        colDefMap = new HashMap<>();
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   488
        items = colDef.length;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   489
90ce3da70b43 Initial load
duke
parents:
diff changeset
   490
        for (i=0;i<items;i++) {
6697
39929804f9d4 6989139: Address JDBC Findbugs where Number type Constructor are used
lancea
parents: 6692
diff changeset
   491
            colDefMap.put(colDef[i], Integer.valueOf(i));
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   492
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   493
11129
f9ad1aadf3fa 7116445: Miscellaneous warnings in the JDBC/RowSet classes
lancea
parents: 7668
diff changeset
   494
        dataMap = new HashMap<>();
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   495
        items = data.length;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   496
90ce3da70b43 Initial load
duke
parents:
diff changeset
   497
        for (i=0;i<items;i++) {
6697
39929804f9d4 6989139: Address JDBC Findbugs where Number type Constructor are used
lancea
parents: 6692
diff changeset
   498
            dataMap.put(data[i], Integer.valueOf(i));
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   499
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   500
90ce3da70b43 Initial load
duke
parents:
diff changeset
   501
        //Initialize connection map here
11129
f9ad1aadf3fa 7116445: Miscellaneous warnings in the JDBC/RowSet classes
lancea
parents: 7668
diff changeset
   502
        typeMap = new HashMap<>();
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   503
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   504
90ce3da70b43 Initial load
duke
parents:
diff changeset
   505
    public void startDocument() throws SAXException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   506
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   507
90ce3da70b43 Initial load
duke
parents:
diff changeset
   508
    public void endDocument() throws SAXException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   509
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   510
90ce3da70b43 Initial load
duke
parents:
diff changeset
   511
90ce3da70b43 Initial load
duke
parents:
diff changeset
   512
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   513
     * Sets this <code>XmlReaderContentHandler</code> object's <code>tag</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   514
     * field if the given name is the key for a tag and this object's state
90ce3da70b43 Initial load
duke
parents:
diff changeset
   515
     * is not <code>INITIAL</code>.  The field is set
90ce3da70b43 Initial load
duke
parents:
diff changeset
   516
     * to the constant that corresponds to the given element name.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   517
     * If the state is <code>INITIAL</code>, the state is set to the given
90ce3da70b43 Initial load
duke
parents:
diff changeset
   518
     * name, which will be one of the sections <code>PROPERTIES</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   519
     * <code>METADATA</code>, or <code>DATA</code>.  In either case, this
90ce3da70b43 Initial load
duke
parents:
diff changeset
   520
     * method puts this document handler in the proper state for calling
90ce3da70b43 Initial load
duke
parents:
diff changeset
   521
     * the method <code>endElement</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   522
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   523
     * If the state is <code>DATA</code> and the tag is <code>RowTag</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   524
     * <code>DelTag</code>, or <code>InsTag</code>, this method moves the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   525
     * rowset's cursor to the insert row and sets this
90ce3da70b43 Initial load
duke
parents:
diff changeset
   526
     * <code>XmlReaderContentHandler</code> object's <code>idx</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   527
     * field to <code>0</code> so that it will be in the proper
90ce3da70b43 Initial load
duke
parents:
diff changeset
   528
     * state when the parser calls the method <code>endElement</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   529
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   530
     * @param lName the name of the element; either (1) one of the array
90ce3da70b43 Initial load
duke
parents:
diff changeset
   531
     *        elements in the fields <code>properties</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   532
     *        <code>colDef</code>, or <code>data</code> or
90ce3da70b43 Initial load
duke
parents:
diff changeset
   533
     *        (2) one of the <code>RowSet</code> elements
90ce3da70b43 Initial load
duke
parents:
diff changeset
   534
     *        <code>"properties"</code>, <code>"metadata"</code>, or
90ce3da70b43 Initial load
duke
parents:
diff changeset
   535
     *        <code>"data"</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   536
     * @param attributes <code>org.xml.sax.AttributeList</code> objects that are
90ce3da70b43 Initial load
duke
parents:
diff changeset
   537
     *             attributes of the named section element; may be <code>null</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   538
     *             if there are no attributes, which is the case for
90ce3da70b43 Initial load
duke
parents:
diff changeset
   539
     *             <code>WebRowSet</code> objects
90ce3da70b43 Initial load
duke
parents:
diff changeset
   540
     * @exception SAXException if a general SAX error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
   541
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   542
    public void startElement(String uri, String lName, String qName, Attributes attributes) throws SAXException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   543
        int tag;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   544
        String name = "";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   545
90ce3da70b43 Initial load
duke
parents:
diff changeset
   546
        name = lName;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   547
90ce3da70b43 Initial load
duke
parents:
diff changeset
   548
        switch (getState()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   549
        case PROPERTIES:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   550
90ce3da70b43 Initial load
duke
parents:
diff changeset
   551
            tempCommand = "";
11129
f9ad1aadf3fa 7116445: Miscellaneous warnings in the JDBC/RowSet classes
lancea
parents: 7668
diff changeset
   552
            tag = propMap.get(name);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   553
            if (tag == PropNullTag)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   554
               setNullValue(true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   555
            else
90ce3da70b43 Initial load
duke
parents:
diff changeset
   556
                setTag(tag);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   557
            break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   558
        case METADATA:
11129
f9ad1aadf3fa 7116445: Miscellaneous warnings in the JDBC/RowSet classes
lancea
parents: 7668
diff changeset
   559
            tag = colDefMap.get(name);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   560
90ce3da70b43 Initial load
duke
parents:
diff changeset
   561
            if (tag == MetaNullTag)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   562
                setNullValue(true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   563
            else
90ce3da70b43 Initial load
duke
parents:
diff changeset
   564
                setTag(tag);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   565
            break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   566
        case DATA:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   567
90ce3da70b43 Initial load
duke
parents:
diff changeset
   568
            /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   569
              * This has been added to clear out the values of the previous read
90ce3da70b43 Initial load
duke
parents:
diff changeset
   570
              * so that we should not add up values of data between different tags
90ce3da70b43 Initial load
duke
parents:
diff changeset
   571
              */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   572
            tempStr = "";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   573
            tempUpdate = "";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   574
            if(dataMap.get(name) == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   575
                tag = NullTag;
11129
f9ad1aadf3fa 7116445: Miscellaneous warnings in the JDBC/RowSet classes
lancea
parents: 7668
diff changeset
   576
            } else if(dataMap.get(name) == EmptyStringTag) {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   577
                tag = EmptyStringTag;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   578
            } else {
11129
f9ad1aadf3fa 7116445: Miscellaneous warnings in the JDBC/RowSet classes
lancea
parents: 7668
diff changeset
   579
                 tag = dataMap.get(name);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   580
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   581
90ce3da70b43 Initial load
duke
parents:
diff changeset
   582
            if (tag == NullTag) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   583
                setNullValue(true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   584
            } else if(tag == EmptyStringTag) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   585
                setEmptyStringValue(true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   586
            } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   587
                setTag(tag);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   588
90ce3da70b43 Initial load
duke
parents:
diff changeset
   589
                if (tag == RowTag || tag == DelTag || tag == InsTag) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   590
                    idx = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   591
                    try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   592
                        rs.moveToInsertRow();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   593
                    } catch (SQLException ex) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   594
                        ;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   595
                    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   596
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   597
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   598
90ce3da70b43 Initial load
duke
parents:
diff changeset
   599
            break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   600
        default:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   601
            setState(name);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   602
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   603
90ce3da70b43 Initial load
duke
parents:
diff changeset
   604
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   605
90ce3da70b43 Initial load
duke
parents:
diff changeset
   606
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   607
     * Sets the value for the given element if <code>name</code> is one of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   608
     * the array elements in the fields <code>properties</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   609
     * <code>colDef</code>, or <code>data</code> and this
90ce3da70b43 Initial load
duke
parents:
diff changeset
   610
     * <code>XmlReaderContentHandler</code> object's state is not
90ce3da70b43 Initial load
duke
parents:
diff changeset
   611
     * <code>INITIAL</code>. If the state is <code>INITIAL</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   612
     * this method does nothing.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   613
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   614
     * If the state is <code>METADATA</code> and
90ce3da70b43 Initial load
duke
parents:
diff changeset
   615
     * the argument supplied is <code>"metadata"</code>, the rowset's
90ce3da70b43 Initial load
duke
parents:
diff changeset
   616
     * metadata is set. If the state is <code>PROPERTIES</code>, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   617
     * appropriate property is set using the given name to determine
90ce3da70b43 Initial load
duke
parents:
diff changeset
   618
     * the appropriate value. If the state is <code>DATA</code> and
90ce3da70b43 Initial load
duke
parents:
diff changeset
   619
     * the argument supplied is <code>"data"</code>, this method sets
90ce3da70b43 Initial load
duke
parents:
diff changeset
   620
     * the state to <code>INITIAL</code> and returns.  If the argument
90ce3da70b43 Initial load
duke
parents:
diff changeset
   621
     * supplied is one of the elements in the field <code>data</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   622
     * this method makes the appropriate changes to the rowset's data.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   623
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   624
     * @param lName the name of the element; either (1) one of the array
90ce3da70b43 Initial load
duke
parents:
diff changeset
   625
     *        elements in the fields <code>properties</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   626
     *        <code>colDef</code>, or <code>data</code> or
90ce3da70b43 Initial load
duke
parents:
diff changeset
   627
     *        (2) one of the <code>RowSet</code> elements
90ce3da70b43 Initial load
duke
parents:
diff changeset
   628
     *        <code>"properties"</code>, <code>"metadata"</code>, or
90ce3da70b43 Initial load
duke
parents:
diff changeset
   629
     *        <code>"data"</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   630
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   631
     * @exception SAXException if a general SAX error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
   632
     */
11129
f9ad1aadf3fa 7116445: Miscellaneous warnings in the JDBC/RowSet classes
lancea
parents: 7668
diff changeset
   633
    @SuppressWarnings("fallthrough")
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   634
    public void endElement(String uri, String lName, String qName) throws SAXException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   635
        int tag;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   636
90ce3da70b43 Initial load
duke
parents:
diff changeset
   637
        String name = "";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   638
        name = lName;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   639
90ce3da70b43 Initial load
duke
parents:
diff changeset
   640
        switch (getState()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   641
        case PROPERTIES:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   642
            if (name.equals("properties")) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   643
                state = INITIAL;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   644
                break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   645
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   646
90ce3da70b43 Initial load
duke
parents:
diff changeset
   647
            try {
11129
f9ad1aadf3fa 7116445: Miscellaneous warnings in the JDBC/RowSet classes
lancea
parents: 7668
diff changeset
   648
                tag = propMap.get(name);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   649
                switch (tag) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   650
                case KeycolsTag:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   651
                    if (keyCols != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   652
                        int i[] = new int[keyCols.size()];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   653
                        for (int j = 0; j < i.length; j++)
11129
f9ad1aadf3fa 7116445: Miscellaneous warnings in the JDBC/RowSet classes
lancea
parents: 7668
diff changeset
   654
                            i[j] = Integer.parseInt(keyCols.elementAt(j));
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   655
                        rs.setKeyColumns(i);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   656
                    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   657
                    break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   658
90ce3da70b43 Initial load
duke
parents:
diff changeset
   659
                 case PropClassTag:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   660
                     //Added the handling for Class tags to take care of maps
90ce3da70b43 Initial load
duke
parents:
diff changeset
   661
                     //Makes an entry into the map upon end of class tag
90ce3da70b43 Initial load
duke
parents:
diff changeset
   662
                     try{
22301
43e72ecb53b9 8022904: Enhance JDBC Parsers
lancea
parents: 14342
diff changeset
   663
                          typeMap.put(Key_map,sun.reflect.misc.ReflectUtil.forName(Value_map));
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   664
90ce3da70b43 Initial load
duke
parents:
diff changeset
   665
                        }catch(ClassNotFoundException ex) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   666
                          throw new SAXException(MessageFormat.format(resBundle.handleGetObject("xmlrch.errmap").toString(), ex.getMessage()));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   667
                        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   668
                      break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   669
90ce3da70b43 Initial load
duke
parents:
diff changeset
   670
                 case MapTag:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   671
                      //Added the handling for Map to take set the typeMap
90ce3da70b43 Initial load
duke
parents:
diff changeset
   672
                      rs.setTypeMap(typeMap);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   673
                      break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   674
90ce3da70b43 Initial load
duke
parents:
diff changeset
   675
                default:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   676
                    break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   677
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   678
90ce3da70b43 Initial load
duke
parents:
diff changeset
   679
                if (getNullValue()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   680
                    setPropertyValue(null);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   681
                    setNullValue(false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   682
                } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   683
                    setPropertyValue(propertyValue);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   684
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   685
            } catch (SQLException ex) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   686
                throw new SAXException(ex.getMessage());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   687
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   688
90ce3da70b43 Initial load
duke
parents:
diff changeset
   689
            // propertyValue need to be reset to an empty string
6692
aef4e294026f 6988993: Address Findbugs warnings for the use of String Constructor
lancea
parents: 5506
diff changeset
   690
            propertyValue = "";
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   691
            setTag(-1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   692
            break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   693
        case METADATA:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   694
            if (name.equals("metadata")) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   695
                try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   696
                    rs.setMetaData(md);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   697
                    state = INITIAL;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   698
                } catch (SQLException ex) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   699
                    throw new SAXException(MessageFormat.format(resBundle.handleGetObject("xmlrch.errmetadata").toString(), ex.getMessage()));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   700
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   701
            } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   702
                try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   703
                    if (getNullValue()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   704
                        setMetaDataValue(null);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   705
                        setNullValue(false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   706
                    } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   707
                        setMetaDataValue(metaDataValue);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   708
                    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   709
                } catch (SQLException ex) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   710
                    throw new SAXException(MessageFormat.format(resBundle.handleGetObject("xmlrch.errmetadata").toString(), ex.getMessage()));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   711
90ce3da70b43 Initial load
duke
parents:
diff changeset
   712
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   713
                // metaDataValue needs to be reset to an empty string
6692
aef4e294026f 6988993: Address Findbugs warnings for the use of String Constructor
lancea
parents: 5506
diff changeset
   714
                metaDataValue = "";
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   715
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   716
            setTag(-1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   717
            break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   718
        case DATA:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   719
            if (name.equals("data")) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   720
                state = INITIAL;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   721
                return;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   722
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   723
90ce3da70b43 Initial load
duke
parents:
diff changeset
   724
            if(dataMap.get(name) == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   725
                tag = NullTag;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   726
            } else {
11129
f9ad1aadf3fa 7116445: Miscellaneous warnings in the JDBC/RowSet classes
lancea
parents: 7668
diff changeset
   727
                 tag = dataMap.get(name);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   728
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   729
            switch (tag) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   730
            case ColTag:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   731
                try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   732
                    idx++;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   733
                    if (getNullValue()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   734
                        insertValue(null);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   735
                        setNullValue(false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   736
                    } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   737
                        insertValue(tempStr);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   738
                    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   739
                    // columnValue now need to be reset to the empty string
6692
aef4e294026f 6988993: Address Findbugs warnings for the use of String Constructor
lancea
parents: 5506
diff changeset
   740
                    columnValue = "";
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   741
                } catch (SQLException ex) {
7283
c26ee71a85b2 7000752: Duplicate entry in RowSetResourceBundles.properties
lancea
parents: 6697
diff changeset
   742
                    throw new SAXException(MessageFormat.format(resBundle.handleGetObject("xmlrch.errinsertval").toString(), ex.getMessage()));
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   743
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   744
                break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   745
            case RowTag:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   746
                try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   747
                    rs.insertRow();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   748
                    rs.moveToCurrentRow();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   749
                    rs.next();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   750
90ce3da70b43 Initial load
duke
parents:
diff changeset
   751
                    // Making this as the original to turn off the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   752
                    // rowInserted flagging
90ce3da70b43 Initial load
duke
parents:
diff changeset
   753
                    rs.setOriginalRow();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   754
90ce3da70b43 Initial load
duke
parents:
diff changeset
   755
                    applyUpdates();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   756
                } catch (SQLException ex) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   757
                    throw new SAXException(MessageFormat.format(resBundle.handleGetObject("xmlrch.errconstr").toString(), ex.getMessage()));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   758
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   759
                break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   760
            case DelTag:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   761
                try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   762
                    rs.insertRow();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   763
                    rs.moveToCurrentRow();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   764
                    rs.next();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   765
                    rs.setOriginalRow();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   766
                    applyUpdates();
13013
87829cbb7fbe 7171918: XmlReaderContentHandler.endElement does not handle a Delete Tag properly
lancea
parents: 11129
diff changeset
   767
                    rs.deleteRow();
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   768
                } catch (SQLException ex) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   769
                    throw new SAXException(MessageFormat.format(resBundle.handleGetObject("xmlrch.errdel").toString() , ex.getMessage()));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   770
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   771
                break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   772
            case InsTag:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   773
                try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   774
                    rs.insertRow();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   775
                    rs.moveToCurrentRow();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   776
                    rs.next();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   777
                    applyUpdates();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   778
                } catch (SQLException ex) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   779
                    throw new SAXException(MessageFormat.format(resBundle.handleGetObject("xmlrch.errinsert").toString() , ex.getMessage()));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   780
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   781
                break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   782
90ce3da70b43 Initial load
duke
parents:
diff changeset
   783
            case InsDelTag:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   784
                try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   785
                    rs.insertRow();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   786
                    rs.moveToCurrentRow();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   787
                    rs.next();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   788
                    rs.setOriginalRow();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   789
                    applyUpdates();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   790
                } catch (SQLException ex) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   791
                    throw new SAXException(MessageFormat.format(resBundle.handleGetObject("xmlrch.errinsdel").toString() , ex.getMessage()));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   792
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   793
                break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   794
90ce3da70b43 Initial load
duke
parents:
diff changeset
   795
             case UpdTag:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   796
                 try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   797
                        if(getNullValue())
90ce3da70b43 Initial load
duke
parents:
diff changeset
   798
                         {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   799
                          insertValue(null);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   800
                          setNullValue(false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   801
                         } else if(getEmptyStringValue()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   802
                               insertValue("");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   803
                               setEmptyStringValue(false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   804
                         } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   805
                            updates.add(upd);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   806
                         }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   807
                 }  catch(SQLException ex) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   808
                        throw new SAXException(MessageFormat.format(resBundle.handleGetObject("xmlrch.errupdate").toString() , ex.getMessage()));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   809
                 }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   810
                break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   811
90ce3da70b43 Initial load
duke
parents:
diff changeset
   812
            default:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   813
                break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   814
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   815
        default:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   816
            break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   817
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   818
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   819
90ce3da70b43 Initial load
duke
parents:
diff changeset
   820
    private void applyUpdates() throws SAXException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   821
        // now handle any updates
90ce3da70b43 Initial load
duke
parents:
diff changeset
   822
        if (updates.size() > 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   823
            try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   824
                Object upd[];
11129
f9ad1aadf3fa 7116445: Miscellaneous warnings in the JDBC/RowSet classes
lancea
parents: 7668
diff changeset
   825
                Iterator<?> i = updates.iterator();
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   826
                while (i.hasNext()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   827
                    upd = (Object [])i.next();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   828
                    idx = ((Integer)upd[0]).intValue();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   829
90ce3da70b43 Initial load
duke
parents:
diff changeset
   830
                   if(!(lastval.equals(upd[1]))){
90ce3da70b43 Initial load
duke
parents:
diff changeset
   831
                       insertValue((String)(upd[1]));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   832
                    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   833
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   834
90ce3da70b43 Initial load
duke
parents:
diff changeset
   835
                rs.updateRow();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   836
                } catch (SQLException ex) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   837
                    throw new SAXException(MessageFormat.format(resBundle.handleGetObject("xmlrch.errupdrow").toString() , ex.getMessage()));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   838
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   839
            updates.removeAllElements();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   840
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   841
90ce3da70b43 Initial load
duke
parents:
diff changeset
   842
90ce3da70b43 Initial load
duke
parents:
diff changeset
   843
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   844
90ce3da70b43 Initial load
duke
parents:
diff changeset
   845
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   846
     * Sets a property, metadata, or data value with the characters in
90ce3da70b43 Initial load
duke
parents:
diff changeset
   847
     * the given array of characters, starting with the array element
90ce3da70b43 Initial load
duke
parents:
diff changeset
   848
     * indicated by <code>start</code> and continuing for <code>length</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   849
     * number of characters.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   850
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   851
     * The SAX parser invokes this method and supplies
90ce3da70b43 Initial load
duke
parents:
diff changeset
   852
     * the character array, start position, and length parameter values it
90ce3da70b43 Initial load
duke
parents:
diff changeset
   853
     * got from parsing the XML document.  An application programmer never
90ce3da70b43 Initial load
duke
parents:
diff changeset
   854
     * invokes this method directly.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   855
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   856
     * @param ch an array of characters supplied by the SAX parser, all or part of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   857
     *         which will be used to set a value
90ce3da70b43 Initial load
duke
parents:
diff changeset
   858
     * @param start the position in the given array at which to start
90ce3da70b43 Initial load
duke
parents:
diff changeset
   859
     * @param length the number of consecutive characters to use
90ce3da70b43 Initial load
duke
parents:
diff changeset
   860
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   861
    public void characters(char[] ch, int start, int length) throws SAXException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   862
        try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   863
            switch (getState()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   864
            case PROPERTIES:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   865
                propertyValue = new String(ch, start, length);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   866
90ce3da70b43 Initial load
duke
parents:
diff changeset
   867
                /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   868
                  * This has been added for handling of special characters. When special
90ce3da70b43 Initial load
duke
parents:
diff changeset
   869
                  * characters are encountered the characters function gets called for
90ce3da70b43 Initial load
duke
parents:
diff changeset
   870
                  * each of the characters so we need to append the value got in the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   871
                  * previous call as it is the same data present between the start and
90ce3da70b43 Initial load
duke
parents:
diff changeset
   872
                  * the end tag.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   873
                  **/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   874
                tempCommand = tempCommand.concat(propertyValue);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   875
                propertyValue = tempCommand;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   876
90ce3da70b43 Initial load
duke
parents:
diff changeset
   877
                // Added the following check for handling of type tags in maps
90ce3da70b43 Initial load
duke
parents:
diff changeset
   878
                if(tag == PropTypeTag)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   879
                {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   880
                        Key_map = propertyValue;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   881
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   882
90ce3da70b43 Initial load
duke
parents:
diff changeset
   883
                // Added the following check for handling of class tags in maps
90ce3da70b43 Initial load
duke
parents:
diff changeset
   884
                else if(tag == PropClassTag)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   885
                {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   886
                        Value_map = propertyValue;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   887
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   888
                break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   889
90ce3da70b43 Initial load
duke
parents:
diff changeset
   890
            case METADATA:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   891
90ce3da70b43 Initial load
duke
parents:
diff changeset
   892
                // The parser will come here after the endElement as there is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   893
                // "\n" in the after endTag is printed. This will cause a problem
90ce3da70b43 Initial load
duke
parents:
diff changeset
   894
                // when the data between the tags is an empty string so adding
90ce3da70b43 Initial load
duke
parents:
diff changeset
   895
                // below condition to take care of that situation.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   896
90ce3da70b43 Initial load
duke
parents:
diff changeset
   897
                if (tag == -1)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   898
                {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   899
                        break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   900
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   901
90ce3da70b43 Initial load
duke
parents:
diff changeset
   902
                metaDataValue = new String(ch, start, length);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   903
                break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   904
            case DATA:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   905
                setDataValue(ch, start, length);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   906
                break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   907
            default:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   908
                ;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   909
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   910
        } catch (SQLException ex) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   911
            throw new SAXException(resBundle.handleGetObject("xmlrch.chars").toString() + ex.getMessage());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   912
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   913
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   914
90ce3da70b43 Initial load
duke
parents:
diff changeset
   915
    private void setState(String s) throws SAXException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   916
        if (s.equals("webRowSet")) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   917
            state = INITIAL;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   918
        } else if (s.equals("properties")) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   919
            if (state != PROPERTIES)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   920
                state = PROPERTIES;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   921
            else
90ce3da70b43 Initial load
duke
parents:
diff changeset
   922
                state = INITIAL;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   923
        } else if (s.equals("metadata")) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   924
            if (state != METADATA)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   925
                state = METADATA;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   926
            else
90ce3da70b43 Initial load
duke
parents:
diff changeset
   927
                state = INITIAL;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   928
        } else if (s.equals("data")) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   929
            if (state != DATA)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   930
                state = DATA;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   931
            else
90ce3da70b43 Initial load
duke
parents:
diff changeset
   932
                state = INITIAL;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   933
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   934
90ce3da70b43 Initial load
duke
parents:
diff changeset
   935
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   936
90ce3da70b43 Initial load
duke
parents:
diff changeset
   937
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   938
     * Retrieves the current state of this <code>XmlReaderContentHandler</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   939
     * object's rowset, which is stored in the document handler's
90ce3da70b43 Initial load
duke
parents:
diff changeset
   940
     * <code>state</code> field.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   941
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   942
     * @return one of the following constants:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   943
     *         <code>XmlReaderContentHandler.PROPERTIES</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   944
     *         <code>XmlReaderContentHandler.METADATA</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   945
     *         <code>XmlReaderContentHandler.DATA</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   946
     *         <code>XmlReaderContentHandler.INITIAL</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   947
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   948
    private int getState() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   949
        return state;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   950
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   951
90ce3da70b43 Initial load
duke
parents:
diff changeset
   952
    private void setTag(int t) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   953
        tag = t;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   954
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   955
90ce3da70b43 Initial load
duke
parents:
diff changeset
   956
    private int getTag() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   957
        return tag;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   958
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   959
90ce3da70b43 Initial load
duke
parents:
diff changeset
   960
    private void setNullValue(boolean n) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   961
        nullVal = n;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   962
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   963
90ce3da70b43 Initial load
duke
parents:
diff changeset
   964
    private boolean getNullValue() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   965
        return nullVal;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   966
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   967
90ce3da70b43 Initial load
duke
parents:
diff changeset
   968
    private void setEmptyStringValue(boolean e) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   969
        emptyStringVal = e;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   970
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   971
90ce3da70b43 Initial load
duke
parents:
diff changeset
   972
    private boolean getEmptyStringValue() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   973
        return emptyStringVal;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   974
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   975
90ce3da70b43 Initial load
duke
parents:
diff changeset
   976
    private String getStringValue(String s) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   977
         return s;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   978
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   979
90ce3da70b43 Initial load
duke
parents:
diff changeset
   980
    private int getIntegerValue(String s) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   981
        return Integer.parseInt(s);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   982
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   983
90ce3da70b43 Initial load
duke
parents:
diff changeset
   984
    private boolean getBooleanValue(String s) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   985
6697
39929804f9d4 6989139: Address JDBC Findbugs where Number type Constructor are used
lancea
parents: 6692
diff changeset
   986
        return Boolean.valueOf(s).booleanValue();
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   987
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   988
90ce3da70b43 Initial load
duke
parents:
diff changeset
   989
    private java.math.BigDecimal getBigDecimalValue(String s) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   990
        return new java.math.BigDecimal(s);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   991
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   992
90ce3da70b43 Initial load
duke
parents:
diff changeset
   993
    private byte getByteValue(String s) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   994
        return Byte.parseByte(s);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   995
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   996
90ce3da70b43 Initial load
duke
parents:
diff changeset
   997
    private short getShortValue(String s) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   998
        return Short.parseShort(s);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   999
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1000
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1001
    private long getLongValue(String s) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1002
        return Long.parseLong(s);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1003
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1004
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1005
    private float getFloatValue(String s) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1006
        return Float.parseFloat(s);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1007
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1008
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1009
    private double getDoubleValue(String s) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1010
        return Double.parseDouble(s);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1011
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1012
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1013
    private byte[] getBinaryValue(String s) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1014
        return s.getBytes();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1015
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1016
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1017
    private java.sql.Date getDateValue(String s) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1018
        return new java.sql.Date(getLongValue(s));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1019
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1020
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1021
    private java.sql.Time getTimeValue(String s) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1022
        return new java.sql.Time(getLongValue(s));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1023
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1024
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1025
    private java.sql.Timestamp getTimestampValue(String s) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1026
        return new java.sql.Timestamp(getLongValue(s));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1027
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1028
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1029
    private void setPropertyValue(String s) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1030
        // find out if we are going to be dealing with a null
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1031
        boolean nullValue = getNullValue();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1032
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1033
        switch(getTag()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1034
        case CommandTag:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1035
            if (nullValue)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1036
               ; //rs.setCommand(null);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1037
            else
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1038
                rs.setCommand(s);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1039
            break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1040
        case ConcurrencyTag:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1041
            if (nullValue)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1042
                throw new SQLException(resBundle.handleGetObject("xmlrch.badvalue").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1043
            else
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1044
                rs.setConcurrency(getIntegerValue(s));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1045
            break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1046
        case DatasourceTag:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1047
            if (nullValue)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1048
                rs.setDataSourceName(null);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1049
            else
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1050
                rs.setDataSourceName(s);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1051
            break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1052
        case EscapeProcessingTag:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1053
            if (nullValue)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1054
                throw new SQLException(resBundle.handleGetObject("xmlrch.badvalue").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1055
            else
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1056
                rs.setEscapeProcessing(getBooleanValue(s));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1057
            break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1058
        case FetchDirectionTag:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1059
            if (nullValue)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1060
                throw new SQLException(resBundle.handleGetObject("xmlrch.badvalue").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1061
            else
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1062
                rs.setFetchDirection(getIntegerValue(s));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1063
            break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1064
        case FetchSizeTag:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1065
            if (nullValue)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1066
                throw new SQLException(resBundle.handleGetObject("xmlrch.badvalue").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1067
            else
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1068
                rs.setFetchSize(getIntegerValue(s));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1069
            break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1070
        case IsolationLevelTag:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1071
            if (nullValue)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1072
                throw new SQLException(resBundle.handleGetObject("xmlrch.badvalue").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1073
            else
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1074
                rs.setTransactionIsolation(getIntegerValue(s));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1075
            break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1076
        case KeycolsTag:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1077
            break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1078
        case PropColumnTag:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1079
            if (keyCols == null)
11129
f9ad1aadf3fa 7116445: Miscellaneous warnings in the JDBC/RowSet classes
lancea
parents: 7668
diff changeset
  1080
                keyCols = new Vector<>();
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1081
            keyCols.add(s);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1082
            break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1083
        case MapTag:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1084
            break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1085
        case MaxFieldSizeTag:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1086
            if (nullValue)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1087
                throw new SQLException(resBundle.handleGetObject("xmlrch.badvalue").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1088
            else
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1089
                rs.setMaxFieldSize(getIntegerValue(s));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1090
            break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1091
        case MaxRowsTag:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1092
            if (nullValue)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1093
                throw new SQLException(resBundle.handleGetObject("xmlrch.badvalue").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1094
            else
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1095
                rs.setMaxRows(getIntegerValue(s));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1096
            break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1097
        case QueryTimeoutTag:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1098
            if (nullValue)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1099
                throw new SQLException(resBundle.handleGetObject("xmlrch.badvalue").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1100
            else
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1101
                rs.setQueryTimeout(getIntegerValue(s));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1102
            break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1103
        case ReadOnlyTag:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1104
            if (nullValue)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1105
                throw new SQLException(resBundle.handleGetObject("xmlrch.badvalue").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1106
            else
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1107
                rs.setReadOnly(getBooleanValue(s));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1108
            break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1109
        case RowsetTypeTag:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1110
            if (nullValue) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1111
                throw new SQLException(resBundle.handleGetObject("xmlrch.badvalue").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1112
            } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1113
                //rs.setType(getIntegerValue(s));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1114
                String strType = getStringValue(s);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1115
                int iType = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1116
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1117
                if(strType.trim().equals("ResultSet.TYPE_SCROLL_INSENSITIVE")) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1118
                   iType = 1004;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1119
                } else if(strType.trim().equals("ResultSet.TYPE_SCROLL_SENSITIVE"))   {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1120
                   iType = 1005;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1121
                } else if(strType.trim().equals("ResultSet.TYPE_FORWARD_ONLY")) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1122
                   iType = 1003;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1123
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1124
                rs.setType(iType);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1125
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1126
            break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1127
        case ShowDeletedTag:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1128
            if (nullValue)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1129
                throw new SQLException(resBundle.handleGetObject("xmlrch.badvalue").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1130
            else
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1131
                rs.setShowDeleted(getBooleanValue(s));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1132
            break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1133
        case TableNameTag:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1134
            if (nullValue)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1135
                //rs.setTableName(null);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1136
                ;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1137
            else
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1138
                rs.setTableName(s);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1139
            break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1140
        case UrlTag:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1141
            if (nullValue)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1142
                rs.setUrl(null);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1143
            else
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1144
                rs.setUrl(s);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1145
            break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1146
        case SyncProviderNameTag:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1147
            if (nullValue) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1148
                rs.setSyncProvider(null);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1149
            } else {
24685
215fa91e1b4c 8044461: Cleanup new Boolean and single character strings
rriggs
parents: 22301
diff changeset
  1150
                String str = s.substring(0,s.indexOf('@')+1);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1151
                rs.setSyncProvider(str);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1152
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1153
            break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1154
        case SyncProviderVendorTag:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1155
            // to be implemented
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1156
            break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1157
        case SyncProviderVersionTag:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1158
            // to be implemented
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1159
            break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1160
        case SyncProviderGradeTag:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1161
            // to be implemented
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1162
            break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1163
        case DataSourceLock:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1164
            // to be implemented
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1165
            break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1166
        default:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1167
            break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1168
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1169
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1170
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1171
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1172
    private void setMetaDataValue(String s) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1173
        // find out if we are going to be dealing with a null
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1174
        boolean nullValue = getNullValue();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1175
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1176
        switch (getTag()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1177
        case ColumnCountTag:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1178
            md = new RowSetMetaDataImpl();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1179
            idx = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1180
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1181
            if (nullValue) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1182
                throw new SQLException(resBundle.handleGetObject("xmlrch.badvalue1").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1183
            } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1184
                md.setColumnCount(getIntegerValue(s));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1185
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1186
            break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1187
        case ColumnDefinitionTag:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1188
            break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1189
        case ColumnIndexTag:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1190
            idx++;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1191
            break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1192
        case AutoIncrementTag:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1193
            if (nullValue)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1194
                throw new SQLException(resBundle.handleGetObject("xmlrch.badvalue1").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1195
            else
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1196
                md.setAutoIncrement(idx, getBooleanValue(s));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1197
            break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1198
        case CaseSensitiveTag:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1199
            if (nullValue)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1200
                throw new SQLException(resBundle.handleGetObject("xmlrch.badvalue1").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1201
            else
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1202
                md.setCaseSensitive(idx, getBooleanValue(s));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1203
            break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1204
        case CurrencyTag:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1205
            if (nullValue)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1206
                throw new SQLException(resBundle.handleGetObject("xmlrch.badvalue1").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1207
            else
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1208
                md.setCurrency(idx, getBooleanValue(s));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1209
            break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1210
        case NullableTag:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1211
            if (nullValue)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1212
                throw new SQLException(resBundle.handleGetObject("xmlrch.badvalue1").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1213
            else
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1214
                md.setNullable(idx, getIntegerValue(s));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1215
            break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1216
        case SignedTag:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1217
            if (nullValue)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1218
                throw new SQLException(resBundle.handleGetObject("xmlrch.badvalue1").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1219
            else
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1220
                md.setSigned(idx, getBooleanValue(s));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1221
            break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1222
        case SearchableTag:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1223
            if (nullValue)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1224
                throw new SQLException(resBundle.handleGetObject("xmlrch.badvalue1").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1225
            else
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1226
                md.setSearchable(idx, getBooleanValue(s));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1227
            break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1228
        case ColumnDisplaySizeTag:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1229
            if (nullValue)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1230
                throw new SQLException(resBundle.handleGetObject("xmlrch.badvalue1").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1231
            else
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1232
                md.setColumnDisplaySize(idx, getIntegerValue(s));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1233
            break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1234
        case ColumnLabelTag:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1235
            if (nullValue)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1236
                md.setColumnLabel(idx, null);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1237
            else
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1238
                md.setColumnLabel(idx, s);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1239
            break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1240
        case ColumnNameTag:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1241
            if (nullValue)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1242
                md.setColumnName(idx, null);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1243
            else
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1244
                md.setColumnName(idx, s);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1245
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1246
            break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1247
        case SchemaNameTag:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1248
            if (nullValue) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1249
                md.setSchemaName(idx, null); }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1250
            else
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1251
                md.setSchemaName(idx, s);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1252
            break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1253
        case ColumnPrecisionTag:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1254
            if (nullValue)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1255
                throw new SQLException(resBundle.handleGetObject("xmlrch.badvalue1").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1256
            else
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1257
                md.setPrecision(idx, getIntegerValue(s));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1258
            break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1259
        case ColumnScaleTag:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1260
            if (nullValue)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1261
                throw new SQLException(resBundle.handleGetObject("xmlrch.badvalue1").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1262
            else
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1263
                md.setScale(idx, getIntegerValue(s));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1264
            break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1265
        case MetaTableNameTag:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1266
            if (nullValue)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1267
                md.setTableName(idx, null);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1268
            else
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1269
                md.setTableName(idx, s);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1270
            break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1271
        case CatalogNameTag:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1272
            if (nullValue)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1273
                md.setCatalogName(idx, null);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1274
            else
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1275
                md.setCatalogName(idx, s);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1276
            break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1277
        case ColumnTypeTag:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1278
            if (nullValue)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1279
                throw new SQLException(resBundle.handleGetObject("xmlrch.badvalue1").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1280
            else
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1281
                md.setColumnType(idx, getIntegerValue(s));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1282
            break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1283
        case ColumnTypeNameTag:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1284
            if (nullValue)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1285
                md.setColumnTypeName(idx, null);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1286
            else
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1287
                md.setColumnTypeName(idx, s);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1288
            break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1289
        default:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1290
            //System.out.println("MetaData: Unknown Tag: (" + getTag() + ")");
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1291
            break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1292
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1293
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1294
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1295
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1296
    private void setDataValue(char[] ch, int start, int len) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1297
        switch (getTag()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1298
        case ColTag:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1299
            columnValue = new String(ch, start, len);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1300
            /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1301
              * This has been added for handling of special characters. When special
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1302
              * characters are encountered the characters function gets called for
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1303
              * each of the characters so we need to append the value got in the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1304
              * previous call as it is the same data present between the start and
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1305
              * the end tag.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1306
              **/
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1307
            tempStr = tempStr.concat(columnValue);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1308
            break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1309
        case UpdTag:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1310
            upd = new Object[2];
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1311
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1312
            /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1313
              * This has been added for handling of special characters. When special
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1314
              * characters are encountered the characters function gets called for
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1315
              * each of the characters so we need to append the value got in the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1316
              * previous call as it is the same data present between the start and
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1317
              * the end tag.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1318
              **/
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1319
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1320
            tempUpdate = tempUpdate.concat(new String(ch,start,len));
6697
39929804f9d4 6989139: Address JDBC Findbugs where Number type Constructor are used
lancea
parents: 6692
diff changeset
  1321
            upd[0] = Integer.valueOf(idx);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1322
            upd[1] = tempUpdate;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1323
            //updates.add(upd);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1324
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1325
            lastval = (String)upd[1];
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1326
            //insertValue(ch, start, len);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1327
            break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1328
        case InsTag:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1329
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1330
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1331
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1332
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1333
    private void insertValue(String s) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1334
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1335
        if (getNullValue()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1336
            rs.updateNull(idx);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1337
            return;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1338
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1339
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1340
        // no longer have to deal with those pesky nulls.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1341
        int type = rs.getMetaData().getColumnType(idx);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1342
        switch (type) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1343
        case java.sql.Types.BIT:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1344
            rs.updateBoolean(idx, getBooleanValue(s));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1345
            break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1346
        case java.sql.Types.BOOLEAN:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1347
            rs.updateBoolean(idx, getBooleanValue(s));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1348
            break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1349
        case java.sql.Types.SMALLINT:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1350
        case java.sql.Types.TINYINT:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1351
            rs.updateShort(idx, getShortValue(s));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1352
            break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1353
        case java.sql.Types.INTEGER:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1354
            rs.updateInt(idx, getIntegerValue(s));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1355
            break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1356
        case java.sql.Types.BIGINT:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1357
            rs.updateLong(idx, getLongValue(s));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1358
            break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1359
        case java.sql.Types.REAL:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1360
        case java.sql.Types.FLOAT:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1361
            rs.updateFloat(idx, getFloatValue(s));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1362
            break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1363
        case java.sql.Types.DOUBLE:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1364
            rs.updateDouble(idx, getDoubleValue(s));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1365
            break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1366
        case java.sql.Types.NUMERIC:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1367
        case java.sql.Types.DECIMAL:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1368
            rs.updateObject(idx, getBigDecimalValue(s));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1369
            break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1370
        case java.sql.Types.BINARY:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1371
        case java.sql.Types.VARBINARY:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1372
        case java.sql.Types.LONGVARBINARY:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1373
            rs.updateBytes(idx, getBinaryValue(s));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1374
            break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1375
        case java.sql.Types.DATE:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1376
            rs.updateDate(idx,  getDateValue(s));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1377
            break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1378
        case java.sql.Types.TIME:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1379
            rs.updateTime(idx, getTimeValue(s));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1380
            break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1381
        case java.sql.Types.TIMESTAMP:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1382
            rs.updateTimestamp(idx, getTimestampValue(s));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1383
            break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1384
        case java.sql.Types.CHAR:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1385
        case java.sql.Types.VARCHAR:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1386
        case java.sql.Types.LONGVARCHAR:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1387
            rs.updateString(idx, getStringValue(s));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1388
            break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1389
        default:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1390
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1391
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1392
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1393
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1394
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1395
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1396
     * Throws the given <code>SAXParseException</code> object. This
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1397
     * exception was originally thrown by the SAX parser and is passed
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1398
     * to the method <code>error</code> when the SAX parser invokes it.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1399
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1400
     * @param e the <code>SAXParseException</code> object to throw
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1401
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1402
    public void error (SAXParseException e) throws SAXParseException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1403
            throw e;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1404
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1405
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1406
    // dump warnings too
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1407
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1408
     * Prints a warning message to <code>System.out</code> giving the line
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1409
     * number and uri for what caused the warning plus a message explaining
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1410
     * the reason for the warning. This method is invoked by the SAX parser.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1411
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1412
     * @param err a warning generated by the SAX parser
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1413
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1414
    public void warning (SAXParseException err) throws SAXParseException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1415
        System.out.println (MessageFormat.format(resBundle.handleGetObject("xmlrch.warning").toString(), new Object[] { err.getMessage(), err.getLineNumber(), err.getSystemId() }));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1416
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1417
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1418
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1419
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1420
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1421
    public void notationDecl(String name, String publicId, String systemId) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1422
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1423
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1424
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1425
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1426
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1427
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1428
    public void unparsedEntityDecl(String name, String publicId, String systemId, String notationName) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1429
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1430
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1431
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1432
   /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1433
    * Returns the current row of this <code>Rowset</code>object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1434
    * The ResultSet's cursor is positioned at the Row which is needed
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1435
    *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1436
    * @return the <code>Row</code> object on which the <code>RowSet</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1437
    *           implementation objects's cursor is positioned
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1438
    */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1439
    private Row getPresentRow(WebRowSetImpl rs) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1440
         //rs.setOriginalRow();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1441
         // ResultSetMetaData rsmd = rs.getMetaData();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1442
         // int numCols = rsmd.getColumnCount();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1443
         // Object vals[] = new Object[numCols];
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1444
         // for(int j = 1; j<= numCols ; j++){
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1445
         //     vals[j-1] = rs.getObject(j);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1446
         // }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1447
         // return(new Row(numCols, vals));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1448
         return null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1449
   }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1450
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1451
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1452
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1453
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1454
}