Mercurial > hg > monetdb-java
annotate src/main/java/org/monetdb/jdbc/MonetDatabaseMetaData.java @ 833:e890195256ac
Update copyright for the new year, move to MonetDB Foundation, add SPDX.
author | Sjoerd Mullender <sjoerd@acm.org> |
---|---|
date | Fri, 29 Dec 2023 14:37:42 +0100 (15 months ago) |
parents | b2cbe866d020 |
children | 9ad9c8c38fe4 |
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:
827
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:
827
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 * |
833
e890195256ac
Update copyright for the new year, move to MonetDB Foundation, add SPDX.
Sjoerd Mullender <sjoerd@acm.org>
parents:
827
diff
changeset
|
8 * Copyright 2024 MonetDB Foundation; |
e890195256ac
Update copyright for the new year, move to MonetDB Foundation, add SPDX.
Sjoerd Mullender <sjoerd@acm.org>
parents:
827
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:
827
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:
389
diff
changeset
|
13 package org.monetdb.jdbc; |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
14 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
15 import java.sql.Connection; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
16 import java.sql.DatabaseMetaData; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
17 import java.sql.Statement; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
18 import java.sql.SQLException; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
19 import java.sql.ResultSet; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
20 import java.sql.ResultSetMetaData; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
21 import java.sql.RowIdLifetime; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
22 import java.sql.Types; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
23 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
24 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
25 * A DatabaseMetaData object suitable for the MonetDB database. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
26 * |
323
8701024a9bb0
In DatabaseMetaData methods which accept name match patterns, optimise the SQL generation when the pattern equals a: %
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
306
diff
changeset
|
27 * @author Fabian Groffen |
8701024a9bb0
In DatabaseMetaData methods which accept name match patterns, optimise the SQL generation when the pattern equals a: %
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
306
diff
changeset
|
28 * @author Martin van Dinther |
376
ffdc7b0e102d
Updated JDBC driver to comply with JDBC 4.2 interface now we compile for Java 8. This includes:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
375
diff
changeset
|
29 * @version 1.0 |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
30 */ |
670
3034312c1eda
Mark these 2 classes as final.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
669
diff
changeset
|
31 public final class MonetDatabaseMetaData |
295
003ae6d881db
Add "final" keyword to method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
294
diff
changeset
|
32 extends MonetWrapper |
003ae6d881db
Add "final" keyword to method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
294
diff
changeset
|
33 implements DatabaseMetaData |
003ae6d881db
Add "final" keyword to method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
294
diff
changeset
|
34 { |
332
e8962bdaa206
Moved utility methods and associated caches from DatabaseMetaData to Connection object.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
331
diff
changeset
|
35 private final MonetConnection con; |
e8962bdaa206
Moved utility methods and associated caches from DatabaseMetaData to Connection object.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
331
diff
changeset
|
36 |
736
f317b37bad30
In MonetCallableStatement constructor skip calling removeEscapes() when the connected server supports ODBC/JDBC escape sequence syntax.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
734
diff
changeset
|
37 /** |
f317b37bad30
In MonetCallableStatement constructor skip calling removeEscapes() when the connected server supports ODBC/JDBC escape sequence syntax.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
734
diff
changeset
|
38 * Constructor |
f317b37bad30
In MonetCallableStatement constructor skip calling removeEscapes() when the connected server supports ODBC/JDBC escape sequence syntax.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
734
diff
changeset
|
39 * @param parent the parent MonetConnection object. |
f317b37bad30
In MonetCallableStatement constructor skip calling removeEscapes() when the connected server supports ODBC/JDBC escape sequence syntax.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
734
diff
changeset
|
40 */ |
332
e8962bdaa206
Moved utility methods and associated caches from DatabaseMetaData to Connection object.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
331
diff
changeset
|
41 public MonetDatabaseMetaData(final MonetConnection parent) { |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
42 con = parent; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
43 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
44 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
45 /** |
245
55375d489024
Corrected return values of DatabaseMetaData methods allTablesAreSelectable() and allProceduresAreCallable().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
231
diff
changeset
|
46 * Retrieves whether the current user can call all the procedures |
55375d489024
Corrected return values of DatabaseMetaData methods allTablesAreSelectable() and allProceduresAreCallable().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
231
diff
changeset
|
47 * returned by the method getProcedures. |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
48 * |
245
55375d489024
Corrected return values of DatabaseMetaData methods allTablesAreSelectable() and allProceduresAreCallable().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
231
diff
changeset
|
49 * @return false because we currently return all procedures from sys.functions |
55375d489024
Corrected return values of DatabaseMetaData methods allTablesAreSelectable() and allProceduresAreCallable().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
231
diff
changeset
|
50 * and do not filter on EXECUTE privilege or procedure ownership. |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
51 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
52 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
53 public boolean allProceduresAreCallable() { |
245
55375d489024
Corrected return values of DatabaseMetaData methods allTablesAreSelectable() and allProceduresAreCallable().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
231
diff
changeset
|
54 return false; |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
55 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
56 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
57 /** |
245
55375d489024
Corrected return values of DatabaseMetaData methods allTablesAreSelectable() and allProceduresAreCallable().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
231
diff
changeset
|
58 * Retrieves whether the current user can use all the tables |
55375d489024
Corrected return values of DatabaseMetaData methods allTablesAreSelectable() and allProceduresAreCallable().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
231
diff
changeset
|
59 * returned by the method getTables in a SELECT statement. |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
60 * |
245
55375d489024
Corrected return values of DatabaseMetaData methods allTablesAreSelectable() and allProceduresAreCallable().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
231
diff
changeset
|
61 * @return false because we currently return all tables from sys.tables |
55375d489024
Corrected return values of DatabaseMetaData methods allTablesAreSelectable() and allProceduresAreCallable().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
231
diff
changeset
|
62 * and do not filter on SELECT privilege or table ownership. |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
63 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
64 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
65 public boolean allTablesAreSelectable() { |
245
55375d489024
Corrected return values of DatabaseMetaData methods allTablesAreSelectable() and allProceduresAreCallable().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
231
diff
changeset
|
66 return false; |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
67 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
68 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
69 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
70 * What is the URL for this database? |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
71 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
72 * @return a reconstructed connection string |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
73 * @throws SQLException if a database access error occurs |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
74 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
75 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
76 public String getURL() throws SQLException { |
332
e8962bdaa206
Moved utility methods and associated caches from DatabaseMetaData to Connection object.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
331
diff
changeset
|
77 return con.getJDBCURL(); |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
78 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
79 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
80 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
81 * What is our user name as known to the database? |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
82 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
83 * @return sql user |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
84 * @throws SQLException if a database access error occurs |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
85 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
86 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
87 public String getUserName() throws SQLException { |
332
e8962bdaa206
Moved utility methods and associated caches from DatabaseMetaData to Connection object.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
331
diff
changeset
|
88 return con.getUserName(); |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
89 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
90 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
91 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
92 * Is the database in read-only mode? |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
93 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
94 * @return always false for now |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
95 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
96 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
97 public boolean isReadOnly() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
98 return false; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
99 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
100 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
101 /** |
15
6e48d0fae766
Corrected return values of DatabaseMetaData methods nullsAreSortedHigh(), nullsAreSortedLow(),
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
7
diff
changeset
|
102 * Retrieves whether NULL values are sorted high. Sorted high means |
6e48d0fae766
Corrected return values of DatabaseMetaData methods nullsAreSortedHigh(), nullsAreSortedLow(),
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
7
diff
changeset
|
103 * that NULL values sort higher than any other value in a domain. |
6e48d0fae766
Corrected return values of DatabaseMetaData methods nullsAreSortedHigh(), nullsAreSortedLow(),
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
7
diff
changeset
|
104 * In an ascending order, if this method returns true, NULL values will appear at the end. |
6e48d0fae766
Corrected return values of DatabaseMetaData methods nullsAreSortedHigh(), nullsAreSortedLow(),
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
7
diff
changeset
|
105 * By contrast, the method nullsAreSortedAtEnd indicates whether NULL values are sorted at the end regardless of sort order. |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
106 * |
626
06d69b82d409
Resolve javadoc error and warnings :
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
619
diff
changeset
|
107 * @return false because MonetDB shows NULL values at the beginning upon ORDER BY .. ASC, not at the end |
06d69b82d409
Resolve javadoc error and warnings :
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
619
diff
changeset
|
108 * @see #nullsAreSortedLow() |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
109 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
110 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
111 public boolean nullsAreSortedHigh() { |
15
6e48d0fae766
Corrected return values of DatabaseMetaData methods nullsAreSortedHigh(), nullsAreSortedLow(),
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
7
diff
changeset
|
112 return false; |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
113 } |
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 /** |
15
6e48d0fae766
Corrected return values of DatabaseMetaData methods nullsAreSortedHigh(), nullsAreSortedLow(),
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
7
diff
changeset
|
116 * Retrieves whether NULL values are sorted low. Sorted low means |
6e48d0fae766
Corrected return values of DatabaseMetaData methods nullsAreSortedHigh(), nullsAreSortedLow(),
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
7
diff
changeset
|
117 * that NULL values sort lower than any other value in a domain. |
6e48d0fae766
Corrected return values of DatabaseMetaData methods nullsAreSortedHigh(), nullsAreSortedLow(),
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
7
diff
changeset
|
118 * In an ascending order, if this method returns true, NULL values will appear at the beginning. |
6e48d0fae766
Corrected return values of DatabaseMetaData methods nullsAreSortedHigh(), nullsAreSortedLow(),
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
7
diff
changeset
|
119 * By contrast, the method nullsAreSortedAtStart indicates whether NULL values are sorted at the beginning regardless of sort order. |
6e48d0fae766
Corrected return values of DatabaseMetaData methods nullsAreSortedHigh(), nullsAreSortedLow(),
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
7
diff
changeset
|
120 * |
6e48d0fae766
Corrected return values of DatabaseMetaData methods nullsAreSortedHigh(), nullsAreSortedLow(),
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
7
diff
changeset
|
121 * @return true because MonetDB shows NULL values at the beginning upon ORDER BY .. ASC |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
122 * @see #nullsAreSortedHigh() |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
123 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
124 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
125 public boolean nullsAreSortedLow() { |
15
6e48d0fae766
Corrected return values of DatabaseMetaData methods nullsAreSortedHigh(), nullsAreSortedLow(),
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
7
diff
changeset
|
126 return true; |
0
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 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
129 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
130 * Are NULL values sorted at the start regardless of sort order? |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
131 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
132 * @return false, since MonetDB doesn't do this |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
133 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
134 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
135 public boolean nullsAreSortedAtStart() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
136 return false; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
137 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
138 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
139 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
140 * Are NULL values sorted at the end regardless of sort order? |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
141 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
142 * @return false, since MonetDB doesn't do this |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
143 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
144 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
145 public boolean nullsAreSortedAtEnd() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
146 return false; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
147 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
148 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
149 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
150 * What is the name of this database product - this should be MonetDB |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
151 * of course, so we return that explicitly. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
152 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
153 * @return the database product name |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
154 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
155 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
156 public String getDatabaseProductName() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
157 return "MonetDB"; |
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 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
160 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
161 * What is the version of this database product. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
162 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
163 * @return the mserver5 version number string |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
164 * @throws SQLException if a database access error occurs |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
165 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
166 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
167 public String getDatabaseProductVersion() throws SQLException { |
332
e8962bdaa206
Moved utility methods and associated caches from DatabaseMetaData to Connection object.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
331
diff
changeset
|
168 return con.getDatabaseProductVersion(); |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
169 } |
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 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
172 * What is the name of this JDBC driver? |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
173 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
174 * @return the JDBC driver name |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
175 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
176 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
177 public String getDriverName() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
178 return "MonetDB Native Driver"; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
179 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
180 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
181 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
182 * Retrieves the version number of this JDBC driver as a String. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
183 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
184 * @return the JDBC driver version string |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
185 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
186 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
187 public String getDriverVersion() { |
825
23f84ff380c2
Now we have a MonetVersion class use it from MonetDatabaseMetaData also.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
822
diff
changeset
|
188 return MonetVersion.driverVersion; |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
189 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
190 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
191 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
192 * What is this JDBC driver's major version number? |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
193 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
194 * @return the JDBC driver major version number |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
195 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
196 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
197 public int getDriverMajorVersion() { |
825
23f84ff380c2
Now we have a MonetVersion class use it from MonetDatabaseMetaData also.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
822
diff
changeset
|
198 return MonetVersion.majorVersion; |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
199 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
200 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
201 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
202 * What is this JDBC driver's minor version number? |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
203 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
204 * @return the JDBC driver minor version number |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
205 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
206 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
207 public int getDriverMinorVersion() { |
825
23f84ff380c2
Now we have a MonetVersion class use it from MonetDatabaseMetaData also.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
822
diff
changeset
|
208 return MonetVersion.minorVersion; |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
209 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
210 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
211 /** |
15
6e48d0fae766
Corrected return values of DatabaseMetaData methods nullsAreSortedHigh(), nullsAreSortedLow(),
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
7
diff
changeset
|
212 * Does the database store tables in a local file? |
6e48d0fae766
Corrected return values of DatabaseMetaData methods nullsAreSortedHigh(), nullsAreSortedLow(),
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
7
diff
changeset
|
213 * No, it stores them in files on the server. |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
214 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
215 * @return false because that's what MonetDB is for |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
216 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
217 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
218 public boolean usesLocalFiles() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
219 return false; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
220 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
221 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
222 /** |
15
6e48d0fae766
Corrected return values of DatabaseMetaData methods nullsAreSortedHigh(), nullsAreSortedLow(),
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
7
diff
changeset
|
223 * Does the database use a local file for each table? |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
224 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
225 * @return false for it doesn't |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
226 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
227 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
228 public boolean usesLocalFilePerTable() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
229 return false; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
230 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
231 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
232 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
233 * Does the database treat mixed case unquoted SQL identifiers |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
234 * as case sensitive and as a result store them in mixed case? |
231
68b9452f1215
Fix warnings:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
222
diff
changeset
|
235 * A JDBC Compliant <sup>TM</sup> driver always returns false. |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
236 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
237 * @return false |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
238 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
239 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
240 public boolean supportsMixedCaseIdentifiers() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
241 return false; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
242 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
243 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
244 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
245 * Does the database treat mixed case unquoted SQL identifiers as |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
246 * case insensitive and store them in upper case? |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
247 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
248 * @return true if so |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
249 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
250 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
251 public boolean storesUpperCaseIdentifiers() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
252 return false; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
253 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
254 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
255 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
256 * Does the database treat mixed case unquoted SQL identifiers as |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
257 * case insensitive and store them in lower case? |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
258 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
259 * @return true if so |
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 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
262 public boolean storesLowerCaseIdentifiers() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
263 return true; |
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 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
266 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
267 * Does the database treat mixed case unquoted SQL identifiers as |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
268 * case insensitive and store them in mixed case? |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
269 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
270 * @return true if so |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
271 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
272 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
273 public boolean storesMixedCaseIdentifiers() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
274 return false; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
275 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
276 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
277 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
278 * Does the database treat mixed case quoted SQL identifiers as |
213
115f6351bf4b
Update some documentation text
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
200
diff
changeset
|
279 * case sensitive and as a result store them in mixed case? |
231
68b9452f1215
Fix warnings:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
222
diff
changeset
|
280 * A JDBC Compliant <sup>TM</sup> driver always returns true. |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
281 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
282 * @return true if so |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
283 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
284 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
285 public boolean supportsMixedCaseQuotedIdentifiers() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
286 return true; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
287 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
288 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
289 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
290 * Does the database treat mixed case quoted SQL identifiers as |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
291 * case insensitive and store them in upper case? |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
292 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
293 * @return true if so |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
294 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
295 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
296 public boolean storesUpperCaseQuotedIdentifiers() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
297 return false; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
298 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
299 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
300 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
301 * Does the database treat mixed case quoted SQL identifiers as case |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
302 * insensitive and store them in lower case? |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
303 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
304 * @return true if so |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
305 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
306 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
307 public boolean storesLowerCaseQuotedIdentifiers() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
308 return false; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
309 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
310 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
311 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
312 * Does the database treat mixed case quoted SQL identifiers as case |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
313 * insensitive and store them in mixed case? |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
314 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
315 * @return true if so |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
316 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
317 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
318 public boolean storesMixedCaseQuotedIdentifiers() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
319 return false; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
320 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
321 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
322 /** |
213
115f6351bf4b
Update some documentation text
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
200
diff
changeset
|
323 * What is the string used to quote SQL identifiers? |
115f6351bf4b
Update some documentation text
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
200
diff
changeset
|
324 * This returns a space if identifier quoting isn't supported. |
231
68b9452f1215
Fix warnings:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
222
diff
changeset
|
325 * A JDBC Compliant <sup>TM</sup> driver |
213
115f6351bf4b
Update some documentation text
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
200
diff
changeset
|
326 * will always use a double quote character. |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
327 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
328 * @return the quoting string |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
329 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
330 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
331 public String getIdentifierQuoteString() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
332 return "\""; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
333 } |
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 /** |
730
ee061ab9ee32
Corrected DatabaseMetaData.getSQLKeywords() output.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
724
diff
changeset
|
336 * Retrieves a comma-separated list of all of this database's |
ee061ab9ee32
Corrected DatabaseMetaData.getSQLKeywords() output.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
724
diff
changeset
|
337 * SQL keywords that are NOT also SQL:2003 keywords. |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
338 * |
730
ee061ab9ee32
Corrected DatabaseMetaData.getSQLKeywords() output.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
724
diff
changeset
|
339 * @return a comma separated list of MonetDB keywords that are not also SQL:2003 keywords |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
340 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
341 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
342 public String getSQLKeywords() { |
767
1547843b3a9b
Removed code to support old MonetDB servers Oct2014 or older.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
761
diff
changeset
|
343 return getConcatenatedStringFromQuery( |
730
ee061ab9ee32
Corrected DatabaseMetaData.getSQLKeywords() output.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
724
diff
changeset
|
344 "SELECT \"keyword\" FROM \"sys\".\"keywords\" " + |
ee061ab9ee32
Corrected DatabaseMetaData.getSQLKeywords() output.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
724
diff
changeset
|
345 // exclude all SQL:2003 keywords |
ee061ab9ee32
Corrected DatabaseMetaData.getSQLKeywords() output.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
724
diff
changeset
|
346 "WHERE \"keyword\" NOT IN (" + |
ee061ab9ee32
Corrected DatabaseMetaData.getSQLKeywords() output.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
724
diff
changeset
|
347 "'ABS','ALL','ALLOCATE','ALTER','AND','ANY','ARE','ARRAY','AS'," + |
ee061ab9ee32
Corrected DatabaseMetaData.getSQLKeywords() output.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
724
diff
changeset
|
348 "'ASENSITIVE','ASYMMETRIC','AT','ATOMIC','AUTHORIZATION','AVG'," + |
ee061ab9ee32
Corrected DatabaseMetaData.getSQLKeywords() output.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
724
diff
changeset
|
349 "'BEGIN','BETWEEN','BIGINT','BINARY','BLOB','BOOLEAN','BOTH','BY'," + |
ee061ab9ee32
Corrected DatabaseMetaData.getSQLKeywords() output.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
724
diff
changeset
|
350 "'CALL','CALLED','CARDINALITY','CASCADED','CASE','CAST','CEIL','CEILING'," + |
ee061ab9ee32
Corrected DatabaseMetaData.getSQLKeywords() output.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
724
diff
changeset
|
351 "'CHAR','CHARACTER','CHARACTER_LENGTH','CHAR_LENGTH','CHECK','CLOB'," + |
ee061ab9ee32
Corrected DatabaseMetaData.getSQLKeywords() output.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
724
diff
changeset
|
352 "'CLOSE','COALESCE','COLLATE','COLLECT','COLUMN','COMMIT','CONDITION'," + |
ee061ab9ee32
Corrected DatabaseMetaData.getSQLKeywords() output.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
724
diff
changeset
|
353 "'CONNECT','CONSTRAINT','CONVERT','CORR','CORRESPONDING','COUNT'," + |
ee061ab9ee32
Corrected DatabaseMetaData.getSQLKeywords() output.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
724
diff
changeset
|
354 "'COVAR_POP','COVAR_SAMP','CREATE','CROSS','CUBE','CUME_DIST','CURRENT','CURRENT_DATE'," + |
ee061ab9ee32
Corrected DatabaseMetaData.getSQLKeywords() output.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
724
diff
changeset
|
355 "'CURRENT_DEFAULT_TRANSFORM_GROUP','CURRENT_PATH','CURRENT_ROLE','CURRENT_TIME'," + |
ee061ab9ee32
Corrected DatabaseMetaData.getSQLKeywords() output.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
724
diff
changeset
|
356 "'CURRENT_TIMESTAMP','CURRENT_TRANSFORM_GROUP_FOR_TYPE','CURRENT_USER','CURSOR','CYCLE'," + |
ee061ab9ee32
Corrected DatabaseMetaData.getSQLKeywords() output.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
724
diff
changeset
|
357 "'DATE','DAY','DEALLOCATE','DEC','DECIMAL','DECLARE','DEFAULT','DELETE','DENSE_RANK','DEREF'," + |
ee061ab9ee32
Corrected DatabaseMetaData.getSQLKeywords() output.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
724
diff
changeset
|
358 "'DESCRIBE','DETERMINISTIC','DISCONNECT','DISTINCT','DOUBLE','DROP','DYNAMIC'," + |
ee061ab9ee32
Corrected DatabaseMetaData.getSQLKeywords() output.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
724
diff
changeset
|
359 "'EACH','ELEMENT','ELSE','END','END-EXEC','ESCAPE','EVERY','EXCEPT','EXEC','EXECUTE','EXISTS','EXP','EXTERNAL','EXTRACT'," + |
ee061ab9ee32
Corrected DatabaseMetaData.getSQLKeywords() output.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
724
diff
changeset
|
360 "'FALSE','FETCH','FILTER','FLOAT','FLOOR','FOR','FOREIGN','FREE','FROM','FULL','FUNCTION','FUSION'," + |
ee061ab9ee32
Corrected DatabaseMetaData.getSQLKeywords() output.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
724
diff
changeset
|
361 "'GET','GLOBAL','GRANT','GROUP','GROUPING','HAVING','HOLD','HOUR'," + |
ee061ab9ee32
Corrected DatabaseMetaData.getSQLKeywords() output.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
724
diff
changeset
|
362 "'IDENTITY','IN','INDICATOR','INNER','INOUT','INSENSITIVE','INSERT'," + |
ee061ab9ee32
Corrected DatabaseMetaData.getSQLKeywords() output.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
724
diff
changeset
|
363 "'INT','INTEGER','INTERSECT','INTERSECTION','INTERVAL','INTO','IS','JOIN'," + |
ee061ab9ee32
Corrected DatabaseMetaData.getSQLKeywords() output.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
724
diff
changeset
|
364 "'LANGUAGE','LARGE','LATERAL','LEADING','LEFT','LIKE','LN','LOCAL','LOCALTIME','LOCALTIMESTAMP','LOWER'," + |
ee061ab9ee32
Corrected DatabaseMetaData.getSQLKeywords() output.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
724
diff
changeset
|
365 "'MATCH','MAX','MEMBER','MERGE','METHOD','MIN','MINUTE','MOD','MODIFIES','MODULE','MONTH','MULTISET'," + |
ee061ab9ee32
Corrected DatabaseMetaData.getSQLKeywords() output.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
724
diff
changeset
|
366 "'NATIONAL','NATURAL','NCHAR','NCLOB','NEW','NO','NONE','NORMALIZE','NOT','NULL','NULLIF','NUMERIC'," + |
ee061ab9ee32
Corrected DatabaseMetaData.getSQLKeywords() output.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
724
diff
changeset
|
367 "'OCTET_LENGTH','OF','OLD','ON','ONLY','OPEN','OR','ORDER','OUT','OUTER','OVER','OVERLAPS','OVERLAY'," + |
ee061ab9ee32
Corrected DatabaseMetaData.getSQLKeywords() output.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
724
diff
changeset
|
368 "'PARAMETER','PARTITION','PERCENTILE_CONT','PERCENTILE_DISC','PERCENT_RANK'," + |
ee061ab9ee32
Corrected DatabaseMetaData.getSQLKeywords() output.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
724
diff
changeset
|
369 "'POSITION','POWER','PRECISION','PREPARE','PRIMARY','PROCEDURE'," + |
ee061ab9ee32
Corrected DatabaseMetaData.getSQLKeywords() output.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
724
diff
changeset
|
370 "'RANGE','RANK','READS','REAL','RECURSIVE','REF','REFERENCES','REFERENCING'," + |
ee061ab9ee32
Corrected DatabaseMetaData.getSQLKeywords() output.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
724
diff
changeset
|
371 "'REGR_AVGX','REGR_AVGY','REGR_COUNT','REGR_INTERCEPT','REGR_R2','REGR_SLOPE','REGR_SXX','REGR_SXY','REGR_SYY'," + |
ee061ab9ee32
Corrected DatabaseMetaData.getSQLKeywords() output.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
724
diff
changeset
|
372 "'RELEASE','RESULT','RETURN','RETURNS','REVOKE','RIGHT','ROLLBACK','ROLLUP','ROW','ROWS','ROW_NUMBER'," + |
ee061ab9ee32
Corrected DatabaseMetaData.getSQLKeywords() output.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
724
diff
changeset
|
373 "'SAVEPOINT','SCOPE','SCROLL','SEARCH','SECOND','SELECT','SENSITIVE','SESSION_USER','SET'," + |
ee061ab9ee32
Corrected DatabaseMetaData.getSQLKeywords() output.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
724
diff
changeset
|
374 "'SIMILAR','SMALLINT','SOME','SPECIFIC','SPECIFICTYPE','SQL','SQLEXCEPTION','SQLSTATE','SQLWARNING'," + |
ee061ab9ee32
Corrected DatabaseMetaData.getSQLKeywords() output.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
724
diff
changeset
|
375 "'SQRT','START','STATIC','STDDEV_POP','STDDEV_SAMP','SUBMULTISET','SUBSTRING','SUM'," + |
ee061ab9ee32
Corrected DatabaseMetaData.getSQLKeywords() output.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
724
diff
changeset
|
376 "'SYMMETRIC','SYSTEM','SYSTEM_USER'," + |
ee061ab9ee32
Corrected DatabaseMetaData.getSQLKeywords() output.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
724
diff
changeset
|
377 "'TABLE','TABLESAMPLE','THEN','TIME','TIMESTAMP','TIMEZONE_HOUR','TIMEZONE_MINUTE'," + |
ee061ab9ee32
Corrected DatabaseMetaData.getSQLKeywords() output.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
724
diff
changeset
|
378 "'TO','TRAILING','TRANSLATE','TRANSLATION','TREAT','TRIGGER','TRIM','TRUE'," + |
ee061ab9ee32
Corrected DatabaseMetaData.getSQLKeywords() output.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
724
diff
changeset
|
379 "'UESCAPE','UNION','UNIQUE','UNKNOWN','UNNEST','UPDATE','UPPER','USER','USING'," + |
ee061ab9ee32
Corrected DatabaseMetaData.getSQLKeywords() output.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
724
diff
changeset
|
380 "'VALUE','VALUES','VARCHAR','VARYING','VAR_POP','VAR_SAMP'," + |
ee061ab9ee32
Corrected DatabaseMetaData.getSQLKeywords() output.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
724
diff
changeset
|
381 "'WHEN','WHENEVER','WHERE','WIDTH_BUCKET','WINDOW','WITH','WITHIN','WITHOUT','YEAR'" + |
ee061ab9ee32
Corrected DatabaseMetaData.getSQLKeywords() output.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
724
diff
changeset
|
382 ") ORDER BY 1"); |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
383 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
384 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
385 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
386 * Internal utility method getConcatenatedStringFromQuery(String query) |
626
06d69b82d409
Resolve javadoc error and warnings :
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
619
diff
changeset
|
387 * @param query the SQL SELECT query. Only the output of the first column is fetched and concatenated. |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
388 * @return a String of query result values concatenated into one string, and values separated by comma's |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
389 */ |
295
003ae6d881db
Add "final" keyword to method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
294
diff
changeset
|
390 private String getConcatenatedStringFromQuery(final String query) { |
755
99ff3cd9f4f0
Corrected DatabaseMetaData method getStringFunctions() when connected to a Jun2023 server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
736
diff
changeset
|
391 final StringBuilder sb = new StringBuilder(1200); |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
392 Statement st = null; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
393 ResultSet rs = null; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
394 try { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
395 st = con.createStatement(); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
396 rs = st.executeQuery(query); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
397 // Fetch the first column output and concatenate the values into a StringBuilder separated by comma's |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
398 boolean isfirst = true; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
399 while (rs.next()) { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
400 String value = rs.getString(1); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
401 if (value != null) { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
402 if (isfirst) { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
403 isfirst = false; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
404 } else { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
405 sb.append(','); |
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 sb.append(value); |
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 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
410 } catch (SQLException e) { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
411 /* ignore */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
412 } finally { |
300
8cc3b51d1984
Add a utility method to close objects ignoring any possible SQLExceptions thrown.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
299
diff
changeset
|
413 MonetConnection.closeResultsetStatement(rs, st); |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
414 } |
755
99ff3cd9f4f0
Corrected DatabaseMetaData method getStringFunctions() when connected to a Jun2023 server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
736
diff
changeset
|
415 // for debug: System.out.println("SQL (len " + query.length() + "): " + query + "\nResult string(len " + sb.length() + "): " + sb.toString()); |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
416 return sb.toString(); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
417 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
418 |
19
7acc09f59b21
Added missing scalar functions sql_max and sql_min to the lists returned by getNumericFunctions(), getStringFunctions() and getTimeDateFunctions().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
15
diff
changeset
|
419 // SQL query parts shared by four get<Type>Functions() below |
734
e0caafa2d814
Extend getSystemFunctions() to also report system functions database() and ifnull() if they exist in sys.functions and can be called without odbc escape sequences.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
733
diff
changeset
|
420 private static final String FunctionsSelect = "SELECT DISTINCT CASE WHEN f.\"language\" > 0 THEN s.\"name\"||'.'||f.\"name\" ELSE f.\"name\" END" + |
e0caafa2d814
Extend getSystemFunctions() to also report system functions database() and ifnull() if they exist in sys.functions and can be called without odbc escape sequences.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
733
diff
changeset
|
421 " FROM \"sys\".\"functions\" f JOIN \"sys\".\"schemas\" s ON f.\"schema_id\" = s.\"id\" WHERE "; |
298
6db8f6702ce8
Improved MonetDatabaseMetaData methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
295
diff
changeset
|
422 private static final String FunctionsWhere = "(f.\"id\" IN (SELECT \"func_id\" FROM \"sys\".\"args\" WHERE \"number\" = 1 AND \"name\" = 'arg_1' AND \"type\" IN "; |
263
8fbed4aeff0e
Improved MonetDatabaseMetaData methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
261
diff
changeset
|
423 // Scalar functions sql_max(x,y), sql_min(x,y), greatest(x,y) and least(x,y) are defined in sys.args for type 'any' and usable as num, str and timedate functions. |
298
6db8f6702ce8
Improved MonetDatabaseMetaData methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
295
diff
changeset
|
424 private static final String OrFunctionsMaxMin = " OR f.\"name\" IN ('sql_max','sql_min','least','greatest')"; |
186
4767b005a531
Making variables private where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
177
diff
changeset
|
425 private static final String FunctionsOrderBy1 = " ORDER BY 1"; |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
426 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
427 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
428 public String getNumericFunctions() { |
295
003ae6d881db
Add "final" keyword to method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
294
diff
changeset
|
429 final String match = |
298
6db8f6702ce8
Improved MonetDatabaseMetaData methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
295
diff
changeset
|
430 "('tinyint','smallint','int','bigint','hugeint','decimal','double','real'))" + |
338
98018e38994b
Correct getNumericFunctions() which incorrectly returned functions 'code' and 'space' as numeric functions.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
332
diff
changeset
|
431 " AND \"type\" = 1" + // only scalar functions |
98018e38994b
Correct getNumericFunctions() which incorrectly returned functions 'code' and 'space' as numeric functions.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
332
diff
changeset
|
432 // exclude functions which do not work or belong to string functions (code(int) and space(int)) |
98018e38994b
Correct getNumericFunctions() which incorrectly returned functions 'code' and 'space' as numeric functions.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
332
diff
changeset
|
433 " AND f.\"name\" NOT IN ('code','not_uniques','rotate_xor_hash','space'))" + |
365
63cccacad468
Add sys.ms_stuff() to returned list of StringFunctions.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
363
diff
changeset
|
434 // include specific functions which have no arguments (pi()) or are numeric. Actually ms_str is a conversion function from float to str. |
298
6db8f6702ce8
Improved MonetDatabaseMetaData methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
295
diff
changeset
|
435 " OR f.\"name\" IN ('alpha','degrees','fuse','ms_round','ms_str','ms_trunc','pi','radians')"; |
263
8fbed4aeff0e
Improved MonetDatabaseMetaData methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
261
diff
changeset
|
436 return getConcatenatedStringFromQuery(FunctionsSelect + FunctionsWhere + match + OrFunctionsMaxMin + FunctionsOrderBy1); |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
437 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
438 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
439 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
440 public String getStringFunctions() { |
295
003ae6d881db
Add "final" keyword to method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
294
diff
changeset
|
441 final String match = |
298
6db8f6702ce8
Improved MonetDatabaseMetaData methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
295
diff
changeset
|
442 "('char','varchar','clob','json','url'))" + |
6db8f6702ce8
Improved MonetDatabaseMetaData methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
295
diff
changeset
|
443 " AND \"type\" = 1" + // only scalar functions |
6db8f6702ce8
Improved MonetDatabaseMetaData methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
295
diff
changeset
|
444 // exclude sql functions: get_value_for, next_value_for, restart |
6db8f6702ce8
Improved MonetDatabaseMetaData methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
295
diff
changeset
|
445 " AND \"mod\" <> 'sql')" + |
6db8f6702ce8
Improved MonetDatabaseMetaData methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
295
diff
changeset
|
446 // include specific functions code(int) and space(int) which belong to the 'str' module |
755
99ff3cd9f4f0
Corrected DatabaseMetaData method getStringFunctions() when connected to a Jun2023 server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
736
diff
changeset
|
447 // include functions (difference, editdistance, editdistance2, levenshtein, qgramnormalize, similarity, soundex) which since Jun2023 are in the 'txtsim' module |
99ff3cd9f4f0
Corrected DatabaseMetaData method getStringFunctions() when connected to a Jun2023 server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
736
diff
changeset
|
448 " OR (\"mod\" IN ('str','txtsim') AND \"type\" = 1)" + |
99ff3cd9f4f0
Corrected DatabaseMetaData method getStringFunctions() when connected to a Jun2023 server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
736
diff
changeset
|
449 // include 3 specific json functions and md5(), ms_stuff() and udf reverse() which all accept a string arg |
365
63cccacad468
Add sys.ms_stuff() to returned list of StringFunctions.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
363
diff
changeset
|
450 " OR f.\"name\" IN ('isarray','isobject','isvalid','md5','ms_stuff','reverse')"; |
295
003ae6d881db
Add "final" keyword to method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
294
diff
changeset
|
451 final String unionPart = |
298
6db8f6702ce8
Improved MonetDatabaseMetaData methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
295
diff
changeset
|
452 // add functions which are not listed in sys.functions but implemented in the SQL parser (see sql/server/sql_parser.y) |
268
ee4c826e3933
Extended method getNumericFunctions() by also returning functions: degrees, fuse, ms_round, ms_str, ms_trunc and radians.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
267
diff
changeset
|
453 " UNION SELECT 'position'"; |
ee4c826e3933
Extended method getNumericFunctions() by also returning functions: degrees, fuse, ms_round, ms_str, ms_trunc and radians.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
267
diff
changeset
|
454 return getConcatenatedStringFromQuery(FunctionsSelect + FunctionsWhere + match + OrFunctionsMaxMin + unionPart + FunctionsOrderBy1); |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
455 } |
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 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
458 public String getSystemFunctions() { |
295
003ae6d881db
Add "final" keyword to method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
294
diff
changeset
|
459 final String wherePart = |
781
71d32f1a4d60
Improved DatabaseMetaData.getSystemFunctions(). It now also returns functions: current_sessionid, greatest, ifnull, least, sql_max, sql_min. Function ifnull will only be returned for servers Jun2023 (11.47 or higher).
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
767
diff
changeset
|
460 "f.\"name\" IN ('columnsize','current_sessionid','database','debug'" + |
71d32f1a4d60
Improved DatabaseMetaData.getSystemFunctions(). It now also returns functions: current_sessionid, greatest, ifnull, least, sql_max, sql_min. Function ifnull will only be returned for servers Jun2023 (11.47 or higher).
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
767
diff
changeset
|
461 ",'get_value_for','greatest','hash','hashsize','heapsize'" + |
71d32f1a4d60
Improved DatabaseMetaData.getSystemFunctions(). It now also returns functions: current_sessionid, greatest, ifnull, least, sql_max, sql_min. Function ifnull will only be returned for servers Jun2023 (11.47 or higher).
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
767
diff
changeset
|
462 ",'ifthenelse','imprintsize','isaurl','isauuid','isnull','least'" + |
71d32f1a4d60
Improved DatabaseMetaData.getSystemFunctions(). It now also returns functions: current_sessionid, greatest, ifnull, least, sql_max, sql_min. Function ifnull will only be returned for servers Jun2023 (11.47 or higher).
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
767
diff
changeset
|
463 ",'masterclock','mastertick'" + // wlc/wlr functions |
71d32f1a4d60
Improved DatabaseMetaData.getSystemFunctions(). It now also returns functions: current_sessionid, greatest, ifnull, least, sql_max, sql_min. Function ifnull will only be returned for servers Jun2023 (11.47 or higher).
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
767
diff
changeset
|
464 ",'newurl','next_value_for','password_hash'" + |
71d32f1a4d60
Improved DatabaseMetaData.getSystemFunctions(). It now also returns functions: current_sessionid, greatest, ifnull, least, sql_max, sql_min. Function ifnull will only be returned for servers Jun2023 (11.47 or higher).
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
767
diff
changeset
|
465 ",'replicaclock','replicatick'" + // wlc/wlr functions |
71d32f1a4d60
Improved DatabaseMetaData.getSystemFunctions(). It now also returns functions: current_sessionid, greatest, ifnull, least, sql_max, sql_min. Function ifnull will only be returned for servers Jun2023 (11.47 or higher).
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
767
diff
changeset
|
466 ",'sql_max','sql_min','uuid')"; |
71d32f1a4d60
Improved DatabaseMetaData.getSystemFunctions(). It now also returns functions: current_sessionid, greatest, ifnull, least, sql_max, sql_min. Function ifnull will only be returned for servers Jun2023 (11.47 or higher).
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
767
diff
changeset
|
467 String unionPart = |
298
6db8f6702ce8
Improved MonetDatabaseMetaData methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
295
diff
changeset
|
468 // add functions which are not listed in sys.functions but implemented in the SQL parser (see sql/server/sql_parser.y) |
781
71d32f1a4d60
Improved DatabaseMetaData.getSystemFunctions(). It now also returns functions: current_sessionid, greatest, ifnull, least, sql_max, sql_min. Function ifnull will only be returned for servers Jun2023 (11.47 or higher).
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
767
diff
changeset
|
469 " UNION SELECT * FROM (VALUES('cast'),('coalesce'),('convert'),('ifnull'),('nullif')) as sf"; |
71d32f1a4d60
Improved DatabaseMetaData.getSystemFunctions(). It now also returns functions: current_sessionid, greatest, ifnull, least, sql_max, sql_min. Function ifnull will only be returned for servers Jun2023 (11.47 or higher).
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
767
diff
changeset
|
470 try { |
71d32f1a4d60
Improved DatabaseMetaData.getSystemFunctions(). It now also returns functions: current_sessionid, greatest, ifnull, least, sql_max, sql_min. Function ifnull will only be returned for servers Jun2023 (11.47 or higher).
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
767
diff
changeset
|
471 // from release 11.47.1 we support function: ifnull, but only with odbc escape notation, so {fn ifnull(null, 2)}. See issue: 6933. |
71d32f1a4d60
Improved DatabaseMetaData.getSystemFunctions(). It now also returns functions: current_sessionid, greatest, ifnull, least, sql_max, sql_min. Function ifnull will only be returned for servers Jun2023 (11.47 or higher).
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
767
diff
changeset
|
472 // from release 11.49.1 we support function: ifnull also without odbc escape notation. |
71d32f1a4d60
Improved DatabaseMetaData.getSystemFunctions(). It now also returns functions: current_sessionid, greatest, ifnull, least, sql_max, sql_min. Function ifnull will only be returned for servers Jun2023 (11.47 or higher).
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
767
diff
changeset
|
473 if ((con.getDatabaseMajorVersion() == 11) && (con.getDatabaseMinorVersion() <= 45)) |
71d32f1a4d60
Improved DatabaseMetaData.getSystemFunctions(). It now also returns functions: current_sessionid, greatest, ifnull, least, sql_max, sql_min. Function ifnull will only be returned for servers Jun2023 (11.47 or higher).
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
767
diff
changeset
|
474 // release 11.45 (Sep2022) or older did not support function: ifnull. |
71d32f1a4d60
Improved DatabaseMetaData.getSystemFunctions(). It now also returns functions: current_sessionid, greatest, ifnull, least, sql_max, sql_min. Function ifnull will only be returned for servers Jun2023 (11.47 or higher).
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
767
diff
changeset
|
475 unionPart = unionPart.replace(",('ifnull')", ""); |
71d32f1a4d60
Improved DatabaseMetaData.getSystemFunctions(). It now also returns functions: current_sessionid, greatest, ifnull, least, sql_max, sql_min. Function ifnull will only be returned for servers Jun2023 (11.47 or higher).
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
767
diff
changeset
|
476 } catch (SQLException e) { /* ignore */ } |
71d32f1a4d60
Improved DatabaseMetaData.getSystemFunctions(). It now also returns functions: current_sessionid, greatest, ifnull, least, sql_max, sql_min. Function ifnull will only be returned for servers Jun2023 (11.47 or higher).
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
767
diff
changeset
|
477 return getConcatenatedStringFromQuery(FunctionsSelect + wherePart + unionPart + FunctionsOrderBy1); |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
478 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
479 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
480 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
481 public String getTimeDateFunctions() { |
295
003ae6d881db
Add "final" keyword to method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
294
diff
changeset
|
482 final String wherePart = |
298
6db8f6702ce8
Improved MonetDatabaseMetaData methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
295
diff
changeset
|
483 "\"mod\" IN ('mtime','timestamp')" + |
6db8f6702ce8
Improved MonetDatabaseMetaData methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
295
diff
changeset
|
484 // include Date/Time functions which are located in 'str' module |
6db8f6702ce8
Improved MonetDatabaseMetaData methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
295
diff
changeset
|
485 " OR f.\"name\" IN ('localtime','localtimestamp','date_trunc')"; |
295
003ae6d881db
Add "final" keyword to method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
294
diff
changeset
|
486 final String unionPart = |
263
8fbed4aeff0e
Improved MonetDatabaseMetaData methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
261
diff
changeset
|
487 // add time date functions which are not listed in sys.functions but implemented in the SQL parser (see sql/server/sql_parser.y) |
8fbed4aeff0e
Improved MonetDatabaseMetaData methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
261
diff
changeset
|
488 " UNION SELECT 'extract'" + |
8fbed4aeff0e
Improved MonetDatabaseMetaData methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
261
diff
changeset
|
489 " UNION SELECT 'now'"; |
734
e0caafa2d814
Extend getSystemFunctions() to also report system functions database() and ifnull() if they exist in sys.functions and can be called without odbc escape sequences.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
733
diff
changeset
|
490 // ToDo: from release 11.47.1 we also support functions: dayname and monthname, but only with odbc escape notation, so {fn dayname(current_date)}. Related issue: 7300. |
263
8fbed4aeff0e
Improved MonetDatabaseMetaData methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
261
diff
changeset
|
491 return getConcatenatedStringFromQuery(FunctionsSelect + wherePart + OrFunctionsMaxMin + unionPart + FunctionsOrderBy1); |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
492 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
493 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
494 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
495 * This is the string that can be used to escape '_' and '%' in |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
496 * a search string pattern style catalog search parameters |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
497 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
498 * @return the string used to escape wildcard characters |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
499 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
500 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
501 public String getSearchStringEscape() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
502 return "\\"; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
503 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
504 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
505 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
506 * Get all the "extra" characters that can be used in unquoted |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
507 * identifier names (those beyond a-zA-Z0-9 and _) |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
508 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
509 * @return a string containing the extra characters |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
510 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
511 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
512 public String getExtraNameCharacters() { |
194
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
513 // MonetDB has no extra characters. Verified it for chars: !@#$%^&*()~{}[]? |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
514 return ""; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
515 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
516 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
517 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
518 * Is "ALTER TABLE" with an add column supported? |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
519 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
520 * @return true if so |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
521 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
522 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
523 public boolean supportsAlterTableWithAddColumn() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
524 return true; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
525 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
526 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
527 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
528 * Is "ALTER TABLE" with a drop column supported? |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
529 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
530 * @return true if so |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
531 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
532 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
533 public boolean supportsAlterTableWithDropColumn() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
534 return true; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
535 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
536 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
537 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
538 * Is column aliasing supported? |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
539 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
540 * <p>If so, the SQL AS clause can be used to provide names for |
213
115f6351bf4b
Update some documentation text
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
200
diff
changeset
|
541 * computed columns or to provide alias names for columns as required. |
231
68b9452f1215
Fix warnings:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
222
diff
changeset
|
542 * A JDBC Compliant <sup>TM</sup> driver always returns true. |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
543 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
544 * <p>e.g. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
545 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
546 * <br><pre> |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
547 * select count(C) as C_COUNT from T group by C; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
548 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
549 * </pre><br> |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
550 * should return a column named as C_COUNT instead of count(C) |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
551 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
552 * @return true if so |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
553 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
554 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
555 public boolean supportsColumnAliasing() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
556 return true; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
557 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
558 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
559 /** |
213
115f6351bf4b
Update some documentation text
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
200
diff
changeset
|
560 * Are concatenations between NULL and non-NULL values NULL? |
231
68b9452f1215
Fix warnings:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
222
diff
changeset
|
561 * A JDBC Compliant <sup>TM</sup> driver always returns true. |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
562 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
563 * @return true if so |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
564 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
565 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
566 public boolean nullPlusNonNullIsNull() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
567 return true; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
568 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
569 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
570 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
571 * Retrieves whether this database supports the JDBC scalar function |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
572 * CONVERT for the conversion of one JDBC type to another. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
573 * The JDBC types are the generic SQL data types defined in java.sql.Types. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
574 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
575 * @return true if so; false otherwise |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
576 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
577 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
578 public boolean supportsConvert() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
579 return true; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
580 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
581 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
582 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
583 * Retrieves whether this database supports the JDBC scalar function |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
584 * CONVERT for conversions between the JDBC types fromType and toType. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
585 * The JDBC types are the generic SQL data types defined in java.sql.Types. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
586 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
587 * @return true if so; false otherwise |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
588 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
589 @Override |
295
003ae6d881db
Add "final" keyword to method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
294
diff
changeset
|
590 public boolean supportsConvert(final int fromType, final int toType) { |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
591 switch (fromType) { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
592 case Types.BOOLEAN: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
593 switch (toType) { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
594 case Types.BOOLEAN: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
595 /* case Types.BIT: is not supported by MonetDB and will fail */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
596 case Types.TINYINT: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
597 case Types.SMALLINT: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
598 case Types.INTEGER: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
599 case Types.BIGINT: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
600 /* conversion to FLOAT, REAL, DOUBLE, NUMERIC and DECIMAL is not supported by MonetDB */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
601 case Types.CHAR: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
602 case Types.VARCHAR: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
603 /* case Types.LONGVARCHAR: is not supported by MonetDB and will fail */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
604 case Types.CLOB: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
605 return true; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
606 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
607 // conversion to all other types is not supported |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
608 return false; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
609 /* case Types.BIT: is not supported by MonetDB and will fail */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
610 /* case Types.BINARY: is not supported by MonetDB and will fail */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
611 /* case Types.VARBINARY: is not supported by MonetDB and will fail */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
612 /* case Types.LONGVARBINARY: is not supported by MonetDB and will fail */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
613 case Types.BLOB: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
614 switch (toType) { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
615 /* case Types.BINARY: is not supported by MonetDB and will fail */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
616 /* case Types.VARBINARY: is not supported by MonetDB and will fail */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
617 /* case Types.LONGVARBINARY: is not supported by MonetDB and will fail */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
618 case Types.BLOB: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
619 case Types.VARCHAR: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
620 /* case Types.LONGVARCHAR: is not supported by MonetDB and will fail */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
621 case Types.CLOB: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
622 return true; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
623 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
624 // conversion to all other types is not supported |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
625 return false; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
626 case Types.TINYINT: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
627 case Types.SMALLINT: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
628 case Types.INTEGER: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
629 case Types.BIGINT: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
630 case Types.FLOAT: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
631 case Types.REAL: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
632 case Types.DOUBLE: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
633 case Types.NUMERIC: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
634 case Types.DECIMAL: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
635 switch (toType) { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
636 case Types.BOOLEAN: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
637 /* case Types.BIT: is not supported by MonetDB and will fail */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
638 case Types.TINYINT: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
639 case Types.SMALLINT: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
640 case Types.INTEGER: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
641 case Types.BIGINT: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
642 case Types.FLOAT: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
643 case Types.REAL: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
644 case Types.DOUBLE: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
645 case Types.NUMERIC: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
646 case Types.DECIMAL: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
647 case Types.CHAR: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
648 case Types.VARCHAR: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
649 /* case Types.LONGVARCHAR: is not supported by MonetDB and will fail */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
650 case Types.CLOB: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
651 return true; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
652 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
653 // conversion to all other types is not supported |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
654 return false; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
655 case Types.CHAR: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
656 case Types.VARCHAR: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
657 /* case Types.LONGVARCHAR: is not supported by MonetDB and will fail */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
658 case Types.CLOB: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
659 switch (toType) { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
660 case Types.BOOLEAN: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
661 /* case Types.BIT: is not supported by MonetDB and will fail */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
662 case Types.TINYINT: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
663 case Types.SMALLINT: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
664 case Types.INTEGER: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
665 case Types.BIGINT: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
666 case Types.FLOAT: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
667 case Types.REAL: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
668 case Types.DOUBLE: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
669 case Types.NUMERIC: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
670 case Types.DECIMAL: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
671 case Types.CHAR: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
672 case Types.VARCHAR: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
673 /* case Types.LONGVARCHAR: is not supported by MonetDB and will fail */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
674 case Types.CLOB: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
675 case Types.BLOB: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
676 case Types.DATE: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
677 case Types.TIME: |
380
bf521f343172
Added support 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:
379
diff
changeset
|
678 case Types.TIME_WITH_TIMEZONE: |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
679 case Types.TIMESTAMP: |
380
bf521f343172
Added support 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:
379
diff
changeset
|
680 case Types.TIMESTAMP_WITH_TIMEZONE: |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
681 return true; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
682 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
683 // conversion to all other types is not supported |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
684 return false; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
685 case Types.DATE: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
686 switch (toType) { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
687 case Types.CHAR: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
688 case Types.VARCHAR: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
689 /* case Types.LONGVARCHAR: is not supported by MonetDB and will fail */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
690 case Types.CLOB: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
691 case Types.DATE: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
692 case Types.TIMESTAMP: |
380
bf521f343172
Added support 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:
379
diff
changeset
|
693 case Types.TIMESTAMP_WITH_TIMEZONE: |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
694 return true; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
695 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
696 // conversion to all other types is not supported |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
697 return false; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
698 case Types.TIME: |
380
bf521f343172
Added support 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:
379
diff
changeset
|
699 case Types.TIME_WITH_TIMEZONE: |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
700 switch (toType) { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
701 case Types.CHAR: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
702 case Types.VARCHAR: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
703 /* case Types.LONGVARCHAR: is not supported by MonetDB and will fail */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
704 case Types.CLOB: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
705 case Types.TIME: |
380
bf521f343172
Added support 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:
379
diff
changeset
|
706 case Types.TIME_WITH_TIMEZONE: |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
707 return true; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
708 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
709 // conversion to all other types is not supported |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
710 return false; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
711 case Types.TIMESTAMP: |
380
bf521f343172
Added support 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:
379
diff
changeset
|
712 case Types.TIMESTAMP_WITH_TIMEZONE: |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
713 switch (toType) { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
714 case Types.CHAR: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
715 case Types.VARCHAR: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
716 /* case Types.LONGVARCHAR: is not supported by MonetDB and will fail */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
717 case Types.CLOB: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
718 case Types.DATE: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
719 case Types.TIME: |
380
bf521f343172
Added support 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:
379
diff
changeset
|
720 case Types.TIME_WITH_TIMEZONE: |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
721 case Types.TIMESTAMP: |
380
bf521f343172
Added support 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:
379
diff
changeset
|
722 case Types.TIMESTAMP_WITH_TIMEZONE: |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
723 return true; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
724 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
725 // conversion to all other types is not supported |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
726 return false; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
727 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
728 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
729 // conversion from all other JDBC SQL types are not supported |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
730 return false; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
731 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
732 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
733 /** |
213
115f6351bf4b
Update some documentation text
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
200
diff
changeset
|
734 * Are table correlation names supported? |
231
68b9452f1215
Fix warnings:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
222
diff
changeset
|
735 * A JDBC Compliant <sup>TM</sup> driver always returns true. |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
736 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
737 * @return true if so |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
738 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
739 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
740 public boolean supportsTableCorrelationNames() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
741 return true; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
742 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
743 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
744 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
745 * If table correlation names are supported, are they restricted to |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
746 * be different from the names of the tables? |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
747 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
748 * @return true if so; false otherwise |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
749 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
750 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
751 public boolean supportsDifferentTableCorrelationNames() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
752 return false; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
753 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
754 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
755 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
756 * Are expressions in "ORDER BY" lists supported? |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
757 * e.g. select * from t order by a + b; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
758 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
759 * MonetDB supports this, try: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
760 * select (radix * 1000) + digits as comp, * from types order by (radix * 1000) + digits, -id; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
761 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
762 * @return true if so |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
763 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
764 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
765 public boolean supportsExpressionsInOrderBy() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
766 return true; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
767 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
768 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
769 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
770 * Can an "ORDER BY" clause use columns not in the SELECT? |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
771 * MonetDB differs from SQL03 => true |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
772 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
773 * @return true if so |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
774 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
775 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
776 public boolean supportsOrderByUnrelated() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
777 return true; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
778 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
779 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
780 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
781 * Is some form of "GROUP BY" clause supported? |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
782 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
783 * @return true since MonetDB supports it |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
784 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
785 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
786 public boolean supportsGroupBy() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
787 return true; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
788 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
789 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
790 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
791 * Can a "GROUP BY" clause use columns not in the SELECT? |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
792 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
793 * @return true since that also is supported |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
794 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
795 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
796 public boolean supportsGroupByUnrelated() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
797 return true; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
798 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
799 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
800 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
801 * Can a "GROUP BY" clause add columns not in the SELECT provided |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
802 * it specifies all the columns in the SELECT? |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
803 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
804 * (MonetDB already supports the more difficult supportsGroupByUnrelated(), |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
805 * so this is a piece of cake) |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
806 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
807 * @return true if so |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
808 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
809 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
810 public boolean supportsGroupByBeyondSelect() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
811 return true; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
812 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
813 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
814 /** |
213
115f6351bf4b
Update some documentation text
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
200
diff
changeset
|
815 * Is the escape character in "LIKE" clauses supported? |
231
68b9452f1215
Fix warnings:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
222
diff
changeset
|
816 * A JDBC Compliant <sup>TM</sup> driver always returns true. |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
817 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
818 * @return true if so |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
819 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
820 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
821 public boolean supportsLikeEscapeClause() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
822 return true; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
823 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
824 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
825 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
826 * Are multiple ResultSets from a single execute supported? |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
827 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
828 * @return true if so |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
829 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
830 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
831 public boolean supportsMultipleResultSets() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
832 return true; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
833 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
834 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
835 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
836 * Can we have multiple transactions open at once (on different |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
837 * connections?) |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
838 * This is the main idea behind the Connection, is it? |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
839 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
840 * @return true if so |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
841 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
842 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
843 public boolean supportsMultipleTransactions() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
844 return true; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
845 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
846 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
847 /** |
213
115f6351bf4b
Update some documentation text
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
200
diff
changeset
|
848 * Can columns be defined as non-nullable. |
231
68b9452f1215
Fix warnings:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
222
diff
changeset
|
849 * A JDBC Compliant <sup>TM</sup> driver always returns true. |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
850 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
851 * @return true if so |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
852 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
853 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
854 public boolean supportsNonNullableColumns() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
855 return true; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
856 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
857 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
858 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
859 * Does this driver support the minimum ODBC SQL grammar. This |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
860 * grammar is defined at: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
861 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
862 * http://msdn.microsoft.com/library/default.asp?url=/library/en-us/odbc/htm/odappcpr.asp |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
863 * From this description, we seem to support the ODBC minimal (Level 0) grammar. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
864 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
865 * @return true if so |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
866 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
867 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
868 public boolean supportsMinimumSQLGrammar() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
869 return true; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
870 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
871 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
872 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
873 * Does this driver support the Core ODBC SQL grammar. We need |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
874 * SQL-92 conformance for this. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
875 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
876 * @return true if so |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
877 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
878 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
879 public boolean supportsCoreSQLGrammar() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
880 return true; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
881 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
882 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
883 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
884 * Does this driver support the Extended (Level 2) ODBC SQL |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
885 * grammar. We don't conform to the Core (Level 1), so we can't |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
886 * conform to the Extended SQL Grammar. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
887 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
888 * @return true if so |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
889 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
890 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
891 public boolean supportsExtendedSQLGrammar() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
892 return false; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
893 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
894 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
895 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
896 * Does this driver support the ANSI-92 entry level SQL grammar? |
231
68b9452f1215
Fix warnings:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
222
diff
changeset
|
897 * All JDBC Compliant <sup>TM</sup> drivers must return true. |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
898 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
899 * @return true if so |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
900 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
901 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
902 public boolean supportsANSI92EntryLevelSQL() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
903 return true; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
904 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
905 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
906 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
907 * Does this driver support the ANSI-92 intermediate level SQL |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
908 * grammar? |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
909 * probably not |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
910 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
911 * @return true if so |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
912 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
913 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
914 public boolean supportsANSI92IntermediateSQL() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
915 return false; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
916 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
917 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
918 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
919 * Does this driver support the ANSI-92 full SQL grammar? |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
920 * Would be good if it was like that |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
921 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
922 * @return true if so |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
923 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
924 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
925 public boolean supportsANSI92FullSQL() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
926 return false; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
927 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
928 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
929 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
930 * Is the SQL Integrity Enhancement Facility supported? |
267
43ea6c50483e
Correct return value for supportsIntegrityEnhancementFacility()
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
265
diff
changeset
|
931 * |
43ea6c50483e
Correct return value for supportsIntegrityEnhancementFacility()
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
265
diff
changeset
|
932 * The SQL Integrity Enhancement facility offers additional tools for referential integrity, |
43ea6c50483e
Correct return value for supportsIntegrityEnhancementFacility()
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
265
diff
changeset
|
933 * CHECK constraint clauses, and DEFAULT clauses. Referential integrity allows specification of |
43ea6c50483e
Correct return value for supportsIntegrityEnhancementFacility()
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
265
diff
changeset
|
934 * primary and foreign keys with the requirement that no foreign key row may be inserted or |
43ea6c50483e
Correct return value for supportsIntegrityEnhancementFacility()
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
265
diff
changeset
|
935 * updated unless a matching primary key row exists. Check clauses allow specification of |
43ea6c50483e
Correct return value for supportsIntegrityEnhancementFacility()
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
265
diff
changeset
|
936 * inter-column constraints to be maintained by the database system. |
302
1b6c514106ce
Added table aliases and use them in all meta data SQL queries to reduce query size.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
300
diff
changeset
|
937 * Default clauses provide optional default values for missing data. |
267
43ea6c50483e
Correct return value for supportsIntegrityEnhancementFacility()
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
265
diff
changeset
|
938 * |
43ea6c50483e
Correct return value for supportsIntegrityEnhancementFacility()
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
265
diff
changeset
|
939 * We currently do not supprt CHECK constraints (see bug 3568) nor deferrable FK constraints. |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
940 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
941 * @return true if so |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
942 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
943 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
944 public boolean supportsIntegrityEnhancementFacility() { |
267
43ea6c50483e
Correct return value for supportsIntegrityEnhancementFacility()
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
265
diff
changeset
|
945 return false; |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
946 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
947 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
948 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
949 * Is some form of outer join supported? |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
950 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
951 * @return true if so |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
952 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
953 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
954 public boolean supportsOuterJoins(){ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
955 return true; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
956 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
957 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
958 /** |
15
6e48d0fae766
Corrected return values of DatabaseMetaData methods nullsAreSortedHigh(), nullsAreSortedLow(),
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
7
diff
changeset
|
959 * Are full nested outer joins supported? |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
960 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
961 * @return true if so |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
962 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
963 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
964 public boolean supportsFullOuterJoins() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
965 return true; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
966 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
967 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
968 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
969 * Is there limited support for outer joins? |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
970 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
971 * @return true if so |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
972 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
973 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
974 public boolean supportsLimitedOuterJoins() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
975 return false; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
976 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
977 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
978 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
979 * What is the database vendor's preferred term for "schema"? |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
980 * MonetDB uses the term "schema". |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
981 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
982 * @return the vendor term |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
983 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
984 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
985 public String getSchemaTerm() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
986 return "schema"; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
987 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
988 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
989 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
990 * What is the database vendor's preferred term for "procedure"? |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
991 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
992 * @return the vendor term |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
993 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
994 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
995 public String getProcedureTerm() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
996 return "procedure"; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
997 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
998 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
999 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1000 * What is the database vendor's preferred term for "catalog"? |
356
eabbc5bf7cdb
Corrected the return value of getCatalogTerm();
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
352
diff
changeset
|
1001 * |
eabbc5bf7cdb
Corrected the return value of getCatalogTerm();
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
352
diff
changeset
|
1002 * MonetDB doesn't support the SQL catalog naming concept. |
eabbc5bf7cdb
Corrected the return value of getCatalogTerm();
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
352
diff
changeset
|
1003 * Only SQL schemas are supported. |
eabbc5bf7cdb
Corrected the return value of getCatalogTerm();
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
352
diff
changeset
|
1004 * We also do not allow the name of a database to be included in |
eabbc5bf7cdb
Corrected the return value of getCatalogTerm();
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
352
diff
changeset
|
1005 * a fully qualified name, so we shouldn't return "database" here. |
eabbc5bf7cdb
Corrected the return value of getCatalogTerm();
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
352
diff
changeset
|
1006 * A database is a different concept than an SQL catalog. |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1007 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1008 * @return the vendor term |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1009 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1010 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1011 public String getCatalogTerm() { |
356
eabbc5bf7cdb
Corrected the return value of getCatalogTerm();
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
352
diff
changeset
|
1012 // MonetDB does NOT support catalogs, so also no catalog term |
eabbc5bf7cdb
Corrected the return value of getCatalogTerm();
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
352
diff
changeset
|
1013 // Some generic SQL clients (e.g. DbVisualiser) use this string in their GUI |
eabbc5bf7cdb
Corrected the return value of getCatalogTerm();
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
352
diff
changeset
|
1014 // To avoid NPE, just return an abrev string: "cat" (we like cats) |
eabbc5bf7cdb
Corrected the return value of getCatalogTerm();
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
352
diff
changeset
|
1015 return "cat"; |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1016 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1017 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1018 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1019 * Does a catalog appear at the start of a qualified table name? |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1020 * (Otherwise it appears at the end). |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1021 * Currently there is no catalog support at all in MonetDB |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1022 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1023 * @return true if so |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1024 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1025 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1026 public boolean isCatalogAtStart() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1027 // return true here; we return false for every other catalog function |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1028 // so it won't matter what we return here |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1029 return true; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1030 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1031 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1032 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1033 * What is the Catalog separator. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1034 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1035 * @return the catalog separator string |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1036 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1037 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1038 public String getCatalogSeparator() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1039 // MonetDB does NOT support catalogs, so also no catalog separator |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1040 return null; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1041 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1042 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1043 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1044 * Can a schema name be used in a data manipulation statement? |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1045 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1046 * @return true if so |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1047 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1048 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1049 public boolean supportsSchemasInDataManipulation() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1050 return true; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1051 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1052 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1053 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1054 * Can a schema name be used in a procedure call statement? |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1055 * Ohw probably, but I don't know of procedures in MonetDB |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1056 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1057 * @return true if so |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1058 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1059 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1060 public boolean supportsSchemasInProcedureCalls() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1061 return true; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1062 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1063 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1064 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1065 * Can a schema be used in a table definition statement? |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1066 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1067 * @return true if so |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1068 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1069 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1070 public boolean supportsSchemasInTableDefinitions() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1071 return true; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1072 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1073 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1074 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1075 * Can a schema name be used in an index definition statement? |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1076 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1077 * @return true if so |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1078 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1079 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1080 public boolean supportsSchemasInIndexDefinitions() { |
294
894abb249de1
Corrected 3 MonetDatabaseMetaData methods
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
286
diff
changeset
|
1081 // we currently do NOT support: create index sch.tblidx on sch.tbl(col); |
894abb249de1
Corrected 3 MonetDatabaseMetaData methods
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
286
diff
changeset
|
1082 // only: create index tblidx on sch.tbl(col); |
894abb249de1
Corrected 3 MonetDatabaseMetaData methods
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
286
diff
changeset
|
1083 return false; |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1084 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1085 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1086 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1087 * Can a schema name be used in a privilege definition statement? |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1088 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1089 * @return true if so |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1090 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1091 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1092 public boolean supportsSchemasInPrivilegeDefinitions() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1093 return true; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1094 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1095 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1096 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1097 * Can a catalog name be used in a data manipulation statement? |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1098 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1099 * @return true if so |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1100 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1101 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1102 public boolean supportsCatalogsInDataManipulation() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1103 return false; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1104 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1105 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1106 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1107 * Can a catalog name be used in a procedure call statement? |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1108 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1109 * @return true if so |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1110 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1111 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1112 public boolean supportsCatalogsInProcedureCalls() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1113 return false; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1114 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1115 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1116 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1117 * Can a catalog name be used in a table definition statement? |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1118 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1119 * @return true if so |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1120 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1121 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1122 public boolean supportsCatalogsInTableDefinitions() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1123 return false; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1124 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1125 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1126 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1127 * Can a catalog name be used in an index definition? |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1128 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1129 * @return true if so |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1130 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1131 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1132 public boolean supportsCatalogsInIndexDefinitions() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1133 return false; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1134 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1135 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1136 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1137 * Can a catalog name be used in a privilege definition statement? |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1138 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1139 * @return true if so |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1140 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1141 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1142 public boolean supportsCatalogsInPrivilegeDefinitions() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1143 return false; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1144 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1145 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1146 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1147 * MonetDB doesn't support positioned DELETEs I guess |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1148 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1149 * @return true if so |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1150 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1151 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1152 public boolean supportsPositionedDelete() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1153 return false; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1154 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1155 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1156 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1157 * Is positioned UPDATE supported? (same as above) |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1158 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1159 * @return true if so |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1160 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1161 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1162 public boolean supportsPositionedUpdate() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1163 return false; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1164 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1165 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1166 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1167 * Is SELECT FOR UPDATE supported? |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1168 * My test resulted in a negative answer |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1169 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1170 * @return true if so; false otherwise |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1171 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1172 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1173 public boolean supportsSelectForUpdate(){ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1174 return false; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1175 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1176 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1177 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1178 * Are stored procedure calls using the stored procedure escape |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1179 * syntax supported? |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1180 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1181 * @return true if so; false otherwise |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1182 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1183 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1184 public boolean supportsStoredProcedures() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1185 return true; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1186 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1187 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1188 /** |
213
115f6351bf4b
Update some documentation text
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
200
diff
changeset
|
1189 * Are subqueries in comparison expressions supported? |
231
68b9452f1215
Fix warnings:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
222
diff
changeset
|
1190 * A JDBC Compliant <sup>TM</sup> driver always returns true. |
213
115f6351bf4b
Update some documentation text
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
200
diff
changeset
|
1191 * MonetDB also supports this |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1192 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1193 * @return true if so; false otherwise |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1194 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1195 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1196 public boolean supportsSubqueriesInComparisons() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1197 return true; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1198 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1199 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1200 /** |
213
115f6351bf4b
Update some documentation text
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
200
diff
changeset
|
1201 * Are subqueries in 'exists' expressions supported? |
231
68b9452f1215
Fix warnings:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
222
diff
changeset
|
1202 * A JDBC Compliant <sup>TM</sup> driver always returns true. |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1203 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1204 * @return true if so; false otherwise |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1205 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1206 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1207 public boolean supportsSubqueriesInExists() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1208 return true; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1209 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1210 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1211 /** |
213
115f6351bf4b
Update some documentation text
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
200
diff
changeset
|
1212 * Are subqueries in 'in' statements supported? |
231
68b9452f1215
Fix warnings:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
222
diff
changeset
|
1213 * A JDBC Compliant <sup>TM</sup> driver always returns true. |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1214 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1215 * @return true if so; false otherwise |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1216 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1217 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1218 public boolean supportsSubqueriesInIns() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1219 return true; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1220 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1221 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1222 /** |
213
115f6351bf4b
Update some documentation text
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
200
diff
changeset
|
1223 * Are subqueries in quantified expressions supported? |
231
68b9452f1215
Fix warnings:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
222
diff
changeset
|
1224 * A JDBC Compliant <sup>TM</sup> driver always returns true. |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1225 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1226 * (No idea what this is, but we support a good deal of |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1227 * subquerying.) |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1228 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1229 * @return true if so; false otherwise |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1230 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1231 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1232 public boolean supportsSubqueriesInQuantifieds() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1233 return true; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1234 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1235 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1236 /** |
213
115f6351bf4b
Update some documentation text
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
200
diff
changeset
|
1237 * Are correlated subqueries supported? |
231
68b9452f1215
Fix warnings:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
222
diff
changeset
|
1238 * A JDBC Compliant <sup>TM</sup> driver always returns true. |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1239 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1240 * (a.k.a. subselect in from?) |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1241 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1242 * @return true if so; false otherwise |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1243 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1244 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1245 public boolean supportsCorrelatedSubqueries() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1246 return true; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1247 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1248 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1249 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1250 * Is SQL UNION supported? |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1251 * since 2004-03-20 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1252 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1253 * @return true if so |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1254 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1255 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1256 public boolean supportsUnion() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1257 return true; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1258 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1259 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1260 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1261 * Is SQL UNION ALL supported? |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1262 * since 2004-03-20 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1263 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1264 * @return true if so |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1265 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1266 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1267 public boolean supportsUnionAll() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1268 return true; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1269 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1270 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1271 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1272 * ResultSet objects (cursors) are not closed upon explicit or |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1273 * implicit commit. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1274 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1275 * @return true if so |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1276 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1277 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1278 public boolean supportsOpenCursorsAcrossCommit() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1279 return true; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1280 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1281 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1282 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1283 * Same as above |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1284 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1285 * @return true if so |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1286 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1287 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1288 public boolean supportsOpenCursorsAcrossRollback() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1289 return true; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1290 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1291 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1292 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1293 * Can statements remain open across commits? They may, but |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1294 * this driver cannot guarentee that. In further reflection. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1295 * we are taking a Statement object here, so the answer is |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1296 * yes, since the Statement is only a vehicle to execute some SQL |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1297 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1298 * @return true if they always remain open; false otherwise |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1299 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1300 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1301 public boolean supportsOpenStatementsAcrossCommit() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1302 return true; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1303 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1304 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1305 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1306 * Can statements remain open across rollbacks? They may, but |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1307 * this driver cannot guarentee that. In further contemplation, |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1308 * we are taking a Statement object here, so the answer is yes again. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1309 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1310 * @return true if they always remain open; false otherwise |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1311 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1312 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1313 public boolean supportsOpenStatementsAcrossRollback() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1314 return true; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1315 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1316 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1317 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1318 * How many hex characters can you have in an inline binary literal |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1319 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1320 * @return the max literal length |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1321 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1322 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1323 public int getMaxBinaryLiteralLength() { |
817
93b256bf29a7
Fix arithmetic overflow
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
781
diff
changeset
|
1324 return 0x7ffffffe; // MonetDB supports null terminated strings of max 2GB, see function: int UTF8_strlen() |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1325 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1326 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1327 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1328 * What is the maximum length for a character literal |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1329 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1330 * @return the max literal length |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1331 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1332 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1333 public int getMaxCharLiteralLength() { |
817
93b256bf29a7
Fix arithmetic overflow
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
781
diff
changeset
|
1334 return 0x7ffffffe; // MonetDB supports null terminated strings of max 2GB, see function: int UTF8_strlen() |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1335 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1336 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1337 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1338 * Whats the limit on column name length. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1339 * I take some safety here, but it's just a varchar in MonetDB |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1340 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1341 * @return the maximum column name length |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1342 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1343 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1344 public int getMaxColumnNameLength() { |
15
6e48d0fae766
Corrected return values of DatabaseMetaData methods nullsAreSortedHigh(), nullsAreSortedLow(),
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
7
diff
changeset
|
1345 return 1024; // In MonetDB the max length of column sys._columns.name is defined as 1024 |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1346 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1347 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1348 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1349 * What is the maximum number of columns in a "GROUP BY" clause? |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1350 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1351 * @return the max number of columns |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1352 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1353 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1354 public int getMaxColumnsInGroupBy() { |
15
6e48d0fae766
Corrected return values of DatabaseMetaData methods nullsAreSortedHigh(), nullsAreSortedLow(),
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
7
diff
changeset
|
1355 return 0; // no specific limit known |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1356 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1357 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1358 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1359 * What's the maximum number of columns allowed in an index? |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1360 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1361 * @return max number of columns |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1362 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1363 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1364 public int getMaxColumnsInIndex() { |
15
6e48d0fae766
Corrected return values of DatabaseMetaData methods nullsAreSortedHigh(), nullsAreSortedLow(),
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
7
diff
changeset
|
1365 return 0; // no specific limit known |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1366 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1367 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1368 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1369 * What's the maximum number of columns in an "ORDER BY clause? |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1370 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1371 * @return the max columns |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1372 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1373 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1374 public int getMaxColumnsInOrderBy() { |
15
6e48d0fae766
Corrected return values of DatabaseMetaData methods nullsAreSortedHigh(), nullsAreSortedLow(),
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
7
diff
changeset
|
1375 return 0; // no specific limit known |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1376 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1377 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1378 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1379 * What is the maximum number of columns in a "SELECT" list? |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1380 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1381 * @return the max columns |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1382 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1383 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1384 public int getMaxColumnsInSelect() { |
15
6e48d0fae766
Corrected return values of DatabaseMetaData methods nullsAreSortedHigh(), nullsAreSortedLow(),
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
7
diff
changeset
|
1385 return 0; // no specific limit known |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1386 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1387 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1388 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1389 * What is the maximum number of columns in a table? |
15
6e48d0fae766
Corrected return values of DatabaseMetaData methods nullsAreSortedHigh(), nullsAreSortedLow(),
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
7
diff
changeset
|
1390 * |
6e48d0fae766
Corrected return values of DatabaseMetaData methods nullsAreSortedHigh(), nullsAreSortedLow(),
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
7
diff
changeset
|
1391 * The theoretical max value of int column sys._columns.id is 2^31 -1 |
6e48d0fae766
Corrected return values of DatabaseMetaData methods nullsAreSortedHigh(), nullsAreSortedLow(),
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
7
diff
changeset
|
1392 * but this is for all columns of all tables in all schemas (including all data dictionary columns). |
6e48d0fae766
Corrected return values of DatabaseMetaData methods nullsAreSortedHigh(), nullsAreSortedLow(),
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
7
diff
changeset
|
1393 * For one table we should reduce it to a more practical soft limit of say 100 thousand |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1394 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1395 * @return the max columns |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1396 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1397 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1398 public int getMaxColumnsInTable() { |
15
6e48d0fae766
Corrected return values of DatabaseMetaData methods nullsAreSortedHigh(), nullsAreSortedLow(),
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
7
diff
changeset
|
1399 return 100*1000; // soft limit it to 100 thousand |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1400 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1401 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1402 /** |
332
e8962bdaa206
Moved utility methods and associated caches from DatabaseMetaData to Connection object.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
331
diff
changeset
|
1403 * Retrieves the maximum number of concurrent connections to this database that are possible. |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1404 * |
332
e8962bdaa206
Moved utility methods and associated caches from DatabaseMetaData to Connection object.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
331
diff
changeset
|
1405 * @return the maximum number of active connections possible at one time; a result of zero means that there is no limit or the limit is not known |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1406 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1407 @Override |
7
b3ca1157be73
Improve DatabaseMetaData.getDatabaseProductVersion() to never return a null String.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
0
diff
changeset
|
1408 public int getMaxConnections() throws SQLException { |
332
e8962bdaa206
Moved utility methods and associated caches from DatabaseMetaData to Connection object.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
331
diff
changeset
|
1409 return con.getMaxConnections(); |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1410 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1411 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1412 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1413 * What is the maximum cursor name length |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1414 * Actually we do not do named cursors, so I keep the value small as |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1415 * a precaution for maybe the future. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1416 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1417 * @return max cursor name length in bytes |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1418 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1419 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1420 public int getMaxCursorNameLength() { |
15
6e48d0fae766
Corrected return values of DatabaseMetaData methods nullsAreSortedHigh(), nullsAreSortedLow(),
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
7
diff
changeset
|
1421 return 0; // no specific limit known |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1422 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1423 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1424 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1425 * Retrieves the maximum number of bytes for an index, including all |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1426 * of the parts of the index. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1427 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1428 * @return max index length in bytes, which includes the composite |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1429 * of all the constituent parts of the index; a result of zero |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1430 * means that there is no limit or the limit is not known |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1431 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1432 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1433 public int getMaxIndexLength() { |
15
6e48d0fae766
Corrected return values of DatabaseMetaData methods nullsAreSortedHigh(), nullsAreSortedLow(),
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
7
diff
changeset
|
1434 return 0; // no specific limit known |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1435 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1436 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1437 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1438 * Retrieves the maximum number of characters that this database |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1439 * allows in a schema name. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1440 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1441 * @return the number of characters or 0 if there is no limit, or the |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1442 * limit is unknown. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1443 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1444 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1445 public int getMaxSchemaNameLength() { |
15
6e48d0fae766
Corrected return values of DatabaseMetaData methods nullsAreSortedHigh(), nullsAreSortedLow(),
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
7
diff
changeset
|
1446 return 1024; // In MonetDB the max length of column sys.schemas.name is defined as 1024 |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1447 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1448 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1449 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1450 * What is the maximum length of a procedure name |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1451 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1452 * @return the max name length in bytes |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1453 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1454 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1455 public int getMaxProcedureNameLength() { |
15
6e48d0fae766
Corrected return values of DatabaseMetaData methods nullsAreSortedHigh(), nullsAreSortedLow(),
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
7
diff
changeset
|
1456 return 256; // In MonetDB the max length of column sys.functions.name is defined as 256 |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1457 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1458 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1459 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1460 * What is the maximum length of a catalog |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1461 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1462 * @return the maximum number of characters allowed in a catalog name; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1463 * a result of zero means that there is no limit or the limit is not known |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1464 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1465 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1466 public int getMaxCatalogNameLength() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1467 return 0; // MonetDB does not support catalog names |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1468 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1469 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1470 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1471 * What is the maximum length of a single row? |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1472 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1473 * @return max row size in bytes |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1474 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1475 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1476 public int getMaxRowSize() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1477 return 0; // very long I hope... |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1478 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1479 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1480 /** |
15
6e48d0fae766
Corrected return values of DatabaseMetaData methods nullsAreSortedHigh(), nullsAreSortedLow(),
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
7
diff
changeset
|
1481 * Did getMaxRowSize() include the SQL data types LONGVARCHAR and LONGVARBINARY |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1482 * blobs? |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1483 * Yes I thought so... |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1484 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1485 * @return true if so |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1486 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1487 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1488 public boolean doesMaxRowSizeIncludeBlobs() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1489 return true; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1490 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1491 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1492 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1493 * What is the maximum length of a SQL statement? |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1494 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1495 * @return max length in bytes |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1496 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1497 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1498 public int getMaxStatementLength() { |
817
93b256bf29a7
Fix arithmetic overflow
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
781
diff
changeset
|
1499 return 0x7ffffffe; // MonetDB supports null terminated strings of max 2GB, see function: int UTF8_strlen() |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1500 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1501 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1502 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1503 * How many active statements can we have open at one time to |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1504 * this database? Basically, since each Statement downloads |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1505 * the results as the query is executed, we can have many. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1506 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1507 * @return the maximum |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1508 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1509 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1510 public int getMaxStatements() { |
15
6e48d0fae766
Corrected return values of DatabaseMetaData methods nullsAreSortedHigh(), nullsAreSortedLow(),
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
7
diff
changeset
|
1511 return 0; // no specific limit known |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1512 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1513 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1514 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1515 * What is the maximum length of a table name |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1516 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1517 * @return max name length in bytes |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1518 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1519 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1520 public int getMaxTableNameLength() { |
15
6e48d0fae766
Corrected return values of DatabaseMetaData methods nullsAreSortedHigh(), nullsAreSortedLow(),
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
7
diff
changeset
|
1521 return 1024; // In MonetDB the max length of column sys._tables.name is defined as 1024 |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1522 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1523 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1524 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1525 * What is the maximum number of tables that can be specified |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1526 * in a SELECT? |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1527 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1528 * @return the maximum |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1529 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1530 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1531 public int getMaxTablesInSelect() { |
15
6e48d0fae766
Corrected return values of DatabaseMetaData methods nullsAreSortedHigh(), nullsAreSortedLow(),
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
7
diff
changeset
|
1532 return 0; // no specific limit known |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1533 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1534 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1535 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1536 * What is the maximum length of a user name |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1537 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1538 * @return the max name length in bytes |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1539 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1540 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1541 public int getMaxUserNameLength() { |
15
6e48d0fae766
Corrected return values of DatabaseMetaData methods nullsAreSortedHigh(), nullsAreSortedLow(),
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
7
diff
changeset
|
1542 return 1024; // In MonetDB the max length of column sys.db_user_info.name is defined as 1024 |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1543 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1544 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1545 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1546 * What is the database's default transaction isolation level? |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1547 * We only see commited data, nonrepeatable reads and phantom |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1548 * reads can occur. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1549 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1550 * @return the default isolation level |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1551 * @see Connection |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1552 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1553 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1554 public int getDefaultTransactionIsolation() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1555 return Connection.TRANSACTION_SERIALIZABLE; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1556 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1557 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1558 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1559 * Are transactions supported? If not, commit and rollback are noops |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1560 * and the isolation level is TRANSACTION_NONE. We do support |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1561 * transactions. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1562 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1563 * @return true if transactions are supported |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1564 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1565 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1566 public boolean supportsTransactions() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1567 return true; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1568 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1569 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1570 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1571 * Does the database support the given transaction isolation level? |
213
115f6351bf4b
Update some documentation text
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
200
diff
changeset
|
1572 * We only support TRANSACTION_SERIALIZABLE as far as I know |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1573 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1574 * @param level the values are defined in java.sql.Connection |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1575 * @return true if so |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1576 * @see Connection |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1577 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1578 @Override |
295
003ae6d881db
Add "final" keyword to method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
294
diff
changeset
|
1579 public boolean supportsTransactionIsolationLevel(final int level) { |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1580 return level == Connection.TRANSACTION_SERIALIZABLE; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1581 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1582 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1583 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1584 * Are both data definition and data manipulation transactions |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1585 * supported? |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1586 * Supposedly that data definition is like CREATE or ALTER TABLE |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1587 * yes it is. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1588 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1589 * @return true if so |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1590 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1591 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1592 public boolean supportsDataDefinitionAndDataManipulationTransactions() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1593 return true; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1594 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1595 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1596 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1597 * Are only data manipulation statements within a transaction |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1598 * supported? |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1599 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1600 * @return true if so |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1601 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1602 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1603 public boolean supportsDataManipulationTransactionsOnly() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1604 return false; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1605 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1606 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1607 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1608 * Does a data definition statement within a transaction force |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1609 * the transaction to commit? I think this means something like: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1610 * |
194
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
1611 * <pre> |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1612 * CREATE TABLE T (A INT); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1613 * INSERT INTO T (A) VALUES (2); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1614 * BEGIN; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1615 * UPDATE T SET A = A + 1; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1616 * CREATE TABLE X (A INT); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1617 * SELECT A FROM T INTO X; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1618 * COMMIT; |
194
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
1619 * </pre> |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1620 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1621 * does the CREATE TABLE call cause a commit? The answer is no. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1622 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1623 * @return true if so |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1624 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1625 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1626 public boolean dataDefinitionCausesTransactionCommit() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1627 return false; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1628 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1629 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1630 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1631 * Is a data definition statement within a transaction ignored? |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1632 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1633 * @return true if so |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1634 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1635 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1636 public boolean dataDefinitionIgnoredInTransactions() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1637 return false; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1638 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1639 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1640 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1641 * Get a description of stored procedures available in a catalog |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1642 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1643 * <p>Only procedure descriptions matching the schema and procedure |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1644 * name criteria are returned. They are ordered by PROCEDURE_SCHEM, |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1645 * PROCEDURE_NAME and SPECIFIC_NAME. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1646 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1647 * <p>Each procedure description has the following columns: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1648 * <ol> |
194
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
1649 * <li><b>PROCEDURE_CAT</b> String => procedure catalog (may be null) |
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
1650 * <li><b>PROCEDURE_SCHEM</b> String => procedure schema (may be null) |
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
1651 * <li><b>PROCEDURE_NAME</b> String => procedure name |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1652 * <li><b>Field4</b> reserved (make it null) |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1653 * <li><b>Field5</b> reserved (make it null) |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1654 * <li><b>Field6</b> reserved (make it null) |
194
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
1655 * <li><b>REMARKS</b> String => explanatory comment on the procedure |
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
1656 * <li><b>PROCEDURE_TYPE</b> short => kind of procedure |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1657 * <ul> |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1658 * <li> procedureResultUnknown - May return a result |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1659 * <li> procedureNoResult - Does not return a result |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1660 * <li> procedureReturnsResult - Returns a result |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1661 * </ul> |
194
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
1662 * <li><b>SPECIFIC_NAME</b> String => The name which uniquely identifies this procedure within its schema. |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1663 * </ol> |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1664 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1665 * @param catalog - a catalog name; must match the catalog name as it is stored in the database; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1666 * "" retrieves those without a catalog; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1667 * null means that the catalog name should not be used to narrow the search |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1668 * @param schemaPattern - a schema name pattern; must match the schema name as it is stored in the database; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1669 * "" retrieves those without a schema; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1670 * null means that the schema name should not be used to narrow the search |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1671 * @param procedureNamePattern - a procedure name pattern; must match the procedure name as it is stored in the database |
371
67fa5c6147d7
Correct SQL syntax in comment (LIKE "%" is not valid SQL in WHERE clause)
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
370
diff
changeset
|
1672 * Note that our implementation allows this param to be null also (for efficiency as no extra LIKE '%' condition is added to be evaluated). |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1673 * @return ResultSet - each row is a procedure description |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1674 * @throws SQLException if a database access error occurs |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1675 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1676 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1677 public ResultSet getProcedures( |
295
003ae6d881db
Add "final" keyword to method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
294
diff
changeset
|
1678 final String catalog, |
003ae6d881db
Add "final" keyword to method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
294
diff
changeset
|
1679 final String schemaPattern, |
003ae6d881db
Add "final" keyword to method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
294
diff
changeset
|
1680 final String procedureNamePattern |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1681 ) throws SQLException |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1682 { |
332
e8962bdaa206
Moved utility methods and associated caches from DatabaseMetaData to Connection object.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
331
diff
changeset
|
1683 final boolean useCommentsTable = con.commentsTableExists(); |
295
003ae6d881db
Add "final" keyword to method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
294
diff
changeset
|
1684 final StringBuilder query = new StringBuilder(980); |
217
7cbd20ff628c
Removed DISTINCT from SELECT DISTINCT where it should not be needed (in getTables() and getFunctionColumns())
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
216
diff
changeset
|
1685 query.append("SELECT cast(null as char(1)) AS \"PROCEDURE_CAT\", " + |
302
1b6c514106ce
Added table aliases and use them in all meta data SQL queries to reduce query size.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
300
diff
changeset
|
1686 "s.\"name\" AS \"PROCEDURE_SCHEM\", " + |
1b6c514106ce
Added table aliases and use them in all meta data SQL queries to reduce query size.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
300
diff
changeset
|
1687 "f.\"name\" AS \"PROCEDURE_NAME\", " + |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1688 "cast(null as char(1)) AS \"Field4\", " + |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1689 "cast(null as char(1)) AS \"Field5\", " + |
215
71b039bc2d99
Added support for querying the sys.comments table for some meta data methods
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
213
diff
changeset
|
1690 "cast(null as char(1)) AS \"Field6\", ") |
302
1b6c514106ce
Added table aliases and use them in all meta data SQL queries to reduce query size.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
300
diff
changeset
|
1691 .append(useCommentsTable ? "COALESCE(cm.\"remark\", cast(f.\"func\" as varchar(9999)))" : "cast(f.\"func\" as varchar(9999))").append(" AS \"REMARKS\", " + |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1692 // in MonetDB procedures have no return value by design. |
759
846a456f0f0c
Remove append() calls for static int values in construction of Strings.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
757
diff
changeset
|
1693 "cast(" + DatabaseMetaData.procedureNoResult + " AS smallint) AS \"PROCEDURE_TYPE\", " + |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1694 // only the id value uniquely identifies a procedure. Include it to be able to differentiate between multiple overloaded procedures with the same name |
302
1b6c514106ce
Added table aliases and use them in all meta data SQL queries to reduce query size.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
300
diff
changeset
|
1695 "cast(f.\"id\" as varchar(10)) AS \"SPECIFIC_NAME\" " + |
759
846a456f0f0c
Remove append() calls for static int values in construction of Strings.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
757
diff
changeset
|
1696 "FROM \"sys\".\"functions\" f " + |
846a456f0f0c
Remove append() calls for static int values in construction of Strings.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
757
diff
changeset
|
1697 "JOIN \"sys\".\"schemas\" s ON f.\"schema_id\" = s.\"id\" "); |
215
71b039bc2d99
Added support for querying the sys.comments table for some meta data methods
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
213
diff
changeset
|
1698 if (useCommentsTable) { |
352
f62137dd6050
Remove spaces from static SQL predicates: 1 = 0 and 1 = 1.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
350
diff
changeset
|
1699 query.append("LEFT OUTER JOIN \"sys\".\"comments\" cm ON f.\"id\" = cm.\"id\" "); |
215
71b039bc2d99
Added support for querying the sys.comments table for some meta data methods
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
213
diff
changeset
|
1700 } |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1701 // include procedures only (type = 2). Others will be returned via getFunctions() |
302
1b6c514106ce
Added table aliases and use them in all meta data SQL queries to reduce query size.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
300
diff
changeset
|
1702 query.append("WHERE f.\"type\" = 2"); |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1703 |
216
116b5a149fb4
Optimise SQL query generation for cases where the WHERE clause already has a AND 1 = 0 condition. Exlude adding more AND ... conditions.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
215
diff
changeset
|
1704 if (catalog != null && !catalog.isEmpty()) { |
299
1f0324072b0c
Correcting typo in comment
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
298
diff
changeset
|
1705 // non-empty catalog selection. |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1706 // as we do not support catalogs this always results in no rows returned |
352
f62137dd6050
Remove spaces from static SQL predicates: 1 = 0 and 1 = 1.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
350
diff
changeset
|
1707 query.append(" AND 1=0"); |
216
116b5a149fb4
Optimise SQL query generation for cases where the WHERE clause already has a AND 1 = 0 condition. Exlude adding more AND ... conditions.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
215
diff
changeset
|
1708 } else { |
323
8701024a9bb0
In DatabaseMetaData methods which accept name match patterns, optimise the SQL generation when the pattern equals a: %
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
306
diff
changeset
|
1709 if (schemaPattern != null && !schemaPattern.equals("%")) { |
302
1b6c514106ce
Added table aliases and use them in all meta data SQL queries to reduce query size.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
300
diff
changeset
|
1710 query.append(" AND s.\"name\" ").append(composeMatchPart(schemaPattern)); |
216
116b5a149fb4
Optimise SQL query generation for cases where the WHERE clause already has a AND 1 = 0 condition. Exlude adding more AND ... conditions.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
215
diff
changeset
|
1711 } |
323
8701024a9bb0
In DatabaseMetaData methods which accept name match patterns, optimise the SQL generation when the pattern equals a: %
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
306
diff
changeset
|
1712 if (procedureNamePattern != null && !procedureNamePattern.equals("%")) { |
302
1b6c514106ce
Added table aliases and use them in all meta data SQL queries to reduce query size.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
300
diff
changeset
|
1713 query.append(" AND f.\"name\" ").append(composeMatchPart(procedureNamePattern)); |
216
116b5a149fb4
Optimise SQL query generation for cases where the WHERE clause already has a AND 1 = 0 condition. Exlude adding more AND ... conditions.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
215
diff
changeset
|
1714 } |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1715 } |
216
116b5a149fb4
Optimise SQL query generation for cases where the WHERE clause already has a AND 1 = 0 condition. Exlude adding more AND ... conditions.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
215
diff
changeset
|
1716 |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1717 query.append(" ORDER BY \"PROCEDURE_SCHEM\", \"PROCEDURE_NAME\", \"SPECIFIC_NAME\""); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1718 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1719 return executeMetaDataQuery(query.toString()); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1720 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1721 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1722 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1723 * Get a description of a catalog's stored procedure parameters |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1724 * and result columns. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1725 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1726 * <p>Only descriptions matching the schema, procedure and parameter name |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1727 * criteria are returned. They are ordered by PROCEDURE_SCHEM, PROCEDURE_NAME |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1728 * and SPECIFIC_NAME. Within this, the return value, if any, is first. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1729 * Next are the parameter descriptions in call order. The |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1730 * column descriptions follow in column number order. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1731 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1732 * <p>Each row in the ResultSet is a parameter description or column |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1733 * description with the following fields: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1734 * <ol> |
194
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
1735 * <li><b>PROCEDURE_CAT</b> String => procedure catalog (may be null) |
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
1736 * <li><b>PROCEDURE_SCHEM</b> String => procedure schema (may be null) |
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
1737 * <li><b>PROCEDURE_NAME</b> String => procedure name |
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
1738 * <li><b>COLUMN_NAME</b> String => column/parameter name |
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
1739 * <li><b>COLUMN_TYPE</b> Short => kind of column/parameter: |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1740 * <ul><li>procedureColumnUnknown - nobody knows |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1741 * <li>procedureColumnIn - IN parameter |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1742 * <li>procedureColumnInOut - INOUT parameter |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1743 * <li>procedureColumnOut - OUT parameter |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1744 * <li>procedureColumnReturn - procedure return value |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1745 * <li>procedureColumnResult - result column in ResultSet |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1746 * </ul> |
194
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
1747 * <li><b>DATA_TYPE</b> int => SQL type from java.sql.Types |
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
1748 * <li><b>TYPE_NAME</b> String => SQL type name, for a UDT type the type name is fully qualified |
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
1749 * <li><b>PRECISION</b> int => precision |
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
1750 * <li><b>LENGTH</b> int => length in bytes of data |
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
1751 * <li><b>SCALE</b> short => scale - null is returned for data types where SCALE is not applicable. |
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
1752 * <li><b>RADIX</b> short => radix |
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
1753 * <li><b>NULLABLE</b> short => can it contain NULL? |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1754 * <ul><li>procedureNoNulls - does not allow NULL values |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1755 * <li>procedureNullable - allows NULL values |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1756 * <li>procedureNullableUnknown - nullability unknown |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1757 * </ul> |
194
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
1758 * <li><b>REMARKS</b> String => comment describing parameter/column |
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
1759 * <li><b>COLUMN_DEF</b> String => default value for the column, which should be interpreted as a string when the value is enclosed in single quotes (may be null) |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1760 * The string NULL (not enclosed in quotes) - if NULL was specified as the default value |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1761 * TRUNCATE (not enclosed in quotes) - if the specified default value cannot be represented without truncation |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1762 * NULL - if a default value was not specified |
194
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
1763 * <li><b>SQL_DATA_TYPE</b> int => reserved for future use |
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
1764 * <li><b>SQL_DATETIME_SUB</b> int => reserved for future use |
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
1765 * <li><b>CHAR_OCTET_LENGTH</b> int => the maximum length of binary and character based columns. For any other datatype the returned value is a NULL |
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
1766 * <li><b>ORDINAL_POSITION</b> int => the ordinal position, starting from 1, for the input and output parameters for a procedure. |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1767 * A value of 0 is returned if this row describes the procedure's return value. For result set columns, it is the ordinal position of the |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1768 * column in the result set starting from 1. If there are multiple result sets, the column ordinal positions are implementation defined. |
194
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
1769 * <li><b>IS_NULLABLE</b> String => ISO rules are used to determine the nullability for a column. |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1770 * <ul><li>YES --- if the parameter can include NULLs |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1771 * <li>NO --- if the parameter cannot include NULLs |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1772 * <li>empty string --- if the nullability for the parameter is unknown |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1773 * </ul> |
194
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
1774 * <li><b>SPECIFIC_NAME</b> String => the name which uniquely identifies this procedure within its schema. |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1775 * </ol> |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1776 * @param catalog - a catalog name; must match the catalog name as it is stored in the database; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1777 * "" retrieves those without a catalog; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1778 * null means that the catalog name should not be used to narrow the search |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1779 * @param schemaPattern - a schema name pattern; must match the schema name as it is stored in the database; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1780 * "" retrieves those without a schema; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1781 * null means that the schema name should not be used to narrow the search |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1782 * @param procedureNamePattern - a procedure name pattern; must match the procedure name as it is stored in the database |
371
67fa5c6147d7
Correct SQL syntax in comment (LIKE "%" is not valid SQL in WHERE clause)
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
370
diff
changeset
|
1783 * Note that our implementation allows this param to be null also (for efficiency as no extra LIKE '%' condition is added to be evaluated). |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1784 * @param columnNamePattern - a column name pattern; must match the column name as it is stored in the database |
371
67fa5c6147d7
Correct SQL syntax in comment (LIKE "%" is not valid SQL in WHERE clause)
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
370
diff
changeset
|
1785 * Note that our implementation allows this param to be null also (for efficiency as no extra LIKE '%' condition is added to be evaluated). |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1786 * @return ResultSet - each row describes a stored procedure parameter or column |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1787 * @throws SQLException if a database-access error occurs |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1788 * @see #getSearchStringEscape |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1789 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1790 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1791 public ResultSet getProcedureColumns( |
295
003ae6d881db
Add "final" keyword to method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
294
diff
changeset
|
1792 final String catalog, |
003ae6d881db
Add "final" keyword to method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
294
diff
changeset
|
1793 final String schemaPattern, |
003ae6d881db
Add "final" keyword to method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
294
diff
changeset
|
1794 final String procedureNamePattern, |
003ae6d881db
Add "final" keyword to method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
294
diff
changeset
|
1795 final String columnNamePattern |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1796 ) throws SQLException { |
295
003ae6d881db
Add "final" keyword to method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
294
diff
changeset
|
1797 final StringBuilder query = new StringBuilder(2900); |
217
7cbd20ff628c
Removed DISTINCT from SELECT DISTINCT where it should not be needed (in getTables() and getFunctionColumns())
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
216
diff
changeset
|
1798 query.append("SELECT cast(null as char(1)) AS \"PROCEDURE_CAT\", " + |
302
1b6c514106ce
Added table aliases and use them in all meta data SQL queries to reduce query size.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
300
diff
changeset
|
1799 "s.\"name\" AS \"PROCEDURE_SCHEM\", " + |
1b6c514106ce
Added table aliases and use them in all meta data SQL queries to reduce query size.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
300
diff
changeset
|
1800 "f.\"name\" AS \"PROCEDURE_NAME\", " + |
1b6c514106ce
Added table aliases and use them in all meta data SQL queries to reduce query size.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
300
diff
changeset
|
1801 "a.\"name\" AS \"COLUMN_NAME\", " + |
1b6c514106ce
Added table aliases and use them in all meta data SQL queries to reduce query size.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
300
diff
changeset
|
1802 "cast(CASE a.\"inout\"" + |
759
846a456f0f0c
Remove append() calls for static int values in construction of Strings.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
757
diff
changeset
|
1803 " WHEN 0 THEN (CASE a.\"number\" WHEN 0 THEN " + DatabaseMetaData.procedureColumnReturn + " ELSE " + DatabaseMetaData.procedureColumnOut + " END)" + |
846a456f0f0c
Remove append() calls for static int values in construction of Strings.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
757
diff
changeset
|
1804 " WHEN 1 THEN " + DatabaseMetaData.procedureColumnIn + |
846a456f0f0c
Remove append() calls for static int values in construction of Strings.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
757
diff
changeset
|
1805 " ELSE " + DatabaseMetaData.procedureColumnUnknown + " END AS smallint) AS \"COLUMN_TYPE\", " + |
302
1b6c514106ce
Added table aliases and use them in all meta data SQL queries to reduce query size.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
300
diff
changeset
|
1806 "cast(").append(MonetDriver.getSQLTypeMap("a.\"type\"")).append(" AS int) AS \"DATA_TYPE\", " + |
1b6c514106ce
Added table aliases and use them in all meta data SQL queries to reduce query size.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
300
diff
changeset
|
1807 "a.\"type\" AS \"TYPE_NAME\", " + |
379
d7661075ebf7
Add support for new (as of Oct2020 release) datatype: day_interval
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
376
diff
changeset
|
1808 "CASE a.\"type\" WHEN 'tinyint' THEN 3 WHEN 'smallint' THEN 5 WHEN 'int' THEN 10 WHEN 'bigint' THEN 19" + |
d7661075ebf7
Add support for new (as of Oct2020 release) datatype: day_interval
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
376
diff
changeset
|
1809 " WHEN 'hugeint' THEN 38 WHEN 'oid' THEN 19 WHEN 'wrd' THEN 19 ELSE a.\"type_digits\" END AS \"PRECISION\", " + |
d7661075ebf7
Add support for new (as of Oct2020 release) datatype: day_interval
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
376
diff
changeset
|
1810 "CASE a.\"type\" WHEN 'tinyint' THEN 1 WHEN 'smallint' THEN 2 WHEN 'int' THEN 4 WHEN 'bigint' THEN 8" + |
d7661075ebf7
Add support for new (as of Oct2020 release) datatype: day_interval
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
376
diff
changeset
|
1811 " WHEN 'hugeint' THEN 16 WHEN 'oid' THEN 8 WHEN 'wrd' THEN 8 ELSE a.\"type_digits\" END AS \"LENGTH\", " + |
d7661075ebf7
Add support for new (as of Oct2020 release) datatype: day_interval
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
376
diff
changeset
|
1812 "cast(CASE WHEN a.\"type\" IN ('tinyint','smallint','int','bigint','hugeint','oid','wrd','decimal','numeric'," + |
d7661075ebf7
Add support for new (as of Oct2020 release) datatype: day_interval
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
376
diff
changeset
|
1813 "'time','timetz','timestamp','timestamptz','day_interval','month_interval','sec_interval') THEN a.\"type_scale\" ELSE NULL END AS smallint) AS \"SCALE\", " + |
415
50e43af49d47
Improved DatabaseMetaData.getTypeInfo() output for temporal data types: sec_interval, day_interval, month_interval, date, time, timetz, timestamp and timestamptz.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
406
diff
changeset
|
1814 "cast(CASE WHEN a.\"type\" IN ('tinyint','smallint','int','bigint','hugeint','oid','wrd','decimal','numeric','day_interval','month_interval','sec_interval') THEN 10" + |
379
d7661075ebf7
Add support for new (as of Oct2020 release) datatype: day_interval
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
376
diff
changeset
|
1815 " WHEN a.\"type\" IN ('real','float','double') THEN 2 ELSE NULL END AS smallint) AS \"RADIX\", " + |
759
846a456f0f0c
Remove append() calls for static int values in construction of Strings.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
757
diff
changeset
|
1816 // mvd: do not remove next append. The String above is same as used by getFunctionColumns, so shared in class file. |
217
7cbd20ff628c
Removed DISTINCT from SELECT DISTINCT where it should not be needed (in getTables() and getFunctionColumns())
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
216
diff
changeset
|
1817 "cast(").append(DatabaseMetaData.procedureNullableUnknown).append(" AS smallint) AS \"NULLABLE\", " + |
7cbd20ff628c
Removed DISTINCT from SELECT DISTINCT where it should not be needed (in getTables() and getFunctionColumns())
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
216
diff
changeset
|
1818 "cast(null as char(1)) AS \"REMARKS\", " + |
7cbd20ff628c
Removed DISTINCT from SELECT DISTINCT where it should not be needed (in getTables() and getFunctionColumns())
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
216
diff
changeset
|
1819 "cast(null as char(1)) AS \"COLUMN_DEF\", " + |
7cbd20ff628c
Removed DISTINCT from SELECT DISTINCT where it should not be needed (in getTables() and getFunctionColumns())
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
216
diff
changeset
|
1820 "cast(0 as int) AS \"SQL_DATA_TYPE\", " + |
7cbd20ff628c
Removed DISTINCT from SELECT DISTINCT where it should not be needed (in getTables() and getFunctionColumns())
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
216
diff
changeset
|
1821 "cast(0 as int) AS \"SQL_DATETIME_SUB\", " + |
822
ad4491372c2c
Prevent sql processor to produce server msg: mul_int_bte_int: ERROR: 22003!overflow in calculation 2147483647*4.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
818
diff
changeset
|
1822 "cast(CASE WHEN a.\"type\" IN ('varchar','clob','char','json','url','xml') THEN 4 * cast(a.\"type_digits\" as bigint) WHEN a.\"type\" = 'blob' THEN a.\"type_digits\" ELSE NULL END as bigint) AS \"CHAR_OCTET_LENGTH\", " + |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1823 // in MonetDB procedures have no return value by design. The arguments in sys.args are numbered from 0 so we must add 1 to comply with the API specification. |
302
1b6c514106ce
Added table aliases and use them in all meta data SQL queries to reduce query size.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
300
diff
changeset
|
1824 "cast(a.\"number\" + 1 as int) AS \"ORDINAL_POSITION\", " + |
217
7cbd20ff628c
Removed DISTINCT from SELECT DISTINCT where it should not be needed (in getTables() and getFunctionColumns())
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
216
diff
changeset
|
1825 "cast('' as varchar(3)) AS \"IS_NULLABLE\", " + |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1826 // the specific name contains the function id, in order to be able to match the args to the correct overloaded procedure name |
302
1b6c514106ce
Added table aliases and use them in all meta data SQL queries to reduce query size.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
300
diff
changeset
|
1827 "cast(f.\"id\" as varchar(10)) AS \"SPECIFIC_NAME\" " + |
1b6c514106ce
Added table aliases and use them in all meta data SQL queries to reduce query size.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
300
diff
changeset
|
1828 "FROM \"sys\".\"args\" a " + |
352
f62137dd6050
Remove spaces from static SQL predicates: 1 = 0 and 1 = 1.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
350
diff
changeset
|
1829 "JOIN \"sys\".\"functions\" f ON a.\"func_id\" = f.\"id\" " + |
f62137dd6050
Remove spaces from static SQL predicates: 1 = 0 and 1 = 1.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
350
diff
changeset
|
1830 "JOIN \"sys\".\"schemas\" s ON f.\"schema_id\" = s.\"id\" " + |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1831 // include procedures only (type = 2). Others will be returned via getFunctionColumns() |
302
1b6c514106ce
Added table aliases and use them in all meta data SQL queries to reduce query size.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
300
diff
changeset
|
1832 "WHERE f.\"type\" = 2"); |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1833 |
216
116b5a149fb4
Optimise SQL query generation for cases where the WHERE clause already has a AND 1 = 0 condition. Exlude adding more AND ... conditions.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
215
diff
changeset
|
1834 if (catalog != null && !catalog.isEmpty()) { |
299
1f0324072b0c
Correcting typo in comment
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
298
diff
changeset
|
1835 // non-empty catalog selection. |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1836 // as we do not support catalogs this always results in no rows returned |
352
f62137dd6050
Remove spaces from static SQL predicates: 1 = 0 and 1 = 1.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
350
diff
changeset
|
1837 query.append(" AND 1=0"); |
216
116b5a149fb4
Optimise SQL query generation for cases where the WHERE clause already has a AND 1 = 0 condition. Exlude adding more AND ... conditions.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
215
diff
changeset
|
1838 } else { |
323
8701024a9bb0
In DatabaseMetaData methods which accept name match patterns, optimise the SQL generation when the pattern equals a: %
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
306
diff
changeset
|
1839 if (schemaPattern != null && !schemaPattern.equals("%")) { |
302
1b6c514106ce
Added table aliases and use them in all meta data SQL queries to reduce query size.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
300
diff
changeset
|
1840 query.append(" AND s.\"name\" ").append(composeMatchPart(schemaPattern)); |
216
116b5a149fb4
Optimise SQL query generation for cases where the WHERE clause already has a AND 1 = 0 condition. Exlude adding more AND ... conditions.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
215
diff
changeset
|
1841 } |
323
8701024a9bb0
In DatabaseMetaData methods which accept name match patterns, optimise the SQL generation when the pattern equals a: %
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
306
diff
changeset
|
1842 if (procedureNamePattern != null && !procedureNamePattern.equals("%")) { |
302
1b6c514106ce
Added table aliases and use them in all meta data SQL queries to reduce query size.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
300
diff
changeset
|
1843 query.append(" AND f.\"name\" ").append(composeMatchPart(procedureNamePattern)); |
216
116b5a149fb4
Optimise SQL query generation for cases where the WHERE clause already has a AND 1 = 0 condition. Exlude adding more AND ... conditions.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
215
diff
changeset
|
1844 } |
323
8701024a9bb0
In DatabaseMetaData methods which accept name match patterns, optimise the SQL generation when the pattern equals a: %
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
306
diff
changeset
|
1845 if (columnNamePattern != null && !columnNamePattern.equals("%")) { |
302
1b6c514106ce
Added table aliases and use them in all meta data SQL queries to reduce query size.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
300
diff
changeset
|
1846 query.append(" AND a.\"name\" ").append(composeMatchPart(columnNamePattern)); |
216
116b5a149fb4
Optimise SQL query generation for cases where the WHERE clause already has a AND 1 = 0 condition. Exlude adding more AND ... conditions.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
215
diff
changeset
|
1847 } |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1848 } |
216
116b5a149fb4
Optimise SQL query generation for cases where the WHERE clause already has a AND 1 = 0 condition. Exlude adding more AND ... conditions.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
215
diff
changeset
|
1849 |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1850 query.append(" ORDER BY \"PROCEDURE_SCHEM\", \"PROCEDURE_NAME\", \"SPECIFIC_NAME\", \"ORDINAL_POSITION\""); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1851 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1852 return executeMetaDataQuery(query.toString()); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1853 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1854 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1855 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1856 * Retrieves a description of the tables available in the given catalog. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1857 * Only table descriptions matching the catalog, schema, table name and type criteria are returned. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1858 * They are ordered by TABLE_TYPE, TABLE_CAT, TABLE_SCHEM and TABLE_NAME. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1859 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1860 * <p>Each table description has the following columns: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1861 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1862 * <ol> |
194
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
1863 * <li><b>TABLE_CAT</b> String => table catalog (may be null) |
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
1864 * <li><b>TABLE_SCHEM</b> String => table schema (may be null) |
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
1865 * <li><b>TABLE_NAME</b> String => table name |
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
1866 * <li><b>TABLE_TYPE</b> String => table type. Typical types are "TABLE", |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1867 * "VIEW", "SYSTEM TABLE", "GLOBAL TEMPORARY", "LOCAL TEMPORARY", "ALIAS", "SYNONYM". |
194
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
1868 * <li><b>REMARKS</b> String => explanatory comment on the table |
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
1869 * <li><b>TYPE_CAT</b> String => the types catalog (may be null) |
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
1870 * <li><b>TYPE_SCHEM</b> String => the types schema (may be null) |
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
1871 * <li><b>TYPE_NAME</b> String => type name (may be null) |
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
1872 * <li><b>SELF_REFERENCING_COL_NAME</b> String => name of the designated "identifier" column of a typed table (may be null) |
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
1873 * <li><b>REF_GENERATION</b> String => specifies how values in SELF_REFERENCING_COL_NAME are created. Values are "SYSTEM", "USER", "DERIVED". (may be null) |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1874 * </ol> |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1875 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1876 * @param catalog - a catalog name; must match the catalog name as it is stored in the database; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1877 * "" retrieves those without a catalog; null means that the |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1878 * catalog name should not be used to narrow the search |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1879 * @param schemaPattern - a schema name pattern; must match the schema name as it is stored |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1880 * in the database; "" retrieves those without a schema; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1881 * null means that the schema name should not be used to narrow the search |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1882 * @param tableNamePattern - a table name pattern; must match the table name as it is stored in the database |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1883 * For all tables this should be "%" |
371
67fa5c6147d7
Correct SQL syntax in comment (LIKE "%" is not valid SQL in WHERE clause)
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
370
diff
changeset
|
1884 * Note that our implementation allows this param to be null also (for efficiency as no extra LIKE '%' condition is added to be evaluated). |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1885 * @param types - a list of table types, which must be from the list of table types returned |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1886 * from getTableTypes(),to include; null returns all types |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1887 * @return ResultSet - each row is a table description |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1888 * @throws SQLException if a database-access error occurs. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1889 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1890 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1891 public ResultSet getTables( |
295
003ae6d881db
Add "final" keyword to method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
294
diff
changeset
|
1892 final String catalog, |
003ae6d881db
Add "final" keyword to method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
294
diff
changeset
|
1893 final String schemaPattern, |
003ae6d881db
Add "final" keyword to method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
294
diff
changeset
|
1894 final String tableNamePattern, |
003ae6d881db
Add "final" keyword to method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
294
diff
changeset
|
1895 final String types[] |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1896 ) throws SQLException |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1897 { |
332
e8962bdaa206
Moved utility methods and associated caches from DatabaseMetaData to Connection object.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
331
diff
changeset
|
1898 final boolean useCommentsTable = con.commentsTableExists(); |
295
003ae6d881db
Add "final" keyword to method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
294
diff
changeset
|
1899 final StringBuilder query = new StringBuilder(1600); |
217
7cbd20ff628c
Removed DISTINCT from SELECT DISTINCT where it should not be needed (in getTables() and getFunctionColumns())
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
216
diff
changeset
|
1900 query.append("SELECT cast(null as char(1)) AS \"TABLE_CAT\", " + |
302
1b6c514106ce
Added table aliases and use them in all meta data SQL queries to reduce query size.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
300
diff
changeset
|
1901 "s.\"name\" AS \"TABLE_SCHEM\", " + |
767
1547843b3a9b
Removed code to support old MonetDB servers Oct2014 or older.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
761
diff
changeset
|
1902 "t.\"name\" AS \"TABLE_NAME\", " + |
1547843b3a9b
Removed code to support old MonetDB servers Oct2014 or older.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
761
diff
changeset
|
1903 "tt.\"table_type_name\" AS \"TABLE_TYPE\", ") |
1547843b3a9b
Removed code to support old MonetDB servers Oct2014 or older.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
761
diff
changeset
|
1904 .append(useCommentsTable ? "COALESCE(cm.\"remark\", t.\"query\")" : "t.\"query\"") |
1547843b3a9b
Removed code to support old MonetDB servers Oct2014 or older.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
761
diff
changeset
|
1905 .append(" AS \"REMARKS\", " + |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1906 "cast(null as char(1)) AS \"TYPE_CAT\", " + |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1907 "cast(null as char(1)) AS \"TYPE_SCHEM\", " + |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1908 "cast(null as char(1)) AS \"TYPE_NAME\", " + |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1909 "cast(null as char(1)) AS \"SELF_REFERENCING_COL_NAME\", " + |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1910 "cast(null as char(1)) AS \"REF_GENERATION\" " + |
767
1547843b3a9b
Removed code to support old MonetDB servers Oct2014 or older.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
761
diff
changeset
|
1911 "FROM \"sys\".\"tables\" t " + |
1547843b3a9b
Removed code to support old MonetDB servers Oct2014 or older.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
761
diff
changeset
|
1912 "JOIN \"sys\".\"table_types\" tt ON t.\"type\" = tt.\"table_type_id\" " + |
1547843b3a9b
Removed code to support old MonetDB servers Oct2014 or older.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
761
diff
changeset
|
1913 "JOIN \"sys\".\"schemas\" s ON t.\"schema_id\" = s.\"id\" "); |
302
1b6c514106ce
Added table aliases and use them in all meta data SQL queries to reduce query size.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
300
diff
changeset
|
1914 if (useCommentsTable) { |
1b6c514106ce
Added table aliases and use them in all meta data SQL queries to reduce query size.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
300
diff
changeset
|
1915 query.append("LEFT OUTER JOIN \"sys\".\"comments\" cm ON t.\"id\" = cm.\"id\" "); |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1916 } |
372
159c628527c4
Optimize SQL query generation by eliminating "WHERE 1=1" conditions
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
371
diff
changeset
|
1917 |
159c628527c4
Optimize SQL query generation by eliminating "WHERE 1=1" conditions
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
371
diff
changeset
|
1918 boolean needWhere = true; |
216
116b5a149fb4
Optimise SQL query generation for cases where the WHERE clause already has a AND 1 = 0 condition. Exlude adding more AND ... conditions.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
215
diff
changeset
|
1919 if (catalog != null && !catalog.isEmpty()) { |
299
1f0324072b0c
Correcting typo in comment
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
298
diff
changeset
|
1920 // non-empty catalog selection. |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1921 // as we do not support catalogs this always results in no rows returned |
372
159c628527c4
Optimize SQL query generation by eliminating "WHERE 1=1" conditions
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
371
diff
changeset
|
1922 query.append("WHERE 1=0"); |
159c628527c4
Optimize SQL query generation by eliminating "WHERE 1=1" conditions
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
371
diff
changeset
|
1923 needWhere = false; |
216
116b5a149fb4
Optimise SQL query generation for cases where the WHERE clause already has a AND 1 = 0 condition. Exlude adding more AND ... conditions.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
215
diff
changeset
|
1924 } else { |
323
8701024a9bb0
In DatabaseMetaData methods which accept name match patterns, optimise the SQL generation when the pattern equals a: %
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
306
diff
changeset
|
1925 if (schemaPattern != null && !schemaPattern.equals("%")) { |
372
159c628527c4
Optimize SQL query generation by eliminating "WHERE 1=1" conditions
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
371
diff
changeset
|
1926 query.append("WHERE s.\"name\" ").append(composeMatchPart(schemaPattern)); |
159c628527c4
Optimize SQL query generation by eliminating "WHERE 1=1" conditions
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
371
diff
changeset
|
1927 needWhere = false; |
216
116b5a149fb4
Optimise SQL query generation for cases where the WHERE clause already has a AND 1 = 0 condition. Exlude adding more AND ... conditions.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
215
diff
changeset
|
1928 } |
323
8701024a9bb0
In DatabaseMetaData methods which accept name match patterns, optimise the SQL generation when the pattern equals a: %
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
306
diff
changeset
|
1929 if (tableNamePattern != null && !tableNamePattern.equals("%")) { |
372
159c628527c4
Optimize SQL query generation by eliminating "WHERE 1=1" conditions
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
371
diff
changeset
|
1930 query.append(needWhere ? "WHERE" : " AND") |
159c628527c4
Optimize SQL query generation by eliminating "WHERE 1=1" conditions
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
371
diff
changeset
|
1931 .append(" t.\"name\" ").append(composeMatchPart(tableNamePattern)); |
159c628527c4
Optimize SQL query generation by eliminating "WHERE 1=1" conditions
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
371
diff
changeset
|
1932 needWhere = false; |
216
116b5a149fb4
Optimise SQL query generation for cases where the WHERE clause already has a AND 1 = 0 condition. Exlude adding more AND ... conditions.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
215
diff
changeset
|
1933 } |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1934 } |
216
116b5a149fb4
Optimise SQL query generation for cases where the WHERE clause already has a AND 1 = 0 condition. Exlude adding more AND ... conditions.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
215
diff
changeset
|
1935 |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1936 if (types != null && types.length > 0) { |
767
1547843b3a9b
Removed code to support old MonetDB servers Oct2014 or older.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
761
diff
changeset
|
1937 query.append(needWhere ? "WHERE" : " AND").append(" tt.\"table_type_name\" IN ("); |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1938 for (int i = 0; i < types.length; i++) { |
827
b2cbe866d020
Enhanced DatabaseMetaData.getTables() method by adding support for SQL table type names: 'BASE TABLE', 'GLOBAL TEMPORARY' and 'LOCAL TEMPORARY' in parameter types[].
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
825
diff
changeset
|
1939 String tabletype = types[i]; |
b2cbe866d020
Enhanced DatabaseMetaData.getTables() method by adding support for SQL table type names: 'BASE TABLE', 'GLOBAL TEMPORARY' and 'LOCAL TEMPORARY' in parameter types[].
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
825
diff
changeset
|
1940 /* Some JDBC applications use different table type names. |
b2cbe866d020
Enhanced DatabaseMetaData.getTables() method by adding support for SQL table type names: 'BASE TABLE', 'GLOBAL TEMPORARY' and 'LOCAL TEMPORARY' in parameter types[].
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
825
diff
changeset
|
1941 * Replace some SQL synonyms to valid MonetDB |
b2cbe866d020
Enhanced DatabaseMetaData.getTables() method by adding support for SQL table type names: 'BASE TABLE', 'GLOBAL TEMPORARY' and 'LOCAL TEMPORARY' in parameter types[].
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
825
diff
changeset
|
1942 * table type names as defined in sys.table_types */ |
b2cbe866d020
Enhanced DatabaseMetaData.getTables() method by adding support for SQL table type names: 'BASE TABLE', 'GLOBAL TEMPORARY' and 'LOCAL TEMPORARY' in parameter types[].
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
825
diff
changeset
|
1943 if ("BASE TABLE".equals(tabletype)) { |
b2cbe866d020
Enhanced DatabaseMetaData.getTables() method by adding support for SQL table type names: 'BASE TABLE', 'GLOBAL TEMPORARY' and 'LOCAL TEMPORARY' in parameter types[].
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
825
diff
changeset
|
1944 tabletype = "TABLE"; |
b2cbe866d020
Enhanced DatabaseMetaData.getTables() method by adding support for SQL table type names: 'BASE TABLE', 'GLOBAL TEMPORARY' and 'LOCAL TEMPORARY' in parameter types[].
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
825
diff
changeset
|
1945 } else |
b2cbe866d020
Enhanced DatabaseMetaData.getTables() method by adding support for SQL table type names: 'BASE TABLE', 'GLOBAL TEMPORARY' and 'LOCAL TEMPORARY' in parameter types[].
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
825
diff
changeset
|
1946 if ("GLOBAL TEMPORARY".equals(tabletype)) { |
b2cbe866d020
Enhanced DatabaseMetaData.getTables() method by adding support for SQL table type names: 'BASE TABLE', 'GLOBAL TEMPORARY' and 'LOCAL TEMPORARY' in parameter types[].
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
825
diff
changeset
|
1947 tabletype = "GLOBAL TEMPORARY TABLE"; |
b2cbe866d020
Enhanced DatabaseMetaData.getTables() method by adding support for SQL table type names: 'BASE TABLE', 'GLOBAL TEMPORARY' and 'LOCAL TEMPORARY' in parameter types[].
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
825
diff
changeset
|
1948 } else |
b2cbe866d020
Enhanced DatabaseMetaData.getTables() method by adding support for SQL table type names: 'BASE TABLE', 'GLOBAL TEMPORARY' and 'LOCAL TEMPORARY' in parameter types[].
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
825
diff
changeset
|
1949 if ("LOCAL TEMPORARY".equals(tabletype)) { |
b2cbe866d020
Enhanced DatabaseMetaData.getTables() method by adding support for SQL table type names: 'BASE TABLE', 'GLOBAL TEMPORARY' and 'LOCAL TEMPORARY' in parameter types[].
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
825
diff
changeset
|
1950 tabletype = "LOCAL TEMPORARY TABLE"; |
b2cbe866d020
Enhanced DatabaseMetaData.getTables() method by adding support for SQL table type names: 'BASE TABLE', 'GLOBAL TEMPORARY' and 'LOCAL TEMPORARY' in parameter types[].
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
825
diff
changeset
|
1951 } |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1952 if (i > 0) { |
767
1547843b3a9b
Removed code to support old MonetDB servers Oct2014 or older.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
761
diff
changeset
|
1953 query.append(','); |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1954 } |
827
b2cbe866d020
Enhanced DatabaseMetaData.getTables() method by adding support for SQL table type names: 'BASE TABLE', 'GLOBAL TEMPORARY' and 'LOCAL TEMPORARY' in parameter types[].
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
825
diff
changeset
|
1955 query.append('\'').append(tabletype).append('\''); |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1956 } |
767
1547843b3a9b
Removed code to support old MonetDB servers Oct2014 or older.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
761
diff
changeset
|
1957 query.append(')'); |
827
b2cbe866d020
Enhanced DatabaseMetaData.getTables() method by adding support for SQL table type names: 'BASE TABLE', 'GLOBAL TEMPORARY' and 'LOCAL TEMPORARY' in parameter types[].
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
825
diff
changeset
|
1958 // for debug: System.out.println("SQL (len " + query.length() + "): " + query); |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1959 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1960 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1961 query.append(" ORDER BY \"TABLE_TYPE\", \"TABLE_SCHEM\", \"TABLE_NAME\""); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1962 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1963 return executeMetaDataQuery(query.toString()); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1964 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1965 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1966 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1967 * Get the schema names available in this database. The results |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1968 * are ordered by schema name. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1969 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1970 * <P>The schema column is: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1971 * <OL> |
194
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
1972 * <LI><B>TABLE_SCHEM</B> String => schema name |
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
1973 * <LI><B>TABLE_CATALOG</B> String => catalog name (may be null) |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1974 * </OL> |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1975 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1976 * @param catalog a catalog name; must match the catalog name as it |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1977 * is stored in the database;"" retrieves those without a |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1978 * catalog; null means catalog name should not be used to |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1979 * narrow down the search. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1980 * @param schemaPattern a schema name; must match the schema name as |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1981 * it is stored in the database; null means schema name |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1982 * should not be used to narrow down the search. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1983 * @return ResultSet each row has a single String column that is a |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1984 * schema name |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1985 * @throws SQLException if a database error occurs |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1986 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1987 @Override |
295
003ae6d881db
Add "final" keyword to method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
294
diff
changeset
|
1988 public ResultSet getSchemas(final String catalog, final String schemaPattern) |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1989 throws SQLException |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1990 { |
295
003ae6d881db
Add "final" keyword to method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
294
diff
changeset
|
1991 final StringBuilder query = new StringBuilder(170); |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1992 query.append("SELECT \"name\" AS \"TABLE_SCHEM\", " + |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1993 "cast(null as char(1)) AS \"TABLE_CATALOG\" " + |
372
159c628527c4
Optimize SQL query generation by eliminating "WHERE 1=1" conditions
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
371
diff
changeset
|
1994 "FROM \"sys\".\"schemas\" "); |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1995 |
216
116b5a149fb4
Optimise SQL query generation for cases where the WHERE clause already has a AND 1 = 0 condition. Exlude adding more AND ... conditions.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
215
diff
changeset
|
1996 if (catalog != null && !catalog.isEmpty()) { |
299
1f0324072b0c
Correcting typo in comment
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
298
diff
changeset
|
1997 // non-empty catalog selection. |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1998 // as we do not support catalogs this always results in no rows returned |
372
159c628527c4
Optimize SQL query generation by eliminating "WHERE 1=1" conditions
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
371
diff
changeset
|
1999 query.append("WHERE 1=0"); |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2000 } else { |
323
8701024a9bb0
In DatabaseMetaData methods which accept name match patterns, optimise the SQL generation when the pattern equals a: %
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
306
diff
changeset
|
2001 if (schemaPattern != null && !schemaPattern.equals("%")) { |
372
159c628527c4
Optimize SQL query generation by eliminating "WHERE 1=1" conditions
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
371
diff
changeset
|
2002 query.append("WHERE \"name\" ").append(composeMatchPart(schemaPattern)); |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2003 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2004 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2005 query.append(" ORDER BY \"TABLE_SCHEM\""); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2006 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2007 return executeMetaDataQuery(query.toString()); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2008 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2009 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2010 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2011 * Get the catalog names available in this database. The results |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2012 * are ordered by catalog name. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2013 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2014 * <P>The catalog column is: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2015 * <OL> |
194
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
2016 * <LI><B>TABLE_CAT</B> String => catalog name |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2017 * </OL> |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2018 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2019 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2020 * @return ResultSet each row has a single String column that is a |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2021 * catalog name |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2022 * @throws SQLException if a database error occurs |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2023 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2024 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2025 public ResultSet getCatalogs() throws SQLException { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2026 // MonetDB does NOT support catalogs. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2027 // Return a resultset with no rows |
352
f62137dd6050
Remove spaces from static SQL predicates: 1 = 0 and 1 = 1.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
350
diff
changeset
|
2028 return executeMetaDataQuery("SELECT cast(null as char(1)) AS \"TABLE_CAT\" WHERE 1=0"); |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2029 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2030 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2031 /** |
303
a91168efdf27
Small code and doc improvements. Moved helper functions to the bottom.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
302
diff
changeset
|
2032 * Get the table types available in this database. |
a91168efdf27
Small code and doc improvements. Moved helper functions to the bottom.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
302
diff
changeset
|
2033 * The results are ordered by table type. |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2034 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2035 * <P>The table type is: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2036 * <OL> |
194
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
2037 * <LI><B>TABLE_TYPE</B> String => table type. Typical types are "TABLE", |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2038 * "VIEW", "SYSTEM TABLE", "GLOBAL TEMPORARY", |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2039 * "LOCAL TEMPORARY", "ALIAS", "SYNONYM". |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2040 * </OL> |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2041 * |
303
a91168efdf27
Small code and doc improvements. Moved helper functions to the bottom.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
302
diff
changeset
|
2042 * @return ResultSet each row has a single String column that is a table type |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2043 * @throws SQLException if a database error occurs |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2044 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2045 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2046 public ResultSet getTableTypes() throws SQLException { |
767
1547843b3a9b
Removed code to support old MonetDB servers Oct2014 or older.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
761
diff
changeset
|
2047 return executeMetaDataQuery("SELECT \"table_type_name\" AS \"TABLE_TYPE\" FROM \"sys\".\"table_types\" ORDER BY 1"); |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2048 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2049 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2050 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2051 * Get a description of table columns available in a catalog. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2052 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2053 * <P>Only column descriptions matching the catalog, schema, table |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2054 * and column name criteria are returned. They are ordered by |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2055 * TABLE_SCHEM, TABLE_NAME and ORDINAL_POSITION. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2056 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2057 * <P>Each column description has the following columns: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2058 * <OL> |
194
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
2059 * <LI><B>TABLE_CAT</B> String => table catalog (may be null) |
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
2060 * <LI><B>TABLE_SCHEM</B> String => table schema (may be null) |
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
2061 * <LI><B>TABLE_NAME</B> String => table name |
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
2062 * <LI><B>COLUMN_NAME</B> String => column name |
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
2063 * <LI><B>DATA_TYPE</B> int => SQL type from java.sql.Types |
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
2064 * <LI><B>TYPE_NAME</B> String => Data source dependent type name |
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
2065 * <LI><B>COLUMN_SIZE</B> int => column size. For char or date |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2066 * types this is the maximum number of characters, for numeric or |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2067 * decimal types this is precision. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2068 * <LI><B>BUFFER_LENGTH</B> is not used. |
194
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
2069 * <LI><B>DECIMAL_DIGITS</B> int => the number of fractional digits |
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
2070 * <LI><B>NUM_PREC_RADIX</B> int => Radix (typically either 10 or 2) |
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
2071 * <LI><B>NULLABLE</B> int => is NULL allowed? |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2072 * <UL> |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2073 * <LI> columnNoNulls - might not allow NULL values |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2074 * <LI> columnNullable - definitely allows NULL values |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2075 * <LI> columnNullableUnknown - nullability unknown |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2076 * </UL> |
194
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
2077 * <LI><B>REMARKS</B> String => comment describing column (may be null) |
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
2078 * <LI><B>COLUMN_DEF</B> String => default value (may be null) |
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
2079 * <LI><B>SQL_DATA_TYPE</B> int => unused |
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
2080 * <LI><B>SQL_DATETIME_SUB</B> int => unused |
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
2081 * <LI><B>CHAR_OCTET_LENGTH</B> int => for char types the |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2082 * maximum number of bytes in the column |
194
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
2083 * <LI><B>ORDINAL_POSITION</B> int => index of column in table |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2084 * (starting at 1) |
194
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
2085 * <LI><B>IS_NULLABLE</B> String => "NO" means column definitely |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2086 * does not allow NULL values; "YES" means the column might |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2087 * allow NULL values. An empty string means nobody knows. |
194
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
2088 * <LI><B>SCOPE_CATALOG</B> String => catalog of table that is the scope of a reference attribute (null if DATA_TYPE isn't REF) |
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
2089 * <LI><B>SCOPE_SCHEMA</B> String => schema of table that is the scope of a reference attribute (null if the DATA_TYPE isn't REF) |
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
2090 * <LI><B>SCOPE_TABLE</B> String => table name that this the scope of a reference attribute (null if the DATA_TYPE isn't REF) |
652
6a34d2c36dec
Improved and optimized DatabaseMetaData.getBestRowIdentifier().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
649
diff
changeset
|
2091 * <LI><B>SOURCE_DATA_TYPE</B> short => source type of a distinct type or user-generated Ref type, |
6a34d2c36dec
Improved and optimized DatabaseMetaData.getBestRowIdentifier().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
649
diff
changeset
|
2092 * SQL type from java.sql.Types (null if DATA_TYPE isn't DISTINCT or user-generated REF) |
194
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
2093 * <LI><B>IS_AUTOINCREMENT</B> String => Indicates whether this column is auto incremented |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2094 * <UL> |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2095 * <LI> YES --- if the column is auto incremented |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2096 * <LI> NO --- if the column is not auto incremented |
15
6e48d0fae766
Corrected return values of DatabaseMetaData methods nullsAreSortedHigh(), nullsAreSortedLow(),
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
7
diff
changeset
|
2097 * <LI> empty string --- if it cannot be determined whether the column is auto incremented |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2098 * </UL> |
194
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
2099 * <LI><B>IS_GENERATEDCOLUMN</B> String => Indicates whether this is a generated column |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2100 * <UL> |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2101 * <LI> YES --- if this a generated column |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2102 * <LI> NO --- if this not a generated column |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2103 * <LI> empty string --- if it cannot be determined whether this is a generated column |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2104 * </UL> |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2105 * </OL> |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2106 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2107 * @param catalog - a catalog name; must match the catalog name as it is stored in the database; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2108 * "" retrieves those without a catalog; null means that the |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2109 * catalog name should not be used to narrow the search |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2110 * @param schemaPattern - a schema name pattern; must match the schema name as it is stored |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2111 * in the database; "" retrieves those without a schema; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2112 * null means that the schema name should not be used to narrow the search |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2113 * @param tableNamePattern - a table name pattern; must match the table name as it is stored in the database |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2114 * For all tables this should be "%" |
371
67fa5c6147d7
Correct SQL syntax in comment (LIKE "%" is not valid SQL in WHERE clause)
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
370
diff
changeset
|
2115 * Note that our implementation allows this param to be null also (for efficiency as no extra LIKE '%' condition is added to be evaluated). |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2116 * @param columnNamePattern - a column name pattern; must match the column name as it is stored in the database |
371
67fa5c6147d7
Correct SQL syntax in comment (LIKE "%" is not valid SQL in WHERE clause)
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
370
diff
changeset
|
2117 * Note that our implementation allows this param to be null also (for efficiency as no extra LIKE '%' condition is added to be evaluated). |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2118 * @return ResultSet - each row is a column description |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2119 * @throws SQLException if a database error occurs |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2120 * @see #getSearchStringEscape |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2121 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2122 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2123 public ResultSet getColumns( |
295
003ae6d881db
Add "final" keyword to method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
294
diff
changeset
|
2124 final String catalog, |
003ae6d881db
Add "final" keyword to method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
294
diff
changeset
|
2125 final String schemaPattern, |
003ae6d881db
Add "final" keyword to method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
294
diff
changeset
|
2126 final String tableNamePattern, |
003ae6d881db
Add "final" keyword to method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
294
diff
changeset
|
2127 final String columnNamePattern |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2128 ) throws SQLException |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2129 { |
332
e8962bdaa206
Moved utility methods and associated caches from DatabaseMetaData to Connection object.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
331
diff
changeset
|
2130 final boolean useCommentsTable = con.commentsTableExists(); |
295
003ae6d881db
Add "final" keyword to method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
294
diff
changeset
|
2131 final StringBuilder query = new StringBuilder(2450); |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2132 query.append("SELECT cast(null as char(1)) AS \"TABLE_CAT\", " + |
302
1b6c514106ce
Added table aliases and use them in all meta data SQL queries to reduce query size.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
300
diff
changeset
|
2133 "s.\"name\" AS \"TABLE_SCHEM\", " + |
1b6c514106ce
Added table aliases and use them in all meta data SQL queries to reduce query size.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
300
diff
changeset
|
2134 "t.\"name\" AS \"TABLE_NAME\", " + |
1b6c514106ce
Added table aliases and use them in all meta data SQL queries to reduce query size.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
300
diff
changeset
|
2135 "c.\"name\" AS \"COLUMN_NAME\", " + |
1b6c514106ce
Added table aliases and use them in all meta data SQL queries to reduce query size.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
300
diff
changeset
|
2136 "cast(").append(MonetDriver.getSQLTypeMap("c.\"type\"")).append(" AS int) AS \"DATA_TYPE\", " + |
1b6c514106ce
Added table aliases and use them in all meta data SQL queries to reduce query size.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
300
diff
changeset
|
2137 "c.\"type\" AS \"TYPE_NAME\", " + |
1b6c514106ce
Added table aliases and use them in all meta data SQL queries to reduce query size.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
300
diff
changeset
|
2138 "c.\"type_digits\" AS \"COLUMN_SIZE\", " + |
331
6ed8f5b1f9ed
Corrected method DatabaseMetaData.getBestRowIdentifier(). It used to return columns of both primary key and unique constraints. Now it only returns the columns of the primary key if it has one, else columns of a unique constraint.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
323
diff
changeset
|
2139 "cast(0 as int) AS \"BUFFER_LENGTH\", " + |
302
1b6c514106ce
Added table aliases and use them in all meta data SQL queries to reduce query size.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
300
diff
changeset
|
2140 "c.\"type_scale\" AS \"DECIMAL_DIGITS\", " + |
379
d7661075ebf7
Add support for new (as of Oct2020 release) datatype: day_interval
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
376
diff
changeset
|
2141 "cast(CASE WHEN c.\"type\" IN ('decimal','numeric','day_interval','month_interval','sec_interval') THEN 10 " + |
d7661075ebf7
Add support for new (as of Oct2020 release) datatype: day_interval
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
376
diff
changeset
|
2142 "WHEN c.\"type\" IN ('int','smallint','tinyint','bigint','hugeint','float','real','double','oid','wrd') THEN 2 " + |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2143 "ELSE 0 END AS int) AS \"NUM_PREC_RADIX\", " + |
759
846a456f0f0c
Remove append() calls for static int values in construction of Strings.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
757
diff
changeset
|
2144 "cast(CASE c.\"null\" WHEN true THEN " + ResultSetMetaData.columnNullable + |
846a456f0f0c
Remove append() calls for static int values in construction of Strings.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
757
diff
changeset
|
2145 " WHEN false THEN " + ResultSetMetaData.columnNoNulls + |
846a456f0f0c
Remove append() calls for static int values in construction of Strings.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
757
diff
changeset
|
2146 " ELSE " + ResultSetMetaData.columnNullableUnknown + |
846a456f0f0c
Remove append() calls for static int values in construction of Strings.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
757
diff
changeset
|
2147 " END AS int) AS \"NULLABLE\", ") |
302
1b6c514106ce
Added table aliases and use them in all meta data SQL queries to reduce query size.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
300
diff
changeset
|
2148 .append(useCommentsTable ? "cm.\"remark\"" : "cast(null AS varchar(9999))").append(" AS \"REMARKS\", " + |
1b6c514106ce
Added table aliases and use them in all meta data SQL queries to reduce query size.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
300
diff
changeset
|
2149 "c.\"default\" AS \"COLUMN_DEF\", " + |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2150 "cast(0 as int) AS \"SQL_DATA_TYPE\", " + |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2151 "cast(0 as int) AS \"SQL_DATETIME_SUB\", " + |
822
ad4491372c2c
Prevent sql processor to produce server msg: mul_int_bte_int: ERROR: 22003!overflow in calculation 2147483647*4.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
818
diff
changeset
|
2152 "cast(CASE WHEN c.\"type\" IN ('varchar','clob','char','json','url','xml') THEN 4 * cast(c.\"type_digits\" as bigint) ELSE NULL END as bigint) AS \"CHAR_OCTET_LENGTH\", " + |
302
1b6c514106ce
Added table aliases and use them in all meta data SQL queries to reduce query size.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
300
diff
changeset
|
2153 "cast(c.\"number\" + 1 as int) AS \"ORDINAL_POSITION\", " + |
1b6c514106ce
Added table aliases and use them in all meta data SQL queries to reduce query size.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
300
diff
changeset
|
2154 "cast(CASE c.\"null\" WHEN true THEN 'YES' WHEN false THEN 'NO' ELSE '' END AS varchar(3)) AS \"IS_NULLABLE\", " + |
217
7cbd20ff628c
Removed DISTINCT from SELECT DISTINCT where it should not be needed (in getTables() and getFunctionColumns())
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
216
diff
changeset
|
2155 "cast(null AS char(1)) AS \"SCOPE_CATALOG\", " + |
7cbd20ff628c
Removed DISTINCT from SELECT DISTINCT where it should not be needed (in getTables() and getFunctionColumns())
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
216
diff
changeset
|
2156 "cast(null AS char(1)) AS \"SCOPE_SCHEMA\", " + |
7cbd20ff628c
Removed DISTINCT from SELECT DISTINCT where it should not be needed (in getTables() and getFunctionColumns())
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
216
diff
changeset
|
2157 "cast(null AS char(1)) AS \"SCOPE_TABLE\", " + |
168
70630bc76ac6
Correct returned value for column SOURCE_DATA_TYPE of method getColumns().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
146
diff
changeset
|
2158 "cast(null AS smallint) AS \"SOURCE_DATA_TYPE\", " + |
302
1b6c514106ce
Added table aliases and use them in all meta data SQL queries to reduce query size.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
300
diff
changeset
|
2159 "cast(CASE WHEN c.\"default\" IS NOT NULL AND c.\"default\" LIKE 'next value for %' THEN 'YES' ELSE 'NO' END AS varchar(3)) AS \"IS_AUTOINCREMENT\", " + |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2160 "cast('NO' AS varchar(3)) AS \"IS_GENERATEDCOLUMN\" " + |
302
1b6c514106ce
Added table aliases and use them in all meta data SQL queries to reduce query size.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
300
diff
changeset
|
2161 "FROM \"sys\".\"columns\" c " + |
1b6c514106ce
Added table aliases and use them in all meta data SQL queries to reduce query size.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
300
diff
changeset
|
2162 "JOIN \"sys\".\"tables\" t ON c.\"table_id\" = t.\"id\" " + |
1b6c514106ce
Added table aliases and use them in all meta data SQL queries to reduce query size.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
300
diff
changeset
|
2163 "JOIN \"sys\".\"schemas\" s ON t.\"schema_id\" = s.\"id\" "); |
215
71b039bc2d99
Added support for querying the sys.comments table for some meta data methods
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
213
diff
changeset
|
2164 if (useCommentsTable) { |
302
1b6c514106ce
Added table aliases and use them in all meta data SQL queries to reduce query size.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
300
diff
changeset
|
2165 query.append("LEFT OUTER JOIN \"sys\".\"comments\" cm ON c.\"id\" = cm.\"id\" "); |
215
71b039bc2d99
Added support for querying the sys.comments table for some meta data methods
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
213
diff
changeset
|
2166 } |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2167 |
216
116b5a149fb4
Optimise SQL query generation for cases where the WHERE clause already has a AND 1 = 0 condition. Exlude adding more AND ... conditions.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
215
diff
changeset
|
2168 if (catalog != null && !catalog.isEmpty()) { |
299
1f0324072b0c
Correcting typo in comment
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
298
diff
changeset
|
2169 // non-empty catalog selection. |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2170 // as we do not support catalogs this always results in no rows returned |
372
159c628527c4
Optimize SQL query generation by eliminating "WHERE 1=1" conditions
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
371
diff
changeset
|
2171 query.append("WHERE 1=0"); |
216
116b5a149fb4
Optimise SQL query generation for cases where the WHERE clause already has a AND 1 = 0 condition. Exlude adding more AND ... conditions.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
215
diff
changeset
|
2172 } else { |
372
159c628527c4
Optimize SQL query generation by eliminating "WHERE 1=1" conditions
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
371
diff
changeset
|
2173 boolean needWhere = true; |
323
8701024a9bb0
In DatabaseMetaData methods which accept name match patterns, optimise the SQL generation when the pattern equals a: %
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
306
diff
changeset
|
2174 if (schemaPattern != null && !schemaPattern.equals("%")) { |
372
159c628527c4
Optimize SQL query generation by eliminating "WHERE 1=1" conditions
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
371
diff
changeset
|
2175 query.append("WHERE s.\"name\" ").append(composeMatchPart(schemaPattern)); |
159c628527c4
Optimize SQL query generation by eliminating "WHERE 1=1" conditions
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
371
diff
changeset
|
2176 needWhere = false; |
216
116b5a149fb4
Optimise SQL query generation for cases where the WHERE clause already has a AND 1 = 0 condition. Exlude adding more AND ... conditions.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
215
diff
changeset
|
2177 } |
323
8701024a9bb0
In DatabaseMetaData methods which accept name match patterns, optimise the SQL generation when the pattern equals a: %
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
306
diff
changeset
|
2178 if (tableNamePattern != null && !tableNamePattern.equals("%")) { |
372
159c628527c4
Optimize SQL query generation by eliminating "WHERE 1=1" conditions
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
371
diff
changeset
|
2179 query.append(needWhere ? "WHERE" : " AND") |
159c628527c4
Optimize SQL query generation by eliminating "WHERE 1=1" conditions
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
371
diff
changeset
|
2180 .append(" t.\"name\" ").append(composeMatchPart(tableNamePattern)); |
159c628527c4
Optimize SQL query generation by eliminating "WHERE 1=1" conditions
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
371
diff
changeset
|
2181 needWhere = false; |
216
116b5a149fb4
Optimise SQL query generation for cases where the WHERE clause already has a AND 1 = 0 condition. Exlude adding more AND ... conditions.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
215
diff
changeset
|
2182 } |
323
8701024a9bb0
In DatabaseMetaData methods which accept name match patterns, optimise the SQL generation when the pattern equals a: %
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
306
diff
changeset
|
2183 if (columnNamePattern != null && !columnNamePattern.equals("%")) { |
372
159c628527c4
Optimize SQL query generation by eliminating "WHERE 1=1" conditions
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
371
diff
changeset
|
2184 query.append(needWhere ? "WHERE" : " AND") |
159c628527c4
Optimize SQL query generation by eliminating "WHERE 1=1" conditions
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
371
diff
changeset
|
2185 .append(" c.\"name\" ").append(composeMatchPart(columnNamePattern)); |
216
116b5a149fb4
Optimise SQL query generation for cases where the WHERE clause already has a AND 1 = 0 condition. Exlude adding more AND ... conditions.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
215
diff
changeset
|
2186 } |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2187 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2188 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2189 query.append(" ORDER BY \"TABLE_SCHEM\", \"TABLE_NAME\", \"ORDINAL_POSITION\""); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2190 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2191 return executeMetaDataQuery(query.toString()); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2192 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2193 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2194 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2195 * Get a description of the access rights for a table's columns. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2196 * MonetDB doesn't have this level of access rights. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2197 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2198 * <P>Only privileges matching the column name criteria are |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2199 * returned. They are ordered by COLUMN_NAME and PRIVILEGE. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2200 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2201 * <P>Each privilige description has the following columns: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2202 * <OL> |
194
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
2203 * <LI><B>TABLE_CAT</B> String => table catalog (may be null) |
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
2204 * <LI><B>TABLE_SCHEM</B> String => table schema (may be null) |
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
2205 * <LI><B>TABLE_NAME</B> String => table name |
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
2206 * <LI><B>COLUMN_NAME</B> String => column name |
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
2207 * <LI><B>GRANTOR</B> => grantor of access (may be null) |
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
2208 * <LI><B>GRANTEE</B> String => grantee of access |
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
2209 * <LI><B>PRIVILEGE</B> String => name of access (SELECT, |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2210 * INSERT, UPDATE, REFRENCES, ...) |
194
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
2211 * <LI><B>IS_GRANTABLE</B> String => "YES" if grantee is permitted |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2212 * to grant to others; "NO" if not; null if unknown |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2213 * </OL> |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2214 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2215 * @param catalog a catalog name; "" retrieves those without a catalog |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2216 * @param schemaPattern a schema name; "" retrieves those without a schema |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2217 * @param tableNamePattern a table name |
371
67fa5c6147d7
Correct SQL syntax in comment (LIKE "%" is not valid SQL in WHERE clause)
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
370
diff
changeset
|
2218 * Note that our implementation allows this param to be null also (for efficiency as no extra LIKE '%' condition is added to be evaluated). |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2219 * @param columnNamePattern a column name pattern |
371
67fa5c6147d7
Correct SQL syntax in comment (LIKE "%" is not valid SQL in WHERE clause)
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
370
diff
changeset
|
2220 * Note that our implementation allows this param to be null also (for efficiency as no extra LIKE '%' condition is added to be evaluated). |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2221 * @return ResultSet each row is a column privilege description |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2222 * @see #getSearchStringEscape |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2223 * @throws SQLException if a database error occurs |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2224 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2225 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2226 public ResultSet getColumnPrivileges( |
295
003ae6d881db
Add "final" keyword to method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
294
diff
changeset
|
2227 final String catalog, |
003ae6d881db
Add "final" keyword to method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
294
diff
changeset
|
2228 final String schemaPattern, |
003ae6d881db
Add "final" keyword to method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
294
diff
changeset
|
2229 final String tableNamePattern, |
003ae6d881db
Add "final" keyword to method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
294
diff
changeset
|
2230 final String columnNamePattern |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2231 ) throws SQLException |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2232 { |
332
e8962bdaa206
Moved utility methods and associated caches from DatabaseMetaData to Connection object.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
331
diff
changeset
|
2233 final boolean usePrivilege_codesTable = con.privilege_codesTableExists(); |
295
003ae6d881db
Add "final" keyword to method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
294
diff
changeset
|
2234 final StringBuilder query = new StringBuilder(1100); |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2235 query.append("SELECT cast(null as char(1)) AS \"TABLE_CAT\", " + |
302
1b6c514106ce
Added table aliases and use them in all meta data SQL queries to reduce query size.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
300
diff
changeset
|
2236 "s.\"name\" AS \"TABLE_SCHEM\", " + |
1b6c514106ce
Added table aliases and use them in all meta data SQL queries to reduce query size.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
300
diff
changeset
|
2237 "t.\"name\" AS \"TABLE_NAME\", " + |
1b6c514106ce
Added table aliases and use them in all meta data SQL queries to reduce query size.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
300
diff
changeset
|
2238 "c.\"name\" AS \"COLUMN_NAME\", " + |
1b6c514106ce
Added table aliases and use them in all meta data SQL queries to reduce query size.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
300
diff
changeset
|
2239 "grantors.\"name\" AS \"GRANTOR\", " + |
1b6c514106ce
Added table aliases and use them in all meta data SQL queries to reduce query size.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
300
diff
changeset
|
2240 "grantees.\"name\" AS \"GRANTEE\", ") |
1b6c514106ce
Added table aliases and use them in all meta data SQL queries to reduce query size.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
300
diff
changeset
|
2241 .append(usePrivilege_codesTable ? "pc.\"privilege_code_name\"" : |
1b6c514106ce
Added table aliases and use them in all meta data SQL queries to reduce query size.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
300
diff
changeset
|
2242 "cast(CASE p.\"privileges\" " + |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2243 "WHEN 1 THEN 'SELECT' " + |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2244 "WHEN 2 THEN 'UPDATE' " + |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2245 "WHEN 4 THEN 'INSERT' " + |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2246 "WHEN 8 THEN 'DELETE' " + |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2247 "WHEN 16 THEN 'EXECUTE' " + |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2248 "WHEN 32 THEN 'GRANT' " + |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2249 "ELSE NULL " + |
219
4572f0694fde
Improved DatabaseMetaData methods getTablePrivileges() and getColumnPrivileges() by returning also
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
218
diff
changeset
|
2250 "END AS varchar(7))").append(" AS \"PRIVILEGE\", " + |
302
1b6c514106ce
Added table aliases and use them in all meta data SQL queries to reduce query size.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
300
diff
changeset
|
2251 "cast(CASE p.\"grantable\" " + |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2252 "WHEN 0 THEN 'NO' " + |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2253 "WHEN 1 THEN 'YES' " + |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2254 "ELSE NULL " + |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2255 "END AS varchar(3)) AS \"IS_GRANTABLE\" " + |
302
1b6c514106ce
Added table aliases and use them in all meta data SQL queries to reduce query size.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
300
diff
changeset
|
2256 "FROM \"sys\".\"privileges\" p " + |
1b6c514106ce
Added table aliases and use them in all meta data SQL queries to reduce query size.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
300
diff
changeset
|
2257 "JOIN \"sys\".\"columns\" c ON p.\"obj_id\" = c.\"id\" " + |
1b6c514106ce
Added table aliases and use them in all meta data SQL queries to reduce query size.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
300
diff
changeset
|
2258 "JOIN \"sys\".\"tables\" t ON c.\"table_id\" = t.\"id\" " + |
1b6c514106ce
Added table aliases and use them in all meta data SQL queries to reduce query size.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
300
diff
changeset
|
2259 "JOIN \"sys\".\"schemas\" s ON t.\"schema_id\" = s.\"id\" " + |
1b6c514106ce
Added table aliases and use them in all meta data SQL queries to reduce query size.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
300
diff
changeset
|
2260 "JOIN \"sys\".\"auths\" grantors ON p.\"grantor\" = grantors.\"id\" " + |
1b6c514106ce
Added table aliases and use them in all meta data SQL queries to reduce query size.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
300
diff
changeset
|
2261 "JOIN \"sys\".\"auths\" grantees ON p.\"auth_id\" = grantees.\"id\" "); |
219
4572f0694fde
Improved DatabaseMetaData methods getTablePrivileges() and getColumnPrivileges() by returning also
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
218
diff
changeset
|
2262 if (usePrivilege_codesTable) { |
302
1b6c514106ce
Added table aliases and use them in all meta data SQL queries to reduce query size.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
300
diff
changeset
|
2263 query.append("JOIN \"sys\".\"privilege_codes\" pc ON p.\"privileges\" = pc.\"privilege_code_id\" "); |
219
4572f0694fde
Improved DatabaseMetaData methods getTablePrivileges() and getColumnPrivileges() by returning also
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
218
diff
changeset
|
2264 } |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2265 |
216
116b5a149fb4
Optimise SQL query generation for cases where the WHERE clause already has a AND 1 = 0 condition. Exlude adding more AND ... conditions.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
215
diff
changeset
|
2266 if (catalog != null && !catalog.isEmpty()) { |
299
1f0324072b0c
Correcting typo in comment
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
298
diff
changeset
|
2267 // non-empty catalog selection. |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2268 // as we do not support catalogs this always results in no rows returned |
372
159c628527c4
Optimize SQL query generation by eliminating "WHERE 1=1" conditions
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
371
diff
changeset
|
2269 query.append("WHERE 1=0"); |
216
116b5a149fb4
Optimise SQL query generation for cases where the WHERE clause already has a AND 1 = 0 condition. Exlude adding more AND ... conditions.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
215
diff
changeset
|
2270 } else { |
372
159c628527c4
Optimize SQL query generation by eliminating "WHERE 1=1" conditions
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
371
diff
changeset
|
2271 boolean needWhere = true; |
323
8701024a9bb0
In DatabaseMetaData methods which accept name match patterns, optimise the SQL generation when the pattern equals a: %
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
306
diff
changeset
|
2272 if (schemaPattern != null && !schemaPattern.equals("%")) { |
372
159c628527c4
Optimize SQL query generation by eliminating "WHERE 1=1" conditions
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
371
diff
changeset
|
2273 query.append("WHERE s.\"name\" ").append(composeMatchPart(schemaPattern)); |
159c628527c4
Optimize SQL query generation by eliminating "WHERE 1=1" conditions
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
371
diff
changeset
|
2274 needWhere = false; |
216
116b5a149fb4
Optimise SQL query generation for cases where the WHERE clause already has a AND 1 = 0 condition. Exlude adding more AND ... conditions.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
215
diff
changeset
|
2275 } |
323
8701024a9bb0
In DatabaseMetaData methods which accept name match patterns, optimise the SQL generation when the pattern equals a: %
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
306
diff
changeset
|
2276 if (tableNamePattern != null && !tableNamePattern.equals("%")) { |
372
159c628527c4
Optimize SQL query generation by eliminating "WHERE 1=1" conditions
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
371
diff
changeset
|
2277 query.append(needWhere ? "WHERE" : " AND") |
159c628527c4
Optimize SQL query generation by eliminating "WHERE 1=1" conditions
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
371
diff
changeset
|
2278 .append(" t.\"name\" ").append(composeMatchPart(tableNamePattern)); |
159c628527c4
Optimize SQL query generation by eliminating "WHERE 1=1" conditions
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
371
diff
changeset
|
2279 needWhere = false; |
216
116b5a149fb4
Optimise SQL query generation for cases where the WHERE clause already has a AND 1 = 0 condition. Exlude adding more AND ... conditions.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
215
diff
changeset
|
2280 } |
323
8701024a9bb0
In DatabaseMetaData methods which accept name match patterns, optimise the SQL generation when the pattern equals a: %
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
306
diff
changeset
|
2281 if (columnNamePattern != null && !columnNamePattern.equals("%")) { |
372
159c628527c4
Optimize SQL query generation by eliminating "WHERE 1=1" conditions
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
371
diff
changeset
|
2282 query.append(needWhere ? "WHERE" : " AND") |
159c628527c4
Optimize SQL query generation by eliminating "WHERE 1=1" conditions
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
371
diff
changeset
|
2283 .append(" c.\"name\" ").append(composeMatchPart(columnNamePattern)); |
216
116b5a149fb4
Optimise SQL query generation for cases where the WHERE clause already has a AND 1 = 0 condition. Exlude adding more AND ... conditions.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
215
diff
changeset
|
2284 } |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2285 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2286 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2287 query.append(" ORDER BY \"TABLE_SCHEM\", \"TABLE_NAME\", \"COLUMN_NAME\", \"PRIVILEGE\""); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2288 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2289 return executeMetaDataQuery(query.toString()); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2290 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2291 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2292 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2293 * Get a description of the access rights for each table available |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2294 * in a catalog. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2295 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2296 * <P>Only privileges matching the schema and table name |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2297 * criteria are returned. They are ordered by TABLE_SCHEM, |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2298 * TABLE_NAME, and PRIVILEGE. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2299 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2300 * <P>Each privilege description has the following columns: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2301 * <OL> |
194
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
2302 * <LI><B>TABLE_CAT</B> String => table catalog (may be null) |
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
2303 * <LI><B>TABLE_SCHEM</B> String => table schema (may be null) |
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
2304 * <LI><B>TABLE_NAME</B> String => table name |
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
2305 * <LI><B>GRANTOR</B> => grantor of access (may be null) |
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
2306 * <LI><B>GRANTEE</B> String => grantee of access |
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
2307 * <LI><B>PRIVILEGE</B> String => name of access (SELECT, |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2308 * INSERT, UPDATE, REFRENCES, ...) |
194
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
2309 * <LI><B>IS_GRANTABLE</B> String => "YES" if grantee is permitted |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2310 * to grant to others; "NO" if not; null if unknown |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2311 * </OL> |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2312 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2313 * @param catalog a catalog name; "" retrieves those without a catalog |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2314 * @param schemaPattern a schema name pattern; "" retrieves those without a schema |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2315 * @param tableNamePattern a table name pattern |
371
67fa5c6147d7
Correct SQL syntax in comment (LIKE "%" is not valid SQL in WHERE clause)
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
370
diff
changeset
|
2316 * Note that our implementation allows this param to be null also (for efficiency as no extra LIKE '%' condition is added to be evaluated). |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2317 * @return ResultSet each row is a table privilege description |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2318 * @see #getSearchStringEscape |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2319 * @throws SQLException if a database error occurs |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2320 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2321 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2322 public ResultSet getTablePrivileges( |
295
003ae6d881db
Add "final" keyword to method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
294
diff
changeset
|
2323 final String catalog, |
003ae6d881db
Add "final" keyword to method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
294
diff
changeset
|
2324 final String schemaPattern, |
003ae6d881db
Add "final" keyword to method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
294
diff
changeset
|
2325 final String tableNamePattern |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2326 ) throws SQLException |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2327 { |
332
e8962bdaa206
Moved utility methods and associated caches from DatabaseMetaData to Connection object.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
331
diff
changeset
|
2328 final boolean usePrivilege_codesTable = con.privilege_codesTableExists(); |
295
003ae6d881db
Add "final" keyword to method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
294
diff
changeset
|
2329 final StringBuilder query = new StringBuilder(1000); |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2330 query.append("SELECT cast(null as char(1)) AS \"TABLE_CAT\", " + |
302
1b6c514106ce
Added table aliases and use them in all meta data SQL queries to reduce query size.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
300
diff
changeset
|
2331 "s.\"name\" AS \"TABLE_SCHEM\", " + |
1b6c514106ce
Added table aliases and use them in all meta data SQL queries to reduce query size.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
300
diff
changeset
|
2332 "t.\"name\" AS \"TABLE_NAME\", " + |
1b6c514106ce
Added table aliases and use them in all meta data SQL queries to reduce query size.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
300
diff
changeset
|
2333 "grantors.\"name\" AS \"GRANTOR\", " + |
1b6c514106ce
Added table aliases and use them in all meta data SQL queries to reduce query size.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
300
diff
changeset
|
2334 "grantees.\"name\" AS \"GRANTEE\", ") |
1b6c514106ce
Added table aliases and use them in all meta data SQL queries to reduce query size.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
300
diff
changeset
|
2335 .append(usePrivilege_codesTable ? "pc.\"privilege_code_name\"" : |
1b6c514106ce
Added table aliases and use them in all meta data SQL queries to reduce query size.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
300
diff
changeset
|
2336 "cast(CASE p.\"privileges\" " + |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2337 "WHEN 1 THEN 'SELECT' " + |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2338 "WHEN 2 THEN 'UPDATE' " + |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2339 "WHEN 4 THEN 'INSERT' " + |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2340 "WHEN 8 THEN 'DELETE' " + |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2341 "WHEN 16 THEN 'EXECUTE' " + |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2342 "WHEN 32 THEN 'GRANT' " + |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2343 "ELSE NULL " + |
219
4572f0694fde
Improved DatabaseMetaData methods getTablePrivileges() and getColumnPrivileges() by returning also
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
218
diff
changeset
|
2344 "END AS varchar(7))").append(" AS \"PRIVILEGE\", " + |
302
1b6c514106ce
Added table aliases and use them in all meta data SQL queries to reduce query size.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
300
diff
changeset
|
2345 "cast(CASE p.\"grantable\" " + |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2346 "WHEN 0 THEN 'NO' " + |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2347 "WHEN 1 THEN 'YES' " + |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2348 "ELSE NULL " + |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2349 "END AS varchar(3)) AS \"IS_GRANTABLE\" " + |
302
1b6c514106ce
Added table aliases and use them in all meta data SQL queries to reduce query size.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
300
diff
changeset
|
2350 "FROM \"sys\".\"privileges\" p " + |
1b6c514106ce
Added table aliases and use them in all meta data SQL queries to reduce query size.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
300
diff
changeset
|
2351 "JOIN \"sys\".\"tables\" t ON p.\"obj_id\" = t.\"id\" " + |
1b6c514106ce
Added table aliases and use them in all meta data SQL queries to reduce query size.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
300
diff
changeset
|
2352 "JOIN \"sys\".\"schemas\" s ON t.\"schema_id\" = s.\"id\" " + |
1b6c514106ce
Added table aliases and use them in all meta data SQL queries to reduce query size.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
300
diff
changeset
|
2353 "JOIN \"sys\".\"auths\" grantors ON p.\"grantor\" = grantors.\"id\" " + |
1b6c514106ce
Added table aliases and use them in all meta data SQL queries to reduce query size.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
300
diff
changeset
|
2354 "JOIN \"sys\".\"auths\" grantees ON p.\"auth_id\" = grantees.\"id\" "); |
219
4572f0694fde
Improved DatabaseMetaData methods getTablePrivileges() and getColumnPrivileges() by returning also
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
218
diff
changeset
|
2355 if (usePrivilege_codesTable) { |
302
1b6c514106ce
Added table aliases and use them in all meta data SQL queries to reduce query size.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
300
diff
changeset
|
2356 query.append("JOIN \"sys\".\"privilege_codes\" pc ON p.\"privileges\" = pc.\"privilege_code_id\" "); |
219
4572f0694fde
Improved DatabaseMetaData methods getTablePrivileges() and getColumnPrivileges() by returning also
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
218
diff
changeset
|
2357 } |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2358 |
216
116b5a149fb4
Optimise SQL query generation for cases where the WHERE clause already has a AND 1 = 0 condition. Exlude adding more AND ... conditions.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
215
diff
changeset
|
2359 if (catalog != null && !catalog.isEmpty()) { |
299
1f0324072b0c
Correcting typo in comment
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
298
diff
changeset
|
2360 // non-empty catalog selection. |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2361 // as we do not support catalogs this always results in no rows returned |
372
159c628527c4
Optimize SQL query generation by eliminating "WHERE 1=1" conditions
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
371
diff
changeset
|
2362 query.append("WHERE 1=0"); |
216
116b5a149fb4
Optimise SQL query generation for cases where the WHERE clause already has a AND 1 = 0 condition. Exlude adding more AND ... conditions.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
215
diff
changeset
|
2363 } else { |
372
159c628527c4
Optimize SQL query generation by eliminating "WHERE 1=1" conditions
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
371
diff
changeset
|
2364 boolean needWhere = true; |
323
8701024a9bb0
In DatabaseMetaData methods which accept name match patterns, optimise the SQL generation when the pattern equals a: %
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
306
diff
changeset
|
2365 if (schemaPattern != null && !schemaPattern.equals("%")) { |
372
159c628527c4
Optimize SQL query generation by eliminating "WHERE 1=1" conditions
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
371
diff
changeset
|
2366 query.append("WHERE s.\"name\" ").append(composeMatchPart(schemaPattern)); |
159c628527c4
Optimize SQL query generation by eliminating "WHERE 1=1" conditions
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
371
diff
changeset
|
2367 needWhere = false; |
216
116b5a149fb4
Optimise SQL query generation for cases where the WHERE clause already has a AND 1 = 0 condition. Exlude adding more AND ... conditions.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
215
diff
changeset
|
2368 } |
323
8701024a9bb0
In DatabaseMetaData methods which accept name match patterns, optimise the SQL generation when the pattern equals a: %
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
306
diff
changeset
|
2369 if (tableNamePattern != null && !tableNamePattern.equals("%")) { |
372
159c628527c4
Optimize SQL query generation by eliminating "WHERE 1=1" conditions
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
371
diff
changeset
|
2370 query.append(needWhere ? "WHERE" : " AND") |
159c628527c4
Optimize SQL query generation by eliminating "WHERE 1=1" conditions
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
371
diff
changeset
|
2371 .append(" t.\"name\" ").append(composeMatchPart(tableNamePattern)); |
216
116b5a149fb4
Optimise SQL query generation for cases where the WHERE clause already has a AND 1 = 0 condition. Exlude adding more AND ... conditions.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
215
diff
changeset
|
2372 } |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2373 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2374 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2375 query.append(" ORDER BY \"TABLE_SCHEM\", \"TABLE_NAME\", \"PRIVILEGE\""); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2376 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2377 return executeMetaDataQuery(query.toString()); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2378 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2379 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2380 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2381 * Get a description of a table's optimal set of columns that |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2382 * uniquely identifies a row. They are ordered by SCOPE. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2383 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2384 * <P>Each column description has the following columns: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2385 * <OL> |
194
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
2386 * <LI><B>SCOPE</B> short => actual scope of result |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2387 * <UL> |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2388 * <LI> bestRowTemporary - very temporary, while using row |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2389 * <LI> bestRowTransaction - valid for remainder of current transaction |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2390 * <LI> bestRowSession - valid for remainder of current session |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2391 * </UL> |
194
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
2392 * <LI><B>COLUMN_NAME</B> String => column name |
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
2393 * <LI><B>DATA_TYPE</B> int => SQL data type from java.sql.Types |
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
2394 * <LI><B>TYPE_NAME</B> String => Data source dependent type name |
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
2395 * <LI><B>COLUMN_SIZE</B> int => precision |
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
2396 * <LI><B>BUFFER_LENGTH</B> int => not used |
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
2397 * <LI><B>DECIMAL_DIGITS</B> short => scale |
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
2398 * <LI><B>PSEUDO_COLUMN</B> short => is this a pseudo column |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2399 * like an Oracle ROWID |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2400 * <UL> |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2401 * <LI> bestRowUnknown - may or may not be pseudo column |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2402 * <LI> bestRowNotPseudo - is NOT a pseudo column |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2403 * <LI> bestRowPseudo - is a pseudo column |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2404 * </UL> |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2405 * </OL> |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2406 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2407 * @param catalog a catalog name; "" retrieves those without a catalog |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2408 * @param schema a schema name; "" retrieves those without a schema |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2409 * @param table a table name |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2410 * @param scope the scope of interest; use same values as SCOPE |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2411 * @param nullable include columns that are nullable? |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2412 * @return ResultSet each row is a column description |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2413 * @throws SQLException if a database error occurs |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2414 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2415 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2416 public ResultSet getBestRowIdentifier( |
295
003ae6d881db
Add "final" keyword to method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
294
diff
changeset
|
2417 final String catalog, |
003ae6d881db
Add "final" keyword to method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
294
diff
changeset
|
2418 final String schema, |
003ae6d881db
Add "final" keyword to method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
294
diff
changeset
|
2419 final String table, |
003ae6d881db
Add "final" keyword to method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
294
diff
changeset
|
2420 final int scope, |
003ae6d881db
Add "final" keyword to method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
294
diff
changeset
|
2421 final boolean nullable |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2422 ) throws SQLException |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2423 { |
652
6a34d2c36dec
Improved and optimized DatabaseMetaData.getBestRowIdentifier().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
649
diff
changeset
|
2424 /* determine if we need to include a query against the tmp.* tables also */ |
6a34d2c36dec
Improved and optimized DatabaseMetaData.getBestRowIdentifier().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
649
diff
changeset
|
2425 final boolean incltmpkey = (schema == null) |
6a34d2c36dec
Improved and optimized DatabaseMetaData.getBestRowIdentifier().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
649
diff
changeset
|
2426 || (schema != null && ("tmp".equals(schema) || schema.contains("%") || schema.contains("_"))); |
6a34d2c36dec
Improved and optimized DatabaseMetaData.getBestRowIdentifier().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
649
diff
changeset
|
2427 |
6a34d2c36dec
Improved and optimized DatabaseMetaData.getBestRowIdentifier().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
649
diff
changeset
|
2428 /* When there is a PK for the table we return the pkey columns |
6a34d2c36dec
Improved and optimized DatabaseMetaData.getBestRowIdentifier().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
649
diff
changeset
|
2429 * When there is No PK but there are multiple unique constraints, we need to pick one. |
6a34d2c36dec
Improved and optimized DatabaseMetaData.getBestRowIdentifier().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
649
diff
changeset
|
2430 * In the current implementation we return the first uc (lowest sys.keys.id). |
6a34d2c36dec
Improved and optimized DatabaseMetaData.getBestRowIdentifier().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
649
diff
changeset
|
2431 * Instead of the first (in case of multiple) we should potentially use the uc which has |
6a34d2c36dec
Improved and optimized DatabaseMetaData.getBestRowIdentifier().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
649
diff
changeset
|
2432 * a) the least number of columns and |
6a34d2c36dec
Improved and optimized DatabaseMetaData.getBestRowIdentifier().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
649
diff
changeset
|
2433 * b) the smallest total(size in bytes). |
653
5eb9d54057e6
Improved DatabaseMetaData.getBestRowIdentifier() further by introducing an extra cte: tableids. It makes it easier to understand/maintain and possibly faster.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
652
diff
changeset
|
2434 * That's much more complex to do in SQL than the current implementation, which is fast and gives a correct result. |
652
6a34d2c36dec
Improved and optimized DatabaseMetaData.getBestRowIdentifier().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
649
diff
changeset
|
2435 */ |
653
5eb9d54057e6
Improved DatabaseMetaData.getBestRowIdentifier() further by introducing an extra cte: tableids. It makes it easier to understand/maintain and possibly faster.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
652
diff
changeset
|
2436 |
5eb9d54057e6
Improved DatabaseMetaData.getBestRowIdentifier() further by introducing an extra cte: tableids. It makes it easier to understand/maintain and possibly faster.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
652
diff
changeset
|
2437 final StringBuilder query = new StringBuilder(3000); |
5eb9d54057e6
Improved DatabaseMetaData.getBestRowIdentifier() further by introducing an extra cte: tableids. It makes it easier to understand/maintain and possibly faster.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
652
diff
changeset
|
2438 // 1st cte: syskeys |
652
6a34d2c36dec
Improved and optimized DatabaseMetaData.getBestRowIdentifier().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
649
diff
changeset
|
2439 query.append("with syskeys as (" + |
6a34d2c36dec
Improved and optimized DatabaseMetaData.getBestRowIdentifier().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
649
diff
changeset
|
2440 // all pkeys |
6a34d2c36dec
Improved and optimized DatabaseMetaData.getBestRowIdentifier().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
649
diff
changeset
|
2441 "SELECT \"id\", \"table_id\" FROM \"sys\".\"keys\" WHERE \"type\" = 0 " + |
6a34d2c36dec
Improved and optimized DatabaseMetaData.getBestRowIdentifier().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
649
diff
changeset
|
2442 "UNION ALL " + |
6a34d2c36dec
Improved and optimized DatabaseMetaData.getBestRowIdentifier().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
649
diff
changeset
|
2443 // and first unique constraint of a table when table has no pkey |
6a34d2c36dec
Improved and optimized DatabaseMetaData.getBestRowIdentifier().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
649
diff
changeset
|
2444 "SELECT \"id\", \"table_id\" FROM \"sys\".\"keys\" WHERE \"type\" = 1 " + |
6a34d2c36dec
Improved and optimized DatabaseMetaData.getBestRowIdentifier().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
649
diff
changeset
|
2445 "AND \"table_id\" NOT IN (select \"table_id\" from \"sys\".\"keys\" where \"type\" = 0) " + |
6a34d2c36dec
Improved and optimized DatabaseMetaData.getBestRowIdentifier().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
649
diff
changeset
|
2446 "AND (\"table_id\", \"id\") IN (select \"table_id\", min(\"id\") from \"sys\".\"keys\" where \"type\" = 1 group by \"table_id\"))"); |
6a34d2c36dec
Improved and optimized DatabaseMetaData.getBestRowIdentifier().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
649
diff
changeset
|
2447 if (incltmpkey) { |
6a34d2c36dec
Improved and optimized DatabaseMetaData.getBestRowIdentifier().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
649
diff
changeset
|
2448 // we must also include the primary key or unique constraint of local temporary tables which are stored in tmp.keys |
653
5eb9d54057e6
Improved DatabaseMetaData.getBestRowIdentifier() further by introducing an extra cte: tableids. It makes it easier to understand/maintain and possibly faster.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
652
diff
changeset
|
2449 // 2nd cte: tmpkeys |
652
6a34d2c36dec
Improved and optimized DatabaseMetaData.getBestRowIdentifier().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
649
diff
changeset
|
2450 query.append(", tmpkeys as (" + |
6a34d2c36dec
Improved and optimized DatabaseMetaData.getBestRowIdentifier().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
649
diff
changeset
|
2451 "SELECT \"id\", \"table_id\" FROM \"tmp\".\"keys\" WHERE \"type\" = 0 " + |
6a34d2c36dec
Improved and optimized DatabaseMetaData.getBestRowIdentifier().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
649
diff
changeset
|
2452 "UNION ALL " + |
6a34d2c36dec
Improved and optimized DatabaseMetaData.getBestRowIdentifier().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
649
diff
changeset
|
2453 "SELECT \"id\", \"table_id\" FROM \"tmp\".\"keys\" WHERE \"type\" = 1 " + |
6a34d2c36dec
Improved and optimized DatabaseMetaData.getBestRowIdentifier().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
649
diff
changeset
|
2454 "AND \"table_id\" NOT IN (select \"table_id\" from \"tmp\".\"keys\" where \"type\" = 0) " + |
6a34d2c36dec
Improved and optimized DatabaseMetaData.getBestRowIdentifier().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
649
diff
changeset
|
2455 "AND (\"table_id\", \"id\") IN (select \"table_id\", min(\"id\") from \"tmp\".\"keys\" where \"type\" = 1 group by \"table_id\"))"); |
619
ffc2fc8e82ec
Fixed an SQL query problem in DatabaseMetaData.getBestRowIdentifier() method when used with MonetDB Jan2022 (or newer) releases.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
610
diff
changeset
|
2456 } |
653
5eb9d54057e6
Improved DatabaseMetaData.getBestRowIdentifier() further by introducing an extra cte: tableids. It makes it easier to understand/maintain and possibly faster.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
652
diff
changeset
|
2457 // 3rd cte: tableids |
5eb9d54057e6
Improved DatabaseMetaData.getBestRowIdentifier() further by introducing an extra cte: tableids. It makes it easier to understand/maintain and possibly faster.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
652
diff
changeset
|
2458 query.append(", tableids as (" + |
5eb9d54057e6
Improved DatabaseMetaData.getBestRowIdentifier() further by introducing an extra cte: tableids. It makes it easier to understand/maintain and possibly faster.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
652
diff
changeset
|
2459 "SELECT t.\"id\" " + |
5eb9d54057e6
Improved DatabaseMetaData.getBestRowIdentifier() further by introducing an extra cte: tableids. It makes it easier to understand/maintain and possibly faster.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
652
diff
changeset
|
2460 "FROM \"sys\".\"tables\" t " + |
652
6a34d2c36dec
Improved and optimized DatabaseMetaData.getBestRowIdentifier().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
649
diff
changeset
|
2461 "JOIN \"sys\".\"schemas\" s ON t.\"schema_id\" = s.\"id\" " + |
759
846a456f0f0c
Remove append() calls for static int values in construction of Strings.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
757
diff
changeset
|
2462 "WHERE t.\"type\" NOT IN (1, 11)"); // exclude all VIEWs and SYSTEM VIEWs |
216
116b5a149fb4
Optimise SQL query generation for cases where the WHERE clause already has a AND 1 = 0 condition. Exlude adding more AND ... conditions.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
215
diff
changeset
|
2463 if (catalog != null && !catalog.isEmpty()) { |
299
1f0324072b0c
Correcting typo in comment
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
298
diff
changeset
|
2464 // non-empty catalog selection. |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2465 // as we do not support catalogs this always results in no rows returned |
759
846a456f0f0c
Remove append() calls for static int values in construction of Strings.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
757
diff
changeset
|
2466 query.append(" AND 1=0"); |
216
116b5a149fb4
Optimise SQL query generation for cases where the WHERE clause already has a AND 1 = 0 condition. Exlude adding more AND ... conditions.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
215
diff
changeset
|
2467 } else { |
331
6ed8f5b1f9ed
Corrected method DatabaseMetaData.getBestRowIdentifier(). It used to return columns of both primary key and unique constraints. Now it only returns the columns of the primary key if it has one, else columns of a unique constraint.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
323
diff
changeset
|
2468 if (scope == DatabaseMetaData.bestRowSession |
6ed8f5b1f9ed
Corrected method DatabaseMetaData.getBestRowIdentifier(). It used to return columns of both primary key and unique constraints. Now it only returns the columns of the primary key if it has one, else columns of a unique constraint.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
323
diff
changeset
|
2469 || scope == DatabaseMetaData.bestRowTransaction |
6ed8f5b1f9ed
Corrected method DatabaseMetaData.getBestRowIdentifier(). It used to return columns of both primary key and unique constraints. Now it only returns the columns of the primary key if it has one, else columns of a unique constraint.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
323
diff
changeset
|
2470 || scope == DatabaseMetaData.bestRowTemporary) { |
645
fbed03097738
Corrected DatabaseMetaData methods getPrimaryKeys(), getBestRowIdentifier() and getIndexInfo() for temporary tables in schema tmp.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
642
diff
changeset
|
2471 if (schema != null) { |
fbed03097738
Corrected DatabaseMetaData methods getPrimaryKeys(), getBestRowIdentifier() and getIndexInfo() for temporary tables in schema tmp.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
642
diff
changeset
|
2472 // do not allow wildcard matching with LIKE, as the resultset does not include the schema info |
759
846a456f0f0c
Remove append() calls for static int values in construction of Strings.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
757
diff
changeset
|
2473 query.append(" AND s.\"name\" = ").append(MonetWrapper.sq(schema)); |
216
116b5a149fb4
Optimise SQL query generation for cases where the WHERE clause already has a AND 1 = 0 condition. Exlude adding more AND ... conditions.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
215
diff
changeset
|
2474 } |
645
fbed03097738
Corrected DatabaseMetaData methods getPrimaryKeys(), getBestRowIdentifier() and getIndexInfo() for temporary tables in schema tmp.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
642
diff
changeset
|
2475 if (table != null) { |
fbed03097738
Corrected DatabaseMetaData methods getPrimaryKeys(), getBestRowIdentifier() and getIndexInfo() for temporary tables in schema tmp.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
642
diff
changeset
|
2476 // do not allow wildcard matching with LIKE, as the resultset does not include the table info |
fbed03097738
Corrected DatabaseMetaData methods getPrimaryKeys(), getBestRowIdentifier() and getIndexInfo() for temporary tables in schema tmp.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
642
diff
changeset
|
2477 query.append(" AND t.\"name\" = ").append(MonetWrapper.sq(table)); |
216
116b5a149fb4
Optimise SQL query generation for cases where the WHERE clause already has a AND 1 = 0 condition. Exlude adding more AND ... conditions.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
215
diff
changeset
|
2478 } |
331
6ed8f5b1f9ed
Corrected method DatabaseMetaData.getBestRowIdentifier(). It used to return columns of both primary key and unique constraints. Now it only returns the columns of the primary key if it has one, else columns of a unique constraint.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
323
diff
changeset
|
2479 } else { |
759
846a456f0f0c
Remove append() calls for static int values in construction of Strings.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
757
diff
changeset
|
2480 query.append(" AND 1=0"); |
216
116b5a149fb4
Optimise SQL query generation for cases where the WHERE clause already has a AND 1 = 0 condition. Exlude adding more AND ... conditions.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
215
diff
changeset
|
2481 } |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2482 } |
653
5eb9d54057e6
Improved DatabaseMetaData.getBestRowIdentifier() further by introducing an extra cte: tableids. It makes it easier to understand/maintain and possibly faster.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
652
diff
changeset
|
2483 // 4th cte: cols, this unions 2 (or 4 when incltmpkey == true) select queries |
5eb9d54057e6
Improved DatabaseMetaData.getBestRowIdentifier() further by introducing an extra cte: tableids. It makes it easier to understand/maintain and possibly faster.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
652
diff
changeset
|
2484 query.append("), cols as (" + |
5eb9d54057e6
Improved DatabaseMetaData.getBestRowIdentifier() further by introducing an extra cte: tableids. It makes it easier to understand/maintain and possibly faster.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
652
diff
changeset
|
2485 "SELECT c.\"name\", c.\"type\", c.\"type_digits\", c.\"type_scale\", o.\"nr\" " + |
5eb9d54057e6
Improved DatabaseMetaData.getBestRowIdentifier() further by introducing an extra cte: tableids. It makes it easier to understand/maintain and possibly faster.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
652
diff
changeset
|
2486 "FROM syskeys k " + |
5eb9d54057e6
Improved DatabaseMetaData.getBestRowIdentifier() further by introducing an extra cte: tableids. It makes it easier to understand/maintain and possibly faster.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
652
diff
changeset
|
2487 "JOIN tableids t ON k.\"table_id\" = t.\"id\" " + |
5eb9d54057e6
Improved DatabaseMetaData.getBestRowIdentifier() further by introducing an extra cte: tableids. It makes it easier to understand/maintain and possibly faster.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
652
diff
changeset
|
2488 "JOIN \"sys\".\"objects\" o ON k.\"id\" = o.\"id\" " + |
5eb9d54057e6
Improved DatabaseMetaData.getBestRowIdentifier() further by introducing an extra cte: tableids. It makes it easier to understand/maintain and possibly faster.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
652
diff
changeset
|
2489 "JOIN \"sys\".\"_columns\" c ON (k.\"table_id\" = c.\"table_id\" AND o.\"name\" = c.\"name\")"); |
5eb9d54057e6
Improved DatabaseMetaData.getBestRowIdentifier() further by introducing an extra cte: tableids. It makes it easier to understand/maintain and possibly faster.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
652
diff
changeset
|
2490 if (!nullable) { |
5eb9d54057e6
Improved DatabaseMetaData.getBestRowIdentifier() further by introducing an extra cte: tableids. It makes it easier to understand/maintain and possibly faster.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
652
diff
changeset
|
2491 query.append(" WHERE c.\"null\" = false"); |
5eb9d54057e6
Improved DatabaseMetaData.getBestRowIdentifier() further by introducing an extra cte: tableids. It makes it easier to understand/maintain and possibly faster.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
652
diff
changeset
|
2492 } |
652
6a34d2c36dec
Improved and optimized DatabaseMetaData.getBestRowIdentifier().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
649
diff
changeset
|
2493 if (incltmpkey) { |
6a34d2c36dec
Improved and optimized DatabaseMetaData.getBestRowIdentifier().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
649
diff
changeset
|
2494 // we must also include the primary key or unique constraint of local temporary tables |
6a34d2c36dec
Improved and optimized DatabaseMetaData.getBestRowIdentifier().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
649
diff
changeset
|
2495 // which are stored in tmp.keys, tmp.objects, tmp._tables and tmp._columns |
6a34d2c36dec
Improved and optimized DatabaseMetaData.getBestRowIdentifier().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
649
diff
changeset
|
2496 query.append(" UNION ALL " + |
6a34d2c36dec
Improved and optimized DatabaseMetaData.getBestRowIdentifier().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
649
diff
changeset
|
2497 "SELECT c.\"name\", c.\"type\", c.\"type_digits\", c.\"type_scale\", o.\"nr\" " + |
6a34d2c36dec
Improved and optimized DatabaseMetaData.getBestRowIdentifier().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
649
diff
changeset
|
2498 "FROM tmpkeys k " + |
653
5eb9d54057e6
Improved DatabaseMetaData.getBestRowIdentifier() further by introducing an extra cte: tableids. It makes it easier to understand/maintain and possibly faster.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
652
diff
changeset
|
2499 "JOIN tableids t ON k.\"table_id\" = t.\"id\" " + |
649
060347aa81ea
By fixing methods getPrimaryKeys(), getBestRowIdentifier() and getIndexInfo() for local temporary tables, it also caused it to fail for global temporary tables in schema tmp.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
645
diff
changeset
|
2500 "JOIN \"tmp\".\"objects\" o ON k.\"id\" = o.\"id\" " + |
653
5eb9d54057e6
Improved DatabaseMetaData.getBestRowIdentifier() further by introducing an extra cte: tableids. It makes it easier to understand/maintain and possibly faster.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
652
diff
changeset
|
2501 "JOIN \"tmp\".\"_columns\" c ON (k.\"table_id\" = c.\"table_id\" AND o.\"name\" = c.\"name\")"); |
5eb9d54057e6
Improved DatabaseMetaData.getBestRowIdentifier() further by introducing an extra cte: tableids. It makes it easier to understand/maintain and possibly faster.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
652
diff
changeset
|
2502 if (!nullable) { |
5eb9d54057e6
Improved DatabaseMetaData.getBestRowIdentifier() further by introducing an extra cte: tableids. It makes it easier to understand/maintain and possibly faster.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
652
diff
changeset
|
2503 query.append(" WHERE c.\"null\" = false"); |
649
060347aa81ea
By fixing methods getPrimaryKeys(), getBestRowIdentifier() and getIndexInfo() for local temporary tables, it also caused it to fail for global temporary tables in schema tmp.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
645
diff
changeset
|
2504 } |
060347aa81ea
By fixing methods getPrimaryKeys(), getBestRowIdentifier() and getIndexInfo() for local temporary tables, it also caused it to fail for global temporary tables in schema tmp.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
645
diff
changeset
|
2505 } |
653
5eb9d54057e6
Improved DatabaseMetaData.getBestRowIdentifier() further by introducing an extra cte: tableids. It makes it easier to understand/maintain and possibly faster.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
652
diff
changeset
|
2506 // when there is No PK and No unique constraints, we should return all columns of the table |
5eb9d54057e6
Improved DatabaseMetaData.getBestRowIdentifier() further by introducing an extra cte: tableids. It makes it easier to understand/maintain and possibly faster.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
652
diff
changeset
|
2507 // (else in SQuirreL no header is shown in the "Row IDs" tab) |
5eb9d54057e6
Improved DatabaseMetaData.getBestRowIdentifier() further by introducing an extra cte: tableids. It makes it easier to understand/maintain and possibly faster.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
652
diff
changeset
|
2508 query.append(" UNION ALL " + |
5eb9d54057e6
Improved DatabaseMetaData.getBestRowIdentifier() further by introducing an extra cte: tableids. It makes it easier to understand/maintain and possibly faster.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
652
diff
changeset
|
2509 "SELECT c.\"name\", c.\"type\", c.\"type_digits\", c.\"type_scale\", c.\"number\" " + |
5eb9d54057e6
Improved DatabaseMetaData.getBestRowIdentifier() further by introducing an extra cte: tableids. It makes it easier to understand/maintain and possibly faster.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
652
diff
changeset
|
2510 "FROM tableids t " + |
5eb9d54057e6
Improved DatabaseMetaData.getBestRowIdentifier() further by introducing an extra cte: tableids. It makes it easier to understand/maintain and possibly faster.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
652
diff
changeset
|
2511 "JOIN \"sys\".\"_columns\" c ON t.\"id\" = c.\"table_id\" " + |
5eb9d54057e6
Improved DatabaseMetaData.getBestRowIdentifier() further by introducing an extra cte: tableids. It makes it easier to understand/maintain and possibly faster.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
652
diff
changeset
|
2512 "WHERE t.\"id\" NOT IN (SELECT \"table_id\" FROM \"sys\".\"keys\" WHERE \"type\" in (0, 1))"); |
5eb9d54057e6
Improved DatabaseMetaData.getBestRowIdentifier() further by introducing an extra cte: tableids. It makes it easier to understand/maintain and possibly faster.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
652
diff
changeset
|
2513 if (!nullable) { |
5eb9d54057e6
Improved DatabaseMetaData.getBestRowIdentifier() further by introducing an extra cte: tableids. It makes it easier to understand/maintain and possibly faster.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
652
diff
changeset
|
2514 query.append(" AND c.\"null\" = false"); |
5eb9d54057e6
Improved DatabaseMetaData.getBestRowIdentifier() further by introducing an extra cte: tableids. It makes it easier to understand/maintain and possibly faster.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
652
diff
changeset
|
2515 } |
5eb9d54057e6
Improved DatabaseMetaData.getBestRowIdentifier() further by introducing an extra cte: tableids. It makes it easier to understand/maintain and possibly faster.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
652
diff
changeset
|
2516 if (incltmpkey) { |
5eb9d54057e6
Improved DatabaseMetaData.getBestRowIdentifier() further by introducing an extra cte: tableids. It makes it easier to understand/maintain and possibly faster.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
652
diff
changeset
|
2517 query.append(" UNION ALL " + |
5eb9d54057e6
Improved DatabaseMetaData.getBestRowIdentifier() further by introducing an extra cte: tableids. It makes it easier to understand/maintain and possibly faster.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
652
diff
changeset
|
2518 "SELECT c.\"name\", c.\"type\", c.\"type_digits\", c.\"type_scale\", c.\"number\" " + |
5eb9d54057e6
Improved DatabaseMetaData.getBestRowIdentifier() further by introducing an extra cte: tableids. It makes it easier to understand/maintain and possibly faster.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
652
diff
changeset
|
2519 "FROM tableids t " + |
5eb9d54057e6
Improved DatabaseMetaData.getBestRowIdentifier() further by introducing an extra cte: tableids. It makes it easier to understand/maintain and possibly faster.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
652
diff
changeset
|
2520 "JOIN \"tmp\".\"_columns\" c ON t.\"id\" = c.\"table_id\" " + |
5eb9d54057e6
Improved DatabaseMetaData.getBestRowIdentifier() further by introducing an extra cte: tableids. It makes it easier to understand/maintain and possibly faster.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
652
diff
changeset
|
2521 "WHERE t.\"id\" NOT IN (SELECT \"table_id\" FROM \"tmp\".\"keys\" WHERE \"type\" in (0, 1))"); |
5eb9d54057e6
Improved DatabaseMetaData.getBestRowIdentifier() further by introducing an extra cte: tableids. It makes it easier to understand/maintain and possibly faster.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
652
diff
changeset
|
2522 if (!nullable) { |
5eb9d54057e6
Improved DatabaseMetaData.getBestRowIdentifier() further by introducing an extra cte: tableids. It makes it easier to understand/maintain and possibly faster.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
652
diff
changeset
|
2523 query.append(" AND c.\"null\" = false"); |
5eb9d54057e6
Improved DatabaseMetaData.getBestRowIdentifier() further by introducing an extra cte: tableids. It makes it easier to understand/maintain and possibly faster.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
652
diff
changeset
|
2524 } |
5eb9d54057e6
Improved DatabaseMetaData.getBestRowIdentifier() further by introducing an extra cte: tableids. It makes it easier to understand/maintain and possibly faster.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
652
diff
changeset
|
2525 } |
5eb9d54057e6
Improved DatabaseMetaData.getBestRowIdentifier() further by introducing an extra cte: tableids. It makes it easier to understand/maintain and possibly faster.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
652
diff
changeset
|
2526 // the final select query |
652
6a34d2c36dec
Improved and optimized DatabaseMetaData.getBestRowIdentifier().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
649
diff
changeset
|
2527 query.append(") SELECT " + |
759
846a456f0f0c
Remove append() calls for static int values in construction of Strings.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
757
diff
changeset
|
2528 "cast(" + DatabaseMetaData.bestRowSession + " AS smallint) AS \"SCOPE\", " + |
652
6a34d2c36dec
Improved and optimized DatabaseMetaData.getBestRowIdentifier().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
649
diff
changeset
|
2529 "c.\"name\" AS \"COLUMN_NAME\", " + |
6a34d2c36dec
Improved and optimized DatabaseMetaData.getBestRowIdentifier().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
649
diff
changeset
|
2530 "cast(").append(MonetDriver.getSQLTypeMap("c.\"type\"")).append(" AS int) AS \"DATA_TYPE\", " + |
6a34d2c36dec
Improved and optimized DatabaseMetaData.getBestRowIdentifier().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
649
diff
changeset
|
2531 "c.\"type\" AS \"TYPE_NAME\", " + |
6a34d2c36dec
Improved and optimized DatabaseMetaData.getBestRowIdentifier().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
649
diff
changeset
|
2532 "c.\"type_digits\" AS \"COLUMN_SIZE\", " + |
6a34d2c36dec
Improved and optimized DatabaseMetaData.getBestRowIdentifier().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
649
diff
changeset
|
2533 "cast(0 as int) AS \"BUFFER_LENGTH\", " + |
6a34d2c36dec
Improved and optimized DatabaseMetaData.getBestRowIdentifier().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
649
diff
changeset
|
2534 "cast(c.\"type_scale\" AS smallint) AS \"DECIMAL_DIGITS\", " + |
759
846a456f0f0c
Remove append() calls for static int values in construction of Strings.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
757
diff
changeset
|
2535 "cast(" + DatabaseMetaData.bestRowNotPseudo + " AS smallint) AS \"PSEUDO_COLUMN\" " + |
652
6a34d2c36dec
Improved and optimized DatabaseMetaData.getBestRowIdentifier().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
649
diff
changeset
|
2536 "FROM cols c " + |
6a34d2c36dec
Improved and optimized DatabaseMetaData.getBestRowIdentifier().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
649
diff
changeset
|
2537 "ORDER BY \"SCOPE\", c.\"nr\", \"COLUMN_NAME\""); |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2538 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2539 return executeMetaDataQuery(query.toString()); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2540 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2541 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2542 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2543 * Get a description of a table's columns that are automatically |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2544 * updated when any value in a row is updated. They are unordered. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2545 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2546 * <P>Each column description has the following columns: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2547 * <OL> |
194
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
2548 * <LI><B>SCOPE</B> short => is not used |
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
2549 * <LI><B>COLUMN_NAME</B> String => column name |
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
2550 * <LI><B>DATA_TYPE</B> int => SQL data type from java.sql.Types |
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
2551 * <LI><B>TYPE_NAME</B> String => Data source dependent type name |
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
2552 * <LI><B>COLUMN_SIZE</B> int => precision |
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
2553 * <LI><B>BUFFER_LENGTH</B> int => length of column value in bytes |
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
2554 * <LI><B>DECIMAL_DIGITS</B> short => scale |
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
2555 * <LI><B>PSEUDO_COLUMN</B> short => is this a pseudo column like an Oracle ROWID |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2556 * <UL> |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2557 * <LI> versionColumnUnknown - may or may not be pseudo column |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2558 * <LI> versionColumnNotPseudo - is NOT a pseudo column |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2559 * <LI> versionColumnPseudo - is a pseudo column |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2560 * </UL> |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2561 * </OL> |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2562 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2563 * @param catalog a catalog name; "" retrieves those without a catalog |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2564 * @param schema a schema name; "" retrieves those without a schema |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2565 * @param table a table name |
371
67fa5c6147d7
Correct SQL syntax in comment (LIKE "%" is not valid SQL in WHERE clause)
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
370
diff
changeset
|
2566 * Note that our implementation allows this param to be null also (for efficiency as no extra LIKE '%' condition is added to be evaluated). |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2567 * @return ResultSet each row is a column description |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2568 * @throws SQLException if a database error occurs |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2569 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2570 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2571 public ResultSet getVersionColumns( |
295
003ae6d881db
Add "final" keyword to method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
294
diff
changeset
|
2572 final String catalog, |
003ae6d881db
Add "final" keyword to method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
294
diff
changeset
|
2573 final String schema, |
003ae6d881db
Add "final" keyword to method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
294
diff
changeset
|
2574 final String table |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2575 ) throws SQLException |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2576 { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2577 // MonetDB currently does not have columns which update themselves, so return an empty ResultSet |
295
003ae6d881db
Add "final" keyword to method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
294
diff
changeset
|
2578 final String query = |
217
7cbd20ff628c
Removed DISTINCT from SELECT DISTINCT where it should not be needed (in getTables() and getFunctionColumns())
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
216
diff
changeset
|
2579 "SELECT cast(0 as smallint) AS \"SCOPE\", " + |
7cbd20ff628c
Removed DISTINCT from SELECT DISTINCT where it should not be needed (in getTables() and getFunctionColumns())
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
216
diff
changeset
|
2580 "cast(null as char(1)) AS \"COLUMN_NAME\", " + |
7cbd20ff628c
Removed DISTINCT from SELECT DISTINCT where it should not be needed (in getTables() and getFunctionColumns())
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
216
diff
changeset
|
2581 "cast(0 as int) AS \"DATA_TYPE\", " + |
7cbd20ff628c
Removed DISTINCT from SELECT DISTINCT where it should not be needed (in getTables() and getFunctionColumns())
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
216
diff
changeset
|
2582 "cast(null as char(1)) AS \"TYPE_NAME\", " + |
7cbd20ff628c
Removed DISTINCT from SELECT DISTINCT where it should not be needed (in getTables() and getFunctionColumns())
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
216
diff
changeset
|
2583 "cast(0 as int) AS \"COLUMN_SIZE\", " + |
7cbd20ff628c
Removed DISTINCT from SELECT DISTINCT where it should not be needed (in getTables() and getFunctionColumns())
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
216
diff
changeset
|
2584 "cast(0 as int) AS \"BUFFER_LENGTH\", " + |
7cbd20ff628c
Removed DISTINCT from SELECT DISTINCT where it should not be needed (in getTables() and getFunctionColumns())
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
216
diff
changeset
|
2585 "cast(0 as smallint) AS \"DECIMAL_DIGITS\", " + |
7cbd20ff628c
Removed DISTINCT from SELECT DISTINCT where it should not be needed (in getTables() and getFunctionColumns())
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
216
diff
changeset
|
2586 "cast(0 as smallint) AS \"PSEUDO_COLUMN\" " + |
352
f62137dd6050
Remove spaces from static SQL predicates: 1 = 0 and 1 = 1.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
350
diff
changeset
|
2587 "WHERE 1=0"; |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2588 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2589 return executeMetaDataQuery(query); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2590 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2591 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2592 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2593 * Get a description of a table's primary key columns. They |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2594 * are ordered by COLUMN_NAME. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2595 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2596 * <P>Each column description has the following columns: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2597 * <OL> |
194
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
2598 * <LI><B>TABLE_CAT</B> String => table catalog (may be null) |
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
2599 * <LI><B>TABLE_SCHEM</B> String => table schema (may be null) |
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
2600 * <LI><B>TABLE_NAME</B> String => table name |
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
2601 * <LI><B>COLUMN_NAME</B> String => column name |
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
2602 * <LI><B>KEY_SEQ</B> short => sequence number within primary key |
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
2603 * <LI><B>PK_NAME</B> String => primary key name (may be null) |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2604 * </OL> |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2605 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2606 * @param catalog a catalog name; "" retrieves those without a catalog |
245
55375d489024
Corrected return values of DatabaseMetaData methods allTablesAreSelectable() and allProceduresAreCallable().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
231
diff
changeset
|
2607 * @param schema a schema name pattern; "" retrieves those without a schema |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2608 * @param table a table name |
371
67fa5c6147d7
Correct SQL syntax in comment (LIKE "%" is not valid SQL in WHERE clause)
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
370
diff
changeset
|
2609 * Note that our implementation allows this param to be null also (for efficiency as no extra LIKE '%' condition is added to be evaluated). |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2610 * @return ResultSet each row is a primary key column description |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2611 * @throws SQLException if a database error occurs |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2612 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2613 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2614 public ResultSet getPrimaryKeys( |
295
003ae6d881db
Add "final" keyword to method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
294
diff
changeset
|
2615 final String catalog, |
003ae6d881db
Add "final" keyword to method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
294
diff
changeset
|
2616 final String schema, |
003ae6d881db
Add "final" keyword to method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
294
diff
changeset
|
2617 final String table |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2618 ) throws SQLException |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2619 { |
649
060347aa81ea
By fixing methods getPrimaryKeys(), getBestRowIdentifier() and getIndexInfo() for local temporary tables, it also caused it to fail for global temporary tables in schema tmp.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
645
diff
changeset
|
2620 final StringBuilder query = new StringBuilder(1200); |
217
7cbd20ff628c
Removed DISTINCT from SELECT DISTINCT where it should not be needed (in getTables() and getFunctionColumns())
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
216
diff
changeset
|
2621 query.append("SELECT cast(null AS char(1)) AS \"TABLE_CAT\", " + |
302
1b6c514106ce
Added table aliases and use them in all meta data SQL queries to reduce query size.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
300
diff
changeset
|
2622 "s.\"name\" AS \"TABLE_SCHEM\", " + |
1b6c514106ce
Added table aliases and use them in all meta data SQL queries to reduce query size.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
300
diff
changeset
|
2623 "t.\"name\" AS \"TABLE_NAME\", " + |
1b6c514106ce
Added table aliases and use them in all meta data SQL queries to reduce query size.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
300
diff
changeset
|
2624 "o.\"name\" AS \"COLUMN_NAME\", " + |
1b6c514106ce
Added table aliases and use them in all meta data SQL queries to reduce query size.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
300
diff
changeset
|
2625 "cast(1 + o.\"nr\" AS smallint) AS \"KEY_SEQ\", " + |
649
060347aa81ea
By fixing methods getPrimaryKeys(), getBestRowIdentifier() and getIndexInfo() for local temporary tables, it also caused it to fail for global temporary tables in schema tmp.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
645
diff
changeset
|
2626 "k.\"name\" AS \"PK_NAME\" " + |
060347aa81ea
By fixing methods getPrimaryKeys(), getBestRowIdentifier() and getIndexInfo() for local temporary tables, it also caused it to fail for global temporary tables in schema tmp.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
645
diff
changeset
|
2627 "FROM \"sys\".\"keys\" k " + |
060347aa81ea
By fixing methods getPrimaryKeys(), getBestRowIdentifier() and getIndexInfo() for local temporary tables, it also caused it to fail for global temporary tables in schema tmp.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
645
diff
changeset
|
2628 "JOIN \"sys\".\"objects\" o ON k.\"id\" = o.\"id\" " + |
060347aa81ea
By fixing methods getPrimaryKeys(), getBestRowIdentifier() and getIndexInfo() for local temporary tables, it also caused it to fail for global temporary tables in schema tmp.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
645
diff
changeset
|
2629 "JOIN \"sys\".\"_tables\" t ON k.\"table_id\" = t.\"id\" " + |
302
1b6c514106ce
Added table aliases and use them in all meta data SQL queries to reduce query size.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
300
diff
changeset
|
2630 "JOIN \"sys\".\"schemas\" s ON t.\"schema_id\" = s.\"id\" " + |
1b6c514106ce
Added table aliases and use them in all meta data SQL queries to reduce query size.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
300
diff
changeset
|
2631 "WHERE k.\"type\" = 0"); // only primary keys (type = 0) |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2632 |
216
116b5a149fb4
Optimise SQL query generation for cases where the WHERE clause already has a AND 1 = 0 condition. Exlude adding more AND ... conditions.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
215
diff
changeset
|
2633 if (catalog != null && !catalog.isEmpty()) { |
299
1f0324072b0c
Correcting typo in comment
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
298
diff
changeset
|
2634 // non-empty catalog selection. |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2635 // as we do not support catalogs this always results in no rows returned |
352
f62137dd6050
Remove spaces from static SQL predicates: 1 = 0 and 1 = 1.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
350
diff
changeset
|
2636 query.append(" AND 1=0"); |
216
116b5a149fb4
Optimise SQL query generation for cases where the WHERE clause already has a AND 1 = 0 condition. Exlude adding more AND ... conditions.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
215
diff
changeset
|
2637 } else { |
323
8701024a9bb0
In DatabaseMetaData methods which accept name match patterns, optimise the SQL generation when the pattern equals a: %
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
306
diff
changeset
|
2638 if (schema != null && !schema.equals("%")) { |
302
1b6c514106ce
Added table aliases and use them in all meta data SQL queries to reduce query size.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
300
diff
changeset
|
2639 query.append(" AND s.\"name\" ").append(composeMatchPart(schema)); |
216
116b5a149fb4
Optimise SQL query generation for cases where the WHERE clause already has a AND 1 = 0 condition. Exlude adding more AND ... conditions.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
215
diff
changeset
|
2640 } |
323
8701024a9bb0
In DatabaseMetaData methods which accept name match patterns, optimise the SQL generation when the pattern equals a: %
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
306
diff
changeset
|
2641 if (table != null && !table.equals("%")) { |
302
1b6c514106ce
Added table aliases and use them in all meta data SQL queries to reduce query size.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
300
diff
changeset
|
2642 query.append(" AND t.\"name\" ").append(composeMatchPart(table)); |
216
116b5a149fb4
Optimise SQL query generation for cases where the WHERE clause already has a AND 1 = 0 condition. Exlude adding more AND ... conditions.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
215
diff
changeset
|
2643 } |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2644 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2645 |
649
060347aa81ea
By fixing methods getPrimaryKeys(), getBestRowIdentifier() and getIndexInfo() for local temporary tables, it also caused it to fail for global temporary tables in schema tmp.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
645
diff
changeset
|
2646 final boolean includetmp = (schema == null) |
060347aa81ea
By fixing methods getPrimaryKeys(), getBestRowIdentifier() and getIndexInfo() for local temporary tables, it also caused it to fail for global temporary tables in schema tmp.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
645
diff
changeset
|
2647 || (schema != null && ("tmp".equals(schema) || schema.contains("%") || schema.contains("_"))); |
060347aa81ea
By fixing methods getPrimaryKeys(), getBestRowIdentifier() and getIndexInfo() for local temporary tables, it also caused it to fail for global temporary tables in schema tmp.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
645
diff
changeset
|
2648 if (includetmp) { |
060347aa81ea
By fixing methods getPrimaryKeys(), getBestRowIdentifier() and getIndexInfo() for local temporary tables, it also caused it to fail for global temporary tables in schema tmp.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
645
diff
changeset
|
2649 // we must also include the keys of local temporary tables which are stored in tmp.keys, tmp.objects and tmp._tables |
060347aa81ea
By fixing methods getPrimaryKeys(), getBestRowIdentifier() and getIndexInfo() for local temporary tables, it also caused it to fail for global temporary tables in schema tmp.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
645
diff
changeset
|
2650 query.append(" UNION ALL "); |
060347aa81ea
By fixing methods getPrimaryKeys(), getBestRowIdentifier() and getIndexInfo() for local temporary tables, it also caused it to fail for global temporary tables in schema tmp.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
645
diff
changeset
|
2651 query.append("SELECT cast(null AS char(1)) AS \"TABLE_CAT\", " + |
060347aa81ea
By fixing methods getPrimaryKeys(), getBestRowIdentifier() and getIndexInfo() for local temporary tables, it also caused it to fail for global temporary tables in schema tmp.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
645
diff
changeset
|
2652 "s.\"name\" AS \"TABLE_SCHEM\", " + |
060347aa81ea
By fixing methods getPrimaryKeys(), getBestRowIdentifier() and getIndexInfo() for local temporary tables, it also caused it to fail for global temporary tables in schema tmp.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
645
diff
changeset
|
2653 "t.\"name\" AS \"TABLE_NAME\", " + |
060347aa81ea
By fixing methods getPrimaryKeys(), getBestRowIdentifier() and getIndexInfo() for local temporary tables, it also caused it to fail for global temporary tables in schema tmp.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
645
diff
changeset
|
2654 "o.\"name\" AS \"COLUMN_NAME\", " + |
060347aa81ea
By fixing methods getPrimaryKeys(), getBestRowIdentifier() and getIndexInfo() for local temporary tables, it also caused it to fail for global temporary tables in schema tmp.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
645
diff
changeset
|
2655 "cast(1 + o.\"nr\" AS smallint) AS \"KEY_SEQ\", " + |
060347aa81ea
By fixing methods getPrimaryKeys(), getBestRowIdentifier() and getIndexInfo() for local temporary tables, it also caused it to fail for global temporary tables in schema tmp.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
645
diff
changeset
|
2656 "k.\"name\" AS \"PK_NAME\" " + |
060347aa81ea
By fixing methods getPrimaryKeys(), getBestRowIdentifier() and getIndexInfo() for local temporary tables, it also caused it to fail for global temporary tables in schema tmp.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
645
diff
changeset
|
2657 "FROM \"tmp\".\"keys\" k " + |
060347aa81ea
By fixing methods getPrimaryKeys(), getBestRowIdentifier() and getIndexInfo() for local temporary tables, it also caused it to fail for global temporary tables in schema tmp.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
645
diff
changeset
|
2658 "JOIN \"tmp\".\"objects\" o ON k.\"id\" = o.\"id\" " + |
060347aa81ea
By fixing methods getPrimaryKeys(), getBestRowIdentifier() and getIndexInfo() for local temporary tables, it also caused it to fail for global temporary tables in schema tmp.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
645
diff
changeset
|
2659 "JOIN \"tmp\".\"_tables\" t ON k.\"table_id\" = t.\"id\" " + |
060347aa81ea
By fixing methods getPrimaryKeys(), getBestRowIdentifier() and getIndexInfo() for local temporary tables, it also caused it to fail for global temporary tables in schema tmp.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
645
diff
changeset
|
2660 "JOIN \"sys\".\"schemas\" s ON t.\"schema_id\" = s.\"id\" " + |
060347aa81ea
By fixing methods getPrimaryKeys(), getBestRowIdentifier() and getIndexInfo() for local temporary tables, it also caused it to fail for global temporary tables in schema tmp.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
645
diff
changeset
|
2661 "WHERE k.\"type\" = 0"); // only primary keys (type = 0) |
060347aa81ea
By fixing methods getPrimaryKeys(), getBestRowIdentifier() and getIndexInfo() for local temporary tables, it also caused it to fail for global temporary tables in schema tmp.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
645
diff
changeset
|
2662 |
060347aa81ea
By fixing methods getPrimaryKeys(), getBestRowIdentifier() and getIndexInfo() for local temporary tables, it also caused it to fail for global temporary tables in schema tmp.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
645
diff
changeset
|
2663 if (catalog != null && !catalog.isEmpty()) { |
060347aa81ea
By fixing methods getPrimaryKeys(), getBestRowIdentifier() and getIndexInfo() for local temporary tables, it also caused it to fail for global temporary tables in schema tmp.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
645
diff
changeset
|
2664 // non-empty catalog selection. |
060347aa81ea
By fixing methods getPrimaryKeys(), getBestRowIdentifier() and getIndexInfo() for local temporary tables, it also caused it to fail for global temporary tables in schema tmp.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
645
diff
changeset
|
2665 // as we do not support catalogs this always results in no rows returned |
060347aa81ea
By fixing methods getPrimaryKeys(), getBestRowIdentifier() and getIndexInfo() for local temporary tables, it also caused it to fail for global temporary tables in schema tmp.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
645
diff
changeset
|
2666 query.append(" AND 1=0"); |
060347aa81ea
By fixing methods getPrimaryKeys(), getBestRowIdentifier() and getIndexInfo() for local temporary tables, it also caused it to fail for global temporary tables in schema tmp.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
645
diff
changeset
|
2667 } else { |
060347aa81ea
By fixing methods getPrimaryKeys(), getBestRowIdentifier() and getIndexInfo() for local temporary tables, it also caused it to fail for global temporary tables in schema tmp.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
645
diff
changeset
|
2668 if (schema != null && !schema.equals("%")) { |
060347aa81ea
By fixing methods getPrimaryKeys(), getBestRowIdentifier() and getIndexInfo() for local temporary tables, it also caused it to fail for global temporary tables in schema tmp.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
645
diff
changeset
|
2669 query.append(" AND s.\"name\" ").append(composeMatchPart(schema)); |
060347aa81ea
By fixing methods getPrimaryKeys(), getBestRowIdentifier() and getIndexInfo() for local temporary tables, it also caused it to fail for global temporary tables in schema tmp.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
645
diff
changeset
|
2670 } |
060347aa81ea
By fixing methods getPrimaryKeys(), getBestRowIdentifier() and getIndexInfo() for local temporary tables, it also caused it to fail for global temporary tables in schema tmp.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
645
diff
changeset
|
2671 if (table != null && !table.equals("%")) { |
060347aa81ea
By fixing methods getPrimaryKeys(), getBestRowIdentifier() and getIndexInfo() for local temporary tables, it also caused it to fail for global temporary tables in schema tmp.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
645
diff
changeset
|
2672 query.append(" AND t.\"name\" ").append(composeMatchPart(table)); |
060347aa81ea
By fixing methods getPrimaryKeys(), getBestRowIdentifier() and getIndexInfo() for local temporary tables, it also caused it to fail for global temporary tables in schema tmp.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
645
diff
changeset
|
2673 } |
060347aa81ea
By fixing methods getPrimaryKeys(), getBestRowIdentifier() and getIndexInfo() for local temporary tables, it also caused it to fail for global temporary tables in schema tmp.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
645
diff
changeset
|
2674 } |
060347aa81ea
By fixing methods getPrimaryKeys(), getBestRowIdentifier() and getIndexInfo() for local temporary tables, it also caused it to fail for global temporary tables in schema tmp.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
645
diff
changeset
|
2675 } |
060347aa81ea
By fixing methods getPrimaryKeys(), getBestRowIdentifier() and getIndexInfo() for local temporary tables, it also caused it to fail for global temporary tables in schema tmp.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
645
diff
changeset
|
2676 |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2677 query.append(" ORDER BY \"TABLE_SCHEM\", \"TABLE_NAME\", \"COLUMN_NAME\""); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2678 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2679 return executeMetaDataQuery(query.toString()); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2680 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2681 |
303
a91168efdf27
Small code and doc improvements. Moved helper functions to the bottom.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
302
diff
changeset
|
2682 // same SQL query used by getImportedKeys(), getExportedKeys() and getCrossReference() |
186
4767b005a531
Making variables private where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
177
diff
changeset
|
2683 private static final String keyQuery = |
217
7cbd20ff628c
Removed DISTINCT from SELECT DISTINCT where it should not be needed (in getTables() and getFunctionColumns())
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
216
diff
changeset
|
2684 "SELECT cast(null AS char(1)) AS \"PKTABLE_CAT\", " + |
302
1b6c514106ce
Added table aliases and use them in all meta data SQL queries to reduce query size.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
300
diff
changeset
|
2685 "pkschema.\"name\" AS \"PKTABLE_SCHEM\", " + |
1b6c514106ce
Added table aliases and use them in all meta data SQL queries to reduce query size.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
300
diff
changeset
|
2686 "pktable.\"name\" AS \"PKTABLE_NAME\", " + |
1b6c514106ce
Added table aliases and use them in all meta data SQL queries to reduce query size.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
300
diff
changeset
|
2687 "pkkeycol.\"name\" AS \"PKCOLUMN_NAME\", " + |
217
7cbd20ff628c
Removed DISTINCT from SELECT DISTINCT where it should not be needed (in getTables() and getFunctionColumns())
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
216
diff
changeset
|
2688 "cast(null AS char(1)) AS \"FKTABLE_CAT\", " + |
302
1b6c514106ce
Added table aliases and use them in all meta data SQL queries to reduce query size.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
300
diff
changeset
|
2689 "fkschema.\"name\" AS \"FKTABLE_SCHEM\", " + |
1b6c514106ce
Added table aliases and use them in all meta data SQL queries to reduce query size.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
300
diff
changeset
|
2690 "fktable.\"name\" AS \"FKTABLE_NAME\", " + |
1b6c514106ce
Added table aliases and use them in all meta data SQL queries to reduce query size.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
300
diff
changeset
|
2691 "fkkeycol.\"name\" AS \"FKCOLUMN_NAME\", " + |
217
7cbd20ff628c
Removed DISTINCT from SELECT DISTINCT where it should not be needed (in getTables() and getFunctionColumns())
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
216
diff
changeset
|
2692 "cast(1 + \"pkkeycol\".\"nr\" AS smallint) AS \"KEY_SEQ\", " + |
405
6242351e8802
Corrected output of resultset columns UPDATE_RULE and DELETE_RULE when calling DatabaseMetaData API methods getImportedKeys() or getExportedKeys() or getCrossReference().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
391
diff
changeset
|
2693 "cast(CASE ((fkkey.\"action\" >> 8) & 255)" + // logic pulled from clients/mapiclient/dump.c dump_foreign_keys() |
6242351e8802
Corrected output of resultset columns UPDATE_RULE and DELETE_RULE when calling DatabaseMetaData API methods getImportedKeys() or getExportedKeys() or getCrossReference().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
391
diff
changeset
|
2694 " WHEN 0 THEN " + DatabaseMetaData.importedKeyNoAction + |
6242351e8802
Corrected output of resultset columns UPDATE_RULE and DELETE_RULE when calling DatabaseMetaData API methods getImportedKeys() or getExportedKeys() or getCrossReference().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
391
diff
changeset
|
2695 " WHEN 1 THEN " + DatabaseMetaData.importedKeyCascade + |
6242351e8802
Corrected output of resultset columns UPDATE_RULE and DELETE_RULE when calling DatabaseMetaData API methods getImportedKeys() or getExportedKeys() or getCrossReference().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
391
diff
changeset
|
2696 " WHEN 2 THEN " + DatabaseMetaData.importedKeyRestrict + |
6242351e8802
Corrected output of resultset columns UPDATE_RULE and DELETE_RULE when calling DatabaseMetaData API methods getImportedKeys() or getExportedKeys() or getCrossReference().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
391
diff
changeset
|
2697 " WHEN 3 THEN " + DatabaseMetaData.importedKeySetNull + |
6242351e8802
Corrected output of resultset columns UPDATE_RULE and DELETE_RULE when calling DatabaseMetaData API methods getImportedKeys() or getExportedKeys() or getCrossReference().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
391
diff
changeset
|
2698 " WHEN 4 THEN " + DatabaseMetaData.importedKeySetDefault + |
6242351e8802
Corrected output of resultset columns UPDATE_RULE and DELETE_RULE when calling DatabaseMetaData API methods getImportedKeys() or getExportedKeys() or getCrossReference().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
391
diff
changeset
|
2699 " ELSE " + DatabaseMetaData.importedKeyNoAction + |
6242351e8802
Corrected output of resultset columns UPDATE_RULE and DELETE_RULE when calling DatabaseMetaData API methods getImportedKeys() or getExportedKeys() or getCrossReference().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
391
diff
changeset
|
2700 " END AS smallint) AS \"UPDATE_RULE\", " + |
6242351e8802
Corrected output of resultset columns UPDATE_RULE and DELETE_RULE when calling DatabaseMetaData API methods getImportedKeys() or getExportedKeys() or getCrossReference().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
391
diff
changeset
|
2701 "cast(CASE (fkkey.\"action\" & 255)" + // logic pulled from clients/mapiclient/dump.c dump_foreign_keys() |
6242351e8802
Corrected output of resultset columns UPDATE_RULE and DELETE_RULE when calling DatabaseMetaData API methods getImportedKeys() or getExportedKeys() or getCrossReference().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
391
diff
changeset
|
2702 " WHEN 0 THEN " + DatabaseMetaData.importedKeyNoAction + |
6242351e8802
Corrected output of resultset columns UPDATE_RULE and DELETE_RULE when calling DatabaseMetaData API methods getImportedKeys() or getExportedKeys() or getCrossReference().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
391
diff
changeset
|
2703 " WHEN 1 THEN " + DatabaseMetaData.importedKeyCascade + |
6242351e8802
Corrected output of resultset columns UPDATE_RULE and DELETE_RULE when calling DatabaseMetaData API methods getImportedKeys() or getExportedKeys() or getCrossReference().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
391
diff
changeset
|
2704 " WHEN 2 THEN " + DatabaseMetaData.importedKeyRestrict + |
6242351e8802
Corrected output of resultset columns UPDATE_RULE and DELETE_RULE when calling DatabaseMetaData API methods getImportedKeys() or getExportedKeys() or getCrossReference().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
391
diff
changeset
|
2705 " WHEN 3 THEN " + DatabaseMetaData.importedKeySetNull + |
6242351e8802
Corrected output of resultset columns UPDATE_RULE and DELETE_RULE when calling DatabaseMetaData API methods getImportedKeys() or getExportedKeys() or getCrossReference().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
391
diff
changeset
|
2706 " WHEN 4 THEN " + DatabaseMetaData.importedKeySetDefault + |
6242351e8802
Corrected output of resultset columns UPDATE_RULE and DELETE_RULE when calling DatabaseMetaData API methods getImportedKeys() or getExportedKeys() or getCrossReference().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
391
diff
changeset
|
2707 " ELSE " + DatabaseMetaData.importedKeyNoAction + |
6242351e8802
Corrected output of resultset columns UPDATE_RULE and DELETE_RULE when calling DatabaseMetaData API methods getImportedKeys() or getExportedKeys() or getCrossReference().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
391
diff
changeset
|
2708 " END AS smallint) AS \"DELETE_RULE\", " + |
302
1b6c514106ce
Added table aliases and use them in all meta data SQL queries to reduce query size.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
300
diff
changeset
|
2709 "fkkey.\"name\" AS \"FK_NAME\", " + |
1b6c514106ce
Added table aliases and use them in all meta data SQL queries to reduce query size.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
300
diff
changeset
|
2710 "pkkey.\"name\" AS \"PK_NAME\", " + |
405
6242351e8802
Corrected output of resultset columns UPDATE_RULE and DELETE_RULE when calling DatabaseMetaData API methods getImportedKeys() or getExportedKeys() or getCrossReference().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
391
diff
changeset
|
2711 "cast(" + DatabaseMetaData.importedKeyNotDeferrable + " AS smallint) AS \"DEFERRABILITY\" " + |
302
1b6c514106ce
Added table aliases and use them in all meta data SQL queries to reduce query size.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
300
diff
changeset
|
2712 "FROM \"sys\".\"keys\" pkkey " + |
1b6c514106ce
Added table aliases and use them in all meta data SQL queries to reduce query size.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
300
diff
changeset
|
2713 "JOIN \"sys\".\"objects\" pkkeycol ON pkkey.\"id\" = pkkeycol.\"id\" " + |
1b6c514106ce
Added table aliases and use them in all meta data SQL queries to reduce query size.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
300
diff
changeset
|
2714 "JOIN \"sys\".\"tables\" pktable ON pktable.\"id\" = pkkey.\"table_id\" " + |
1b6c514106ce
Added table aliases and use them in all meta data SQL queries to reduce query size.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
300
diff
changeset
|
2715 "JOIN \"sys\".\"schemas\" pkschema ON pkschema.\"id\" = pktable.\"schema_id\" " + |
1b6c514106ce
Added table aliases and use them in all meta data SQL queries to reduce query size.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
300
diff
changeset
|
2716 "JOIN \"sys\".\"keys\" fkkey ON fkkey.\"rkey\" = pkkey.\"id\" " + |
1b6c514106ce
Added table aliases and use them in all meta data SQL queries to reduce query size.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
300
diff
changeset
|
2717 "JOIN \"sys\".\"objects\" fkkeycol ON (fkkey.\"id\" = fkkeycol.\"id\" AND fkkeycol.\"nr\" = pkkeycol.\"nr\") " + |
1b6c514106ce
Added table aliases and use them in all meta data SQL queries to reduce query size.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
300
diff
changeset
|
2718 "JOIN \"sys\".\"tables\" fktable ON fktable.\"id\" = fkkey.\"table_id\" " + |
1b6c514106ce
Added table aliases and use them in all meta data SQL queries to reduce query size.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
300
diff
changeset
|
2719 "JOIN \"sys\".\"schemas\" fkschema ON fkschema.\"id\" = fktable.\"schema_id\" " + |
1b6c514106ce
Added table aliases and use them in all meta data SQL queries to reduce query size.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
300
diff
changeset
|
2720 "WHERE fkkey.\"rkey\" > 0"; // exclude invalid key references, such as -1 |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2721 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2722 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2723 * Get a description of the primary key columns that are |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2724 * referenced by a table's foreign key columns (the primary keys |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2725 * imported by a table). They are ordered by PKTABLE_CAT, |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2726 * PKTABLE_SCHEM, PKTABLE_NAME, and KEY_SEQ. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2727 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2728 * <P>Each primary key column description has the following columns: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2729 * <OL> |
194
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
2730 * <LI><B>PKTABLE_CAT</B> String => primary key table catalog |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2731 * being imported (may be null) |
194
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
2732 * <LI><B>PKTABLE_SCHEM</B> String => primary key table schema |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2733 * being imported (may be null) |
194
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
2734 * <LI><B>PKTABLE_NAME</B> String => primary key table name |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2735 * being imported |
194
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
2736 * <LI><B>PKCOLUMN_NAME</B> String => primary key column name |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2737 * being imported |
194
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
2738 * <LI><B>FKTABLE_CAT</B> String => foreign key table catalog (may be null) |
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
2739 * <LI><B>FKTABLE_SCHEM</B> String => foreign key table schema (may be null) |
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
2740 * <LI><B>FKTABLE_NAME</B> String => foreign key table name |
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
2741 * <LI><B>FKCOLUMN_NAME</B> String => foreign key column name |
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
2742 * <LI><B>KEY_SEQ</B> short => sequence number within foreign key |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2743 * (a value of 1 represents the first column of the foreign key, a value of 2 would represent the second column within the foreign key). |
405
6242351e8802
Corrected output of resultset columns UPDATE_RULE and DELETE_RULE when calling DatabaseMetaData API methods getImportedKeys() or getExportedKeys() or getCrossReference().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
391
diff
changeset
|
2744 * <LI><B>UPDATE_RULE</B> short => What happens to foreign key when primary is updated: |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2745 * <UL> |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2746 * <LI> importedKeyNoAction - do not allow update of primary key if it has been imported |
405
6242351e8802
Corrected output of resultset columns UPDATE_RULE and DELETE_RULE when calling DatabaseMetaData API methods getImportedKeys() or getExportedKeys() or getCrossReference().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
391
diff
changeset
|
2747 * <LI> importedKeyCascade - change imported key to agree with primary key update |
6242351e8802
Corrected output of resultset columns UPDATE_RULE and DELETE_RULE when calling DatabaseMetaData API methods getImportedKeys() or getExportedKeys() or getCrossReference().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
391
diff
changeset
|
2748 * <LI> importedKeyRestrict - same as importedKeyNoAction (for ODBC 2.x compatibility) |
6242351e8802
Corrected output of resultset columns UPDATE_RULE and DELETE_RULE when calling DatabaseMetaData API methods getImportedKeys() or getExportedKeys() or getCrossReference().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
391
diff
changeset
|
2749 * <LI> importedKeySetNull - change imported key to NULL if its primary key has been updated |
6242351e8802
Corrected output of resultset columns UPDATE_RULE and DELETE_RULE when calling DatabaseMetaData API methods getImportedKeys() or getExportedKeys() or getCrossReference().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
391
diff
changeset
|
2750 * <LI> importedKeySetDefault - change imported key to the default values if its primary key has been updated |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2751 * </UL> |
405
6242351e8802
Corrected output of resultset columns UPDATE_RULE and DELETE_RULE when calling DatabaseMetaData API methods getImportedKeys() or getExportedKeys() or getCrossReference().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
391
diff
changeset
|
2752 * <LI><B>DELETE_RULE</B> short => What happens to the foreign key when primary is deleted. |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2753 * <UL> |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2754 * <LI> importedKeyNoAction - do not allow delete of primary key if it has been imported |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2755 * <LI> importedKeyCascade - delete rows that import a deleted key |
405
6242351e8802
Corrected output of resultset columns UPDATE_RULE and DELETE_RULE when calling DatabaseMetaData API methods getImportedKeys() or getExportedKeys() or getCrossReference().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
391
diff
changeset
|
2756 * <LI> importedKeyRestrict - same as importedKeyNoAction (for ODBC 2.x compatibility) |
6242351e8802
Corrected output of resultset columns UPDATE_RULE and DELETE_RULE when calling DatabaseMetaData API methods getImportedKeys() or getExportedKeys() or getCrossReference().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
391
diff
changeset
|
2757 * <LI> importedKeySetNull - change imported key to NULL if its primary key has been deleted |
6242351e8802
Corrected output of resultset columns UPDATE_RULE and DELETE_RULE when calling DatabaseMetaData API methods getImportedKeys() or getExportedKeys() or getCrossReference().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
391
diff
changeset
|
2758 * <LI> importedKeySetDefault - change imported key to the default values if its primary key has been deleted |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2759 * </UL> |
194
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
2760 * <LI><B>FK_NAME</B> String => foreign key name (may be null) |
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
2761 * <LI><B>PK_NAME</B> String => primary key name (may be null) |
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
2762 * <LI><B>DEFERRABILITY</B> short => can the evaluation of foreign key constraints be deferred until commit |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2763 * <UL> |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2764 * <LI> importedKeyInitiallyDeferred - see SQL92 for definition |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2765 * <LI> importedKeyInitiallyImmediate - see SQL92 for definition |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2766 * <LI> importedKeyNotDeferrable - see SQL92 for definition |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2767 * </UL> |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2768 * </OL> |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2769 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2770 * @param catalog a catalog name; "" retrieves those without a catalog |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2771 * @param schema a schema name pattern; "" retrieves those without a schema |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2772 * @param table a table name |
371
67fa5c6147d7
Correct SQL syntax in comment (LIKE "%" is not valid SQL in WHERE clause)
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
370
diff
changeset
|
2773 * Note that our implementation allows this param to be null also (for efficiency as no extra LIKE '%' condition is added to be evaluated). |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2774 * @return ResultSet each row is a primary key column description |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2775 * @see #getExportedKeys |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2776 * @throws SQLException if a database error occurs |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2777 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2778 @Override |
295
003ae6d881db
Add "final" keyword to method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
294
diff
changeset
|
2779 public ResultSet getImportedKeys( |
003ae6d881db
Add "final" keyword to method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
294
diff
changeset
|
2780 final String catalog, |
003ae6d881db
Add "final" keyword to method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
294
diff
changeset
|
2781 final String schema, |
003ae6d881db
Add "final" keyword to method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
294
diff
changeset
|
2782 final String table |
003ae6d881db
Add "final" keyword to method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
294
diff
changeset
|
2783 ) throws SQLException |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2784 { |
295
003ae6d881db
Add "final" keyword to method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
294
diff
changeset
|
2785 final StringBuilder query = new StringBuilder(keyQuery.length() + 250); |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2786 query.append(keyQuery); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2787 |
216
116b5a149fb4
Optimise SQL query generation for cases where the WHERE clause already has a AND 1 = 0 condition. Exlude adding more AND ... conditions.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
215
diff
changeset
|
2788 if (catalog != null && !catalog.isEmpty()) { |
299
1f0324072b0c
Correcting typo in comment
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
298
diff
changeset
|
2789 // non-empty catalog selection. |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2790 // as we do not support catalogs this always results in no rows returned |
352
f62137dd6050
Remove spaces from static SQL predicates: 1 = 0 and 1 = 1.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
350
diff
changeset
|
2791 query.append(" AND 1=0"); |
216
116b5a149fb4
Optimise SQL query generation for cases where the WHERE clause already has a AND 1 = 0 condition. Exlude adding more AND ... conditions.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
215
diff
changeset
|
2792 } else { |
323
8701024a9bb0
In DatabaseMetaData methods which accept name match patterns, optimise the SQL generation when the pattern equals a: %
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
306
diff
changeset
|
2793 if (schema != null && !schema.equals("%")) { |
302
1b6c514106ce
Added table aliases and use them in all meta data SQL queries to reduce query size.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
300
diff
changeset
|
2794 query.append(" AND fkschema.\"name\" ").append(composeMatchPart(schema)); |
216
116b5a149fb4
Optimise SQL query generation for cases where the WHERE clause already has a AND 1 = 0 condition. Exlude adding more AND ... conditions.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
215
diff
changeset
|
2795 } |
323
8701024a9bb0
In DatabaseMetaData methods which accept name match patterns, optimise the SQL generation when the pattern equals a: %
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
306
diff
changeset
|
2796 if (table != null && !table.equals("%")) { |
302
1b6c514106ce
Added table aliases and use them in all meta data SQL queries to reduce query size.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
300
diff
changeset
|
2797 query.append(" AND fktable.\"name\" ").append(composeMatchPart(table)); |
216
116b5a149fb4
Optimise SQL query generation for cases where the WHERE clause already has a AND 1 = 0 condition. Exlude adding more AND ... conditions.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
215
diff
changeset
|
2798 } |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2799 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2800 |
421
163b784aa93b
Added full ordering to correct issues when retrieving columns from fks where a table has multiple fks to the same table.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
415
diff
changeset
|
2801 // Note: the extra \"FKTABLE_SCHEM\", \"FKTABLE_NAME\", \"FK_NAME\" in the ordering is important |
163b784aa93b
Added full ordering to correct issues when retrieving columns from fks where a table has multiple fks to the same table.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
415
diff
changeset
|
2802 // else we do not get the correct column order when multiple fks exist to the same pk in 1 table or query multiple tables. |
163b784aa93b
Added full ordering to correct issues when retrieving columns from fks where a table has multiple fks to the same table.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
415
diff
changeset
|
2803 query.append(" ORDER BY \"PKTABLE_SCHEM\", \"PKTABLE_NAME\", \"PK_NAME\", \"FKTABLE_SCHEM\", \"FKTABLE_NAME\", \"FK_NAME\", \"KEY_SEQ\""); |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2804 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2805 return executeMetaDataQuery(query.toString()); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2806 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2807 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2808 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2809 * Get a description of a foreign key columns that reference a |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2810 * table's primary key columns (the foreign keys exported by a table). |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2811 * They are ordered by FKTABLE_CAT, FKTABLE_SCHEM, FKTABLE_NAME, and KEY_SEQ. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2812 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2813 * <P>Each foreign key column description has the following columns: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2814 * <OL> |
194
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
2815 * <LI><B>PKTABLE_CAT</B> String => primary key table catalog (may be null) |
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
2816 * <LI><B>PKTABLE_SCHEM</B> String => primary key table schema (may be null) |
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
2817 * <LI><B>PKTABLE_NAME</B> String => primary key table name |
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
2818 * <LI><B>PKCOLUMN_NAME</B> String => primary key column name |
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
2819 * <LI><B>FKTABLE_CAT</B> String => foreign key table catalog (may be null) |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2820 * being exported (may be null) |
194
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
2821 * <LI><B>FKTABLE_SCHEM</B> String => foreign key table schema (may be null) |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2822 * being exported (may be null) |
194
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
2823 * <LI><B>FKTABLE_NAME</B> String => foreign key table name |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2824 * being exported |
194
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
2825 * <LI><B>FKCOLUMN_NAME</B> String => foreign key column name |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2826 * being exported |
194
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
2827 * <LI><B>KEY_SEQ</B> short => sequence number within foreign key |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2828 * (a value of 1 represents the first column of the foreign key, a value of 2 would represent the second column within the foreign key). |
405
6242351e8802
Corrected output of resultset columns UPDATE_RULE and DELETE_RULE when calling DatabaseMetaData API methods getImportedKeys() or getExportedKeys() or getCrossReference().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
391
diff
changeset
|
2829 * <LI><B>UPDATE_RULE</B> short => What happens to foreign key when primary is updated: |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2830 * <UL> |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2831 * <LI> importedKeyNoAction - do not allow update of primary key if it has been imported |
405
6242351e8802
Corrected output of resultset columns UPDATE_RULE and DELETE_RULE when calling DatabaseMetaData API methods getImportedKeys() or getExportedKeys() or getCrossReference().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
391
diff
changeset
|
2832 * <LI> importedKeyCascade - change imported key to agree with primary key update |
6242351e8802
Corrected output of resultset columns UPDATE_RULE and DELETE_RULE when calling DatabaseMetaData API methods getImportedKeys() or getExportedKeys() or getCrossReference().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
391
diff
changeset
|
2833 * <LI> importedKeyRestrict - same as importedKeyNoAction (for ODBC 2.x compatibility) |
6242351e8802
Corrected output of resultset columns UPDATE_RULE and DELETE_RULE when calling DatabaseMetaData API methods getImportedKeys() or getExportedKeys() or getCrossReference().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
391
diff
changeset
|
2834 * <LI> importedKeySetNull - change imported key to NULL if its primary key has been updated |
6242351e8802
Corrected output of resultset columns UPDATE_RULE and DELETE_RULE when calling DatabaseMetaData API methods getImportedKeys() or getExportedKeys() or getCrossReference().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
391
diff
changeset
|
2835 * <LI> importedKeySetDefault - change imported key to the default values if its primary key has been updated |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2836 * </UL> |
405
6242351e8802
Corrected output of resultset columns UPDATE_RULE and DELETE_RULE when calling DatabaseMetaData API methods getImportedKeys() or getExportedKeys() or getCrossReference().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
391
diff
changeset
|
2837 * <LI><B>DELETE_RULE</B> short => What happens to the foreign key when primary is deleted. |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2838 * <UL> |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2839 * <LI> importedKeyNoAction - do not allow delete of primary key if it has been imported |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2840 * <LI> importedKeyCascade - delete rows that import a deleted key |
405
6242351e8802
Corrected output of resultset columns UPDATE_RULE and DELETE_RULE when calling DatabaseMetaData API methods getImportedKeys() or getExportedKeys() or getCrossReference().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
391
diff
changeset
|
2841 * <LI> importedKeyRestrict - same as importedKeyNoAction (for ODBC 2.x compatibility) |
6242351e8802
Corrected output of resultset columns UPDATE_RULE and DELETE_RULE when calling DatabaseMetaData API methods getImportedKeys() or getExportedKeys() or getCrossReference().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
391
diff
changeset
|
2842 * <LI> importedKeySetNull - change imported key to NULL if its primary key has been deleted |
6242351e8802
Corrected output of resultset columns UPDATE_RULE and DELETE_RULE when calling DatabaseMetaData API methods getImportedKeys() or getExportedKeys() or getCrossReference().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
391
diff
changeset
|
2843 * <LI> importedKeySetDefault - change imported key to the default values if its primary key has been deleted |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2844 * </UL> |
194
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
2845 * <LI><B>FK_NAME</B> String => foreign key identifier (may be null) |
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
2846 * <LI><B>PK_NAME</B> String => primary key identifier (may be null) |
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
2847 * <LI><B>DEFERRABILITY</B> short => can the evaluation of foreign key constraints be deferred until commit |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2848 * <UL> |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2849 * <LI> importedKeyInitiallyDeferred - see SQL92 for definition |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2850 * <LI> importedKeyInitiallyImmediate - see SQL92 for definition |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2851 * <LI> importedKeyNotDeferrable - see SQL92 for definition |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2852 * </UL> |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2853 * </OL> |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2854 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2855 * @param catalog a catalog name; "" retrieves those without a catalog |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2856 * @param schema a schema name pattern; "" retrieves those without a schema |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2857 * @param table a table name |
371
67fa5c6147d7
Correct SQL syntax in comment (LIKE "%" is not valid SQL in WHERE clause)
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
370
diff
changeset
|
2858 * Note that our implementation allows this param to be null also (for efficiency as no extra LIKE '%' condition is added to be evaluated). |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2859 * @return ResultSet each row is a foreign key column description |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2860 * @see #getImportedKeys |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2861 * @throws SQLException if a database error occurs |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2862 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2863 @Override |
295
003ae6d881db
Add "final" keyword to method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
294
diff
changeset
|
2864 public ResultSet getExportedKeys( |
003ae6d881db
Add "final" keyword to method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
294
diff
changeset
|
2865 final String catalog, |
003ae6d881db
Add "final" keyword to method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
294
diff
changeset
|
2866 final String schema, |
371
67fa5c6147d7
Correct SQL syntax in comment (LIKE "%" is not valid SQL in WHERE clause)
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
370
diff
changeset
|
2867 final String table |
295
003ae6d881db
Add "final" keyword to method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
294
diff
changeset
|
2868 ) throws SQLException |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2869 { |
295
003ae6d881db
Add "final" keyword to method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
294
diff
changeset
|
2870 final StringBuilder query = new StringBuilder(keyQuery.length() + 250); |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2871 query.append(keyQuery); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2872 |
216
116b5a149fb4
Optimise SQL query generation for cases where the WHERE clause already has a AND 1 = 0 condition. Exlude adding more AND ... conditions.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
215
diff
changeset
|
2873 if (catalog != null && !catalog.isEmpty()) { |
299
1f0324072b0c
Correcting typo in comment
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
298
diff
changeset
|
2874 // non-empty catalog selection. |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2875 // as we do not support catalogs this always results in no rows returned |
352
f62137dd6050
Remove spaces from static SQL predicates: 1 = 0 and 1 = 1.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
350
diff
changeset
|
2876 query.append(" AND 1=0"); |
216
116b5a149fb4
Optimise SQL query generation for cases where the WHERE clause already has a AND 1 = 0 condition. Exlude adding more AND ... conditions.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
215
diff
changeset
|
2877 } else { |
323
8701024a9bb0
In DatabaseMetaData methods which accept name match patterns, optimise the SQL generation when the pattern equals a: %
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
306
diff
changeset
|
2878 if (schema != null && !schema.equals("%")) { |
302
1b6c514106ce
Added table aliases and use them in all meta data SQL queries to reduce query size.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
300
diff
changeset
|
2879 query.append(" AND pkschema.\"name\" ").append(composeMatchPart(schema)); |
216
116b5a149fb4
Optimise SQL query generation for cases where the WHERE clause already has a AND 1 = 0 condition. Exlude adding more AND ... conditions.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
215
diff
changeset
|
2880 } |
323
8701024a9bb0
In DatabaseMetaData methods which accept name match patterns, optimise the SQL generation when the pattern equals a: %
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
306
diff
changeset
|
2881 if (table != null && !table.equals("%")) { |
302
1b6c514106ce
Added table aliases and use them in all meta data SQL queries to reduce query size.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
300
diff
changeset
|
2882 query.append(" AND pktable.\"name\" ").append(composeMatchPart(table)); |
216
116b5a149fb4
Optimise SQL query generation for cases where the WHERE clause already has a AND 1 = 0 condition. Exlude adding more AND ... conditions.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
215
diff
changeset
|
2883 } |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2884 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2885 |
421
163b784aa93b
Added full ordering to correct issues when retrieving columns from fks where a table has multiple fks to the same table.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
415
diff
changeset
|
2886 // Note: the extra \"PKTABLE_SCHEM\", \"PKTABLE_NAME\", \"PK_NAME\" in the ordering is important |
163b784aa93b
Added full ordering to correct issues when retrieving columns from fks where a table has multiple fks to the same table.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
415
diff
changeset
|
2887 // else we do not get the correct column order when multiple fks exist to the same pk in 1 table or query multiple tables. |
163b784aa93b
Added full ordering to correct issues when retrieving columns from fks where a table has multiple fks to the same table.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
415
diff
changeset
|
2888 query.append(" ORDER BY \"FKTABLE_SCHEM\", \"FKTABLE_NAME\", \"FK_NAME\", \"PKTABLE_SCHEM\", \"PKTABLE_NAME\", \"PK_NAME\", \"KEY_SEQ\""); |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2889 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2890 return executeMetaDataQuery(query.toString()); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2891 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2892 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2893 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2894 * Get a description of the foreign key columns in the foreign key |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2895 * table that reference the primary key columns of the primary key |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2896 * table. (describe how one table imports another's key) This |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2897 * should normally return a single foreign key/primary key pair |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2898 * (most tables only import a foreign key from a table once.) |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2899 * They are ordered by FKTABLE_CAT, FKTABLE_SCHEM, FKTABLE_NAME, and KEY_SEQ. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2900 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2901 * <P>Each foreign key column description has the following columns: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2902 * <OL> |
194
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
2903 * <LI><B>PKTABLE_CAT</B> String => primary key table catalog (may be null) |
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
2904 * <LI><B>PKTABLE_SCHEM</B> String => primary key table schema (may be null) |
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
2905 * <LI><B>PKTABLE_NAME</B> String => primary key table name |
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
2906 * <LI><B>PKCOLUMN_NAME</B> String => primary key column name |
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
2907 * <LI><B>FKTABLE_CAT</B> String => foreign key table catalog (may be null) |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2908 * being exported (may be null) |
194
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
2909 * <LI><B>FKTABLE_SCHEM</B> String => foreign key table schema (may be null) |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2910 * being exported (may be null) |
194
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
2911 * <LI><B>FKTABLE_NAME</B> String => foreign key table name |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2912 * being exported |
194
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
2913 * <LI><B>FKCOLUMN_NAME</B> String => foreign key column name |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2914 * being exported |
194
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
2915 * <LI><B>KEY_SEQ</B> short => sequence number within foreign key |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2916 * (a value of 1 represents the first column of the foreign key, a value of 2 would represent the second column within the foreign key). |
405
6242351e8802
Corrected output of resultset columns UPDATE_RULE and DELETE_RULE when calling DatabaseMetaData API methods getImportedKeys() or getExportedKeys() or getCrossReference().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
391
diff
changeset
|
2917 * <LI><B>UPDATE_RULE</B> short => What happens to foreign key when primary is updated: |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2918 * <UL> |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2919 * <LI> importedKeyNoAction - do not allow update of primary key if it has been imported |
405
6242351e8802
Corrected output of resultset columns UPDATE_RULE and DELETE_RULE when calling DatabaseMetaData API methods getImportedKeys() or getExportedKeys() or getCrossReference().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
391
diff
changeset
|
2920 * <LI> importedKeyCascade - change imported key to agree with primary key update |
6242351e8802
Corrected output of resultset columns UPDATE_RULE and DELETE_RULE when calling DatabaseMetaData API methods getImportedKeys() or getExportedKeys() or getCrossReference().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
391
diff
changeset
|
2921 * <LI> importedKeyRestrict - same as importedKeyNoAction (for ODBC 2.x compatibility) |
6242351e8802
Corrected output of resultset columns UPDATE_RULE and DELETE_RULE when calling DatabaseMetaData API methods getImportedKeys() or getExportedKeys() or getCrossReference().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
391
diff
changeset
|
2922 * <LI> importedKeySetNull - change imported key to NULL if its primary key has been updated |
6242351e8802
Corrected output of resultset columns UPDATE_RULE and DELETE_RULE when calling DatabaseMetaData API methods getImportedKeys() or getExportedKeys() or getCrossReference().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
391
diff
changeset
|
2923 * <LI> importedKeySetDefault - change imported key to the default values if its primary key has been updated |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2924 * </UL> |
405
6242351e8802
Corrected output of resultset columns UPDATE_RULE and DELETE_RULE when calling DatabaseMetaData API methods getImportedKeys() or getExportedKeys() or getCrossReference().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
391
diff
changeset
|
2925 * <LI><B>DELETE_RULE</B> short => What happens to the foreign key when primary is deleted. |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2926 * <UL> |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2927 * <LI> importedKeyNoAction - do not allow delete of primary key if it has been imported |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2928 * <LI> importedKeyCascade - delete rows that import a deleted key |
405
6242351e8802
Corrected output of resultset columns UPDATE_RULE and DELETE_RULE when calling DatabaseMetaData API methods getImportedKeys() or getExportedKeys() or getCrossReference().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
391
diff
changeset
|
2929 * <LI> importedKeyRestrict - same as importedKeyNoAction (for ODBC 2.x compatibility) |
6242351e8802
Corrected output of resultset columns UPDATE_RULE and DELETE_RULE when calling DatabaseMetaData API methods getImportedKeys() or getExportedKeys() or getCrossReference().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
391
diff
changeset
|
2930 * <LI> importedKeySetNull - change imported key to NULL if its primary key has been deleted |
6242351e8802
Corrected output of resultset columns UPDATE_RULE and DELETE_RULE when calling DatabaseMetaData API methods getImportedKeys() or getExportedKeys() or getCrossReference().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
391
diff
changeset
|
2931 * <LI> importedKeySetDefault - change imported key to the default values if its primary key has been deleted |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2932 * </UL> |
194
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
2933 * <LI><B>FK_NAME</B> String => foreign key identifier (may be null) |
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
2934 * <LI><B>PK_NAME</B> String => primary key identifier (may be null) |
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
2935 * <LI><B>DEFERRABILITY</B> short => can the evaluation of foreign key constraints be deferred until commit |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2936 * <UL> |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2937 * <LI> importedKeyInitiallyDeferred - see SQL92 for definition |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2938 * <LI> importedKeyInitiallyImmediate - see SQL92 for definition |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2939 * <LI> importedKeyNotDeferrable - see SQL92 for definition |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2940 * </UL> |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2941 * </OL> |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2942 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2943 * @param pcatalog primary key catalog name; "" retrieves those without a catalog |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2944 * @param pschema primary key schema name pattern; "" retrieves those without a schema |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2945 * @param ptable primary key table name |
371
67fa5c6147d7
Correct SQL syntax in comment (LIKE "%" is not valid SQL in WHERE clause)
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
370
diff
changeset
|
2946 * Note that our implementation allows this param to be null also (for efficiency as no extra LIKE '%' condition is added to be evaluated). |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2947 * @param fcatalog foreign key catalog name; "" retrieves those without a catalog |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2948 * @param fschema foreign key schema name pattern; "" retrieves those without a schema |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2949 * @param ftable koreign key table name |
371
67fa5c6147d7
Correct SQL syntax in comment (LIKE "%" is not valid SQL in WHERE clause)
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
370
diff
changeset
|
2950 * Note that our implementation allows this param to be null also (for efficiency as no extra LIKE '%' condition is added to be evaluated). |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2951 * @return ResultSet each row is a foreign key column description |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2952 * @throws SQLException if a database error occurs |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2953 * @see #getImportedKeys |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2954 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2955 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2956 public ResultSet getCrossReference( |
295
003ae6d881db
Add "final" keyword to method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
294
diff
changeset
|
2957 final String pcatalog, |
003ae6d881db
Add "final" keyword to method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
294
diff
changeset
|
2958 final String pschema, |
003ae6d881db
Add "final" keyword to method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
294
diff
changeset
|
2959 final String ptable, |
003ae6d881db
Add "final" keyword to method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
294
diff
changeset
|
2960 final String fcatalog, |
003ae6d881db
Add "final" keyword to method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
294
diff
changeset
|
2961 final String fschema, |
003ae6d881db
Add "final" keyword to method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
294
diff
changeset
|
2962 final String ftable |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2963 ) throws SQLException |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2964 { |
295
003ae6d881db
Add "final" keyword to method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
294
diff
changeset
|
2965 final StringBuilder query = new StringBuilder(keyQuery.length() + 350); |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2966 query.append(keyQuery); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2967 |
216
116b5a149fb4
Optimise SQL query generation for cases where the WHERE clause already has a AND 1 = 0 condition. Exlude adding more AND ... conditions.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
215
diff
changeset
|
2968 if ((pcatalog != null && !pcatalog.isEmpty()) |
116b5a149fb4
Optimise SQL query generation for cases where the WHERE clause already has a AND 1 = 0 condition. Exlude adding more AND ... conditions.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
215
diff
changeset
|
2969 || (fcatalog != null && !fcatalog.isEmpty())) { |
299
1f0324072b0c
Correcting typo in comment
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
298
diff
changeset
|
2970 // non-empty catalog selection. |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2971 // as we do not support catalogs this always results in no rows returned |
352
f62137dd6050
Remove spaces from static SQL predicates: 1 = 0 and 1 = 1.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
350
diff
changeset
|
2972 query.append(" AND 1=0"); |
216
116b5a149fb4
Optimise SQL query generation for cases where the WHERE clause already has a AND 1 = 0 condition. Exlude adding more AND ... conditions.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
215
diff
changeset
|
2973 } else { |
323
8701024a9bb0
In DatabaseMetaData methods which accept name match patterns, optimise the SQL generation when the pattern equals a: %
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
306
diff
changeset
|
2974 if (pschema != null && !pschema.equals("%")) { |
302
1b6c514106ce
Added table aliases and use them in all meta data SQL queries to reduce query size.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
300
diff
changeset
|
2975 query.append(" AND pkschema.\"name\" ").append(composeMatchPart(pschema)); |
216
116b5a149fb4
Optimise SQL query generation for cases where the WHERE clause already has a AND 1 = 0 condition. Exlude adding more AND ... conditions.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
215
diff
changeset
|
2976 } |
323
8701024a9bb0
In DatabaseMetaData methods which accept name match patterns, optimise the SQL generation when the pattern equals a: %
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
306
diff
changeset
|
2977 if (ptable != null && !ptable.equals("%")) { |
302
1b6c514106ce
Added table aliases and use them in all meta data SQL queries to reduce query size.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
300
diff
changeset
|
2978 query.append(" AND pktable.\"name\" ").append(composeMatchPart(ptable)); |
216
116b5a149fb4
Optimise SQL query generation for cases where the WHERE clause already has a AND 1 = 0 condition. Exlude adding more AND ... conditions.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
215
diff
changeset
|
2979 } |
116b5a149fb4
Optimise SQL query generation for cases where the WHERE clause already has a AND 1 = 0 condition. Exlude adding more AND ... conditions.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
215
diff
changeset
|
2980 |
323
8701024a9bb0
In DatabaseMetaData methods which accept name match patterns, optimise the SQL generation when the pattern equals a: %
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
306
diff
changeset
|
2981 if (fschema != null && !fschema.equals("%")) { |
302
1b6c514106ce
Added table aliases and use them in all meta data SQL queries to reduce query size.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
300
diff
changeset
|
2982 query.append(" AND fkschema.\"name\" ").append(composeMatchPart(fschema)); |
216
116b5a149fb4
Optimise SQL query generation for cases where the WHERE clause already has a AND 1 = 0 condition. Exlude adding more AND ... conditions.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
215
diff
changeset
|
2983 } |
323
8701024a9bb0
In DatabaseMetaData methods which accept name match patterns, optimise the SQL generation when the pattern equals a: %
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
306
diff
changeset
|
2984 if (ftable != null && !ftable.equals("%")) { |
302
1b6c514106ce
Added table aliases and use them in all meta data SQL queries to reduce query size.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
300
diff
changeset
|
2985 query.append(" AND fktable.\"name\" ").append(composeMatchPart(ftable)); |
216
116b5a149fb4
Optimise SQL query generation for cases where the WHERE clause already has a AND 1 = 0 condition. Exlude adding more AND ... conditions.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
215
diff
changeset
|
2986 } |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2987 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2988 |
421
163b784aa93b
Added full ordering to correct issues when retrieving columns from fks where a table has multiple fks to the same table.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
415
diff
changeset
|
2989 // Note: the extra \"PKTABLE_SCHEM\", \"PKTABLE_NAME\", \"PK_NAME\" in the ordering is important |
163b784aa93b
Added full ordering to correct issues when retrieving columns from fks where a table has multiple fks to the same table.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
415
diff
changeset
|
2990 // else we do not get the correct column order when multiple fks exist to the same pk in 1 table or query multiple tables. |
163b784aa93b
Added full ordering to correct issues when retrieving columns from fks where a table has multiple fks to the same table.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
415
diff
changeset
|
2991 query.append(" ORDER BY \"FKTABLE_SCHEM\", \"FKTABLE_NAME\", \"FK_NAME\", \"PKTABLE_SCHEM\", \"PKTABLE_NAME\", \"PK_NAME\", \"KEY_SEQ\""); |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2992 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2993 return executeMetaDataQuery(query.toString()); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2994 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2995 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2996 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2997 * Get a description of all the SQL data types supported by |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2998 * this database. They are ordered by DATA_TYPE and then by how |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2999 * closely the data type maps to the corresponding JDBC SQL type. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3000 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3001 * If the database supports SQL distinct types, then getTypeInfo() will |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3002 * return a single row with a TYPE_NAME of DISTINCT and a DATA_TYPE of Types.DISTINCT. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3003 * If the database supports SQL structured types, then getTypeInfo() will |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3004 * return a single row with a TYPE_NAME of STRUCT and a DATA_TYPE of Types.STRUCT. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3005 * If SQL distinct or structured types are supported, then information on |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3006 * the individual types may be obtained from the getUDTs() method. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3007 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3008 * <P>Each type description has the following columns: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3009 * <OL> |
194
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
3010 * <LI><B>TYPE_NAME</B> String => Type name |
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
3011 * <LI><B>DATA_TYPE</B> int => SQL data type from java.sql.Types |
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
3012 * <LI><B>PRECISION</B> int => maximum precision |
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
3013 * <LI><B>LITERAL_PREFIX</B> String => prefix used to quote a literal (may be null) |
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
3014 * <LI><B>LITERAL_SUFFIX</B> String => suffix used to quote a literal (may be null) |
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
3015 * <LI><B>CREATE_PARAMS</B> String => parameters used in creating |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3016 * the type (may be null) |
194
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
3017 * <LI><B>NULLABLE</B> short => can you use NULL for this type? |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3018 * <UL> |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3019 * <LI> typeNoNulls - does not allow NULL values |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3020 * <LI> typeNullable - allows NULL values |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3021 * <LI> typeNullableUnknown - nullability unknown |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3022 * </UL> |
194
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
3023 * <LI><B>CASE_SENSITIVE</B> boolean=> is it case sensitive? |
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
3024 * <LI><B>SEARCHABLE</B> short => can you use "WHERE" based on this type: |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3025 * <UL> |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3026 * <LI> typePredNone - No support |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3027 * <LI> typePredChar - Only supported with WHERE .. LIKE |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3028 * <LI> typePredBasic - Supported except for WHERE .. LIKE |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3029 * <LI> typeSearchable - Supported for all WHERE .. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3030 * </UL> |
194
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
3031 * <LI><B>UNSIGNED_ATTRIBUTE</B> boolean => is it unsigned? |
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
3032 * <LI><B>FIXED_PREC_SCALE</B> boolean => can it be a money value? |
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
3033 * <LI><B>AUTO_INCREMENT</B> boolean => can it be used for an |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3034 * auto-increment value? |
194
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
3035 * <LI><B>LOCAL_TYPE_NAME</B> String => localized version of type name |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3036 * (may be null) |
194
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
3037 * <LI><B>MINIMUM_SCALE</B> short => minimum scale supported |
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
3038 * <LI><B>MAXIMUM_SCALE</B> short => maximum scale supported |
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
3039 * <LI><B>SQL_DATA_TYPE</B> int => unused |
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
3040 * <LI><B>SQL_DATETIME_SUB</B> int => unused |
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
3041 * <LI><B>NUM_PREC_RADIX</B> int => usually 2 or 10 |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3042 * </OL> |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3043 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3044 * @return ResultSet each row is a SQL type description |
194
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
3045 * @throws SQLException if a database error occurs |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3046 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3047 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3048 public ResultSet getTypeInfo() throws SQLException { |
682
78253fdb3c3f
Corrected returned SQL TypeName values for the MonetDB interval types: 'day_interval', 'month_interval' and 'sec_interval'.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
680
diff
changeset
|
3049 final StringBuilder query = new StringBuilder(3200); |
78253fdb3c3f
Corrected returned SQL TypeName values for the MonetDB interval types: 'day_interval', 'month_interval' and 'sec_interval'.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
680
diff
changeset
|
3050 query.append("SELECT CASE \"sqlname\" WHEN 'day_interval' THEN 'interval day'" + |
78253fdb3c3f
Corrected returned SQL TypeName values for the MonetDB interval types: 'day_interval', 'month_interval' and 'sec_interval'.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
680
diff
changeset
|
3051 " WHEN 'month_interval' THEN 'interval month'" + |
78253fdb3c3f
Corrected returned SQL TypeName values for the MonetDB interval types: 'day_interval', 'month_interval' and 'sec_interval'.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
680
diff
changeset
|
3052 " WHEN 'sec_interval' THEN 'interval second'" + |
78253fdb3c3f
Corrected returned SQL TypeName values for the MonetDB interval types: 'day_interval', 'month_interval' and 'sec_interval'.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
680
diff
changeset
|
3053 " ELSE \"sqlname\" END AS \"TYPE_NAME\", " + |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3054 "cast(").append(MonetDriver.getSQLTypeMap("\"sqlname\"")).append(" AS int) AS \"DATA_TYPE\", " + |
818
4117aa40a6b9
Fix the computed CHAR_OCTET_LENGTH value of resultsets returned by getColumns(), getFunctionColumns() and getProcedureColumns().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
817
diff
changeset
|
3055 "cast(CASE WHEN \"sqlname\" IN ('time','timetz','timestamp','timestamptz') THEN \"digits\" -1" + |
4117aa40a6b9
Fix the computed CHAR_OCTET_LENGTH value of resultsets returned by getColumns(), getFunctionColumns() and getProcedureColumns().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
817
diff
changeset
|
3056 " WHEN \"sqlname\" IN ('sec_interval','day_interval') THEN 3" + |
4117aa40a6b9
Fix the computed CHAR_OCTET_LENGTH value of resultsets returned by getColumns(), getFunctionColumns() and getProcedureColumns().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
817
diff
changeset
|
3057 " WHEN \"sqlname\" = 'month_interval' THEN 0 ELSE \"digits\" END AS int) AS \"PRECISION\", " + // note that when radix is 2 the precision shows the number of bits |
415
50e43af49d47
Improved DatabaseMetaData.getTypeInfo() output for temporal data types: sec_interval, day_interval, month_interval, date, time, timetz, timestamp and timestamptz.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
406
diff
changeset
|
3058 "cast(CASE WHEN \"sqlname\" IN ('char','varchar','sec_interval','day_interval','month_interval') THEN ''''" + |
642
dd9b4fb14256
Added recognition of 'xml' type.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
626
diff
changeset
|
3059 " WHEN \"sqlname\" IN ('clob','inet','json','url','uuid','date','time','timetz','timestamp','timestamptz','blob','sqlblob','xml') THEN \"sqlname\"||' '''" + |
415
50e43af49d47
Improved DatabaseMetaData.getTypeInfo() output for temporal data types: sec_interval, day_interval, month_interval, date, time, timetz, timestamp and timestamptz.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
406
diff
changeset
|
3060 " ELSE NULL END AS varchar(16)) AS \"LITERAL_PREFIX\", " + |
50e43af49d47
Improved DatabaseMetaData.getTypeInfo() output for temporal data types: sec_interval, day_interval, month_interval, date, time, timetz, timestamp and timestamptz.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
406
diff
changeset
|
3061 "cast(CASE WHEN \"sqlname\" IN ('char','varchar','sec_interval','day_interval','month_interval'" + |
642
dd9b4fb14256
Added recognition of 'xml' type.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
626
diff
changeset
|
3062 ",'clob','inet','json','url','uuid','date','time','timetz','timestamp','timestamptz','blob','sqlblob','xml') THEN ''''" + |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3063 " ELSE NULL END AS varchar(2)) AS \"LITERAL_SUFFIX\", " + |
379
d7661075ebf7
Add support for new (as of Oct2020 release) datatype: day_interval
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
376
diff
changeset
|
3064 "CASE WHEN \"sqlname\" IN ('char','varchar') THEN 'max length'" + |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3065 " WHEN \"sqlname\" = 'decimal' THEN 'precision, scale'" + |
818
4117aa40a6b9
Fix the computed CHAR_OCTET_LENGTH value of resultsets returned by getColumns(), getFunctionColumns() and getProcedureColumns().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
817
diff
changeset
|
3066 " WHEN \"sqlname\" IN ('time','timetz','timestamp','timestamptz') THEN 'precision'" + |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3067 " ELSE NULL END AS \"CREATE_PARAMS\", " + |
759
846a456f0f0c
Remove append() calls for static int values in construction of Strings.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
757
diff
changeset
|
3068 "cast(CASE WHEN \"systemname\" = 'oid' THEN " + DatabaseMetaData.typeNoNulls + |
846a456f0f0c
Remove append() calls for static int values in construction of Strings.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
757
diff
changeset
|
3069 " ELSE " + DatabaseMetaData.typeNullable + " END AS smallint) AS \"NULLABLE\", " + |
642
dd9b4fb14256
Added recognition of 'xml' type.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
626
diff
changeset
|
3070 "CASE WHEN \"systemname\" IN ('str','json','url','xml') THEN true ELSE false END AS \"CASE_SENSITIVE\", " + |
759
846a456f0f0c
Remove append() calls for static int values in construction of Strings.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
757
diff
changeset
|
3071 "cast(CASE WHEN \"systemname\" IN ('str','inet','json','url','uuid','xml') THEN " + DatabaseMetaData.typeSearchable + |
846a456f0f0c
Remove append() calls for static int values in construction of Strings.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
757
diff
changeset
|
3072 " ELSE " + DatabaseMetaData.typePredBasic + " END AS smallint) AS \"SEARCHABLE\", " + |
415
50e43af49d47
Improved DatabaseMetaData.getTypeInfo() output for temporal data types: sec_interval, day_interval, month_interval, date, time, timetz, timestamp and timestamptz.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
406
diff
changeset
|
3073 "CASE WHEN \"sqlname\" IN ('tinyint','smallint','int','bigint','hugeint','decimal','real','double'" + |
50e43af49d47
Improved DatabaseMetaData.getTypeInfo() output for temporal data types: sec_interval, day_interval, month_interval, date, time, timetz, timestamp and timestamptz.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
406
diff
changeset
|
3074 ",'day_interval','month_interval','sec_interval') THEN false ELSE true END AS \"UNSIGNED_ATTRIBUTE\", " + |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3075 "CASE \"sqlname\" WHEN 'decimal' THEN true ELSE false END AS \"FIXED_PREC_SCALE\", " + |
375
a229ac4e275c
Corrected MonetDatabaseMetaData.getTypeInfo()
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
372
diff
changeset
|
3076 "CASE WHEN \"sqlname\" IN ('tinyint','smallint','int','bigint') THEN true ELSE false END AS \"AUTO_INCREMENT\", " + |
682
78253fdb3c3f
Corrected returned SQL TypeName values for the MonetDB interval types: 'day_interval', 'month_interval' and 'sec_interval'.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
680
diff
changeset
|
3077 "CASE WHEN \"sqlname\" IN ('sec_interval','day_interval','month_interval') THEN \"sqlname\" ELSE \"systemname\" END AS \"LOCAL_TYPE_NAME\", " + |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3078 "cast(0 AS smallint) AS \"MINIMUM_SCALE\", " + |
379
d7661075ebf7
Add support for new (as of Oct2020 release) datatype: day_interval
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
376
diff
changeset
|
3079 "cast(CASE WHEN \"sqlname\" = 'decimal' THEN (CASE \"systemname\" WHEN 'int' THEN 9 WHEN 'lng' THEN 18 WHEN 'sht' THEN 4 WHEN 'hge' THEN 38 WHEN 'bte' THEN 2 ELSE 0 END)" + |
818
4117aa40a6b9
Fix the computed CHAR_OCTET_LENGTH value of resultsets returned by getColumns(), getFunctionColumns() and getProcedureColumns().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
817
diff
changeset
|
3080 " WHEN \"sqlname\" IN ('time','timetz','timestamp','timestamptz') THEN 6" + |
4117aa40a6b9
Fix the computed CHAR_OCTET_LENGTH value of resultsets returned by getColumns(), getFunctionColumns() and getProcedureColumns().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
817
diff
changeset
|
3081 " WHEN \"sqlname\" IN ('day_interval','sec_interval') THEN 3 ELSE 0 END AS smallint) AS \"MAXIMUM_SCALE\", " + |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3082 "cast(0 AS int) AS \"SQL_DATA_TYPE\", " + |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3083 "cast(0 AS int) AS \"SQL_DATETIME_SUB\", " + |
415
50e43af49d47
Improved DatabaseMetaData.getTypeInfo() output for temporal data types: sec_interval, day_interval, month_interval, date, time, timetz, timestamp and timestamptz.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
406
diff
changeset
|
3084 "cast(CASE WHEN \"sqlname\" IN ('time','timetz','timestamp','timestamptz','sec_interval') THEN 10 ELSE \"radix\" END AS int) AS \"NUM_PREC_RADIX\" " + |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3085 "FROM \"sys\".\"types\" " + |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3086 "ORDER BY \"DATA_TYPE\", \"sqlname\", \"id\""); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3087 |
682
78253fdb3c3f
Corrected returned SQL TypeName values for the MonetDB interval types: 'day_interval', 'month_interval' and 'sec_interval'.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
680
diff
changeset
|
3088 /* if (query.length() >= 3200) System.err.println("getTypeInfo(), extend query default size to: " + query.length()); */ |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3089 return executeMetaDataQuery(query.toString()); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3090 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3091 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3092 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3093 * Retrieves a description of the given table's indices and statistics. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3094 * They are ordered by NON_UNIQUE, TYPE, INDEX_NAME, and ORDINAL_POSITION. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3095 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3096 * <P>Each index column description has the following columns: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3097 * <OL> |
194
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
3098 * <LI><B>TABLE_CAT</B> String => table catalog (may be null) |
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
3099 * <LI><B>TABLE_SCHEM</B> String => table schema (may be null) |
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
3100 * <LI><B>TABLE_NAME</B> String => table name |
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
3101 * <LI><B>NON_UNIQUE</B> boolean => Can index values be non-unique? |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3102 * false when TYPE is tableIndexStatistic |
194
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
3103 * <LI><B>INDEX_QUALIFIER</B> String => index catalog (may be null); |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3104 * null when TYPE is tableIndexStatistic |
194
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
3105 * <LI><B>INDEX_NAME</B> String => index name; null when TYPE is |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3106 * tableIndexStatistic |
194
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
3107 * <LI><B>TYPE</B> short => index type: |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3108 * <UL> |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3109 * <LI> tableIndexStatistic - this identifies table statistics that are |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3110 * returned in conjuction with a table's index descriptions |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3111 * <LI> tableIndexClustered - this is a clustered index |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3112 * <LI> tableIndexHashed - this is a hashed index |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3113 * <LI> tableIndexOther - this is some other style of index |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3114 * </UL> |
194
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
3115 * <LI><B>ORDINAL_POSITION</B> short => column sequence number |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3116 * within index; zero when TYPE is tableIndexStatistic |
194
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
3117 * <LI><B>COLUMN_NAME</B> String => column name; null when TYPE is |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3118 * tableIndexStatistic |
194
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
3119 * <LI><B>ASC_OR_DESC</B> String => column sort sequence, "A" => ascending |
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
3120 * "D" => descending, may be null if sort sequence is not supported; |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3121 * null when TYPE is tableIndexStatistic |
194
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
3122 * <LI><B>CARDINALITY</B> int => When TYPE is tableIndexStatisic then |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3123 * this is the number of rows in the table; otherwise it is the |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3124 * number of unique values in the index. |
194
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
3125 * <LI><B>PAGES</B> int => When TYPE is tableIndexStatisic then |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3126 * this is the number of pages used for the table, otherwise it |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3127 * is the number of pages used for the current index. |
194
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
3128 * <LI><B>FILTER_CONDITION</B> String => Filter condition, if any. |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3129 * (may be null) |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3130 * </OL> |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3131 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3132 * @param catalog a catalog name; "" retrieves those without a catalog |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3133 * @param schema a schema name pattern; "" retrieves those without a schema |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3134 * @param table a table name |
371
67fa5c6147d7
Correct SQL syntax in comment (LIKE "%" is not valid SQL in WHERE clause)
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
370
diff
changeset
|
3135 * Note that our implementation allows this param to be null also (for efficiency as no extra LIKE '%' condition is added to be evaluated). |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3136 * @param unique when true, return only indices for unique values; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3137 * when false, return indices regardless of whether unique or not |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3138 * @param approximate when true, result is allowed to reflect approximate |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3139 * or out of data values; when false, results are requested to be |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3140 * accurate |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3141 * @return ResultSet each row is an index column description |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3142 * @throws SQLException if a database occurs |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3143 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3144 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3145 public ResultSet getIndexInfo( |
295
003ae6d881db
Add "final" keyword to method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
294
diff
changeset
|
3146 final String catalog, |
003ae6d881db
Add "final" keyword to method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
294
diff
changeset
|
3147 final String schema, |
003ae6d881db
Add "final" keyword to method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
294
diff
changeset
|
3148 final String table, |
003ae6d881db
Add "final" keyword to method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
294
diff
changeset
|
3149 final boolean unique, |
003ae6d881db
Add "final" keyword to method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
294
diff
changeset
|
3150 final boolean approximate |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3151 ) throws SQLException |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3152 { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3153 String table_row_count = "0"; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3154 |
302
1b6c514106ce
Added table aliases and use them in all meta data SQL queries to reduce query size.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
300
diff
changeset
|
3155 if (!approximate |
1b6c514106ce
Added table aliases and use them in all meta data SQL queries to reduce query size.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
300
diff
changeset
|
3156 && schema != null && !schema.isEmpty() && !schema.contains("%") |
1b6c514106ce
Added table aliases and use them in all meta data SQL queries to reduce query size.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
300
diff
changeset
|
3157 && table != null && !table.isEmpty() && !table.contains("%")) { |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3158 // we need the exact cardinality for one specific fully qualified table |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3159 ResultSet count = null; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3160 try { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3161 count = executeMetaDataQuery("SELECT COUNT(*) FROM \"" + schema + "\".\"" + table + "\""); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3162 if (count != null && count.next()) { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3163 String count_value = count.getString(1); |
216
116b5a149fb4
Optimise SQL query generation for cases where the WHERE clause already has a AND 1 = 0 condition. Exlude adding more AND ... conditions.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
215
diff
changeset
|
3164 if (count_value != null && !count_value.isEmpty()) |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3165 table_row_count = count_value; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3166 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3167 } catch (SQLException e) { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3168 // ignore |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3169 } finally { |
300
8cc3b51d1984
Add a utility method to close objects ignoring any possible SQLExceptions thrown.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
299
diff
changeset
|
3170 MonetConnection.closeResultsetStatement(count, null); |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3171 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3172 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3173 |
649
060347aa81ea
By fixing methods getPrimaryKeys(), getBestRowIdentifier() and getIndexInfo() for local temporary tables, it also caused it to fail for global temporary tables in schema tmp.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
645
diff
changeset
|
3174 final StringBuilder query = new StringBuilder(2500); |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3175 query.append( |
217
7cbd20ff628c
Removed DISTINCT from SELECT DISTINCT where it should not be needed (in getTables() and getFunctionColumns())
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
216
diff
changeset
|
3176 "SELECT cast(null AS char(1)) AS \"TABLE_CAT\", " + |
302
1b6c514106ce
Added table aliases and use them in all meta data SQL queries to reduce query size.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
300
diff
changeset
|
3177 "s.\"name\" AS \"TABLE_SCHEM\", " + |
1b6c514106ce
Added table aliases and use them in all meta data SQL queries to reduce query size.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
300
diff
changeset
|
3178 "t.\"name\" AS \"TABLE_NAME\", " + |
1b6c514106ce
Added table aliases and use them in all meta data SQL queries to reduce query size.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
300
diff
changeset
|
3179 "CASE WHEN k.\"name\" IS NULL THEN true ELSE false END AS \"NON_UNIQUE\", " + |
217
7cbd20ff628c
Removed DISTINCT from SELECT DISTINCT where it should not be needed (in getTables() and getFunctionColumns())
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
216
diff
changeset
|
3180 "cast(null AS char(1)) AS \"INDEX_QUALIFIER\", " + |
302
1b6c514106ce
Added table aliases and use them in all meta data SQL queries to reduce query size.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
300
diff
changeset
|
3181 "i.\"name\" AS \"INDEX_NAME\", " + |
759
846a456f0f0c
Remove append() calls for static int values in construction of Strings.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
757
diff
changeset
|
3182 "CASE i.\"type\" WHEN 0 THEN " + DatabaseMetaData.tableIndexHashed + " ELSE " + DatabaseMetaData.tableIndexOther + " END AS \"TYPE\", " + |
302
1b6c514106ce
Added table aliases and use them in all meta data SQL queries to reduce query size.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
300
diff
changeset
|
3183 "cast(o.\"nr\" +1 AS smallint) AS \"ORDINAL_POSITION\", "+ |
1b6c514106ce
Added table aliases and use them in all meta data SQL queries to reduce query size.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
300
diff
changeset
|
3184 "c.\"name\" AS \"COLUMN_NAME\", " + |
217
7cbd20ff628c
Removed DISTINCT from SELECT DISTINCT where it should not be needed (in getTables() and getFunctionColumns())
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
216
diff
changeset
|
3185 "cast(null AS char(1)) AS \"ASC_OR_DESC\", " + // sort sequence currently not supported in keys or indexes in MonetDB |
7cbd20ff628c
Removed DISTINCT from SELECT DISTINCT where it should not be needed (in getTables() and getFunctionColumns())
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
216
diff
changeset
|
3186 "cast(").append(table_row_count).append(" AS int) AS \"CARDINALITY\", " + |
7cbd20ff628c
Removed DISTINCT from SELECT DISTINCT where it should not be needed (in getTables() and getFunctionColumns())
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
216
diff
changeset
|
3187 "cast(0 AS int) AS \"PAGES\", " + |
7cbd20ff628c
Removed DISTINCT from SELECT DISTINCT where it should not be needed (in getTables() and getFunctionColumns())
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
216
diff
changeset
|
3188 "cast(null AS char(1)) AS \"FILTER_CONDITION\" " + |
649
060347aa81ea
By fixing methods getPrimaryKeys(), getBestRowIdentifier() and getIndexInfo() for local temporary tables, it also caused it to fail for global temporary tables in schema tmp.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
645
diff
changeset
|
3189 "FROM \"sys\".\"idxs\" i " + |
060347aa81ea
By fixing methods getPrimaryKeys(), getBestRowIdentifier() and getIndexInfo() for local temporary tables, it also caused it to fail for global temporary tables in schema tmp.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
645
diff
changeset
|
3190 "JOIN \"sys\".\"_tables\" t ON i.\"table_id\" = t.\"id\" " + |
302
1b6c514106ce
Added table aliases and use them in all meta data SQL queries to reduce query size.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
300
diff
changeset
|
3191 "JOIN \"sys\".\"schemas\" s ON t.\"schema_id\" = s.\"id\" " + |
649
060347aa81ea
By fixing methods getPrimaryKeys(), getBestRowIdentifier() and getIndexInfo() for local temporary tables, it also caused it to fail for global temporary tables in schema tmp.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
645
diff
changeset
|
3192 "JOIN \"sys\".\"objects\" o ON i.\"id\" = o.\"id\" " + |
060347aa81ea
By fixing methods getPrimaryKeys(), getBestRowIdentifier() and getIndexInfo() for local temporary tables, it also caused it to fail for global temporary tables in schema tmp.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
645
diff
changeset
|
3193 "JOIN \"sys\".\"_columns\" c ON (t.\"id\" = c.\"table_id\" AND o.\"name\" = c.\"name\") " + |
060347aa81ea
By fixing methods getPrimaryKeys(), getBestRowIdentifier() and getIndexInfo() for local temporary tables, it also caused it to fail for global temporary tables in schema tmp.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
645
diff
changeset
|
3194 "LEFT OUTER JOIN \"sys\".\"keys\" k ON (i.\"name\" = k.\"name\" AND i.\"table_id\" = k.\"table_id\" AND k.\"type\" IN (0,1)) "); // primary (0) and unique keys (1) only |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3195 |
216
116b5a149fb4
Optimise SQL query generation for cases where the WHERE clause already has a AND 1 = 0 condition. Exlude adding more AND ... conditions.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
215
diff
changeset
|
3196 if (catalog != null && !catalog.isEmpty()) { |
299
1f0324072b0c
Correcting typo in comment
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
298
diff
changeset
|
3197 // non-empty catalog selection. |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3198 // as we do not support catalogs this always results in no rows returned |
372
159c628527c4
Optimize SQL query generation by eliminating "WHERE 1=1" conditions
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
371
diff
changeset
|
3199 query.append("WHERE 1=0"); |
216
116b5a149fb4
Optimise SQL query generation for cases where the WHERE clause already has a AND 1 = 0 condition. Exlude adding more AND ... conditions.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
215
diff
changeset
|
3200 } else { |
372
159c628527c4
Optimize SQL query generation by eliminating "WHERE 1=1" conditions
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
371
diff
changeset
|
3201 boolean needWhere = true; |
323
8701024a9bb0
In DatabaseMetaData methods which accept name match patterns, optimise the SQL generation when the pattern equals a: %
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
306
diff
changeset
|
3202 if (schema != null && !schema.equals("%")) { |
372
159c628527c4
Optimize SQL query generation by eliminating "WHERE 1=1" conditions
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
371
diff
changeset
|
3203 query.append("WHERE s.\"name\" ").append(composeMatchPart(schema)); |
159c628527c4
Optimize SQL query generation by eliminating "WHERE 1=1" conditions
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
371
diff
changeset
|
3204 needWhere = false; |
216
116b5a149fb4
Optimise SQL query generation for cases where the WHERE clause already has a AND 1 = 0 condition. Exlude adding more AND ... conditions.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
215
diff
changeset
|
3205 } |
323
8701024a9bb0
In DatabaseMetaData methods which accept name match patterns, optimise the SQL generation when the pattern equals a: %
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
306
diff
changeset
|
3206 if (table != null && !table.equals("%")) { |
372
159c628527c4
Optimize SQL query generation by eliminating "WHERE 1=1" conditions
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
371
diff
changeset
|
3207 query.append(needWhere ? "WHERE" : " AND") |
159c628527c4
Optimize SQL query generation by eliminating "WHERE 1=1" conditions
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
371
diff
changeset
|
3208 .append(" t.\"name\" ").append(composeMatchPart(table)); |
159c628527c4
Optimize SQL query generation by eliminating "WHERE 1=1" conditions
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
371
diff
changeset
|
3209 needWhere = false; |
216
116b5a149fb4
Optimise SQL query generation for cases where the WHERE clause already has a AND 1 = 0 condition. Exlude adding more AND ... conditions.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
215
diff
changeset
|
3210 } |
116b5a149fb4
Optimise SQL query generation for cases where the WHERE clause already has a AND 1 = 0 condition. Exlude adding more AND ... conditions.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
215
diff
changeset
|
3211 if (unique) { |
372
159c628527c4
Optimize SQL query generation by eliminating "WHERE 1=1" conditions
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
371
diff
changeset
|
3212 query.append(needWhere ? "WHERE" : " AND") |
159c628527c4
Optimize SQL query generation by eliminating "WHERE 1=1" conditions
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
371
diff
changeset
|
3213 .append(" k.\"name\" IS NOT NULL"); |
216
116b5a149fb4
Optimise SQL query generation for cases where the WHERE clause already has a AND 1 = 0 condition. Exlude adding more AND ... conditions.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
215
diff
changeset
|
3214 } |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3215 } |
216
116b5a149fb4
Optimise SQL query generation for cases where the WHERE clause already has a AND 1 = 0 condition. Exlude adding more AND ... conditions.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
215
diff
changeset
|
3216 |
649
060347aa81ea
By fixing methods getPrimaryKeys(), getBestRowIdentifier() and getIndexInfo() for local temporary tables, it also caused it to fail for global temporary tables in schema tmp.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
645
diff
changeset
|
3217 final boolean includetmp = (schema == null) |
060347aa81ea
By fixing methods getPrimaryKeys(), getBestRowIdentifier() and getIndexInfo() for local temporary tables, it also caused it to fail for global temporary tables in schema tmp.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
645
diff
changeset
|
3218 || (schema != null && ("tmp".equals(schema) || schema.contains("%") || schema.contains("_"))); |
060347aa81ea
By fixing methods getPrimaryKeys(), getBestRowIdentifier() and getIndexInfo() for local temporary tables, it also caused it to fail for global temporary tables in schema tmp.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
645
diff
changeset
|
3219 if (includetmp) { |
060347aa81ea
By fixing methods getPrimaryKeys(), getBestRowIdentifier() and getIndexInfo() for local temporary tables, it also caused it to fail for global temporary tables in schema tmp.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
645
diff
changeset
|
3220 // we must also include the indexes of local temporary tables which are stored in tmp.idxs, tmp._tables, tmp._columns, tmp.objects and tmp.keys |
060347aa81ea
By fixing methods getPrimaryKeys(), getBestRowIdentifier() and getIndexInfo() for local temporary tables, it also caused it to fail for global temporary tables in schema tmp.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
645
diff
changeset
|
3221 query.append(" UNION ALL "); |
060347aa81ea
By fixing methods getPrimaryKeys(), getBestRowIdentifier() and getIndexInfo() for local temporary tables, it also caused it to fail for global temporary tables in schema tmp.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
645
diff
changeset
|
3222 query.append( |
060347aa81ea
By fixing methods getPrimaryKeys(), getBestRowIdentifier() and getIndexInfo() for local temporary tables, it also caused it to fail for global temporary tables in schema tmp.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
645
diff
changeset
|
3223 "SELECT cast(null AS char(1)) AS \"TABLE_CAT\", " + |
060347aa81ea
By fixing methods getPrimaryKeys(), getBestRowIdentifier() and getIndexInfo() for local temporary tables, it also caused it to fail for global temporary tables in schema tmp.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
645
diff
changeset
|
3224 "s.\"name\" AS \"TABLE_SCHEM\", " + |
060347aa81ea
By fixing methods getPrimaryKeys(), getBestRowIdentifier() and getIndexInfo() for local temporary tables, it also caused it to fail for global temporary tables in schema tmp.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
645
diff
changeset
|
3225 "t.\"name\" AS \"TABLE_NAME\", " + |
060347aa81ea
By fixing methods getPrimaryKeys(), getBestRowIdentifier() and getIndexInfo() for local temporary tables, it also caused it to fail for global temporary tables in schema tmp.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
645
diff
changeset
|
3226 "CASE WHEN k.\"name\" IS NULL THEN true ELSE false END AS \"NON_UNIQUE\", " + |
060347aa81ea
By fixing methods getPrimaryKeys(), getBestRowIdentifier() and getIndexInfo() for local temporary tables, it also caused it to fail for global temporary tables in schema tmp.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
645
diff
changeset
|
3227 "cast(null AS char(1)) AS \"INDEX_QUALIFIER\", " + |
060347aa81ea
By fixing methods getPrimaryKeys(), getBestRowIdentifier() and getIndexInfo() for local temporary tables, it also caused it to fail for global temporary tables in schema tmp.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
645
diff
changeset
|
3228 "i.\"name\" AS \"INDEX_NAME\", " + |
759
846a456f0f0c
Remove append() calls for static int values in construction of Strings.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
757
diff
changeset
|
3229 "CASE i.\"type\" WHEN 0 THEN " + DatabaseMetaData.tableIndexHashed + " ELSE " + DatabaseMetaData.tableIndexOther + " END AS \"TYPE\", " + |
649
060347aa81ea
By fixing methods getPrimaryKeys(), getBestRowIdentifier() and getIndexInfo() for local temporary tables, it also caused it to fail for global temporary tables in schema tmp.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
645
diff
changeset
|
3230 "cast(o.\"nr\" +1 AS smallint) AS \"ORDINAL_POSITION\", "+ |
060347aa81ea
By fixing methods getPrimaryKeys(), getBestRowIdentifier() and getIndexInfo() for local temporary tables, it also caused it to fail for global temporary tables in schema tmp.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
645
diff
changeset
|
3231 "c.\"name\" AS \"COLUMN_NAME\", " + |
060347aa81ea
By fixing methods getPrimaryKeys(), getBestRowIdentifier() and getIndexInfo() for local temporary tables, it also caused it to fail for global temporary tables in schema tmp.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
645
diff
changeset
|
3232 "cast(null AS char(1)) AS \"ASC_OR_DESC\", " + // sort sequence currently not supported in keys or indexes in MonetDB |
060347aa81ea
By fixing methods getPrimaryKeys(), getBestRowIdentifier() and getIndexInfo() for local temporary tables, it also caused it to fail for global temporary tables in schema tmp.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
645
diff
changeset
|
3233 "cast(").append(table_row_count).append(" AS int) AS \"CARDINALITY\", " + |
060347aa81ea
By fixing methods getPrimaryKeys(), getBestRowIdentifier() and getIndexInfo() for local temporary tables, it also caused it to fail for global temporary tables in schema tmp.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
645
diff
changeset
|
3234 "cast(0 AS int) AS \"PAGES\", " + |
060347aa81ea
By fixing methods getPrimaryKeys(), getBestRowIdentifier() and getIndexInfo() for local temporary tables, it also caused it to fail for global temporary tables in schema tmp.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
645
diff
changeset
|
3235 "cast(null AS char(1)) AS \"FILTER_CONDITION\" " + |
060347aa81ea
By fixing methods getPrimaryKeys(), getBestRowIdentifier() and getIndexInfo() for local temporary tables, it also caused it to fail for global temporary tables in schema tmp.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
645
diff
changeset
|
3236 "FROM \"tmp\".\"idxs\" i " + |
060347aa81ea
By fixing methods getPrimaryKeys(), getBestRowIdentifier() and getIndexInfo() for local temporary tables, it also caused it to fail for global temporary tables in schema tmp.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
645
diff
changeset
|
3237 "JOIN \"tmp\".\"_tables\" t ON i.\"table_id\" = t.\"id\" " + |
060347aa81ea
By fixing methods getPrimaryKeys(), getBestRowIdentifier() and getIndexInfo() for local temporary tables, it also caused it to fail for global temporary tables in schema tmp.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
645
diff
changeset
|
3238 "JOIN \"sys\".\"schemas\" s ON t.\"schema_id\" = s.\"id\" " + |
060347aa81ea
By fixing methods getPrimaryKeys(), getBestRowIdentifier() and getIndexInfo() for local temporary tables, it also caused it to fail for global temporary tables in schema tmp.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
645
diff
changeset
|
3239 "JOIN \"tmp\".\"objects\" o ON i.\"id\" = o.\"id\" " + |
060347aa81ea
By fixing methods getPrimaryKeys(), getBestRowIdentifier() and getIndexInfo() for local temporary tables, it also caused it to fail for global temporary tables in schema tmp.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
645
diff
changeset
|
3240 "JOIN \"tmp\".\"_columns\" c ON (t.\"id\" = c.\"table_id\" AND o.\"name\" = c.\"name\") " + |
060347aa81ea
By fixing methods getPrimaryKeys(), getBestRowIdentifier() and getIndexInfo() for local temporary tables, it also caused it to fail for global temporary tables in schema tmp.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
645
diff
changeset
|
3241 "LEFT OUTER JOIN \"tmp\".\"keys\" k ON (i.\"name\" = k.\"name\" AND i.\"table_id\" = k.\"table_id\" AND k.\"type\" IN (0,1)) "); // primary (0) and unique keys (1) only |
060347aa81ea
By fixing methods getPrimaryKeys(), getBestRowIdentifier() and getIndexInfo() for local temporary tables, it also caused it to fail for global temporary tables in schema tmp.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
645
diff
changeset
|
3242 |
060347aa81ea
By fixing methods getPrimaryKeys(), getBestRowIdentifier() and getIndexInfo() for local temporary tables, it also caused it to fail for global temporary tables in schema tmp.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
645
diff
changeset
|
3243 if (catalog != null && !catalog.isEmpty()) { |
060347aa81ea
By fixing methods getPrimaryKeys(), getBestRowIdentifier() and getIndexInfo() for local temporary tables, it also caused it to fail for global temporary tables in schema tmp.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
645
diff
changeset
|
3244 // non-empty catalog selection. |
060347aa81ea
By fixing methods getPrimaryKeys(), getBestRowIdentifier() and getIndexInfo() for local temporary tables, it also caused it to fail for global temporary tables in schema tmp.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
645
diff
changeset
|
3245 // as we do not support catalogs this always results in no rows returned |
060347aa81ea
By fixing methods getPrimaryKeys(), getBestRowIdentifier() and getIndexInfo() for local temporary tables, it also caused it to fail for global temporary tables in schema tmp.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
645
diff
changeset
|
3246 query.append("WHERE 1=0"); |
060347aa81ea
By fixing methods getPrimaryKeys(), getBestRowIdentifier() and getIndexInfo() for local temporary tables, it also caused it to fail for global temporary tables in schema tmp.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
645
diff
changeset
|
3247 } else { |
060347aa81ea
By fixing methods getPrimaryKeys(), getBestRowIdentifier() and getIndexInfo() for local temporary tables, it also caused it to fail for global temporary tables in schema tmp.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
645
diff
changeset
|
3248 boolean needWhere = true; |
060347aa81ea
By fixing methods getPrimaryKeys(), getBestRowIdentifier() and getIndexInfo() for local temporary tables, it also caused it to fail for global temporary tables in schema tmp.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
645
diff
changeset
|
3249 if (schema != null && !schema.equals("%")) { |
060347aa81ea
By fixing methods getPrimaryKeys(), getBestRowIdentifier() and getIndexInfo() for local temporary tables, it also caused it to fail for global temporary tables in schema tmp.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
645
diff
changeset
|
3250 query.append("WHERE s.\"name\" ").append(composeMatchPart(schema)); |
060347aa81ea
By fixing methods getPrimaryKeys(), getBestRowIdentifier() and getIndexInfo() for local temporary tables, it also caused it to fail for global temporary tables in schema tmp.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
645
diff
changeset
|
3251 needWhere = false; |
060347aa81ea
By fixing methods getPrimaryKeys(), getBestRowIdentifier() and getIndexInfo() for local temporary tables, it also caused it to fail for global temporary tables in schema tmp.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
645
diff
changeset
|
3252 } |
060347aa81ea
By fixing methods getPrimaryKeys(), getBestRowIdentifier() and getIndexInfo() for local temporary tables, it also caused it to fail for global temporary tables in schema tmp.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
645
diff
changeset
|
3253 if (table != null && !table.equals("%")) { |
060347aa81ea
By fixing methods getPrimaryKeys(), getBestRowIdentifier() and getIndexInfo() for local temporary tables, it also caused it to fail for global temporary tables in schema tmp.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
645
diff
changeset
|
3254 query.append(needWhere ? "WHERE" : " AND") |
060347aa81ea
By fixing methods getPrimaryKeys(), getBestRowIdentifier() and getIndexInfo() for local temporary tables, it also caused it to fail for global temporary tables in schema tmp.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
645
diff
changeset
|
3255 .append(" t.\"name\" ").append(composeMatchPart(table)); |
060347aa81ea
By fixing methods getPrimaryKeys(), getBestRowIdentifier() and getIndexInfo() for local temporary tables, it also caused it to fail for global temporary tables in schema tmp.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
645
diff
changeset
|
3256 needWhere = false; |
060347aa81ea
By fixing methods getPrimaryKeys(), getBestRowIdentifier() and getIndexInfo() for local temporary tables, it also caused it to fail for global temporary tables in schema tmp.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
645
diff
changeset
|
3257 } |
060347aa81ea
By fixing methods getPrimaryKeys(), getBestRowIdentifier() and getIndexInfo() for local temporary tables, it also caused it to fail for global temporary tables in schema tmp.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
645
diff
changeset
|
3258 if (unique) { |
060347aa81ea
By fixing methods getPrimaryKeys(), getBestRowIdentifier() and getIndexInfo() for local temporary tables, it also caused it to fail for global temporary tables in schema tmp.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
645
diff
changeset
|
3259 query.append(needWhere ? "WHERE" : " AND") |
060347aa81ea
By fixing methods getPrimaryKeys(), getBestRowIdentifier() and getIndexInfo() for local temporary tables, it also caused it to fail for global temporary tables in schema tmp.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
645
diff
changeset
|
3260 .append(" k.\"name\" IS NOT NULL"); |
060347aa81ea
By fixing methods getPrimaryKeys(), getBestRowIdentifier() and getIndexInfo() for local temporary tables, it also caused it to fail for global temporary tables in schema tmp.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
645
diff
changeset
|
3261 } |
060347aa81ea
By fixing methods getPrimaryKeys(), getBestRowIdentifier() and getIndexInfo() for local temporary tables, it also caused it to fail for global temporary tables in schema tmp.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
645
diff
changeset
|
3262 } |
060347aa81ea
By fixing methods getPrimaryKeys(), getBestRowIdentifier() and getIndexInfo() for local temporary tables, it also caused it to fail for global temporary tables in schema tmp.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
645
diff
changeset
|
3263 } |
060347aa81ea
By fixing methods getPrimaryKeys(), getBestRowIdentifier() and getIndexInfo() for local temporary tables, it also caused it to fail for global temporary tables in schema tmp.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
645
diff
changeset
|
3264 |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3265 query.append(" ORDER BY \"NON_UNIQUE\", \"TYPE\", \"INDEX_NAME\", \"ORDINAL_POSITION\""); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3266 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3267 return executeMetaDataQuery(query.toString()); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3268 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3269 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3270 //== 1.2 methods (JDBC 2) |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3271 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3272 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3273 * Does the database support the given result set type? |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3274 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3275 * @param type - defined in java.sql.ResultSet |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3276 * @return true if so; false otherwise |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3277 * @throws SQLException - if a database access error occurs |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3278 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3279 @Override |
295
003ae6d881db
Add "final" keyword to method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
294
diff
changeset
|
3280 public boolean supportsResultSetType(final int type) throws SQLException { |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3281 // The only type we don't support |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3282 return type != ResultSet.TYPE_SCROLL_SENSITIVE; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3283 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3284 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3285 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3286 * Does the database support the concurrency type in combination |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3287 * with the given result set type? |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3288 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3289 * @param type - defined in java.sql.ResultSet |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3290 * @param concurrency - type defined in java.sql.ResultSet |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3291 * @return true if so; false otherwise |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3292 * @throws SQLException - if a database access error occurs |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3293 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3294 @Override |
295
003ae6d881db
Add "final" keyword to method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
294
diff
changeset
|
3295 public boolean supportsResultSetConcurrency(final int type, final int concurrency) |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3296 throws SQLException |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3297 { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3298 // These combinations are not supported! |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3299 if (type == ResultSet.TYPE_SCROLL_SENSITIVE) |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3300 return false; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3301 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3302 // We do only support Read Only ResultSets |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3303 if (concurrency != ResultSet.CONCUR_READ_ONLY) |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3304 return false; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3305 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3306 // Everything else we do (well, what's left of it :) ) |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3307 return true; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3308 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3309 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3310 /* lots of unsupported stuff... (no updatable ResultSet!) */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3311 @Override |
295
003ae6d881db
Add "final" keyword to method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
294
diff
changeset
|
3312 public boolean ownUpdatesAreVisible(final int type) { |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3313 return false; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3314 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3315 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3316 @Override |
295
003ae6d881db
Add "final" keyword to method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
294
diff
changeset
|
3317 public boolean ownDeletesAreVisible(final int type) { |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3318 return false; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3319 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3320 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3321 @Override |
295
003ae6d881db
Add "final" keyword to method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
294
diff
changeset
|
3322 public boolean ownInsertsAreVisible(final int type) { |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3323 return false; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3324 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3325 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3326 @Override |
295
003ae6d881db
Add "final" keyword to method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
294
diff
changeset
|
3327 public boolean othersUpdatesAreVisible(final int type) { |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3328 return false; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3329 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3330 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3331 @Override |
295
003ae6d881db
Add "final" keyword to method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
294
diff
changeset
|
3332 public boolean othersDeletesAreVisible(final int i) { |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3333 return false; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3334 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3335 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3336 @Override |
295
003ae6d881db
Add "final" keyword to method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
294
diff
changeset
|
3337 public boolean othersInsertsAreVisible(final int type) { |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3338 return false; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3339 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3340 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3341 @Override |
295
003ae6d881db
Add "final" keyword to method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
294
diff
changeset
|
3342 public boolean updatesAreDetected(final int type) { |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3343 return false; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3344 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3345 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3346 @Override |
295
003ae6d881db
Add "final" keyword to method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
294
diff
changeset
|
3347 public boolean deletesAreDetected(final int i) { |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3348 return false; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3349 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3350 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3351 @Override |
295
003ae6d881db
Add "final" keyword to method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
294
diff
changeset
|
3352 public boolean insertsAreDetected(final int type) { |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3353 return false; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3354 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3355 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3356 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3357 * Indicates whether the driver supports batch updates. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3358 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3359 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3360 public boolean supportsBatchUpdates() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3361 return true; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3362 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3363 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3364 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3365 * Retrieves a description of the user-defined types (UDTs) defined in a particular schema. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3366 * Schema-specific UDTs may have type JAVA_OBJECT, STRUCT, or DISTINCT. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3367 * Only types matching the catalog, schema, type name and type criteria are returned. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3368 * They are ordered by DATA_TYPE, TYPE_CAT, TYPE_SCHEM and TYPE_NAME. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3369 * The type name parameter may be a fully-qualified name. In this case, the catalog and schemaPattern parameters are ignored. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3370 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3371 * Each type description has the following columns: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3372 * |
194
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
3373 * 1 TYPE_CAT String => the type's catalog (may be null) |
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
3374 * 2 TYPE_SCHEM String => type's schema (may be null) |
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
3375 * 3 TYPE_NAME String => type name |
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
3376 * 4 CLASS_NAME String => Java class name |
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
3377 * 5 DATA_TYPE int => type value defined in java.sql.Types. One of JAVA_OBJECT, STRUCT, or DISTINCT |
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
3378 * 6 REMARKS String => explanatory comment on the type |
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
3379 * 7 BASE_TYPE short => type code of the source type of a DISTINCT type or the type that implements the |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3380 * user-generated reference type of the SELF_REFERENCING_COLUMN of a structured type as defined |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3381 * in java.sql.Types (null if DATA_TYPE is not DISTINCT or not STRUCT with REFERENCE_GENERATION = USER_DEFINED) |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3382 * |
194
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
3383 * @throws SQLException - if a database access error occurs |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3384 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3385 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3386 public ResultSet getUDTs( |
295
003ae6d881db
Add "final" keyword to method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
294
diff
changeset
|
3387 final String catalog, |
003ae6d881db
Add "final" keyword to method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
294
diff
changeset
|
3388 final String schemaPattern, |
003ae6d881db
Add "final" keyword to method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
294
diff
changeset
|
3389 final String typeNamePattern, |
003ae6d881db
Add "final" keyword to method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
294
diff
changeset
|
3390 final int[] types |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3391 ) throws SQLException |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3392 { |
295
003ae6d881db
Add "final" keyword to method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
294
diff
changeset
|
3393 final StringBuilder query = new StringBuilder(990); |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3394 if (types != null && types.length > 0) { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3395 query.append("SELECT * FROM ("); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3396 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3397 query.append("SELECT cast(null as char(1)) AS \"TYPE_CAT\", " + |
302
1b6c514106ce
Added table aliases and use them in all meta data SQL queries to reduce query size.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
300
diff
changeset
|
3398 "s.\"name\" AS \"TYPE_SCHEM\", " + |
1b6c514106ce
Added table aliases and use them in all meta data SQL queries to reduce query size.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
300
diff
changeset
|
3399 "t.\"sqlname\" AS \"TYPE_NAME\", " + |
1b6c514106ce
Added table aliases and use them in all meta data SQL queries to reduce query size.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
300
diff
changeset
|
3400 "CASE t.\"sqlname\"" + |
642
dd9b4fb14256
Added recognition of 'xml' type.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
626
diff
changeset
|
3401 // next UDT only when "CREATE TYPE xml EXTERNAL NAME xml;" is executed |
dd9b4fb14256
Added recognition of 'xml' type.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
626
diff
changeset
|
3402 " WHEN 'xml' THEN 'java.lang.String'" + |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3403 " ELSE 'java.lang.Object' END AS \"CLASS_NAME\", " + |
761
e1389c0ffb7c
A few more places where we can remove append() calls for static int values in construction of Strings.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
759
diff
changeset
|
3404 "cast(CASE WHEN t.\"sqlname\" = 'xml' THEN " + Types.JAVA_OBJECT + |
e1389c0ffb7c
A few more places where we can remove append() calls for static int values in construction of Strings.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
759
diff
changeset
|
3405 " ELSE " + Types.STRUCT + " END AS int) AS \"DATA_TYPE\", " + |
302
1b6c514106ce
Added table aliases and use them in all meta data SQL queries to reduce query size.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
300
diff
changeset
|
3406 "t.\"systemname\" AS \"REMARKS\", " + |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3407 "cast(null as smallint) AS \"BASE_TYPE\" " + |
302
1b6c514106ce
Added table aliases and use them in all meta data SQL queries to reduce query size.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
300
diff
changeset
|
3408 "FROM \"sys\".\"types\" t " + |
1b6c514106ce
Added table aliases and use them in all meta data SQL queries to reduce query size.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
300
diff
changeset
|
3409 "JOIN \"sys\".\"schemas\" s ON t.\"schema_id\" = s.\"id\" " + |
724
2b763b189452
Corrected DatabaseMetaData.getUDTs() output.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
716
diff
changeset
|
3410 // exclude the built-in types (I assume they always have id <= 99 and eclass < 18) |
2b763b189452
Corrected DatabaseMetaData.getUDTs() output.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
716
diff
changeset
|
3411 "WHERE t.\"id\" > 99" + |
2b763b189452
Corrected DatabaseMetaData.getUDTs() output.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
716
diff
changeset
|
3412 " AND t.\"eclass\" >= 18" + |
2b763b189452
Corrected DatabaseMetaData.getUDTs() output.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
716
diff
changeset
|
3413 " AND t.\"sqlname\" NOT IN ('inet','json','url','uuid')"); |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3414 |
216
116b5a149fb4
Optimise SQL query generation for cases where the WHERE clause already has a AND 1 = 0 condition. Exlude adding more AND ... conditions.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
215
diff
changeset
|
3415 if (catalog != null && !catalog.isEmpty()) { |
299
1f0324072b0c
Correcting typo in comment
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
298
diff
changeset
|
3416 // non-empty catalog selection. |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3417 // as we do not support catalogs this always results in no rows returned |
352
f62137dd6050
Remove spaces from static SQL predicates: 1 = 0 and 1 = 1.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
350
diff
changeset
|
3418 query.append(" AND 1=0"); |
216
116b5a149fb4
Optimise SQL query generation for cases where the WHERE clause already has a AND 1 = 0 condition. Exlude adding more AND ... conditions.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
215
diff
changeset
|
3419 } else { |
323
8701024a9bb0
In DatabaseMetaData methods which accept name match patterns, optimise the SQL generation when the pattern equals a: %
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
306
diff
changeset
|
3420 if (schemaPattern != null && !schemaPattern.equals("%")) { |
302
1b6c514106ce
Added table aliases and use them in all meta data SQL queries to reduce query size.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
300
diff
changeset
|
3421 query.append(" AND s.\"name\" ").append(composeMatchPart(schemaPattern)); |
216
116b5a149fb4
Optimise SQL query generation for cases where the WHERE clause already has a AND 1 = 0 condition. Exlude adding more AND ... conditions.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
215
diff
changeset
|
3422 } |
323
8701024a9bb0
In DatabaseMetaData methods which accept name match patterns, optimise the SQL generation when the pattern equals a: %
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
306
diff
changeset
|
3423 if (typeNamePattern != null && !typeNamePattern.equals("%")) { |
302
1b6c514106ce
Added table aliases and use them in all meta data SQL queries to reduce query size.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
300
diff
changeset
|
3424 query.append(" AND t.\"sqlname\" ").append(composeMatchPart(typeNamePattern)); |
216
116b5a149fb4
Optimise SQL query generation for cases where the WHERE clause already has a AND 1 = 0 condition. Exlude adding more AND ... conditions.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
215
diff
changeset
|
3425 } |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3426 } |
215
71b039bc2d99
Added support for querying the sys.comments table for some meta data methods
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
213
diff
changeset
|
3427 |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3428 if (types != null && types.length > 0) { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3429 query.append(") AS getUDTs WHERE \"DATA_TYPE\" IN ("); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3430 for (int i = 0; i < types.length; i++) { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3431 if (i > 0) { |
767
1547843b3a9b
Removed code to support old MonetDB servers Oct2014 or older.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
761
diff
changeset
|
3432 query.append(','); |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3433 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3434 query.append(types[i]); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3435 } |
767
1547843b3a9b
Removed code to support old MonetDB servers Oct2014 or older.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
761
diff
changeset
|
3436 query.append(')'); |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3437 } |
216
116b5a149fb4
Optimise SQL query generation for cases where the WHERE clause already has a AND 1 = 0 condition. Exlude adding more AND ... conditions.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
215
diff
changeset
|
3438 |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3439 query.append(" ORDER BY \"DATA_TYPE\", \"TYPE_SCHEM\", \"TYPE_NAME\""); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3440 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3441 return executeMetaDataQuery(query.toString()); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3442 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3443 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3444 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3445 * Retrieves the connection that produced this metadata object. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3446 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3447 * @return the connection that produced this metadata object |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3448 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3449 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3450 public Connection getConnection() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3451 return con; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3452 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3453 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3454 //== 1.4 methods (JDBC 3) |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3455 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3456 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3457 * Retrieves whether this database supports savepoints. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3458 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3459 * @return <code>true</code> if savepoints are supported; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3460 * <code>false</code> otherwise |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3461 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3462 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3463 public boolean supportsSavepoints() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3464 return true; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3465 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3466 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3467 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3468 * Retrieves whether this database supports named parameters to callable |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3469 * statements. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3470 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3471 * @return <code>true</code> if named parameters are supported; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3472 * <code>false</code> otherwise |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3473 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3474 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3475 public boolean supportsNamedParameters() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3476 return false; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3477 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3478 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3479 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3480 * Retrieves whether it is possible to have multiple <code>ResultSet</code> objects |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3481 * returned from a <code>CallableStatement</code> object |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3482 * simultaneously. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3483 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3484 * @return <code>true</code> if a <code>CallableStatement</code> object |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3485 * can return multiple <code>ResultSet</code> objects |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3486 * simultaneously; <code>false</code> otherwise |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3487 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3488 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3489 public boolean supportsMultipleOpenResults() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3490 return true; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3491 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3492 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3493 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3494 * Retrieves whether auto-generated keys can be retrieved after |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3495 * a statement has been executed. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3496 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3497 * @return <code>true</code> if auto-generated keys can be retrieved |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3498 * after a statement has executed; <code>false</code> otherwise |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3499 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3500 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3501 public boolean supportsGetGeneratedKeys() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3502 return true; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3503 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3504 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3505 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3506 * Retrieves a description of the user-defined type (UDT) |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3507 * hierarchies defined in a particular schema in this database. Only |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3508 * the immediate super type/ sub type relationship is modeled. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3509 * <P> |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3510 * Only supertype information for UDTs matching the catalog, |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3511 * schema, and type name is returned. The type name parameter |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3512 * may be a fully-qualified name. When the UDT name supplied is a |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3513 * fully-qualified name, the catalog and schemaPattern parameters are |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3514 * ignored. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3515 * <P> |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3516 * If a UDT does not have a direct super type, it is not listed here. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3517 * A row of the <code>ResultSet</code> object returned by this method |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3518 * describes the designated UDT and a direct supertype. A row has the following |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3519 * columns: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3520 * <OL> |
194
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
3521 * <LI><B>TYPE_CAT</B> String => the UDT's catalog (may be <code>null</code>) |
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
3522 * <LI><B>TYPE_SCHEM</B> String => UDT's schema (may be <code>null</code>) |
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
3523 * <LI><B>TYPE_NAME</B> String => type name of the UDT |
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
3524 * <LI><B>SUPERTYPE_CAT</B> String => the direct super type's catalog |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3525 * (may be <code>null</code>) |
194
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
3526 * <LI><B>SUPERTYPE_SCHEM</B> String => the direct super type's schema |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3527 * (may be <code>null</code>) |
194
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
3528 * <LI><B>SUPERTYPE_NAME</B> String => the direct super type's name |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3529 * </OL> |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3530 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3531 * <P><B>Note:</B> If the driver does not support type hierarchies, an |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3532 * empty result set is returned. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3533 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3534 * @param catalog a catalog name; "" retrieves those without a catalog; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3535 * <code>null</code> means drop catalog name from the selection criteria |
245
55375d489024
Corrected return values of DatabaseMetaData methods allTablesAreSelectable() and allProceduresAreCallable().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
231
diff
changeset
|
3536 * @param schemaPattern a schema name pattern; "" retrieves those without a schema |
55375d489024
Corrected return values of DatabaseMetaData methods allTablesAreSelectable() and allProceduresAreCallable().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
231
diff
changeset
|
3537 * @param typeNamePattern a UDT name pattern; may be a fully-qualified name |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3538 * @return a <code>ResultSet</code> object in which a row gives information |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3539 * about the designated UDT |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3540 * @throws SQLException if a database access error occurs |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3541 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3542 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3543 public ResultSet getSuperTypes( |
295
003ae6d881db
Add "final" keyword to method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
294
diff
changeset
|
3544 final String catalog, |
003ae6d881db
Add "final" keyword to method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
294
diff
changeset
|
3545 final String schemaPattern, |
003ae6d881db
Add "final" keyword to method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
294
diff
changeset
|
3546 final String typeNamePattern |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3547 ) throws SQLException |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3548 { |
295
003ae6d881db
Add "final" keyword to method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
294
diff
changeset
|
3549 final String query = |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3550 "SELECT cast(null as char(1)) AS \"TYPE_CAT\", '' AS \"TYPE_SCHEM\", '' AS \"TYPE_NAME\", " + |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3551 "cast(null as char(1)) AS \"SUPERTYPE_CAT\", '' AS \"SUPERTYPE_SCHEM\", '' AS \"SUPERTYPE_NAME\" " + |
352
f62137dd6050
Remove spaces from static SQL predicates: 1 = 0 and 1 = 1.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
350
diff
changeset
|
3552 "WHERE 1=0"; |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3553 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3554 return executeMetaDataQuery(query); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3555 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3556 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3557 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3558 * Retrieves a description of the table hierarchies defined in a particular |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3559 * schema in this database. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3560 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3561 * <P>Only supertable information for tables matching the catalog, schema |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3562 * and table name are returned. The table name parameter may be a fully- |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3563 * qualified name, in which case, the catalog and schemaPattern parameters |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3564 * are ignored. If a table does not have a super table, it is not listed here. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3565 * Supertables have to be defined in the same catalog and schema as the |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3566 * sub tables. Therefore, the type description does not need to include |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3567 * this information for the supertable. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3568 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3569 * <P>Each type description has the following columns: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3570 * <OL> |
194
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
3571 * <LI><B>TABLE_CAT</B> String => the type's catalog (may be <code>null</code>) |
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
3572 * <LI><B>TABLE_SCHEM</B> String => type's schema (may be <code>null</code>) |
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
3573 * <LI><B>TABLE_NAME</B> String => type name |
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
3574 * <LI><B>SUPERTABLE_NAME</B> String => the direct super type's name |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3575 * </OL> |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3576 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3577 * <P><B>Note:</B> If the driver does not support type hierarchies, an |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3578 * empty result set is returned. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3579 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3580 * @param catalog a catalog name; "" retrieves those without a catalog; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3581 * <code>null</code> means drop catalog name from the selection criteria |
245
55375d489024
Corrected return values of DatabaseMetaData methods allTablesAreSelectable() and allProceduresAreCallable().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
231
diff
changeset
|
3582 * @param schemaPattern a schema name pattern; "" retrieves those without a schema |
55375d489024
Corrected return values of DatabaseMetaData methods allTablesAreSelectable() and allProceduresAreCallable().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
231
diff
changeset
|
3583 * @param tableNamePattern a table name pattern; may be a fully-qualified name |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3584 * @return a <code>ResultSet</code> object in which each row is a type description |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3585 * @throws SQLException if a database access error occurs |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3586 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3587 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3588 public ResultSet getSuperTables( |
295
003ae6d881db
Add "final" keyword to method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
294
diff
changeset
|
3589 final String catalog, |
003ae6d881db
Add "final" keyword to method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
294
diff
changeset
|
3590 final String schemaPattern, |
003ae6d881db
Add "final" keyword to method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
294
diff
changeset
|
3591 final String tableNamePattern |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3592 ) throws SQLException |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3593 { |
295
003ae6d881db
Add "final" keyword to method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
294
diff
changeset
|
3594 final String query = |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3595 "SELECT cast(null as char(1)) AS \"TABLE_CAT\", " + |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3596 "'' AS \"TABLE_SCHEM\", '' AS \"TABLE_NAME\", '' AS \"SUPERTABLE_NAME\" " + |
352
f62137dd6050
Remove spaces from static SQL predicates: 1 = 0 and 1 = 1.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
350
diff
changeset
|
3597 "WHERE 1=0"; |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3598 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3599 return executeMetaDataQuery(query); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3600 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3601 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3602 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3603 * Retrieves a description of the given attribute of the given type |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3604 * for a user-defined type (UDT) that is available in the given schema |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3605 * and catalog. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3606 * <P> |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3607 * Descriptions are returned only for attributes of UDTs matching the |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3608 * catalog, schema, type, and attribute name criteria. They are ordered by |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3609 * TYPE_SCHEM, TYPE_NAME and ORDINAL_POSITION. This description |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3610 * does not contain inherited attributes. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3611 * <P> |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3612 * The <code>ResultSet</code> object that is returned has the following |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3613 * columns: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3614 * <OL> |
194
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
3615 * <LI><B>TYPE_CAT</B> String => type catalog (may be <code>null</code>) |
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
3616 * <LI><B>TYPE_SCHEM</B> String => type schema (may be <code>null</code>) |
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
3617 * <LI><B>TYPE_NAME</B> String => type name |
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
3618 * <LI><B>ATTR_NAME</B> String => attribute name |
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
3619 * <LI><B>DATA_TYPE</B> int => attribute type SQL type from java.sql.Types |
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
3620 * <LI><B>ATTR_TYPE_NAME</B> String => Data source dependent type name. |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3621 * For a UDT, the type name is fully qualified. For a REF, the type name is |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3622 * fully qualified and represents the target type of the reference type. |
194
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
3623 * <LI><B>ATTR_SIZE</B> int => column size. For char or date |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3624 * types this is the maximum number of characters; for numeric or |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3625 * decimal types this is precision. |
194
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
3626 * <LI><B>DECIMAL_DIGITS</B> int => the number of fractional digits |
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
3627 * <LI><B>NUM_PREC_RADIX</B> int => Radix (typically either 10 or 2) |
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
3628 * <LI><B>NULLABLE</B> int => whether NULL is allowed |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3629 * <UL> |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3630 * <LI> attributeNoNulls - might not allow NULL values |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3631 * <LI> attributeNullable - definitely allows NULL values |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3632 * <LI> attributeNullableUnknown - nullability unknown |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3633 * </UL> |
194
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
3634 * <LI><B>REMARKS</B> String => comment describing column (may be <code>null</code>) |
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
3635 * <LI><B>ATTR_DEF</B> String => default value (may be <code>null</code>) |
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
3636 * <LI><B>SQL_DATA_TYPE</B> int => unused |
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
3637 * <LI><B>SQL_DATETIME_SUB</B> int => unused |
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
3638 * <LI><B>CHAR_OCTET_LENGTH</B> int => for char types the |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3639 * maximum number of bytes in the column |
194
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
3640 * <LI><B>ORDINAL_POSITION</B> int => index of column in table |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3641 * (starting at 1) |
194
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
3642 * <LI><B>IS_NULLABLE</B> String => "NO" means column definitely |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3643 * does not allow NULL values; "YES" means the column might |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3644 * allow NULL values. An empty string means unknown. |
194
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
3645 * <LI><B>SCOPE_CATALOG</B> String => catalog of table that is the |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3646 * scope of a reference attribute (<code>null</code> if DATA_TYPE isn't REF) |
194
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
3647 * <LI><B>SCOPE_SCHEMA</B> String => schema of table that is the |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3648 * scope of a reference attribute (<code>null</code> if DATA_TYPE isn't REF) |
194
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
3649 * <LI><B>SCOPE_TABLE</B> String => table name that is the scope of a |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3650 * reference attribute (<code>null</code> if the DATA_TYPE isn't REF) |
194
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
3651 * <LI><B>SOURCE_DATA_TYPE</B> short => source type of a distinct type or user-generated |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3652 * Ref type,SQL type from java.sql.Types (<code>null</code> if DATA_TYPE |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3653 * isn't DISTINCT or user-generated REF) |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3654 * </OL> |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3655 * @param catalog a catalog name; must match the catalog name as it |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3656 * is stored in the database; "" retrieves those without a catalog; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3657 * <code>null</code> means that the catalog name should not be used to narrow |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3658 * the search |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3659 * @param schemaPattern a schema name pattern; must match the schema name |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3660 * as it is stored in the database; "" retrieves those without a schema; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3661 * <code>null</code> means that the schema name should not be used to narrow |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3662 * the search |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3663 * @param typeNamePattern a type name pattern; must match the |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3664 * type name as it is stored in the database |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3665 * @param attributeNamePattern an attribute name pattern; must match the attribute |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3666 * name as it is declared in the database |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3667 * @return a <code>ResultSet</code> object in which each row is an |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3668 * attribute description |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3669 * @throws SQLException if a database access error occurs |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3670 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3671 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3672 public ResultSet getAttributes( |
295
003ae6d881db
Add "final" keyword to method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
294
diff
changeset
|
3673 final String catalog, |
003ae6d881db
Add "final" keyword to method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
294
diff
changeset
|
3674 final String schemaPattern, |
003ae6d881db
Add "final" keyword to method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
294
diff
changeset
|
3675 final String typeNamePattern, |
003ae6d881db
Add "final" keyword to method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
294
diff
changeset
|
3676 final String attributeNamePattern |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3677 ) throws SQLException |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3678 { |
295
003ae6d881db
Add "final" keyword to method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
294
diff
changeset
|
3679 final String query = |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3680 "SELECT cast(null as char(1)) AS \"TYPE_CAT\", '' AS \"TYPE_SCHEM\", '' AS \"TYPE_NAME\", " + |
217
7cbd20ff628c
Removed DISTINCT from SELECT DISTINCT where it should not be needed (in getTables() and getFunctionColumns())
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
216
diff
changeset
|
3681 "'' AS \"ATTR_NAME\", cast(0 as int) AS \"DATA_TYPE\", '' AS \"ATTR_TYPE_NAME\", cast(0 as int) AS \"ATTR_SIZE\", " + |
7cbd20ff628c
Removed DISTINCT from SELECT DISTINCT where it should not be needed (in getTables() and getFunctionColumns())
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
216
diff
changeset
|
3682 "cast(0 as int) AS \"DECIMAL_DIGITS\", cast(0 as int) AS \"NUM_PREC_RADIX\", cast(0 as int) AS \"NULLABLE\", " + |
7cbd20ff628c
Removed DISTINCT from SELECT DISTINCT where it should not be needed (in getTables() and getFunctionColumns())
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
216
diff
changeset
|
3683 "'' AS \"REMARKS\", '' AS \"ATTR_DEF\", cast(0 as int) AS \"SQL_DATA_TYPE\", " + |
7cbd20ff628c
Removed DISTINCT from SELECT DISTINCT where it should not be needed (in getTables() and getFunctionColumns())
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
216
diff
changeset
|
3684 "cast(0 as int) AS \"SQL_DATETIME_SUB\", cast(0 as int) AS \"CHAR_OCTET_LENGTH\", " + |
7cbd20ff628c
Removed DISTINCT from SELECT DISTINCT where it should not be needed (in getTables() and getFunctionColumns())
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
216
diff
changeset
|
3685 "cast(0 as int) AS \"ORDINAL_POSITION\", 'YES' AS \"IS_NULLABLE\", " + |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3686 "'' AS \"SCOPE_CATALOG\", '' AS \"SCOPE_SCHEMA\", '' AS \"SCOPE_TABLE\", " + |
217
7cbd20ff628c
Removed DISTINCT from SELECT DISTINCT where it should not be needed (in getTables() and getFunctionColumns())
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
216
diff
changeset
|
3687 "cast(0 as smallint) AS \"SOURCE_DATA_TYPE\" " + |
352
f62137dd6050
Remove spaces from static SQL predicates: 1 = 0 and 1 = 1.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
350
diff
changeset
|
3688 "WHERE 1=0"; |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3689 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3690 return executeMetaDataQuery(query); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3691 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3692 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3693 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3694 * Retrieves whether this database supports the given result set holdability. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3695 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3696 * @param holdability one of the following constants: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3697 * <code>ResultSet.HOLD_CURSORS_OVER_COMMIT</code> or |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3698 * <code>ResultSet.CLOSE_CURSORS_AT_COMMIT</code> |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3699 * @return <code>true</code> if so; <code>false</code> otherwise |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3700 * @see Connection |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3701 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3702 @Override |
295
003ae6d881db
Add "final" keyword to method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
294
diff
changeset
|
3703 public boolean supportsResultSetHoldability(final int holdability) { |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3704 // we don't close ResultSets at commit; and we don't do updateable |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3705 // result sets, so comes closest to hold cursors over commit |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3706 return holdability == ResultSet.HOLD_CURSORS_OVER_COMMIT; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3707 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3708 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3709 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3710 * Retrieves the default holdability of this <code>ResultSet</code> |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3711 * object. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3712 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3713 * @return the default holdability; either |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3714 * <code>ResultSet.HOLD_CURSORS_OVER_COMMIT</code> or |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3715 * <code>ResultSet.CLOSE_CURSORS_AT_COMMIT</code> |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3716 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3717 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3718 public int getResultSetHoldability() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3719 return ResultSet.HOLD_CURSORS_OVER_COMMIT; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3720 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3721 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3722 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3723 * Retrieves the major version number of the underlying database. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3724 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3725 * @return the underlying database's major version |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3726 * @throws SQLException if a database access error occurs |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3727 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3728 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3729 public int getDatabaseMajorVersion() throws SQLException { |
332
e8962bdaa206
Moved utility methods and associated caches from DatabaseMetaData to Connection object.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
331
diff
changeset
|
3730 return con.getDatabaseMajorVersion(); |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3731 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3732 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3733 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3734 * Retrieves the minor version number of the underlying database. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3735 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3736 * @return underlying database's minor version |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3737 * @throws SQLException if a database access error occurs |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3738 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3739 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3740 public int getDatabaseMinorVersion() throws SQLException { |
332
e8962bdaa206
Moved utility methods and associated caches from DatabaseMetaData to Connection object.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
331
diff
changeset
|
3741 return con.getDatabaseMinorVersion(); |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3742 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3743 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3744 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3745 * Retrieves the major JDBC version number for this driver. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3746 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3747 * @return JDBC version major number |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3748 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3749 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3750 public int getJDBCMajorVersion() { |
389
3c224b31bd29
return the correct value for getJDBCMinorVersion() now we implemented JDBC 4.2 methods
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
380
diff
changeset
|
3751 return 4; // This class implements JDBC 4.2 (at least we try to) |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3752 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3753 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3754 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3755 * Retrieves the minor JDBC version number for this driver. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3756 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3757 * @return JDBC version minor number |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3758 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3759 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3760 public int getJDBCMinorVersion() { |
389
3c224b31bd29
return the correct value for getJDBCMinorVersion() now we implemented JDBC 4.2 methods
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
380
diff
changeset
|
3761 return 2; // This class implements JDBC 4.2 (at least we try to) |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3762 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3763 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3764 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3765 * Indicates whether the SQLSTATEs returned by <code>SQLException.getSQLState</code> |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3766 * is X/Open (now known as Open Group) SQL CLI or SQL:2003. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3767 * @return the type of SQLSTATEs, one of: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3768 * sqlStateXOpen or |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3769 * sqlStateSQL |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3770 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3771 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3772 public int getSQLStateType() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3773 // At least this driver conforms with SQLSTATE to the SQL:2003 standard |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3774 return DatabaseMetaData.sqlStateSQL; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3775 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3776 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3777 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3778 * Indicates whether updates made to a LOB are made on a copy or directly |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3779 * to the LOB. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3780 * @return <code>true</code> if updates are made to a copy of the LOB; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3781 * <code>false</code> if updates are made directly to the LOB |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3782 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3783 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3784 public boolean locatorsUpdateCopy() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3785 // not that we have it, but in a transaction it will be copy-on-write |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3786 return true; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3787 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3788 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3789 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3790 * Retrieves whether this database supports statement pooling. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3791 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3792 * @return <code>true</code> is so; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3793 <code>false</code> otherwise |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3794 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3795 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3796 public boolean supportsStatementPooling() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3797 // For the moment, I don't think so |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3798 return false; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3799 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3800 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3801 //== 1.6 methods (JDBC 4) |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3802 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3803 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3804 * Indicates whether or not this data source supports the SQL ROWID |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3805 * type, and if so the lifetime for which a RowId object remains |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3806 * valid. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3807 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3808 * @return ROWID_UNSUPPORTED for now |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3809 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3810 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3811 public RowIdLifetime getRowIdLifetime() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3812 // I believe we don't do rowids |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3813 return RowIdLifetime.ROWID_UNSUPPORTED; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3814 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3815 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3816 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3817 * Get the schema names available in this database. The results |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3818 * are ordered by schema name. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3819 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3820 * <P>The schema column is: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3821 * <OL> |
194
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
3822 * <LI><B>TABLE_SCHEM</B> String => schema name |
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
3823 * <LI><B>TABLE_CATALOG</B> String => catalog name (may be null) |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3824 * </OL> |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3825 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3826 * @return ResultSet each row has a single String column that is a |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3827 * schema name |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3828 * @throws SQLException if a database error occurs |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3829 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3830 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3831 public ResultSet getSchemas() throws SQLException { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3832 return getSchemas(null, null); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3833 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3834 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3835 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3836 * Retrieves whether this database supports invoking user-defined or |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3837 * vendor functions using the stored procedure escape syntax. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3838 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3839 * @return true if so; false otherwise |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3840 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3841 @Override |
736
f317b37bad30
In MonetCallableStatement constructor skip calling removeEscapes() when the connected server supports ODBC/JDBC escape sequence syntax.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
734
diff
changeset
|
3842 public boolean supportsStoredFunctionsUsingCallSyntax() { |
f317b37bad30
In MonetCallableStatement constructor skip calling removeEscapes() when the connected server supports ODBC/JDBC escape sequence syntax.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
734
diff
changeset
|
3843 return con.supportsEscapeSequenceSyntax(); |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3844 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3845 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3846 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3847 * Retrieves whether a SQLException while autoCommit is true |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3848 * inidcates that all open ResultSets are closed, even ones that are |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3849 * holdable. When a SQLException occurs while autocommit is true, it |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3850 * is vendor specific whether the JDBC driver responds with a commit |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3851 * operation, a rollback operation, or by doing neither a commit nor |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3852 * a rollback. A potential result of this difference is in whether |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3853 * or not holdable ResultSets are closed. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3854 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3855 * @return true if so; false otherwise |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3856 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3857 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3858 public boolean autoCommitFailureClosesAllResultSets() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3859 // The driver caches most of it, and as far as I knoww the |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3860 // server doesn't close outstanding result handles on commit |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3861 // failure either. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3862 return false; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3863 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3864 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3865 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3866 * Retrieves a list of the client info properties that the driver |
415
50e43af49d47
Improved DatabaseMetaData.getTypeInfo() output for temporal data types: sec_interval, day_interval, month_interval, date, time, timetz, timestamp and timestamptz.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
406
diff
changeset
|
3867 * supports. The result set contains the following columns: |
194
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
3868 * 1. NAME String => The name of the client info property |
415
50e43af49d47
Improved DatabaseMetaData.getTypeInfo() output for temporal data types: sec_interval, day_interval, month_interval, date, time, timetz, timestamp and timestamptz.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
406
diff
changeset
|
3869 * 2. MAX_LEN int => The maximum length of the value for the property |
50e43af49d47
Improved DatabaseMetaData.getTypeInfo() output for temporal data types: sec_interval, day_interval, month_interval, date, time, timetz, timestamp and timestamptz.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
406
diff
changeset
|
3870 * 3. DEFAULT_VALUE String => The default value of the property |
50e43af49d47
Improved DatabaseMetaData.getTypeInfo() output for temporal data types: sec_interval, day_interval, month_interval, date, time, timetz, timestamp and timestamptz.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
406
diff
changeset
|
3871 * 4. DESCRIPTION String => A description of the property. |
50e43af49d47
Improved DatabaseMetaData.getTypeInfo() output for temporal data types: sec_interval, day_interval, month_interval, date, time, timetz, timestamp and timestamptz.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
406
diff
changeset
|
3872 * This will typically contain information as to |
50e43af49d47
Improved DatabaseMetaData.getTypeInfo() output for temporal data types: sec_interval, day_interval, month_interval, date, time, timetz, timestamp and timestamptz.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
406
diff
changeset
|
3873 * where this property is stored in the database. |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3874 * The ResultSet is sorted by the NAME column |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3875 * |
302
1b6c514106ce
Added table aliases and use them in all meta data SQL queries to reduce query size.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
300
diff
changeset
|
3876 * @return A ResultSet object; each row is a supported client info property |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3877 * @throws SQLException if a database access error occurs |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3878 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3879 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3880 public ResultSet getClientInfoProperties() throws SQLException { |
757
7f68120de37c
Corrected DatabaseMetaData method getClientProperties().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
755
diff
changeset
|
3881 // MonetDB currently does not support any client properties, so return an empty ResultSet |
295
003ae6d881db
Add "final" keyword to method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
294
diff
changeset
|
3882 final String query = |
757
7f68120de37c
Corrected DatabaseMetaData method getClientProperties().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
755
diff
changeset
|
3883 "SELECT cast(null as varchar(64)) AS \"NAME\", " + |
7f68120de37c
Corrected DatabaseMetaData method getClientProperties().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
755
diff
changeset
|
3884 "cast(0 as int) AS \"MAX_LEN\", " + |
7f68120de37c
Corrected DatabaseMetaData method getClientProperties().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
755
diff
changeset
|
3885 "cast(null as varchar(128)) AS \"DEFAULT_VALUE\", " + |
7f68120de37c
Corrected DatabaseMetaData method getClientProperties().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
755
diff
changeset
|
3886 "cast(null as varchar(128)) AS \"DESCRIPTION\" " + |
7f68120de37c
Corrected DatabaseMetaData method getClientProperties().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
755
diff
changeset
|
3887 "WHERE 1=0"; |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3888 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3889 return executeMetaDataQuery(query); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3890 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3891 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3892 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3893 * Retrieves a description of the system and user functions |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3894 * available in the given catalog. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3895 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3896 * Only system and user function descriptions matching the schema |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3897 * and function name criteria are returned. They are ordered by |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3898 * FUNCTION_CAT, FUNCTION_SCHEM, FUNCTION_NAME and SPECIFIC_ NAME. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3899 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3900 * Each function description has the the following columns: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3901 * |
194
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
3902 * 1. FUNCTION_CAT String => function catalog (may be null) |
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
3903 * 2. FUNCTION_SCHEM String => function schema (may be null) |
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
3904 * 3. FUNCTION_NAME String => function name. This is the |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3905 * name used to invoke the function |
194
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
3906 * 4. REMARKS String => explanatory comment on the function |
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
3907 * 5. FUNCTION_TYPE short => kind of function: |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3908 * * functionResultUnknown - Cannot determine if a return |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3909 * value or table will be returned |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3910 * * functionNoTable- Does not return a table |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3911 * * functionReturnsTable - Returns a table |
194
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
3912 * 6. SPECIFIC_NAME String => the name which uniquely identifies |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3913 * this function within its schema. This is a user specified, |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3914 * or DBMS generated, name that may be different then the |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3915 * FUNCTION_NAME for example with overload functions |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3916 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3917 * A user may not have permission to execute any of the functions |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3918 * that are returned by getFunctions. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3919 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3920 * @param catalog a catalog name; must match the catalog name as it |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3921 * is stored in the database; "" retrieves those without a |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3922 * catalog; null means that the catalog name should not be |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3923 * used to narrow the search |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3924 * @param schemaPattern a schema name pattern; must match the schema |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3925 * name as it is stored in the database; "" retrieves those |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3926 * without a schema; null means that the schema name should |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3927 * not be used to narrow the search |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3928 * @param functionNamePattern a function name pattern; must match |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3929 * the function name as it is stored in the database |
371
67fa5c6147d7
Correct SQL syntax in comment (LIKE "%" is not valid SQL in WHERE clause)
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
370
diff
changeset
|
3930 * Note that our implementation allows this param to be null also (for efficiency as no extra LIKE '%' condition is added to be evaluated). |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3931 * @return ResultSet - each row is a function description |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3932 * @throws SQLException if a database access error occurs |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3933 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3934 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3935 public ResultSet getFunctions( |
295
003ae6d881db
Add "final" keyword to method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
294
diff
changeset
|
3936 final String catalog, |
003ae6d881db
Add "final" keyword to method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
294
diff
changeset
|
3937 final String schemaPattern, |
003ae6d881db
Add "final" keyword to method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
294
diff
changeset
|
3938 final String functionNamePattern |
003ae6d881db
Add "final" keyword to method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
294
diff
changeset
|
3939 ) throws SQLException |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3940 { |
332
e8962bdaa206
Moved utility methods and associated caches from DatabaseMetaData to Connection object.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
331
diff
changeset
|
3941 final boolean useCommentsTable = con.commentsTableExists(); |
295
003ae6d881db
Add "final" keyword to method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
294
diff
changeset
|
3942 final StringBuilder query = new StringBuilder(800); |
217
7cbd20ff628c
Removed DISTINCT from SELECT DISTINCT where it should not be needed (in getTables() and getFunctionColumns())
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
216
diff
changeset
|
3943 query.append("SELECT cast(null as char(1)) AS \"FUNCTION_CAT\", " + |
302
1b6c514106ce
Added table aliases and use them in all meta data SQL queries to reduce query size.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
300
diff
changeset
|
3944 "s.\"name\" AS \"FUNCTION_SCHEM\", " + |
1b6c514106ce
Added table aliases and use them in all meta data SQL queries to reduce query size.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
300
diff
changeset
|
3945 "f.\"name\" AS \"FUNCTION_NAME\", ") |
1b6c514106ce
Added table aliases and use them in all meta data SQL queries to reduce query size.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
300
diff
changeset
|
3946 .append(useCommentsTable ? "COALESCE(cm.\"remark\", cast(f.\"func\" as varchar(9999)))" : "cast(f.\"func\" as varchar(9999))").append(" AS \"REMARKS\", " + |
759
846a456f0f0c
Remove append() calls for static int values in construction of Strings.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
757
diff
changeset
|
3947 "CASE WHEN f.\"type\" IN (1,2,3,4,6) THEN " + DatabaseMetaData.functionNoTable + |
846a456f0f0c
Remove append() calls for static int values in construction of Strings.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
757
diff
changeset
|
3948 " WHEN f.\"type\" IN (5,7) THEN " + DatabaseMetaData.functionReturnsTable + |
846a456f0f0c
Remove append() calls for static int values in construction of Strings.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
757
diff
changeset
|
3949 " ELSE " + DatabaseMetaData.functionResultUnknown + " END AS \"FUNCTION_TYPE\", " + |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3950 // only the id value uniquely identifies a function. Include it to be able to differentiate between multiple overloaded functions with the same name |
302
1b6c514106ce
Added table aliases and use them in all meta data SQL queries to reduce query size.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
300
diff
changeset
|
3951 "cast(f.\"id\" as varchar(10)) AS \"SPECIFIC_NAME\" " + |
1b6c514106ce
Added table aliases and use them in all meta data SQL queries to reduce query size.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
300
diff
changeset
|
3952 "FROM \"sys\".\"functions\" f " + |
1b6c514106ce
Added table aliases and use them in all meta data SQL queries to reduce query size.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
300
diff
changeset
|
3953 "JOIN \"sys\".\"schemas\" s ON f.\"schema_id\" = s.\"id\" "); |
215
71b039bc2d99
Added support for querying the sys.comments table for some meta data methods
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
213
diff
changeset
|
3954 if (useCommentsTable) { |
759
846a456f0f0c
Remove append() calls for static int values in construction of Strings.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
757
diff
changeset
|
3955 query.append("LEFT OUTER JOIN \"sys\".\"comments\" cm ON f.\"id\" = cm.\"id\" "); |
215
71b039bc2d99
Added support for querying the sys.comments table for some meta data methods
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
213
diff
changeset
|
3956 } |
71b039bc2d99
Added support for querying the sys.comments table for some meta data methods
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
213
diff
changeset
|
3957 // only functions, so exclude procedures (type = 2). Those will to be returned via getProcedures() |
302
1b6c514106ce
Added table aliases and use them in all meta data SQL queries to reduce query size.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
300
diff
changeset
|
3958 query.append("WHERE f.\"type\" <> 2"); |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3959 |
216
116b5a149fb4
Optimise SQL query generation for cases where the WHERE clause already has a AND 1 = 0 condition. Exlude adding more AND ... conditions.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
215
diff
changeset
|
3960 if (catalog != null && !catalog.isEmpty()) { |
299
1f0324072b0c
Correcting typo in comment
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
298
diff
changeset
|
3961 // non-empty catalog selection. |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3962 // as we do not support catalogs this always results in no rows returned |
352
f62137dd6050
Remove spaces from static SQL predicates: 1 = 0 and 1 = 1.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
350
diff
changeset
|
3963 query.append(" AND 1=0"); |
216
116b5a149fb4
Optimise SQL query generation for cases where the WHERE clause already has a AND 1 = 0 condition. Exlude adding more AND ... conditions.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
215
diff
changeset
|
3964 } else { |
323
8701024a9bb0
In DatabaseMetaData methods which accept name match patterns, optimise the SQL generation when the pattern equals a: %
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
306
diff
changeset
|
3965 if (schemaPattern != null && !schemaPattern.equals("%")) { |
302
1b6c514106ce
Added table aliases and use them in all meta data SQL queries to reduce query size.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
300
diff
changeset
|
3966 query.append(" AND s.\"name\" ").append(composeMatchPart(schemaPattern)); |
216
116b5a149fb4
Optimise SQL query generation for cases where the WHERE clause already has a AND 1 = 0 condition. Exlude adding more AND ... conditions.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
215
diff
changeset
|
3967 } |
323
8701024a9bb0
In DatabaseMetaData methods which accept name match patterns, optimise the SQL generation when the pattern equals a: %
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
306
diff
changeset
|
3968 if (functionNamePattern != null && !functionNamePattern.equals("%")) { |
302
1b6c514106ce
Added table aliases and use them in all meta data SQL queries to reduce query size.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
300
diff
changeset
|
3969 query.append(" AND f.\"name\" ").append(composeMatchPart(functionNamePattern)); |
216
116b5a149fb4
Optimise SQL query generation for cases where the WHERE clause already has a AND 1 = 0 condition. Exlude adding more AND ... conditions.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
215
diff
changeset
|
3970 } |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3971 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3972 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3973 query.append(" ORDER BY \"FUNCTION_SCHEM\", \"FUNCTION_NAME\", \"SPECIFIC_NAME\""); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3974 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3975 return executeMetaDataQuery(query.toString()); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3976 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3977 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3978 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3979 * Retrieves a description of the given catalog's system or user |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3980 * function parameters and return type. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3981 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3982 * Only descriptions matching the schema, function and parameter name criteria are returned. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3983 * They are ordered by FUNCTION_CAT, FUNCTION_SCHEM, FUNCTION_NAME and SPECIFIC_ NAME. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3984 * Within this, the return value, if any, is first. Next are the parameter descriptions in call order. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3985 * The column descriptions follow in column number order. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3986 * |
194
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
3987 * 1. FUNCTION_CAT String => function catalog (may be null) |
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
3988 * 2. FUNCTION_SCHEM String => function schema (may be null) |
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
3989 * 3. FUNCTION_NAME String => function name. This is the name used to invoke the function |
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
3990 * 4. COLUMN_NAME String => column/parameter name |
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
3991 * 5. COLUMN_TYPE Short => kind of column/parameter: |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3992 * functionColumnUnknown - nobody knows |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3993 * functionColumnIn - IN parameter |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3994 * functionColumnInOut - INOUT parameter |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3995 * functionColumnOut - OUT parameter |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3996 * functionColumnReturn - function return value |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3997 * functionColumnResult - Indicates that the parameter or column is a column in the ResultSet |
194
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
3998 * 6. DATA_TYPE int => SQL type from java.sql.Types |
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
3999 * 7. TYPE_NAME String => SQL type name, for a UDT type the type name is fully qualified |
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
4000 * 8. PRECISION int => precision |
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
4001 * 9. LENGTH int => length in bytes of data |
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
4002 * 10. SCALE short => scale - null is returned for data types where SCALE is not applicable. |
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
4003 * 11. RADIX short => radix |
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
4004 * 12. NULLABLE short => can it contain NULL. |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
4005 * functionNoNulls - does not allow NULL values |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
4006 * functionNullable - allows NULL values |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
4007 * functionNullableUnknown - nullability unknown |
194
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
4008 * 13. REMARKS String => comment describing column/parameter |
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
4009 * 14. CHAR_OCTET_LENGTH int => the maximum length of binary and character based parameters or columns. For any other datatype the returned value is a NULL |
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
4010 * 15. ORDINAL_POSITION int => the ordinal position, starting from 1, for the input and output parameters. |
15
6e48d0fae766
Corrected return values of DatabaseMetaData methods nullsAreSortedHigh(), nullsAreSortedLow(),
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
7
diff
changeset
|
4011 * A value of 0 is returned if this row describes the function's return value. For result set columns, it is the ordinal position of the column in the result set starting from 1. |
194
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
4012 * 16. IS_NULLABLE String => ISO rules are used to determine the nullability for a parameter or column. |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
4013 * YES --- if the parameter or column can include NULLs |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
4014 * NO --- if the parameter or column cannot include NULLs |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
4015 * empty string --- if the nullability for the parameter or column is unknown |
194
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
4016 * 17. SPECIFIC_NAME String => the name which uniquely identifies this function within its schema. |
15
6e48d0fae766
Corrected return values of DatabaseMetaData methods nullsAreSortedHigh(), nullsAreSortedLow(),
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
7
diff
changeset
|
4017 * This is a user specified, or DBMS generated, name that may be different then the FUNCTION_NAME for example with overload functions |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
4018 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
4019 * @param catalog a catalog name; must match the catalog name as |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
4020 * it is stored in the database; "" retrieves those without a |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
4021 * catalog; null means that the catalog name should not be |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
4022 * used to narrow the search |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
4023 * @param schemaPattern a schema name pattern; must match the schema |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
4024 * name as it is stored in the database; "" retrieves those |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
4025 * without a schema; null means that the schema name should |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
4026 * not be used to narrow the search |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
4027 * @param functionNamePattern a procedure name pattern; must match the |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
4028 * function name as it is stored in the database |
371
67fa5c6147d7
Correct SQL syntax in comment (LIKE "%" is not valid SQL in WHERE clause)
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
370
diff
changeset
|
4029 * Note that our implementation allows this param to be null also (for efficiency as no extra LIKE '%' condition is added to be evaluated). |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
4030 * @param columnNamePattern a parameter name pattern; must match the |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
4031 * parameter or column name as it is stored in the database |
371
67fa5c6147d7
Correct SQL syntax in comment (LIKE "%" is not valid SQL in WHERE clause)
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
370
diff
changeset
|
4032 * Note that our implementation allows this param to be null also (for efficiency as no extra LIKE '%' condition is added to be evaluated). |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
4033 * @return ResultSet - each row describes a user function parameter, |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
4034 * column or return type |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
4035 * @throws SQLException - if a database access error occurs |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
4036 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
4037 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
4038 public ResultSet getFunctionColumns( |
295
003ae6d881db
Add "final" keyword to method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
294
diff
changeset
|
4039 final String catalog, |
003ae6d881db
Add "final" keyword to method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
294
diff
changeset
|
4040 final String schemaPattern, |
003ae6d881db
Add "final" keyword to method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
294
diff
changeset
|
4041 final String functionNamePattern, |
003ae6d881db
Add "final" keyword to method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
294
diff
changeset
|
4042 final String columnNamePattern |
003ae6d881db
Add "final" keyword to method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
294
diff
changeset
|
4043 ) throws SQLException |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
4044 { |
295
003ae6d881db
Add "final" keyword to method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
294
diff
changeset
|
4045 final StringBuilder query = new StringBuilder(2600); |
217
7cbd20ff628c
Removed DISTINCT from SELECT DISTINCT where it should not be needed (in getTables() and getFunctionColumns())
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
216
diff
changeset
|
4046 query.append("SELECT cast(null as char(1)) AS \"FUNCTION_CAT\", " + |
302
1b6c514106ce
Added table aliases and use them in all meta data SQL queries to reduce query size.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
300
diff
changeset
|
4047 "s.\"name\" AS \"FUNCTION_SCHEM\", " + |
1b6c514106ce
Added table aliases and use them in all meta data SQL queries to reduce query size.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
300
diff
changeset
|
4048 "f.\"name\" AS \"FUNCTION_NAME\", " + |
1b6c514106ce
Added table aliases and use them in all meta data SQL queries to reduce query size.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
300
diff
changeset
|
4049 "a.\"name\" AS \"COLUMN_NAME\", " + |
1b6c514106ce
Added table aliases and use them in all meta data SQL queries to reduce query size.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
300
diff
changeset
|
4050 "cast(CASE a.\"inout\"" + |
759
846a456f0f0c
Remove append() calls for static int values in construction of Strings.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
757
diff
changeset
|
4051 " WHEN 0 THEN (CASE a.\"number\" WHEN 0 THEN " + DatabaseMetaData.functionReturn + " ELSE " + DatabaseMetaData.functionColumnOut + " END)" + |
846a456f0f0c
Remove append() calls for static int values in construction of Strings.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
757
diff
changeset
|
4052 " WHEN 1 THEN " + DatabaseMetaData.functionColumnIn + |
846a456f0f0c
Remove append() calls for static int values in construction of Strings.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
757
diff
changeset
|
4053 " ELSE " + DatabaseMetaData.functionColumnUnknown + " END AS smallint) AS \"COLUMN_TYPE\", " + |
302
1b6c514106ce
Added table aliases and use them in all meta data SQL queries to reduce query size.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
300
diff
changeset
|
4054 "cast(").append(MonetDriver.getSQLTypeMap("a.\"type\"")).append(" AS int) AS \"DATA_TYPE\", " + |
1b6c514106ce
Added table aliases and use them in all meta data SQL queries to reduce query size.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
300
diff
changeset
|
4055 "a.\"type\" AS \"TYPE_NAME\", " + |
1b6c514106ce
Added table aliases and use them in all meta data SQL queries to reduce query size.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
300
diff
changeset
|
4056 "CASE a.\"type\" WHEN 'tinyint' THEN 3 WHEN 'smallint' THEN 5 WHEN 'int' THEN 10 WHEN 'bigint' THEN 19" + |
1b6c514106ce
Added table aliases and use them in all meta data SQL queries to reduce query size.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
300
diff
changeset
|
4057 " WHEN 'hugeint' THEN 38 WHEN 'oid' THEN 19 WHEN 'wrd' THEN 19 ELSE a.\"type_digits\" END AS \"PRECISION\", " + |
1b6c514106ce
Added table aliases and use them in all meta data SQL queries to reduce query size.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
300
diff
changeset
|
4058 "CASE a.\"type\" WHEN 'tinyint' THEN 1 WHEN 'smallint' THEN 2 WHEN 'int' THEN 4 WHEN 'bigint' THEN 8" + |
1b6c514106ce
Added table aliases and use them in all meta data SQL queries to reduce query size.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
300
diff
changeset
|
4059 " WHEN 'hugeint' THEN 16 WHEN 'oid' THEN 8 WHEN 'wrd' THEN 8 ELSE a.\"type_digits\" END AS \"LENGTH\", " + |
1b6c514106ce
Added table aliases and use them in all meta data SQL queries to reduce query size.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
300
diff
changeset
|
4060 "cast(CASE WHEN a.\"type\" IN ('tinyint','smallint','int','bigint','hugeint','oid','wrd','decimal','numeric'," + |
379
d7661075ebf7
Add support for new (as of Oct2020 release) datatype: day_interval
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
376
diff
changeset
|
4061 "'time','timetz','timestamp','timestamptz','day_interval','month_interval','sec_interval') THEN a.\"type_scale\" ELSE NULL END AS smallint) AS \"SCALE\", " + |
415
50e43af49d47
Improved DatabaseMetaData.getTypeInfo() output for temporal data types: sec_interval, day_interval, month_interval, date, time, timetz, timestamp and timestamptz.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
406
diff
changeset
|
4062 "cast(CASE WHEN a.\"type\" IN ('tinyint','smallint','int','bigint','hugeint','oid','wrd','decimal','numeric','day_interval','month_interval','sec_interval') THEN 10" + |
302
1b6c514106ce
Added table aliases and use them in all meta data SQL queries to reduce query size.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
300
diff
changeset
|
4063 " WHEN a.\"type\" IN ('real','float','double') THEN 2 ELSE NULL END AS smallint) AS \"RADIX\", " + |
759
846a456f0f0c
Remove append() calls for static int values in construction of Strings.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
757
diff
changeset
|
4064 // mvd: do not remove next append. The String above is same as used by getProcedureColumns, so shared in class file. |
217
7cbd20ff628c
Removed DISTINCT from SELECT DISTINCT where it should not be needed (in getTables() and getFunctionColumns())
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
216
diff
changeset
|
4065 "cast(").append(DatabaseMetaData.functionNullableUnknown).append(" AS smallint) AS \"NULLABLE\", " + |
7cbd20ff628c
Removed DISTINCT from SELECT DISTINCT where it should not be needed (in getTables() and getFunctionColumns())
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
216
diff
changeset
|
4066 "cast(null as char(1)) AS \"REMARKS\", " + |
822
ad4491372c2c
Prevent sql processor to produce server msg: mul_int_bte_int: ERROR: 22003!overflow in calculation 2147483647*4.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
818
diff
changeset
|
4067 "cast(CASE WHEN a.\"type\" IN ('varchar','clob','char','json','url','xml') THEN 4 * cast(a.\"type_digits\" as bigint) WHEN a.\"type\" = 'blob' THEN a.\"type_digits\" ELSE NULL END as bigint) AS \"CHAR_OCTET_LENGTH\", " + |
302
1b6c514106ce
Added table aliases and use them in all meta data SQL queries to reduce query size.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
300
diff
changeset
|
4068 "cast(a.\"number\" as int) AS \"ORDINAL_POSITION\", " + |
217
7cbd20ff628c
Removed DISTINCT from SELECT DISTINCT where it should not be needed (in getTables() and getFunctionColumns())
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
216
diff
changeset
|
4069 "cast('' as varchar(3)) AS \"IS_NULLABLE\", " + |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
4070 // the specific name contains the function id, in order to be able to match the args to the correct overloaded function name |
302
1b6c514106ce
Added table aliases and use them in all meta data SQL queries to reduce query size.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
300
diff
changeset
|
4071 "cast(f.\"id\" as varchar(10)) AS \"SPECIFIC_NAME\" " + |
1b6c514106ce
Added table aliases and use them in all meta data SQL queries to reduce query size.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
300
diff
changeset
|
4072 "FROM \"sys\".\"args\" a " + |
1b6c514106ce
Added table aliases and use them in all meta data SQL queries to reduce query size.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
300
diff
changeset
|
4073 "JOIN \"sys\".\"functions\" f ON a.\"func_id\" = f.\"id\" " + |
1b6c514106ce
Added table aliases and use them in all meta data SQL queries to reduce query size.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
300
diff
changeset
|
4074 "JOIN \"sys\".\"schemas\" s ON f.\"schema_id\" = s.\"id\" " + |
215
71b039bc2d99
Added support for querying the sys.comments table for some meta data methods
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
213
diff
changeset
|
4075 // only functions, so exclude procedures (type = 2). Those will to be returned via getProcedureColumns() |
302
1b6c514106ce
Added table aliases and use them in all meta data SQL queries to reduce query size.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
300
diff
changeset
|
4076 "WHERE f.\"type\" <> 2"); |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
4077 |
216
116b5a149fb4
Optimise SQL query generation for cases where the WHERE clause already has a AND 1 = 0 condition. Exlude adding more AND ... conditions.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
215
diff
changeset
|
4078 if (catalog != null && !catalog.isEmpty()) { |
299
1f0324072b0c
Correcting typo in comment
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
298
diff
changeset
|
4079 // non-empty catalog selection. |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
4080 // as we do not support catalogs this always results in no rows returned |
352
f62137dd6050
Remove spaces from static SQL predicates: 1 = 0 and 1 = 1.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
350
diff
changeset
|
4081 query.append(" AND 1=0"); |
216
116b5a149fb4
Optimise SQL query generation for cases where the WHERE clause already has a AND 1 = 0 condition. Exlude adding more AND ... conditions.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
215
diff
changeset
|
4082 } else { |
323
8701024a9bb0
In DatabaseMetaData methods which accept name match patterns, optimise the SQL generation when the pattern equals a: %
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
306
diff
changeset
|
4083 if (schemaPattern != null && !schemaPattern.equals("%")) { |
302
1b6c514106ce
Added table aliases and use them in all meta data SQL queries to reduce query size.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
300
diff
changeset
|
4084 query.append(" AND s.\"name\" ").append(composeMatchPart(schemaPattern)); |
216
116b5a149fb4
Optimise SQL query generation for cases where the WHERE clause already has a AND 1 = 0 condition. Exlude adding more AND ... conditions.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
215
diff
changeset
|
4085 } |
323
8701024a9bb0
In DatabaseMetaData methods which accept name match patterns, optimise the SQL generation when the pattern equals a: %
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
306
diff
changeset
|
4086 if (functionNamePattern != null && !functionNamePattern.equals("%")) { |
302
1b6c514106ce
Added table aliases and use them in all meta data SQL queries to reduce query size.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
300
diff
changeset
|
4087 query.append(" AND f.\"name\" ").append(composeMatchPart(functionNamePattern)); |
216
116b5a149fb4
Optimise SQL query generation for cases where the WHERE clause already has a AND 1 = 0 condition. Exlude adding more AND ... conditions.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
215
diff
changeset
|
4088 } |
323
8701024a9bb0
In DatabaseMetaData methods which accept name match patterns, optimise the SQL generation when the pattern equals a: %
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
306
diff
changeset
|
4089 if (columnNamePattern != null && !columnNamePattern.equals("%")) { |
302
1b6c514106ce
Added table aliases and use them in all meta data SQL queries to reduce query size.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
300
diff
changeset
|
4090 query.append(" AND a.\"name\" ").append(composeMatchPart(columnNamePattern)); |
216
116b5a149fb4
Optimise SQL query generation for cases where the WHERE clause already has a AND 1 = 0 condition. Exlude adding more AND ... conditions.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
215
diff
changeset
|
4091 } |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
4092 } |
216
116b5a149fb4
Optimise SQL query generation for cases where the WHERE clause already has a AND 1 = 0 condition. Exlude adding more AND ... conditions.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
215
diff
changeset
|
4093 |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
4094 query.append(" ORDER BY \"FUNCTION_SCHEM\", \"FUNCTION_NAME\", \"SPECIFIC_NAME\", \"ORDINAL_POSITION\""); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
4095 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
4096 return executeMetaDataQuery(query.toString()); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
4097 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
4098 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
4099 //== 1.7 methods (JDBC 4.1) |
372
159c628527c4
Optimize SQL query generation by eliminating "WHERE 1=1" conditions
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
371
diff
changeset
|
4100 |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
4101 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
4102 * Retrieves a description of the pseudo or hidden columns available |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
4103 * in a given table within the specified catalog and schema. Pseudo |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
4104 * or hidden columns may not always be stored within a table and are |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
4105 * not visible in a ResultSet unless they are specified in the |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
4106 * query's outermost SELECT list. Pseudo or hidden columns may not |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
4107 * necessarily be able to be modified. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
4108 * If there are no pseudo or hidden columns, an empty ResultSet is returned. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
4109 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
4110 * Only column descriptions matching the catalog, schema, table and column name criteria are returned. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
4111 * They are ordered by TABLE_CAT,TABLE_SCHEM, TABLE_NAME and COLUMN_NAME. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
4112 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
4113 * Each column description has the following columns: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
4114 * |
194
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
4115 * 1. TABLE_CAT String => table catalog (may be null) |
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
4116 * 2. TABLE_SCHEM String => table schema (may be null) |
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
4117 * 3. TABLE_NAME String => table name |
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
4118 * 4. COLUMN_NAME String => column name |
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
4119 * 5. DATA_TYPE int => SQL type from java.sql.Types |
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
4120 * 6. COLUMN_SIZE int => column size. |
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
4121 * 7. DECIMAL_DIGITS int => the number of fractional digits. Null is returned for data types where DECIMAL_DIGITS is not applicable. |
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
4122 * 8. NUM_PREC_RADIX int => Radix (typically either 10 or 2) |
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
4123 * 9. COLUMN_USAGE String => The allowed usage for the column. The value returned will correspond to the enum name returned by PseudoColumnUsage.name() |
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
4124 * 10. REMARKS String => comment describing column (may be null) |
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
4125 * 11. CHAR_OCTET_LENGTH int => for char types the maximum number of bytes in the column |
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
4126 * 12. IS_NULLABLE String => ISO rules are used to determine the nullability for a column. |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
4127 * YES --- if the column can include NULLs |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
4128 * NO --- if the column cannot include NULLs |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
4129 * empty string --- if the nullability for the column is unknown |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
4130 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
4131 * @param catalog a catalog name |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
4132 * @param schemaPattern a schema name pattern |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
4133 * @param tableNamePattern a table name pattern |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
4134 * @param columnNamePattern a column name pattern |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
4135 * @return ResultSet where each row is a column description |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
4136 * @throws SQLException if a database access error occurs |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
4137 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
4138 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
4139 public ResultSet getPseudoColumns( |
295
003ae6d881db
Add "final" keyword to method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
294
diff
changeset
|
4140 final String catalog, |
003ae6d881db
Add "final" keyword to method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
294
diff
changeset
|
4141 final String schemaPattern, |
003ae6d881db
Add "final" keyword to method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
294
diff
changeset
|
4142 final String tableNamePattern, |
003ae6d881db
Add "final" keyword to method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
294
diff
changeset
|
4143 final String columnNamePattern |
003ae6d881db
Add "final" keyword to method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
294
diff
changeset
|
4144 ) throws SQLException |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
4145 { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
4146 // MonetDB currently does not support pseudo or hidden columns, so return an empty ResultSet |
295
003ae6d881db
Add "final" keyword to method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
294
diff
changeset
|
4147 final String query = |
217
7cbd20ff628c
Removed DISTINCT from SELECT DISTINCT where it should not be needed (in getTables() and getFunctionColumns())
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
216
diff
changeset
|
4148 "SELECT cast(null as char(1)) AS \"TABLE_CAT\", " + |
7cbd20ff628c
Removed DISTINCT from SELECT DISTINCT where it should not be needed (in getTables() and getFunctionColumns())
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
216
diff
changeset
|
4149 "'' AS \"TABLE_SCHEM\", " + |
7cbd20ff628c
Removed DISTINCT from SELECT DISTINCT where it should not be needed (in getTables() and getFunctionColumns())
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
216
diff
changeset
|
4150 "'' AS \"TABLE_NAME\", " + |
7cbd20ff628c
Removed DISTINCT from SELECT DISTINCT where it should not be needed (in getTables() and getFunctionColumns())
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
216
diff
changeset
|
4151 "'' AS \"COLUMN_NAME\", " + |
7cbd20ff628c
Removed DISTINCT from SELECT DISTINCT where it should not be needed (in getTables() and getFunctionColumns())
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
216
diff
changeset
|
4152 "cast(0 as int) AS \"DATA_TYPE\", " + |
7cbd20ff628c
Removed DISTINCT from SELECT DISTINCT where it should not be needed (in getTables() and getFunctionColumns())
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
216
diff
changeset
|
4153 "cast(0 as int) AS \"COLUMN_SIZE\", " + |
7cbd20ff628c
Removed DISTINCT from SELECT DISTINCT where it should not be needed (in getTables() and getFunctionColumns())
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
216
diff
changeset
|
4154 "cast(0 as int) AS \"DECIMAL_DIGITS\", " + |
7cbd20ff628c
Removed DISTINCT from SELECT DISTINCT where it should not be needed (in getTables() and getFunctionColumns())
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
216
diff
changeset
|
4155 "cast(0 as int) AS \"NUM_PREC_RADIX\", " + |
7cbd20ff628c
Removed DISTINCT from SELECT DISTINCT where it should not be needed (in getTables() and getFunctionColumns())
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
216
diff
changeset
|
4156 "'' AS \"COLUMN_USAGE\", " + |
7cbd20ff628c
Removed DISTINCT from SELECT DISTINCT where it should not be needed (in getTables() and getFunctionColumns())
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
216
diff
changeset
|
4157 "'' AS \"REMARKS\", " + |
7cbd20ff628c
Removed DISTINCT from SELECT DISTINCT where it should not be needed (in getTables() and getFunctionColumns())
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
216
diff
changeset
|
4158 "cast(0 as int) AS \"CHAR_OCTET_LENGTH\", " + |
7cbd20ff628c
Removed DISTINCT from SELECT DISTINCT where it should not be needed (in getTables() and getFunctionColumns())
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
216
diff
changeset
|
4159 "'' AS \"IS_NULLABLE\" " + |
352
f62137dd6050
Remove spaces from static SQL predicates: 1 = 0 and 1 = 1.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
350
diff
changeset
|
4160 "WHERE 1=0"; |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
4161 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
4162 return executeMetaDataQuery(query); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
4163 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
4164 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
4165 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
4166 * Retrieves whether a generated key will always be returned if the |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
4167 * column name(s) or index(es) specified for the auto generated key |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
4168 * column(s) are valid and the statement succeeds. The key that is |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
4169 * returned may or may not be based on the column(s) for the auto |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
4170 * generated key. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
4171 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
4172 * @return true if so, false otherwise |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
4173 * @throws SQLException - if a database access error occurs |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
4174 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
4175 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
4176 public boolean generatedKeyAlwaysReturned() throws SQLException { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
4177 return true; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
4178 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
4179 |
376
ffdc7b0e102d
Updated JDBC driver to comply with JDBC 4.2 interface now we compile for Java 8. This includes:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
375
diff
changeset
|
4180 //== Java 1.8 methods (JDBC 4.2) |
264
d31b99f06b26
Implemented two new 1.8 methods (JDBC 4.2)
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
263
diff
changeset
|
4181 |
d31b99f06b26
Implemented two new 1.8 methods (JDBC 4.2)
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
263
diff
changeset
|
4182 /** |
d31b99f06b26
Implemented two new 1.8 methods (JDBC 4.2)
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
263
diff
changeset
|
4183 * Retrieves the maximum number of bytes this database allows for the logical size for a LOB. |
d31b99f06b26
Implemented two new 1.8 methods (JDBC 4.2)
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
263
diff
changeset
|
4184 * The default implementation will return 0 |
376
ffdc7b0e102d
Updated JDBC driver to comply with JDBC 4.2 interface now we compile for Java 8. This includes:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
375
diff
changeset
|
4185 * @return the maximum number of bytes allowed; a result of zero means that there is no limit or the limit is not known |
264
d31b99f06b26
Implemented two new 1.8 methods (JDBC 4.2)
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
263
diff
changeset
|
4186 */ |
d31b99f06b26
Implemented two new 1.8 methods (JDBC 4.2)
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
263
diff
changeset
|
4187 @Override |
d31b99f06b26
Implemented two new 1.8 methods (JDBC 4.2)
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
263
diff
changeset
|
4188 public long getMaxLogicalLobSize() { |
d31b99f06b26
Implemented two new 1.8 methods (JDBC 4.2)
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
263
diff
changeset
|
4189 return 0; |
d31b99f06b26
Implemented two new 1.8 methods (JDBC 4.2)
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
263
diff
changeset
|
4190 } |
d31b99f06b26
Implemented two new 1.8 methods (JDBC 4.2)
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
263
diff
changeset
|
4191 |
d31b99f06b26
Implemented two new 1.8 methods (JDBC 4.2)
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
263
diff
changeset
|
4192 /** |
d31b99f06b26
Implemented two new 1.8 methods (JDBC 4.2)
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
263
diff
changeset
|
4193 * Retrieves whether this database supports REF CURSOR. |
d31b99f06b26
Implemented two new 1.8 methods (JDBC 4.2)
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
263
diff
changeset
|
4194 * The default implementation will return false |
376
ffdc7b0e102d
Updated JDBC driver to comply with JDBC 4.2 interface now we compile for Java 8. This includes:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
375
diff
changeset
|
4195 * @return true if this database supports REF CURSOR; false otherwise |
264
d31b99f06b26
Implemented two new 1.8 methods (JDBC 4.2)
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
263
diff
changeset
|
4196 */ |
d31b99f06b26
Implemented two new 1.8 methods (JDBC 4.2)
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
263
diff
changeset
|
4197 @Override |
d31b99f06b26
Implemented two new 1.8 methods (JDBC 4.2)
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
263
diff
changeset
|
4198 public boolean supportsRefCursors() { |
d31b99f06b26
Implemented two new 1.8 methods (JDBC 4.2)
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
263
diff
changeset
|
4199 return false; |
d31b99f06b26
Implemented two new 1.8 methods (JDBC 4.2)
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
263
diff
changeset
|
4200 } |
d31b99f06b26
Implemented two new 1.8 methods (JDBC 4.2)
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
263
diff
changeset
|
4201 |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
4202 //== end methods interface DatabaseMetaData |
303
a91168efdf27
Small code and doc improvements. Moved helper functions to the bottom.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
302
diff
changeset
|
4203 |
a91168efdf27
Small code and doc improvements. Moved helper functions to the bottom.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
302
diff
changeset
|
4204 |
332
e8962bdaa206
Moved utility methods and associated caches from DatabaseMetaData to Connection object.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
331
diff
changeset
|
4205 //== internal helper methods which do not belong to the JDBC interface |
e8962bdaa206
Moved utility methods and associated caches from DatabaseMetaData to Connection object.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
331
diff
changeset
|
4206 |
e8962bdaa206
Moved utility methods and associated caches from DatabaseMetaData to Connection object.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
331
diff
changeset
|
4207 /** |
e8962bdaa206
Moved utility methods and associated caches from DatabaseMetaData to Connection object.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
331
diff
changeset
|
4208 * Internal utility method to create a Statement object, execute a query and return the ResulSet object which allows scrolling. |
e8962bdaa206
Moved utility methods and associated caches from DatabaseMetaData to Connection object.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
331
diff
changeset
|
4209 * As the Statement object is created internally (the caller does not see it and thus can not close it), |
e8962bdaa206
Moved utility methods and associated caches from DatabaseMetaData to Connection object.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
331
diff
changeset
|
4210 * we set it to close (and free server resources) when the ResultSet object is closed by the caller. |
709
bdeabbd46ec6
Resolve javac and javadoc warnings when compiled with JDK19.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
682
diff
changeset
|
4211 * |
bdeabbd46ec6
Resolve javac and javadoc warnings when compiled with JDK19.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
682
diff
changeset
|
4212 * @param query the SQL query to execute |
bdeabbd46ec6
Resolve javac and javadoc warnings when compiled with JDK19.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
682
diff
changeset
|
4213 * @return a scrollable ResulSet or null when query failed to be executed |
bdeabbd46ec6
Resolve javac and javadoc warnings when compiled with JDK19.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
682
diff
changeset
|
4214 * @throws SQLException if a database access error occurs |
332
e8962bdaa206
Moved utility methods and associated caches from DatabaseMetaData to Connection object.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
331
diff
changeset
|
4215 */ |
370
2ab474af487c
Add utility method to replace calls to x.replaceAll().replaceAll() in several places.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
366
diff
changeset
|
4216 private final ResultSet executeMetaDataQuery(final String query) throws SQLException { |
332
e8962bdaa206
Moved utility methods and associated caches from DatabaseMetaData to Connection object.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
331
diff
changeset
|
4217 final Statement stmt = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); |
e8962bdaa206
Moved utility methods and associated caches from DatabaseMetaData to Connection object.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
331
diff
changeset
|
4218 ResultSet rs = null; |
e8962bdaa206
Moved utility methods and associated caches from DatabaseMetaData to Connection object.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
331
diff
changeset
|
4219 if (stmt != null) { |
e8962bdaa206
Moved utility methods and associated caches from DatabaseMetaData to Connection object.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
331
diff
changeset
|
4220 // for debug: System.out.println("SQL (len " + query.length() + "): " + query); |
e8962bdaa206
Moved utility methods and associated caches from DatabaseMetaData to Connection object.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
331
diff
changeset
|
4221 rs = stmt.executeQuery(query); |
e8962bdaa206
Moved utility methods and associated caches from DatabaseMetaData to Connection object.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
331
diff
changeset
|
4222 if (rs != null) { |
e8962bdaa206
Moved utility methods and associated caches from DatabaseMetaData to Connection object.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
331
diff
changeset
|
4223 /* we want the statement object to be closed also when the resultset is closed by the caller */ |
e8962bdaa206
Moved utility methods and associated caches from DatabaseMetaData to Connection object.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
331
diff
changeset
|
4224 stmt.closeOnCompletion(); |
e8962bdaa206
Moved utility methods and associated caches from DatabaseMetaData to Connection object.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
331
diff
changeset
|
4225 } else { |
e8962bdaa206
Moved utility methods and associated caches from DatabaseMetaData to Connection object.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
331
diff
changeset
|
4226 /* failed to produce a resultset, so release resources for created statement object now */ |
e8962bdaa206
Moved utility methods and associated caches from DatabaseMetaData to Connection object.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
331
diff
changeset
|
4227 stmt.close(); |
e8962bdaa206
Moved utility methods and associated caches from DatabaseMetaData to Connection object.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
331
diff
changeset
|
4228 } |
e8962bdaa206
Moved utility methods and associated caches from DatabaseMetaData to Connection object.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
331
diff
changeset
|
4229 } |
e8962bdaa206
Moved utility methods and associated caches from DatabaseMetaData to Connection object.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
331
diff
changeset
|
4230 return rs; |
e8962bdaa206
Moved utility methods and associated caches from DatabaseMetaData to Connection object.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
331
diff
changeset
|
4231 } |
303
a91168efdf27
Small code and doc improvements. Moved helper functions to the bottom.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
302
diff
changeset
|
4232 |
a91168efdf27
Small code and doc improvements. Moved helper functions to the bottom.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
302
diff
changeset
|
4233 /** |
427
e79bfbd0553e
Added support for escaped wildcards (\% en \_) in String arguments of
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
425
diff
changeset
|
4234 * Returns a SQL match part string where depending on the input value we compose |
e79bfbd0553e
Added support for escaped wildcards (\% en \_) in String arguments of
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
425
diff
changeset
|
4235 * - an exact string match (using = comparator) or |
e79bfbd0553e
Added support for escaped wildcards (\% en \_) in String arguments of
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
425
diff
changeset
|
4236 * - a match with wildcards (using LIKE comparator) or |
e79bfbd0553e
Added support for escaped wildcards (\% en \_) in String arguments of
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
425
diff
changeset
|
4237 * - when input is missing (using IS NULL comparator) |
e79bfbd0553e
Added support for escaped wildcards (\% en \_) in String arguments of
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
425
diff
changeset
|
4238 * |
e79bfbd0553e
Added support for escaped wildcards (\% en \_) in String arguments of
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
425
diff
changeset
|
4239 * Note that wildcard characters can be escaped by prefix \ (a backslash) |
e79bfbd0553e
Added support for escaped wildcards (\% en \_) in String arguments of
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
425
diff
changeset
|
4240 * When ALL wildcard characters are escaped then we remove the \'s and compose an = comparator string match. |
303
a91168efdf27
Small code and doc improvements. Moved helper functions to the bottom.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
302
diff
changeset
|
4241 * |
a91168efdf27
Small code and doc improvements. Moved helper functions to the bottom.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
302
diff
changeset
|
4242 * @param in the string to match |
a91168efdf27
Small code and doc improvements. Moved helper functions to the bottom.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
302
diff
changeset
|
4243 * @return the SQL match part string |
a91168efdf27
Small code and doc improvements. Moved helper functions to the bottom.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
302
diff
changeset
|
4244 */ |
370
2ab474af487c
Add utility method to replace calls to x.replaceAll().replaceAll() in several places.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
366
diff
changeset
|
4245 private final String composeMatchPart(final String in) { |
303
a91168efdf27
Small code and doc improvements. Moved helper functions to the bottom.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
302
diff
changeset
|
4246 if (in == null) |
a91168efdf27
Small code and doc improvements. Moved helper functions to the bottom.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
302
diff
changeset
|
4247 return "IS NULL"; |
a91168efdf27
Small code and doc improvements. Moved helper functions to the bottom.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
302
diff
changeset
|
4248 |
680
238d6a3a6469
Improve composeMatchPart(final String in). Prevent parsing pattern when length is 0. Optimise patterns: % or %%.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
670
diff
changeset
|
4249 final int len = in.length(); |
238d6a3a6469
Improve composeMatchPart(final String in). Prevent parsing pattern when length is 0. Optimise patterns: % or %%.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
670
diff
changeset
|
4250 if (len == 0) |
238d6a3a6469
Improve composeMatchPart(final String in). Prevent parsing pattern when length is 0. Optimise patterns: % or %%.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
670
diff
changeset
|
4251 return "= ''"; |
238d6a3a6469
Improve composeMatchPart(final String in). Prevent parsing pattern when length is 0. Optimise patterns: % or %%.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
670
diff
changeset
|
4252 |
238d6a3a6469
Improve composeMatchPart(final String in). Prevent parsing pattern when length is 0. Optimise patterns: % or %%.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
670
diff
changeset
|
4253 if (in.equals("%") || in.equals("%%")) |
238d6a3a6469
Improve composeMatchPart(final String in). Prevent parsing pattern when length is 0. Optimise patterns: % or %%.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
670
diff
changeset
|
4254 return "LIKE '%'"; |
238d6a3a6469
Improve composeMatchPart(final String in). Prevent parsing pattern when length is 0. Optimise patterns: % or %%.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
670
diff
changeset
|
4255 |
427
e79bfbd0553e
Added support for escaped wildcards (\% en \_) in String arguments of
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
425
diff
changeset
|
4256 // Scan input string for SQL wildcard characters: % and _ |
e79bfbd0553e
Added support for escaped wildcards (\% en \_) in String arguments of
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
425
diff
changeset
|
4257 // When they are all prefixed by a backslash then the backslash is removed (to allow usage of = comparator) |
e79bfbd0553e
Added support for escaped wildcards (\% en \_) in String arguments of
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
425
diff
changeset
|
4258 // else it needs to be interpreted as a wildcard and we need to use LIKE instead of = comparator. |
e79bfbd0553e
Added support for escaped wildcards (\% en \_) in String arguments of
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
425
diff
changeset
|
4259 // A backslash can be escaped by using two backslashes. |
e79bfbd0553e
Added support for escaped wildcards (\% en \_) in String arguments of
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
425
diff
changeset
|
4260 final StringBuilder sb = new StringBuilder(len); |
e79bfbd0553e
Added support for escaped wildcards (\% en \_) in String arguments of
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
425
diff
changeset
|
4261 boolean removed_bs = false; |
e79bfbd0553e
Added support for escaped wildcards (\% en \_) in String arguments of
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
425
diff
changeset
|
4262 boolean use_like = false; |
e79bfbd0553e
Added support for escaped wildcards (\% en \_) in String arguments of
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
425
diff
changeset
|
4263 boolean escaped = false; |
e79bfbd0553e
Added support for escaped wildcards (\% en \_) in String arguments of
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
425
diff
changeset
|
4264 try { |
e79bfbd0553e
Added support for escaped wildcards (\% en \_) in String arguments of
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
425
diff
changeset
|
4265 // parse all characters in input to find if the wildcards are escaped by a \. |
e79bfbd0553e
Added support for escaped wildcards (\% en \_) in String arguments of
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
425
diff
changeset
|
4266 // note: the escape character \ can also be escaped, so \\. |
e79bfbd0553e
Added support for escaped wildcards (\% en \_) in String arguments of
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
425
diff
changeset
|
4267 for (int i = 0; i < len; i++) { |
e79bfbd0553e
Added support for escaped wildcards (\% en \_) in String arguments of
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
425
diff
changeset
|
4268 char c = in.charAt(i); |
e79bfbd0553e
Added support for escaped wildcards (\% en \_) in String arguments of
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
425
diff
changeset
|
4269 switch(c) { |
e79bfbd0553e
Added support for escaped wildcards (\% en \_) in String arguments of
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
425
diff
changeset
|
4270 case '\\': |
e79bfbd0553e
Added support for escaped wildcards (\% en \_) in String arguments of
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
425
diff
changeset
|
4271 if (escaped) { |
e79bfbd0553e
Added support for escaped wildcards (\% en \_) in String arguments of
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
425
diff
changeset
|
4272 // copy the 2 backslash characters as in the original string |
440
a851e6d6a71a
Remove some non essential spaces
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
439
diff
changeset
|
4273 sb.append(c).append(c); |
a851e6d6a71a
Remove some non essential spaces
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
439
diff
changeset
|
4274 escaped = false; |
a851e6d6a71a
Remove some non essential spaces
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
439
diff
changeset
|
4275 } else { |
a851e6d6a71a
Remove some non essential spaces
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
439
diff
changeset
|
4276 escaped = true; |
a851e6d6a71a
Remove some non essential spaces
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
439
diff
changeset
|
4277 } |
a851e6d6a71a
Remove some non essential spaces
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
439
diff
changeset
|
4278 break; |
427
e79bfbd0553e
Added support for escaped wildcards (\% en \_) in String arguments of
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
425
diff
changeset
|
4279 case '%': |
e79bfbd0553e
Added support for escaped wildcards (\% en \_) in String arguments of
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
425
diff
changeset
|
4280 case '_': |
e79bfbd0553e
Added support for escaped wildcards (\% en \_) in String arguments of
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
425
diff
changeset
|
4281 if (escaped) { |
e79bfbd0553e
Added support for escaped wildcards (\% en \_) in String arguments of
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
425
diff
changeset
|
4282 removed_bs = true; |
440
a851e6d6a71a
Remove some non essential spaces
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
439
diff
changeset
|
4283 escaped = false; |
a851e6d6a71a
Remove some non essential spaces
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
439
diff
changeset
|
4284 } else { |
427
e79bfbd0553e
Added support for escaped wildcards (\% en \_) in String arguments of
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
425
diff
changeset
|
4285 use_like = true; |
e79bfbd0553e
Added support for escaped wildcards (\% en \_) in String arguments of
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
425
diff
changeset
|
4286 i = len; /* no need to scan further */ |
e79bfbd0553e
Added support for escaped wildcards (\% en \_) in String arguments of
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
425
diff
changeset
|
4287 } |
440
a851e6d6a71a
Remove some non essential spaces
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
439
diff
changeset
|
4288 sb.append(c); |
a851e6d6a71a
Remove some non essential spaces
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
439
diff
changeset
|
4289 break; |
427
e79bfbd0553e
Added support for escaped wildcards (\% en \_) in String arguments of
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
425
diff
changeset
|
4290 default: |
440
a851e6d6a71a
Remove some non essential spaces
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
439
diff
changeset
|
4291 if (escaped) { |
a851e6d6a71a
Remove some non essential spaces
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
439
diff
changeset
|
4292 sb.append('\\'); // also copy the preceding escape found before this character |
a851e6d6a71a
Remove some non essential spaces
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
439
diff
changeset
|
4293 escaped = false; |
a851e6d6a71a
Remove some non essential spaces
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
439
diff
changeset
|
4294 } |
a851e6d6a71a
Remove some non essential spaces
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
439
diff
changeset
|
4295 sb.append(c); |
a851e6d6a71a
Remove some non essential spaces
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
439
diff
changeset
|
4296 break; |
a851e6d6a71a
Remove some non essential spaces
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
439
diff
changeset
|
4297 } |
427
e79bfbd0553e
Added support for escaped wildcards (\% en \_) in String arguments of
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
425
diff
changeset
|
4298 } |
e79bfbd0553e
Added support for escaped wildcards (\% en \_) in String arguments of
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
425
diff
changeset
|
4299 } catch (IndexOutOfBoundsException iob) { |
e79bfbd0553e
Added support for escaped wildcards (\% en \_) in String arguments of
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
425
diff
changeset
|
4300 /* ignore */ |
e79bfbd0553e
Added support for escaped wildcards (\% en \_) in String arguments of
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
425
diff
changeset
|
4301 } |
e79bfbd0553e
Added support for escaped wildcards (\% en \_) in String arguments of
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
425
diff
changeset
|
4302 |
e79bfbd0553e
Added support for escaped wildcards (\% en \_) in String arguments of
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
425
diff
changeset
|
4303 if (use_like) { |
e79bfbd0553e
Added support for escaped wildcards (\% en \_) in String arguments of
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
425
diff
changeset
|
4304 // for debug: System.out.println("input: " + in + " changed into: " + "LIKE " + MonetWrapper.sq(in)); |
e79bfbd0553e
Added support for escaped wildcards (\% en \_) in String arguments of
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
425
diff
changeset
|
4305 // we found a non-escaped wildcard character, use like and the original input |
e79bfbd0553e
Added support for escaped wildcards (\% en \_) in String arguments of
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
425
diff
changeset
|
4306 return "LIKE " + MonetWrapper.sq(in); |
e79bfbd0553e
Added support for escaped wildcards (\% en \_) in String arguments of
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
425
diff
changeset
|
4307 } |
e79bfbd0553e
Added support for escaped wildcards (\% en \_) in String arguments of
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
425
diff
changeset
|
4308 if (removed_bs) { |
e79bfbd0553e
Added support for escaped wildcards (\% en \_) in String arguments of
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
425
diff
changeset
|
4309 // for debug: System.out.println("input: " + in + " changed into: " + "= " + MonetWrapper.sq(sb.toString())); |
e79bfbd0553e
Added support for escaped wildcards (\% en \_) in String arguments of
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
425
diff
changeset
|
4310 // we found only escaped wildcard character(s), |
680
238d6a3a6469
Improve composeMatchPart(final String in). Prevent parsing pattern when length is 0. Optimise patterns: % or %%.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
670
diff
changeset
|
4311 // use the edited string without the ecapes before the wildcard character(s) so an equals match can be done (which is faster than LIKE) |
427
e79bfbd0553e
Added support for escaped wildcards (\% en \_) in String arguments of
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
425
diff
changeset
|
4312 return "= " + MonetWrapper.sq(sb.toString()); |
e79bfbd0553e
Added support for escaped wildcards (\% en \_) in String arguments of
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
425
diff
changeset
|
4313 } |
e79bfbd0553e
Added support for escaped wildcards (\% en \_) in String arguments of
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
425
diff
changeset
|
4314 // for debug: System.out.println("input: " + in + " changed into: " + "= " + MonetWrapper.sq(in)); |
e79bfbd0553e
Added support for escaped wildcards (\% en \_) in String arguments of
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
425
diff
changeset
|
4315 return "= " + MonetWrapper.sq(in); |
303
a91168efdf27
Small code and doc improvements. Moved helper functions to the bottom.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
302
diff
changeset
|
4316 } |
a91168efdf27
Small code and doc improvements. Moved helper functions to the bottom.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
302
diff
changeset
|
4317 |
a91168efdf27
Small code and doc improvements. Moved helper functions to the bottom.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
302
diff
changeset
|
4318 //== end helper methods |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
4319 } |