Mercurial > hg > monetdb-java
annotate src/main/java/org/monetdb/util/XMLExporter.java @ 975:5e320086a01c default tip
Some docker images are not available as dev-builds
author | Martin van Dinther <martin.van.dinther@monetdbsolutions.com> |
---|---|
date | Thu, 01 May 2025 17:13:53 +0200 (24 hours ago) |
parents | d416e9b6b3d0 |
children |
rev | line source |
---|---|
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1 /* |
833
e890195256ac
Update copyright for the new year, move to MonetDB Foundation, add SPDX.
Sjoerd Mullender <sjoerd@acm.org>
parents:
716
diff
changeset
|
2 * SPDX-License-Identifier: MPL-2.0 |
e890195256ac
Update copyright for the new year, move to MonetDB Foundation, add SPDX.
Sjoerd Mullender <sjoerd@acm.org>
parents:
716
diff
changeset
|
3 * |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
4 * This Source Code Form is subject to the terms of the Mozilla Public |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
5 * License, v. 2.0. If a copy of the MPL was not distributed with this |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
6 * file, You can obtain one at http://mozilla.org/MPL/2.0/. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
7 * |
937
d416e9b6b3d0
Update Copyright year.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
833
diff
changeset
|
8 * Copyright 2024, 2025 MonetDB Foundation; |
833
e890195256ac
Update copyright for the new year, move to MonetDB Foundation, add SPDX.
Sjoerd Mullender <sjoerd@acm.org>
parents:
716
diff
changeset
|
9 * Copyright August 2008 - 2023 MonetDB B.V.; |
e890195256ac
Update copyright for the new year, move to MonetDB Foundation, add SPDX.
Sjoerd Mullender <sjoerd@acm.org>
parents:
716
diff
changeset
|
10 * Copyright 1997 - July 2008 CWI. |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
11 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
12 |
391
f523727db392
Moved Java classes from packages starting with nl.cwi.monetdb.* to package org.monetdb.*
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
350
diff
changeset
|
13 package org.monetdb.util; |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
14 |
70
17fbaf2635bb
Expand import java.*.* statements
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
0
diff
changeset
|
15 import java.sql.ResultSet; |
17fbaf2635bb
Expand import java.*.* statements
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
0
diff
changeset
|
16 import java.sql.SQLException; |
17fbaf2635bb
Expand import java.*.* statements
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
0
diff
changeset
|
17 import java.sql.Timestamp; |
17fbaf2635bb
Expand import java.*.* statements
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
0
diff
changeset
|
18 import java.sql.Types; |
17fbaf2635bb
Expand import java.*.* statements
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
0
diff
changeset
|
19 import java.text.SimpleDateFormat; |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
20 |
307
05549bc7ed26
Add "final" keyword to classes, method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
261
diff
changeset
|
21 public final class XMLExporter extends Exporter { |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
22 private boolean useNil; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
23 |
309
8a96a4a13528
Add additional "final" keyword to classes, method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
307
diff
changeset
|
24 public static final short TYPE_NIL = 1; |
8a96a4a13528
Add additional "final" keyword to classes, method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
307
diff
changeset
|
25 public static final short VALUE_OMIT = 0; |
8a96a4a13528
Add additional "final" keyword to classes, method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
307
diff
changeset
|
26 public static final short VALUE_XSI = 1; |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
27 |
307
05549bc7ed26
Add "final" keyword to classes, method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
261
diff
changeset
|
28 public XMLExporter(final java.io.PrintWriter out) { |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
29 super(out); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
30 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
31 |
312
df815a403bf4
Improved JdbcClient program by including the schema prefix when dumping schema objects. It now behaves more similar to mclient -D -N.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
311
diff
changeset
|
32 /** |
df815a403bf4
Improved JdbcClient program by including the schema prefix when dumping schema objects. It now behaves more similar to mclient -D -N.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
311
diff
changeset
|
33 * A helper method to generate XML xsd schema code for a given table. |
df815a403bf4
Improved JdbcClient program by including the schema prefix when dumping schema objects. It now behaves more similar to mclient -D -N.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
311
diff
changeset
|
34 * This method performs all required lookups to find all relations and |
df815a403bf4
Improved JdbcClient program by including the schema prefix when dumping schema objects. It now behaves more similar to mclient -D -N.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
311
diff
changeset
|
35 * column information. |
df815a403bf4
Improved JdbcClient program by including the schema prefix when dumping schema objects. It now behaves more similar to mclient -D -N.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
311
diff
changeset
|
36 * |
df815a403bf4
Improved JdbcClient program by including the schema prefix when dumping schema objects. It now behaves more similar to mclient -D -N.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
311
diff
changeset
|
37 * @param dbmd a DatabaseMetaData object to query on (not null) |
df815a403bf4
Improved JdbcClient program by including the schema prefix when dumping schema objects. It now behaves more similar to mclient -D -N.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
311
diff
changeset
|
38 * @param type the type of the object, e.g. VIEW, TABLE (not null) |
df815a403bf4
Improved JdbcClient program by including the schema prefix when dumping schema objects. It now behaves more similar to mclient -D -N.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
311
diff
changeset
|
39 * @param schema the schema the object is in (not null) |
df815a403bf4
Improved JdbcClient program by including the schema prefix when dumping schema objects. It now behaves more similar to mclient -D -N.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
311
diff
changeset
|
40 * @param name the table to describe (not null) |
df815a403bf4
Improved JdbcClient program by including the schema prefix when dumping schema objects. It now behaves more similar to mclient -D -N.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
311
diff
changeset
|
41 * @throws SQLException if a database related error occurs |
df815a403bf4
Improved JdbcClient program by including the schema prefix when dumping schema objects. It now behaves more similar to mclient -D -N.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
311
diff
changeset
|
42 */ |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
43 public void dumpSchema( |
309
8a96a4a13528
Add additional "final" keyword to classes, method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
307
diff
changeset
|
44 final java.sql.DatabaseMetaData dbmd, |
307
05549bc7ed26
Add "final" keyword to classes, method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
261
diff
changeset
|
45 final String type, |
05549bc7ed26
Add "final" keyword to classes, method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
261
diff
changeset
|
46 final String schema, |
05549bc7ed26
Add "final" keyword to classes, method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
261
diff
changeset
|
47 final String name) |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
48 throws SQLException |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
49 { |
309
8a96a4a13528
Add additional "final" keyword to classes, method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
307
diff
changeset
|
50 // handle views directly |
318
13a9d5316e37
Corrected JdbcClient program: the dumping of a view DDL was incorrect when the view creation statement was not starting with "create view ", such as when it was created using "CREATE VIEW" or "create or replace view".
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
315
diff
changeset
|
51 if (type.endsWith("VIEW")) { // for types: VIEW and SYSTEM VIEW |
13a9d5316e37
Corrected JdbcClient program: the dumping of a view DDL was incorrect when the view creation statement was not starting with "create view ", such as when it was created using "CREATE VIEW" or "create or replace view".
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
315
diff
changeset
|
52 final String viewDDL = fetchSysTablesQueryValue(dbmd.getConnection(), schema, name); |
13a9d5316e37
Corrected JdbcClient program: the dumping of a view DDL was incorrect when the view creation statement was not starting with "create view ", such as when it was created using "CREATE VIEW" or "create or replace view".
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
315
diff
changeset
|
53 if (viewDDL != null) |
13a9d5316e37
Corrected JdbcClient program: the dumping of a view DDL was incorrect when the view creation statement was not starting with "create view ", such as when it was created using "CREATE VIEW" or "create or replace view".
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
315
diff
changeset
|
54 out.println("<!-- " + viewDDL + " -->"); |
13a9d5316e37
Corrected JdbcClient program: the dumping of a view DDL was incorrect when the view creation statement was not starting with "create view ", such as when it was created using "CREATE VIEW" or "create or replace view".
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
315
diff
changeset
|
55 else |
321
dbd8e9a8566f
Fixed JdbcClient program. It now allows you to describe tables or view which contains whitespaces by using double quotes.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
318
diff
changeset
|
56 out.println("<!-- unknown " + type + " " + dq(schema) + "." + dq(name) + ": no SQL view definition found! -->"); |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
57 return; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
58 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
59 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
60 out.println("<xsd:schema>"); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
61 |
315
4793f9b80bb3
Removed the catalog parameter from the Exporter.dumpSchema method as it is always null for MonetDB.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
314
diff
changeset
|
62 final ResultSet cols = dbmd.getColumns(null, schema, name, null); |
314
6d98a1d3af00
Optimize and improve SQL and XML exporters
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
313
diff
changeset
|
63 final int colNmIndex = cols.findColumn("COLUMN_NAME"); |
6d98a1d3af00
Optimize and improve SQL and XML exporters
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
313
diff
changeset
|
64 final int colTypeNmIndex = cols.findColumn("TYPE_NAME"); |
6d98a1d3af00
Optimize and improve SQL and XML exporters
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
313
diff
changeset
|
65 final int datatypeIndex = cols.findColumn("DATA_TYPE"); |
6d98a1d3af00
Optimize and improve SQL and XML exporters
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
313
diff
changeset
|
66 final int sizeIndex = cols.findColumn("COLUMN_SIZE"); |
6d98a1d3af00
Optimize and improve SQL and XML exporters
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
313
diff
changeset
|
67 final int digitsIndex = cols.findColumn("DECIMAL_DIGITS"); |
6d98a1d3af00
Optimize and improve SQL and XML exporters
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
313
diff
changeset
|
68 |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
69 String ident; |
309
8a96a4a13528
Add additional "final" keyword to classes, method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
307
diff
changeset
|
70 final java.util.HashSet<String> types = new java.util.HashSet<String>(); |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
71 // walk through the ResultSet and create the types |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
72 // for a bit of a clue on the types, see this url: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
73 // http://books.xmlschemata.org/relaxng/relax-CHP-19.html |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
74 while (cols.next()) { |
314
6d98a1d3af00
Optimize and improve SQL and XML exporters
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
313
diff
changeset
|
75 switch (cols.getInt(datatypeIndex)) { |
70
17fbaf2635bb
Expand import java.*.* statements
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
0
diff
changeset
|
76 case Types.CHAR: |
314
6d98a1d3af00
Optimize and improve SQL and XML exporters
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
313
diff
changeset
|
77 ident = "CHAR_" + cols.getString(sizeIndex); |
307
05549bc7ed26
Add "final" keyword to classes, method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
261
diff
changeset
|
78 if (types.contains(ident)) |
05549bc7ed26
Add "final" keyword to classes, method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
261
diff
changeset
|
79 break; |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
80 types.add(ident); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
81 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
82 out.print(" <xsd:simpleType name="); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
83 out.print(dq(ident)); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
84 out.println(">"); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
85 out.println(" <xsd:restriction base=\"xsd:string\">"); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
86 out.print(" <xsd:length value="); |
314
6d98a1d3af00
Optimize and improve SQL and XML exporters
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
313
diff
changeset
|
87 out.print(dq(cols.getString(sizeIndex))); |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
88 out.println(" />"); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
89 out.println(" </xsd:restriction>"); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
90 out.println(" </xsd:simpleType>"); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
91 break; |
70
17fbaf2635bb
Expand import java.*.* statements
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
0
diff
changeset
|
92 case Types.VARCHAR: |
17fbaf2635bb
Expand import java.*.* statements
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
0
diff
changeset
|
93 case Types.LONGVARCHAR: |
314
6d98a1d3af00
Optimize and improve SQL and XML exporters
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
313
diff
changeset
|
94 ident = "VARCHAR_" + cols.getString(sizeIndex); |
307
05549bc7ed26
Add "final" keyword to classes, method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
261
diff
changeset
|
95 if (types.contains(ident)) |
05549bc7ed26
Add "final" keyword to classes, method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
261
diff
changeset
|
96 break; |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
97 types.add(ident); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
98 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
99 out.print(" <xsd:simpleType name="); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
100 out.print(dq(ident)); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
101 out.println(">"); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
102 out.println(" <xsd:restriction base=\"xsd:string\">"); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
103 out.print(" <xsd:maxLength value="); |
314
6d98a1d3af00
Optimize and improve SQL and XML exporters
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
313
diff
changeset
|
104 out.print(dq(cols.getString(sizeIndex))); |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
105 out.println(" />"); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
106 out.println(" </xsd:restriction>"); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
107 out.println(" </xsd:simpleType>"); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
108 break; |
70
17fbaf2635bb
Expand import java.*.* statements
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
0
diff
changeset
|
109 case Types.CLOB: |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
110 ident = "CLOB"; |
307
05549bc7ed26
Add "final" keyword to classes, method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
261
diff
changeset
|
111 if (types.contains(ident)) |
05549bc7ed26
Add "final" keyword to classes, method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
261
diff
changeset
|
112 break; |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
113 types.add(ident); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
114 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
115 out.print(" <xsd:simpleType name="); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
116 out.print(dq(ident)); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
117 out.println(">"); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
118 out.println(" <xsd:restriction base=\"xsd:string\" />"); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
119 out.println(" </xsd:simpleType>"); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
120 break; |
70
17fbaf2635bb
Expand import java.*.* statements
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
0
diff
changeset
|
121 case Types.DECIMAL: |
17fbaf2635bb
Expand import java.*.* statements
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
0
diff
changeset
|
122 case Types.NUMERIC: |
314
6d98a1d3af00
Optimize and improve SQL and XML exporters
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
313
diff
changeset
|
123 ident = "DECIMAL_" + cols.getString(sizeIndex) + "_" + cols.getString(digitsIndex); |
307
05549bc7ed26
Add "final" keyword to classes, method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
261
diff
changeset
|
124 if (types.contains(ident)) |
05549bc7ed26
Add "final" keyword to classes, method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
261
diff
changeset
|
125 break; |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
126 types.add(ident); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
127 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
128 out.print(" <xsd:simpleType name="); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
129 out.print(dq(ident)); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
130 out.println(">"); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
131 out.println(" <xsd:restriction base=\"xsd:decimal\">"); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
132 out.print(" <xsd:totalDigits value="); |
314
6d98a1d3af00
Optimize and improve SQL and XML exporters
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
313
diff
changeset
|
133 out.print(dq(cols.getString(sizeIndex))); |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
134 out.println(" />"); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
135 out.print(" <xsd:fractionDigits value="); |
314
6d98a1d3af00
Optimize and improve SQL and XML exporters
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
313
diff
changeset
|
136 out.print(dq(cols.getString(digitsIndex))); |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
137 out.println(" />"); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
138 out.println(" </xsd:restriction>"); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
139 out.println(" </xsd:simpleType>"); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
140 break; |
70
17fbaf2635bb
Expand import java.*.* statements
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
0
diff
changeset
|
141 case Types.TINYINT: |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
142 ident = "TINYINT"; |
307
05549bc7ed26
Add "final" keyword to classes, method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
261
diff
changeset
|
143 if (types.contains(ident)) |
05549bc7ed26
Add "final" keyword to classes, method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
261
diff
changeset
|
144 break; |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
145 types.add(ident); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
146 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
147 out.print(" <xsd:simpleType name="); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
148 out.print(dq(ident)); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
149 out.println(">"); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
150 out.println(" <xsd:restriction base=\"xsd:byte\" />"); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
151 out.println(" </xsd:simpleType>"); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
152 break; |
70
17fbaf2635bb
Expand import java.*.* statements
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
0
diff
changeset
|
153 case Types.SMALLINT: |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
154 ident = "SMALLINT"; |
307
05549bc7ed26
Add "final" keyword to classes, method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
261
diff
changeset
|
155 if (types.contains(ident)) |
05549bc7ed26
Add "final" keyword to classes, method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
261
diff
changeset
|
156 break; |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
157 types.add(ident); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
158 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
159 out.print(" <xsd:simpleType name="); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
160 out.print(dq(ident)); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
161 out.println(">"); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
162 out.println(" <xsd:restriction base=\"xsd:short\" />"); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
163 out.println(" </xsd:simpleType>"); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
164 break; |
70
17fbaf2635bb
Expand import java.*.* statements
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
0
diff
changeset
|
165 case Types.INTEGER: |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
166 ident = "INTEGER"; |
307
05549bc7ed26
Add "final" keyword to classes, method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
261
diff
changeset
|
167 if (types.contains(ident)) |
05549bc7ed26
Add "final" keyword to classes, method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
261
diff
changeset
|
168 break; |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
169 types.add(ident); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
170 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
171 out.print(" <xsd:simpleType name="); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
172 out.print(dq(ident)); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
173 out.println(">"); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
174 out.println(" <xsd:restriction base=\"xsd:integer\" />"); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
175 out.println(" </xsd:simpleType>"); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
176 break; |
70
17fbaf2635bb
Expand import java.*.* statements
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
0
diff
changeset
|
177 case Types.BIGINT: |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
178 ident = "BIGINT"; |
307
05549bc7ed26
Add "final" keyword to classes, method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
261
diff
changeset
|
179 if (types.contains(ident)) |
05549bc7ed26
Add "final" keyword to classes, method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
261
diff
changeset
|
180 break; |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
181 types.add(ident); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
182 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
183 out.print(" <xsd:simpleType name="); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
184 out.print(dq(ident)); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
185 out.println(">"); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
186 out.println(" <xsd:restriction base=\"xsd:long\" />"); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
187 out.println(" </xsd:simpleType>"); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
188 break; |
70
17fbaf2635bb
Expand import java.*.* statements
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
0
diff
changeset
|
189 case Types.BIT: |
17fbaf2635bb
Expand import java.*.* statements
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
0
diff
changeset
|
190 ident = "BIT"; |
307
05549bc7ed26
Add "final" keyword to classes, method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
261
diff
changeset
|
191 if (types.contains(ident)) |
05549bc7ed26
Add "final" keyword to classes, method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
261
diff
changeset
|
192 break; |
70
17fbaf2635bb
Expand import java.*.* statements
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
0
diff
changeset
|
193 types.add(ident); |
17fbaf2635bb
Expand import java.*.* statements
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
0
diff
changeset
|
194 |
17fbaf2635bb
Expand import java.*.* statements
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
0
diff
changeset
|
195 out.print(" <xsd:simpleType name="); |
17fbaf2635bb
Expand import java.*.* statements
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
0
diff
changeset
|
196 out.print(dq(ident)); |
17fbaf2635bb
Expand import java.*.* statements
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
0
diff
changeset
|
197 out.println(">"); |
17fbaf2635bb
Expand import java.*.* statements
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
0
diff
changeset
|
198 out.println(" <xsd:restriction base=\"xsd:bit\" />"); |
17fbaf2635bb
Expand import java.*.* statements
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
0
diff
changeset
|
199 out.println(" </xsd:simpleType>"); |
17fbaf2635bb
Expand import java.*.* statements
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
0
diff
changeset
|
200 break; |
17fbaf2635bb
Expand import java.*.* statements
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
0
diff
changeset
|
201 case Types.BOOLEAN: |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
202 ident = "BOOLEAN"; |
307
05549bc7ed26
Add "final" keyword to classes, method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
261
diff
changeset
|
203 if (types.contains(ident)) |
05549bc7ed26
Add "final" keyword to classes, method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
261
diff
changeset
|
204 break; |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
205 types.add(ident); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
206 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
207 out.print(" <xsd:simpleType name="); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
208 out.print(dq(ident)); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
209 out.println(">"); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
210 out.println(" <xsd:restriction base=\"xsd:boolean\" />"); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
211 out.println(" </xsd:simpleType>"); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
212 break; |
70
17fbaf2635bb
Expand import java.*.* statements
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
0
diff
changeset
|
213 case Types.DATE: |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
214 ident = "DATE"; |
307
05549bc7ed26
Add "final" keyword to classes, method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
261
diff
changeset
|
215 if (types.contains(ident)) |
05549bc7ed26
Add "final" keyword to classes, method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
261
diff
changeset
|
216 break; |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
217 types.add(ident); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
218 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
219 out.print(" <xsd:simpleType name="); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
220 out.print(dq(ident)); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
221 out.println(">"); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
222 out.println(" <xsd:restriction base=\"xsd:date\" />"); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
223 out.println(" </xsd:simpleType>"); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
224 break; |
70
17fbaf2635bb
Expand import java.*.* statements
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
0
diff
changeset
|
225 case Types.TIME: |
424
709300b32284
Added entries for new Java 8 java.sql.Types: Types.TIME_WITH_TIMEZONE and Types.TIMESTAMP_WITH_TIMEZONE
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
406
diff
changeset
|
226 case Types.TIME_WITH_TIMEZONE: |
314
6d98a1d3af00
Optimize and improve SQL and XML exporters
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
313
diff
changeset
|
227 if ("timetz".equals(cols.getString(colTypeNmIndex))) { |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
228 ident = "TIME_WTZ"; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
229 } else { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
230 ident = "TIME"; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
231 } |
307
05549bc7ed26
Add "final" keyword to classes, method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
261
diff
changeset
|
232 if (types.contains(ident)) |
05549bc7ed26
Add "final" keyword to classes, method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
261
diff
changeset
|
233 break; |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
234 types.add(ident); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
235 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
236 out.print(" <xsd:simpleType name="); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
237 out.print(dq(ident)); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
238 out.println(">"); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
239 out.println(" <xsd:restriction base=\"xsd:time\" />"); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
240 out.println(" </xsd:simpleType>"); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
241 break; |
70
17fbaf2635bb
Expand import java.*.* statements
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
0
diff
changeset
|
242 case Types.TIMESTAMP: |
424
709300b32284
Added entries for new Java 8 java.sql.Types: Types.TIME_WITH_TIMEZONE and Types.TIMESTAMP_WITH_TIMEZONE
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
406
diff
changeset
|
243 case Types.TIMESTAMP_WITH_TIMEZONE: |
314
6d98a1d3af00
Optimize and improve SQL and XML exporters
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
313
diff
changeset
|
244 if ("timestamptz".equals(cols.getString(colTypeNmIndex))) { |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
245 ident = "TIMESTAMP_WTZ"; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
246 } else { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
247 ident = "TIMESTAMP"; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
248 } |
307
05549bc7ed26
Add "final" keyword to classes, method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
261
diff
changeset
|
249 if (types.contains(ident)) |
05549bc7ed26
Add "final" keyword to classes, method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
261
diff
changeset
|
250 break; |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
251 types.add(ident); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
252 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
253 out.print(" <xsd:simpleType name="); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
254 out.print(dq(ident)); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
255 out.println(">"); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
256 out.println(" <xsd:restriction base=\"xsd:dateTime\" />"); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
257 out.println(" </xsd:simpleType>"); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
258 break; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
259 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
260 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
261 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
262 // rewind the ResultSet |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
263 cols.beforeFirst(); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
264 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
265 // create the RowType |
315
4793f9b80bb3
Removed the catalog parameter from the Exporter.dumpSchema method as it is always null for MonetDB.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
314
diff
changeset
|
266 final String tablenm = schema.replaceAll("\\.", "_x002e_") + "." + name.replaceAll("\\.", "_x002e_"); |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
267 out.print(" <xsd:complexType name="); |
315
4793f9b80bb3
Removed the catalog parameter from the Exporter.dumpSchema method as it is always null for MonetDB.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
314
diff
changeset
|
268 out.print(dq("RowType." + tablenm)); |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
269 out.println(">"); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
270 out.println(" <xsd:sequence>"); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
271 while (cols.next()) { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
272 out.print(" <xsd:element name="); |
314
6d98a1d3af00
Optimize and improve SQL and XML exporters
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
313
diff
changeset
|
273 out.print(dq(cols.getString(colNmIndex))); |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
274 out.print(" type="); |
314
6d98a1d3af00
Optimize and improve SQL and XML exporters
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
313
diff
changeset
|
275 switch (cols.getInt(datatypeIndex)) { |
70
17fbaf2635bb
Expand import java.*.* statements
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
0
diff
changeset
|
276 case Types.CHAR: |
314
6d98a1d3af00
Optimize and improve SQL and XML exporters
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
313
diff
changeset
|
277 ident = "CHAR_" + cols.getString(sizeIndex); |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
278 break; |
70
17fbaf2635bb
Expand import java.*.* statements
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
0
diff
changeset
|
279 case Types.VARCHAR: |
17fbaf2635bb
Expand import java.*.* statements
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
0
diff
changeset
|
280 case Types.LONGVARCHAR: |
314
6d98a1d3af00
Optimize and improve SQL and XML exporters
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
313
diff
changeset
|
281 ident = "VARCHAR_" + cols.getString(sizeIndex); |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
282 break; |
70
17fbaf2635bb
Expand import java.*.* statements
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
0
diff
changeset
|
283 case Types.CLOB: |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
284 ident = "CLOB"; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
285 break; |
70
17fbaf2635bb
Expand import java.*.* statements
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
0
diff
changeset
|
286 case Types.DECIMAL: |
17fbaf2635bb
Expand import java.*.* statements
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
0
diff
changeset
|
287 case Types.NUMERIC: |
314
6d98a1d3af00
Optimize and improve SQL and XML exporters
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
313
diff
changeset
|
288 ident = "DECIMAL_" + cols.getString(sizeIndex) + |
6d98a1d3af00
Optimize and improve SQL and XML exporters
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
313
diff
changeset
|
289 "_" + cols.getString(digitsIndex); |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
290 break; |
70
17fbaf2635bb
Expand import java.*.* statements
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
0
diff
changeset
|
291 case Types.TINYINT: |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
292 ident = "TINYINT"; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
293 break; |
70
17fbaf2635bb
Expand import java.*.* statements
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
0
diff
changeset
|
294 case Types.SMALLINT: |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
295 ident = "SMALLINT"; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
296 break; |
70
17fbaf2635bb
Expand import java.*.* statements
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
0
diff
changeset
|
297 case Types.INTEGER: |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
298 ident = "INTEGER"; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
299 break; |
70
17fbaf2635bb
Expand import java.*.* statements
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
0
diff
changeset
|
300 case Types.BIGINT: |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
301 ident = "BIGINT"; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
302 break; |
70
17fbaf2635bb
Expand import java.*.* statements
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
0
diff
changeset
|
303 case Types.BIT: |
17fbaf2635bb
Expand import java.*.* statements
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
0
diff
changeset
|
304 ident = "BIT"; |
17fbaf2635bb
Expand import java.*.* statements
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
0
diff
changeset
|
305 break; |
17fbaf2635bb
Expand import java.*.* statements
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
0
diff
changeset
|
306 case Types.BOOLEAN: |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
307 ident = "BOOLEAN"; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
308 break; |
70
17fbaf2635bb
Expand import java.*.* statements
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
0
diff
changeset
|
309 case Types.DATE: |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
310 ident = "DATE"; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
311 break; |
70
17fbaf2635bb
Expand import java.*.* statements
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
0
diff
changeset
|
312 case Types.TIME: |
424
709300b32284
Added entries for new Java 8 java.sql.Types: Types.TIME_WITH_TIMEZONE and Types.TIMESTAMP_WITH_TIMEZONE
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
406
diff
changeset
|
313 case Types.TIME_WITH_TIMEZONE: |
314
6d98a1d3af00
Optimize and improve SQL and XML exporters
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
313
diff
changeset
|
314 if ("timetz".equals(cols.getString(colTypeNmIndex))) { |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
315 ident = "TIME_WTZ"; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
316 } else { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
317 ident = "TIME"; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
318 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
319 break; |
70
17fbaf2635bb
Expand import java.*.* statements
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
0
diff
changeset
|
320 case Types.TIMESTAMP: |
424
709300b32284
Added entries for new Java 8 java.sql.Types: Types.TIME_WITH_TIMEZONE and Types.TIMESTAMP_WITH_TIMEZONE
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
406
diff
changeset
|
321 case Types.TIMESTAMP_WITH_TIMEZONE: |
314
6d98a1d3af00
Optimize and improve SQL and XML exporters
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
313
diff
changeset
|
322 if ("timestamptz".equals(cols.getString(colTypeNmIndex))) { |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
323 ident = "TIMESTAMP_WTZ"; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
324 } else { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
325 ident = "TIMESTAMP"; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
326 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
327 break; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
328 default: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
329 ident = "(unknown)"; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
330 break; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
331 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
332 out.print(dq(ident)); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
333 out.println(" />"); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
334 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
335 out.println(" </xsd:sequence>"); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
336 out.println(" </xsd:complexType>"); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
337 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
338 out.print(" <xsd:complexType name="); |
315
4793f9b80bb3
Removed the catalog parameter from the Exporter.dumpSchema method as it is always null for MonetDB.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
314
diff
changeset
|
339 out.print(dq("TableType." + tablenm)); |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
340 out.println(">"); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
341 out.println(" <xsd:sequence>"); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
342 out.print(" <xsd:element name=\"row\" type="); |
315
4793f9b80bb3
Removed the catalog parameter from the Exporter.dumpSchema method as it is always null for MonetDB.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
314
diff
changeset
|
343 out.print(dq("RowType." + tablenm)); |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
344 out.println(" minOccurs=\"0\" maxOccurs=\"unbounded\" />"); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
345 out.println(" </xsd:sequence>"); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
346 out.println(" </xsd:complexType>"); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
347 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
348 out.println("</xsd:schema>"); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
349 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
350 |
314
6d98a1d3af00
Optimize and improve SQL and XML exporters
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
313
diff
changeset
|
351 private static SimpleDateFormat xsd_ts; |
6d98a1d3af00
Optimize and improve SQL and XML exporters
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
313
diff
changeset
|
352 private static SimpleDateFormat xsd_tstz; |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
353 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
354 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
355 * Generates an XML representation of the given ResultSet. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
356 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
357 * @param rs the ResultSet |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
358 */ |
307
05549bc7ed26
Add "final" keyword to classes, method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
261
diff
changeset
|
359 public void dumpResultSet(final ResultSet rs) throws SQLException { |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
360 // write simple XML serialisation |
309
8a96a4a13528
Add additional "final" keyword to classes, method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
307
diff
changeset
|
361 final java.sql.ResultSetMetaData rsmd = rs.getMetaData(); |
313
f2750ea9f93d
When exporting table/view definition always include the schema name.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
312
diff
changeset
|
362 final String schema = rsmd.getSchemaName(1); |
f2750ea9f93d
When exporting table/view definition always include the schema name.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
312
diff
changeset
|
363 final String fqname = (schema != null && !schema.isEmpty() ? schema + "." : "") + rsmd.getTableName(1); |
f2750ea9f93d
When exporting table/view definition always include the schema name.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
312
diff
changeset
|
364 out.println("<" + fqname + ">"); |
f2750ea9f93d
When exporting table/view definition always include the schema name.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
312
diff
changeset
|
365 |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
366 String data; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
367 while (rs.next()) { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
368 out.println(" <row>"); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
369 for (int i = 1; i <= rsmd.getColumnCount(); i++) { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
370 switch (rsmd.getColumnType(i)) { |
70
17fbaf2635bb
Expand import java.*.* statements
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
0
diff
changeset
|
371 case Types.TIMESTAMP: |
424
709300b32284
Added entries for new Java 8 java.sql.Types: Types.TIME_WITH_TIMEZONE and Types.TIMESTAMP_WITH_TIMEZONE
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
406
diff
changeset
|
372 case Types.TIMESTAMP_WITH_TIMEZONE: |
309
8a96a4a13528
Add additional "final" keyword to classes, method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
307
diff
changeset
|
373 final Timestamp ts = rs.getTimestamp(i); |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
374 if ("timestamptz".equals(rsmd.getColumnTypeName(i))) { |
314
6d98a1d3af00
Optimize and improve SQL and XML exporters
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
313
diff
changeset
|
375 if (xsd_tstz == null) { |
6d98a1d3af00
Optimize and improve SQL and XML exporters
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
313
diff
changeset
|
376 // first time it is needed, create it |
6d98a1d3af00
Optimize and improve SQL and XML exporters
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
313
diff
changeset
|
377 xsd_tstz = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ"); |
6d98a1d3af00
Optimize and improve SQL and XML exporters
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
313
diff
changeset
|
378 } |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
379 data = xsd_tstz.format(ts).toString(); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
380 } else { |
314
6d98a1d3af00
Optimize and improve SQL and XML exporters
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
313
diff
changeset
|
381 if (xsd_ts == null) { |
6d98a1d3af00
Optimize and improve SQL and XML exporters
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
313
diff
changeset
|
382 // first time it is needed, create it |
6d98a1d3af00
Optimize and improve SQL and XML exporters
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
313
diff
changeset
|
383 xsd_ts = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss"); |
6d98a1d3af00
Optimize and improve SQL and XML exporters
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
313
diff
changeset
|
384 } |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
385 data = xsd_ts.format(ts).toString(); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
386 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
387 break; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
388 default: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
389 data = rs.getString(i); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
390 break; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
391 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
392 if (data == null) { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
393 if (useNil) { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
394 // "nil" method: write <tag xsi:nil="true" /> |
314
6d98a1d3af00
Optimize and improve SQL and XML exporters
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
313
diff
changeset
|
395 out.println(" <" + rsmd.getColumnLabel(i) + " xsi:nil=\"true\" />"); |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
396 } else { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
397 // This is the "absent" method (of completely |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
398 // hiding the tag if null |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
399 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
400 } else { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
401 if (data.length() == 0) { |
314
6d98a1d3af00
Optimize and improve SQL and XML exporters
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
313
diff
changeset
|
402 out.println(" <" + rsmd.getColumnLabel(i) + " />"); |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
403 } else { |
314
6d98a1d3af00
Optimize and improve SQL and XML exporters
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
313
diff
changeset
|
404 final String colLabel = rsmd.getColumnLabel(i); |
6d98a1d3af00
Optimize and improve SQL and XML exporters
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
313
diff
changeset
|
405 out.println(" <" + colLabel + ">" + escapeSpecialXMLChars(data) + "</" + colLabel + ">"); |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
406 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
407 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
408 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
409 out.println(" </row>"); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
410 } |
313
f2750ea9f93d
When exporting table/view definition always include the schema name.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
312
diff
changeset
|
411 out.println("</" + fqname + ">"); |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
412 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
413 |
314
6d98a1d3af00
Optimize and improve SQL and XML exporters
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
313
diff
changeset
|
414 // https://en.wikipedia.org/wiki/XML#Escaping |
6d98a1d3af00
Optimize and improve SQL and XML exporters
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
313
diff
changeset
|
415 private static final String escapeSpecialXMLChars(final String val) { |
6d98a1d3af00
Optimize and improve SQL and XML exporters
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
313
diff
changeset
|
416 final int len = val.length(); |
6d98a1d3af00
Optimize and improve SQL and XML exporters
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
313
diff
changeset
|
417 final StringBuilder sb = new StringBuilder(len + 50); |
6d98a1d3af00
Optimize and improve SQL and XML exporters
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
313
diff
changeset
|
418 // replace each & or < or > or ' or " by special XML escape code |
6d98a1d3af00
Optimize and improve SQL and XML exporters
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
313
diff
changeset
|
419 for (int i = 0; i < len; i++) { |
6d98a1d3af00
Optimize and improve SQL and XML exporters
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
313
diff
changeset
|
420 char c = val.charAt(i); |
6d98a1d3af00
Optimize and improve SQL and XML exporters
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
313
diff
changeset
|
421 switch (c) { |
6d98a1d3af00
Optimize and improve SQL and XML exporters
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
313
diff
changeset
|
422 case '&': |
6d98a1d3af00
Optimize and improve SQL and XML exporters
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
313
diff
changeset
|
423 sb.append("&"); |
6d98a1d3af00
Optimize and improve SQL and XML exporters
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
313
diff
changeset
|
424 break; |
6d98a1d3af00
Optimize and improve SQL and XML exporters
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
313
diff
changeset
|
425 case '<': |
6d98a1d3af00
Optimize and improve SQL and XML exporters
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
313
diff
changeset
|
426 sb.append("<"); |
6d98a1d3af00
Optimize and improve SQL and XML exporters
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
313
diff
changeset
|
427 break; |
6d98a1d3af00
Optimize and improve SQL and XML exporters
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
313
diff
changeset
|
428 case '>': |
6d98a1d3af00
Optimize and improve SQL and XML exporters
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
313
diff
changeset
|
429 sb.append(">"); |
6d98a1d3af00
Optimize and improve SQL and XML exporters
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
313
diff
changeset
|
430 break; |
6d98a1d3af00
Optimize and improve SQL and XML exporters
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
313
diff
changeset
|
431 case '\'': |
6d98a1d3af00
Optimize and improve SQL and XML exporters
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
313
diff
changeset
|
432 sb.append("'"); |
6d98a1d3af00
Optimize and improve SQL and XML exporters
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
313
diff
changeset
|
433 break; |
6d98a1d3af00
Optimize and improve SQL and XML exporters
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
313
diff
changeset
|
434 case '"': |
6d98a1d3af00
Optimize and improve SQL and XML exporters
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
313
diff
changeset
|
435 sb.append("""); |
6d98a1d3af00
Optimize and improve SQL and XML exporters
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
313
diff
changeset
|
436 break; |
6d98a1d3af00
Optimize and improve SQL and XML exporters
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
313
diff
changeset
|
437 default: |
6d98a1d3af00
Optimize and improve SQL and XML exporters
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
313
diff
changeset
|
438 sb.append(c); |
6d98a1d3af00
Optimize and improve SQL and XML exporters
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
313
diff
changeset
|
439 } |
6d98a1d3af00
Optimize and improve SQL and XML exporters
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
313
diff
changeset
|
440 } |
6d98a1d3af00
Optimize and improve SQL and XML exporters
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
313
diff
changeset
|
441 return (sb.length() > len) ? sb.toString() : val; |
6d98a1d3af00
Optimize and improve SQL and XML exporters
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
313
diff
changeset
|
442 } |
6d98a1d3af00
Optimize and improve SQL and XML exporters
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
313
diff
changeset
|
443 |
307
05549bc7ed26
Add "final" keyword to classes, method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
261
diff
changeset
|
444 public void setProperty(final int type, final int value) throws Exception { |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
445 switch (type) { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
446 case TYPE_NIL: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
447 switch (value) { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
448 case VALUE_OMIT: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
449 useNil = false; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
450 break; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
451 case VALUE_XSI: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
452 useNil = true; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
453 break; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
454 default: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
455 throw new Exception("Illegal value " + value + " for TYPE_NIL"); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
456 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
457 break; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
458 default: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
459 throw new Exception("Illegal type " + type); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
460 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
461 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
462 |
307
05549bc7ed26
Add "final" keyword to classes, method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
261
diff
changeset
|
463 public int getProperty(final int type) throws Exception { |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
464 switch (type) { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
465 case TYPE_NIL: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
466 return useNil ? VALUE_XSI : VALUE_OMIT; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
467 default: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
468 throw new Exception("Illegal type " + type); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
469 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
470 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
471 } |