Mercurial > hg > monetdb-java
annotate src/main/java/nl/cwi/monetdb/jdbc/MonetDatabaseMetaData.java @ 363:34ce6e1b1be8
Remove support for deprecated MD5 encryption algorithm in MapiSocket.
author | Martin van Dinther <martin.van.dinther@monetdbsolutions.com> |
---|---|
date | Thu, 10 Sep 2020 18:56:36 +0200 (2020-09-10) |
parents | eabbc5bf7cdb |
children | 63cccacad468 |
rev | line source |
---|---|
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1 /* |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2 * 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
|
3 * 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
|
4 * 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
|
5 * |
350
54137aeb1f92
Update Copyright year.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
338
diff
changeset
|
6 * Copyright 1997 - July 2008 CWI, August 2008 - 2020 MonetDB B.V. |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
7 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
8 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
9 package nl.cwi.monetdb.jdbc; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
10 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
11 import java.sql.Connection; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
12 import java.sql.DatabaseMetaData; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
13 import java.sql.Statement; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
14 import java.sql.SQLException; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
15 import java.sql.ResultSet; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
16 import java.sql.ResultSetMetaData; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
17 import java.sql.RowIdLifetime; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
18 import java.sql.Types; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
19 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
20 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
21 * A DatabaseMetaData object suitable for the MonetDB database. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
22 * |
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
|
23 * @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
|
24 * @author Martin van Dinther |
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
|
25 * @version 0.9 |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
26 */ |
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
|
27 public class MonetDatabaseMetaData |
003ae6d881db
Add "final" keyword to method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
294
diff
changeset
|
28 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
|
29 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
|
30 { |
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
|
31 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
|
32 |
e8962bdaa206
Moved utility methods and associated caches from DatabaseMetaData to Connection object.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
331
diff
changeset
|
33 public MonetDatabaseMetaData(final MonetConnection parent) { |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
34 con = parent; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
35 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
36 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
37 /** |
245
55375d489024
Corrected return values of DatabaseMetaData methods allTablesAreSelectable() and allProceduresAreCallable().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
231
diff
changeset
|
38 * 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
|
39 * returned by the method getProcedures. |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
40 * |
245
55375d489024
Corrected return values of DatabaseMetaData methods allTablesAreSelectable() and allProceduresAreCallable().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
231
diff
changeset
|
41 * @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
|
42 * 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
|
43 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
44 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
45 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
|
46 return false; |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
47 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
48 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
49 /** |
245
55375d489024
Corrected return values of DatabaseMetaData methods allTablesAreSelectable() and allProceduresAreCallable().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
231
diff
changeset
|
50 * 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
|
51 * 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
|
52 * |
245
55375d489024
Corrected return values of DatabaseMetaData methods allTablesAreSelectable() and allProceduresAreCallable().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
231
diff
changeset
|
53 * @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
|
54 * 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
|
55 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
56 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
57 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
|
58 return false; |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
59 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
60 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
61 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
62 * What is the URL for this database? |
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 * @return a reconstructed connection string |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
65 * @throws SQLException if a database access error occurs |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
66 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
67 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
68 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
|
69 return con.getJDBCURL(); |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
70 } |
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 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
73 * 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
|
74 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
75 * @return sql user |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
76 * @throws SQLException if a database access error occurs |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
77 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
78 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
79 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
|
80 return con.getUserName(); |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
81 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
82 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
83 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
84 * Is the database in read-only mode? |
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 * @return always false for now |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
87 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
88 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
89 public boolean isReadOnly() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
90 return false; |
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 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
93 /** |
15
6e48d0fae766
Corrected return values of DatabaseMetaData methods nullsAreSortedHigh(), nullsAreSortedLow(),
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
7
diff
changeset
|
94 * 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
|
95 * 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
|
96 * 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
|
97 * 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
|
98 * |
15
6e48d0fae766
Corrected return values of DatabaseMetaData methods nullsAreSortedHigh(), nullsAreSortedLow(),
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
7
diff
changeset
|
99 * @return false 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
|
100 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
101 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
102 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
|
103 return false; |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
104 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
105 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
106 /** |
15
6e48d0fae766
Corrected return values of DatabaseMetaData methods nullsAreSortedHigh(), nullsAreSortedLow(),
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
7
diff
changeset
|
107 * 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
|
108 * 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
|
109 * 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
|
110 * 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
|
111 * |
6e48d0fae766
Corrected return values of DatabaseMetaData methods nullsAreSortedHigh(), nullsAreSortedLow(),
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
7
diff
changeset
|
112 * @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
|
113 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
114 * @return negative of nullsAreSortedHigh() |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
115 * @see #nullsAreSortedHigh() |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
116 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
117 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
118 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
|
119 return true; |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
120 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
121 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
122 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
123 * 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
|
124 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
125 * @return false, since MonetDB doesn't do this |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
126 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
127 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
128 public boolean nullsAreSortedAtStart() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
129 return false; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
130 } |
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 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
133 * 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
|
134 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
135 * @return false, since MonetDB doesn't do this |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
136 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
137 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
138 public boolean nullsAreSortedAtEnd() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
139 return false; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
140 } |
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 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
143 * 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
|
144 * of course, so we return that explicitly. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
145 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
146 * @return the database product name |
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 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
149 public String getDatabaseProductName() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
150 return "MonetDB"; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
151 } |
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 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
154 * What is the version of this database product. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
155 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
156 * @return the mserver5 version number string |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
157 * @throws SQLException if a database access error occurs |
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 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
160 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
|
161 return con.getDatabaseProductVersion(); |
0
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 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
164 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
165 * What is the name of this JDBC driver? |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
166 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
167 * @return the JDBC driver name |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
168 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
169 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
170 public String getDriverName() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
171 return "MonetDB Native Driver"; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
172 } |
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 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
175 * 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
|
176 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
177 * @return the JDBC driver version string |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
178 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
179 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
180 public String getDriverVersion() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
181 return MonetDriver.getDriverVersion(); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
182 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
183 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
184 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
185 * 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
|
186 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
187 * @return the JDBC driver major version number |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
188 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
189 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
190 public int getDriverMajorVersion() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
191 return MonetDriver.getDriverMajorVersion(); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
192 } |
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 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
195 * 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
|
196 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
197 * @return the JDBC driver minor version number |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
198 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
199 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
200 public int getDriverMinorVersion() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
201 return MonetDriver.getDriverMinorVersion(); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
202 } |
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 /** |
15
6e48d0fae766
Corrected return values of DatabaseMetaData methods nullsAreSortedHigh(), nullsAreSortedLow(),
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
7
diff
changeset
|
205 * 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
|
206 * 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
|
207 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
208 * @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
|
209 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
210 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
211 public boolean usesLocalFiles() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
212 return false; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
213 } |
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 /** |
15
6e48d0fae766
Corrected return values of DatabaseMetaData methods nullsAreSortedHigh(), nullsAreSortedLow(),
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
7
diff
changeset
|
216 * 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
|
217 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
218 * @return false for it doesn't |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
219 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
220 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
221 public boolean usesLocalFilePerTable() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
222 return false; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
223 } |
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 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
226 * 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
|
227 * 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
|
228 * 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
|
229 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
230 * @return false |
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 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
233 public boolean supportsMixedCaseIdentifiers() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
234 return false; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
235 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
236 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
237 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
238 * 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
|
239 * case insensitive and store them in upper case? |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
240 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
241 * @return true if so |
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 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
244 public boolean storesUpperCaseIdentifiers() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
245 return false; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
246 } |
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 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
249 * 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
|
250 * case insensitive and store them in lower case? |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
251 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
252 * @return true if so |
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 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
255 public boolean storesLowerCaseIdentifiers() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
256 return true; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
257 } |
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 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
260 * 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
|
261 * case insensitive and store them in mixed case? |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
262 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
263 * @return true if so |
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 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
266 public boolean storesMixedCaseIdentifiers() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
267 return false; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
268 } |
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 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
271 * 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
|
272 * 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
|
273 * 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
|
274 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
275 * @return true if so |
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 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
278 public boolean supportsMixedCaseQuotedIdentifiers() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
279 return true; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
280 } |
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 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
283 * 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
|
284 * case insensitive and store them in upper case? |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
285 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
286 * @return true if so |
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 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
289 public boolean storesUpperCaseQuotedIdentifiers() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
290 return false; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
291 } |
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 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
294 * 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
|
295 * insensitive and store them in lower case? |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
296 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
297 * @return true if so |
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 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
300 public boolean storesLowerCaseQuotedIdentifiers() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
301 return false; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
302 } |
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 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
305 * 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
|
306 * insensitive and store them in mixed case? |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
307 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
308 * @return true if so |
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 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
311 public boolean storesMixedCaseQuotedIdentifiers() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
312 return false; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
313 } |
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 /** |
213
115f6351bf4b
Update some documentation text
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
200
diff
changeset
|
316 * 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
|
317 * 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
|
318 * 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
|
319 * will always use a double quote character. |
0
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 * @return the quoting string |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
322 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
323 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
324 public String getIdentifierQuoteString() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
325 return "\""; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
326 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
327 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
328 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
329 * Get a comma separated list of all a database's SQL keywords that |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
330 * are NOT also SQL:2003 keywords. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
331 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
332 * @return a comma separated list of MonetDB keywords |
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 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
335 public String getSQLKeywords() { |
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
|
336 final String keywords = getConcatenatedStringFromQuery("SELECT \"keyword\" FROM \"sys\".\"keywords\" ORDER BY 1"); |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
337 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
338 /* An old MonetDB server (pre Jul2015 release) will not have a table sys.keywords and return an empty String */ |
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
|
339 return (keywords.isEmpty()) ? |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
340 /* for old servers return static list (as returned in clients/odbc/driver/SQLGetInfo.c case SQL_KEYWORDS:) */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
341 "ADMIN,AFTER,AGGREGATE,ALWAYS,ASYMMETRIC,ATOMIC," + |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
342 "AUTO_INCREMENT,BEFORE,BIGINT,BIGSERIAL,BINARY,BLOB," + |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
343 "CALL,CHAIN,CLOB,COMMITTED,COPY,CORR,CUME_DIST," + |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
344 "CURRENT_ROLE,CYCLE,DATABASE,DELIMITERS,DENSE_RANK," + |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
345 "DO,EACH,ELSEIF,ENCRYPTED,EVERY,EXCLUDE,FOLLOWING," + |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
346 "FUNCTION,GENERATED,IF,ILIKE,INCREMENT,LAG,LEAD," + |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
347 "LIMIT,LOCALTIME,LOCALTIMESTAMP,LOCKED,MAXVALUE," + |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
348 "MEDIAN,MEDIUMINT,MERGE,MINVALUE,NEW,NOCYCLE," + |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
349 "NOMAXVALUE,NOMINVALUE,NOW,OFFSET,OLD,OTHERS,OVER," + |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
350 "PARTITION,PERCENT_RANK,PLAN,PRECEDING,PROD,QUANTILE," + |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
351 "RANGE,RANK,RECORDS,REFERENCING,REMOTE,RENAME," + |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
352 "REPEATABLE,REPLICA,RESTART,RETURN,RETURNS," + |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
353 "ROW_NUMBER,ROWS,SAMPLE,SAVEPOINT,SCHEMA,SEQUENCE," + |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
354 "SERIAL,SERIALIZABLE,SIMPLE,START,STATEMENT,STDIN," + |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
355 "STDOUT,STREAM,STRING,SYMMETRIC,TIES,TINYINT,TRIGGER," + |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
356 "UNBOUNDED,UNCOMMITTED,UNENCRYPTED,WHILE,XMLAGG," + |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
357 "XMLATTRIBUTES,XMLCOMMENT,XMLCONCAT,XMLDOCUMENT," + |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
358 "XMLELEMENT,XMLFOREST,XMLNAMESPACES,XMLPARSE,XMLPI," + |
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
|
359 "XMLQUERY,XMLSCHEMA,XMLTEXT,XMLVALIDATE" |
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
|
360 : keywords; |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
361 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
362 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
363 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
364 * Internal utility method getConcatenatedStringFromQuery(String query) |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
365 * args: query: SQL SELECT query. Only the output of the first column is concatenated. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
366 * @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
|
367 */ |
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
|
368 private String getConcatenatedStringFromQuery(final String query) { |
003ae6d881db
Add "final" keyword to method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
294
diff
changeset
|
369 final StringBuilder sb = new StringBuilder(1024); |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
370 Statement st = null; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
371 ResultSet rs = null; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
372 try { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
373 st = con.createStatement(); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
374 rs = st.executeQuery(query); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
375 // 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
|
376 boolean isfirst = true; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
377 while (rs.next()) { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
378 String value = rs.getString(1); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
379 if (value != null) { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
380 if (isfirst) { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
381 isfirst = false; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
382 } else { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
383 sb.append(','); |
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 sb.append(value); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
386 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
387 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
388 } catch (SQLException e) { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
389 /* ignore */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
390 } 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
|
391 MonetConnection.closeResultsetStatement(rs, st); |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
392 } |
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
|
393 // for debug: System.out.println("SQL (len " + query.length() + "): " + query + "\nResult string: " + sb.toString()); |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
394 return sb.toString(); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
395 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
396 |
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
|
397 // SQL query parts shared by four get<Type>Functions() below |
298
6db8f6702ce8
Improved MonetDatabaseMetaData methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
295
diff
changeset
|
398 private static final String FunctionsSelect = "SELECT DISTINCT CASE WHEN \"language\" > 0 THEN s.\"name\"||'.'||f.\"name\" ELSE f.\"name\" END FROM \"sys\".\"functions\" f JOIN \"sys\".\"schemas\" s ON f.\"schema_id\" = s.\"id\" WHERE "; |
6db8f6702ce8
Improved MonetDatabaseMetaData methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
295
diff
changeset
|
399 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
|
400 // 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
|
401 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
|
402 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
|
403 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
404 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
405 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
|
406 final String match = |
298
6db8f6702ce8
Improved MonetDatabaseMetaData methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
295
diff
changeset
|
407 "('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
|
408 " 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
|
409 // 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
|
410 " AND f.\"name\" NOT IN ('code','not_uniques','rotate_xor_hash','space'))" + |
298
6db8f6702ce8
Improved MonetDatabaseMetaData methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
295
diff
changeset
|
411 // include specific functions which have no 1st arg (pi()) or it is not numeric |
6db8f6702ce8
Improved MonetDatabaseMetaData methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
295
diff
changeset
|
412 " 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
|
413 return getConcatenatedStringFromQuery(FunctionsSelect + FunctionsWhere + match + OrFunctionsMaxMin + FunctionsOrderBy1); |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
414 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
415 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
416 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
417 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
|
418 final String match = |
298
6db8f6702ce8
Improved MonetDatabaseMetaData methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
295
diff
changeset
|
419 "('char','varchar','clob','json','url'))" + |
6db8f6702ce8
Improved MonetDatabaseMetaData methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
295
diff
changeset
|
420 " AND \"type\" = 1" + // only scalar functions |
6db8f6702ce8
Improved MonetDatabaseMetaData methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
295
diff
changeset
|
421 // 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
|
422 " AND \"mod\" <> 'sql')" + |
6db8f6702ce8
Improved MonetDatabaseMetaData methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
295
diff
changeset
|
423 // include specific functions code(int) and space(int) which belong to the 'str' module |
6db8f6702ce8
Improved MonetDatabaseMetaData methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
295
diff
changeset
|
424 " OR \"mod\" = 'str'" + |
363
34ce6e1b1be8
Remove support for deprecated MD5 encryption algorithm in MapiSocket.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
356
diff
changeset
|
425 // include 3 specific json functions, md5() and udf reverse() which all accept a string arg |
34ce6e1b1be8
Remove support for deprecated MD5 encryption algorithm in MapiSocket.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
356
diff
changeset
|
426 " OR f.\"name\" IN ('isarray','isobject','isvalid','md5','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
|
427 final String unionPart = |
298
6db8f6702ce8
Improved MonetDatabaseMetaData methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
295
diff
changeset
|
428 // 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
|
429 " 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
|
430 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
|
431 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
432 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
433 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
434 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
|
435 final String wherePart = |
298
6db8f6702ce8
Improved MonetDatabaseMetaData methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
295
diff
changeset
|
436 "f.\"name\" IN ('columnsize','debug','get_value_for','hash','hashsize','heapsize'" + |
6db8f6702ce8
Improved MonetDatabaseMetaData methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
295
diff
changeset
|
437 ",'ifthenelse','imprintsize','isaurl','isauuid','isnull','masterclock','mastertick'" + |
363
34ce6e1b1be8
Remove support for deprecated MD5 encryption algorithm in MapiSocket.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
356
diff
changeset
|
438 ",'newurl','next_value_for','password_hash','replicaclock','replicatick','uuid')" + |
298
6db8f6702ce8
Improved MonetDatabaseMetaData methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
295
diff
changeset
|
439 // add functions which are not listed in sys.functions but implemented in the SQL parser (see sql/server/sql_parser.y) |
6db8f6702ce8
Improved MonetDatabaseMetaData methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
295
diff
changeset
|
440 " UNION ALL SELECT * FROM (VALUES('cast'),('coalesce'),('convert'),('nullif')) as sf"; |
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
|
441 return getConcatenatedStringFromQuery(FunctionsSelect + wherePart + FunctionsOrderBy1); |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
442 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
443 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
444 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
445 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
|
446 final String wherePart = |
298
6db8f6702ce8
Improved MonetDatabaseMetaData methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
295
diff
changeset
|
447 "\"mod\" IN ('mtime','timestamp')" + |
6db8f6702ce8
Improved MonetDatabaseMetaData methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
295
diff
changeset
|
448 // 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
|
449 " 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
|
450 final String unionPart = |
263
8fbed4aeff0e
Improved MonetDatabaseMetaData methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
261
diff
changeset
|
451 // 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
|
452 " UNION SELECT 'extract'" + |
8fbed4aeff0e
Improved MonetDatabaseMetaData methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
261
diff
changeset
|
453 " UNION SELECT 'now'"; |
8fbed4aeff0e
Improved MonetDatabaseMetaData methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
261
diff
changeset
|
454 return getConcatenatedStringFromQuery(FunctionsSelect + wherePart + 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 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
458 * 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
|
459 * a search string pattern style catalog search parameters |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
460 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
461 * @return the string used to escape wildcard characters |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
462 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
463 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
464 public String getSearchStringEscape() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
465 return "\\"; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
466 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
467 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
468 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
469 * 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
|
470 * 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
|
471 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
472 * @return a string containing the extra characters |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
473 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
474 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
475 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
|
476 // 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
|
477 return ""; |
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 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
481 * Is "ALTER TABLE" with an add column supported? |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
482 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
483 * @return true if so |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
484 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
485 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
486 public boolean supportsAlterTableWithAddColumn() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
487 return true; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
488 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
489 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
490 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
491 * Is "ALTER TABLE" with a drop column supported? |
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 * @return true if so |
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 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
496 public boolean supportsAlterTableWithDropColumn() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
497 return true; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
498 } |
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 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
501 * Is column aliasing supported? |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
502 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
503 * <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
|
504 * 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
|
505 * 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
|
506 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
507 * <p>e.g. |
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 * <br><pre> |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
510 * 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
|
511 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
512 * </pre><br> |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
513 * 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
|
514 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
515 * @return true if so |
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 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
518 public boolean supportsColumnAliasing() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
519 return true; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
520 } |
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 /** |
213
115f6351bf4b
Update some documentation text
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
200
diff
changeset
|
523 * 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
|
524 * 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
|
525 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
526 * @return true if so |
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 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
529 public boolean nullPlusNonNullIsNull() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
530 return true; |
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 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
533 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
534 * 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
|
535 * 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
|
536 * 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
|
537 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
538 * @return true if so; false otherwise |
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 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
541 public boolean supportsConvert() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
542 return true; |
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 |
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 * 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
|
547 * 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
|
548 * 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
|
549 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
550 * @return true if so; false otherwise |
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 @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
|
553 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
|
554 switch (fromType) { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
555 case Types.BOOLEAN: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
556 switch (toType) { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
557 case Types.BOOLEAN: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
558 /* 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
|
559 case Types.TINYINT: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
560 case Types.SMALLINT: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
561 case Types.INTEGER: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
562 case Types.BIGINT: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
563 /* 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
|
564 case Types.CHAR: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
565 case Types.VARCHAR: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
566 /* 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
|
567 case Types.CLOB: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
568 return true; |
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 // conversion to all other types is not supported |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
571 return false; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
572 /* 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
|
573 /* 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
|
574 /* 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
|
575 /* 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
|
576 case Types.BLOB: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
577 switch (toType) { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
578 /* 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
|
579 /* 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
|
580 /* 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
|
581 case Types.BLOB: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
582 case Types.VARCHAR: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
583 /* 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
|
584 case Types.CLOB: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
585 return true; |
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 // conversion to all other types is not supported |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
588 return false; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
589 case Types.TINYINT: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
590 case Types.SMALLINT: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
591 case Types.INTEGER: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
592 case Types.BIGINT: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
593 case Types.FLOAT: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
594 case Types.REAL: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
595 case Types.DOUBLE: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
596 case Types.NUMERIC: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
597 case Types.DECIMAL: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
598 switch (toType) { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
599 case Types.BOOLEAN: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
600 /* 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
|
601 case Types.TINYINT: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
602 case Types.SMALLINT: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
603 case Types.INTEGER: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
604 case Types.BIGINT: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
605 case Types.FLOAT: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
606 case Types.REAL: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
607 case Types.DOUBLE: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
608 case Types.NUMERIC: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
609 case Types.DECIMAL: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
610 case Types.CHAR: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
611 case Types.VARCHAR: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
612 /* 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
|
613 case Types.CLOB: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
614 return true; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
615 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
616 // conversion to all other types is not supported |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
617 return false; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
618 case Types.CHAR: |
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 switch (toType) { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
623 case Types.BOOLEAN: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
624 /* 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
|
625 case Types.TINYINT: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
626 case Types.SMALLINT: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
627 case Types.INTEGER: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
628 case Types.BIGINT: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
629 case Types.FLOAT: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
630 case Types.REAL: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
631 case Types.DOUBLE: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
632 case Types.NUMERIC: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
633 case Types.DECIMAL: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
634 case Types.CHAR: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
635 case Types.VARCHAR: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
636 /* 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
|
637 case Types.CLOB: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
638 case Types.BLOB: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
639 case Types.DATE: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
640 case Types.TIME: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
641 case Types.TIMESTAMP: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
642 return true; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
643 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
644 // conversion to all other types is not supported |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
645 return false; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
646 case Types.DATE: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
647 switch (toType) { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
648 case Types.CHAR: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
649 case Types.VARCHAR: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
650 /* 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
|
651 case Types.CLOB: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
652 case Types.DATE: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
653 case Types.TIMESTAMP: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
654 return true; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
655 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
656 // conversion to all other types is not supported |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
657 return false; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
658 case Types.TIME: |
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.CHAR: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
661 case Types.VARCHAR: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
662 /* 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
|
663 case Types.CLOB: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
664 case Types.TIME: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
665 return true; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
666 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
667 // conversion to all other types is not supported |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
668 return false; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
669 case Types.TIMESTAMP: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
670 switch (toType) { |
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.DATE: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
676 case Types.TIME: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
677 case Types.TIMESTAMP: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
678 return true; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
679 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
680 // conversion to all other types is not supported |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
681 return false; |
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 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
684 // 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
|
685 return false; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
686 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
687 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
688 /** |
213
115f6351bf4b
Update some documentation text
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
200
diff
changeset
|
689 * Are table correlation names supported? |
231
68b9452f1215
Fix warnings:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
222
diff
changeset
|
690 * 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
|
691 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
692 * @return true if so |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
693 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
694 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
695 public boolean supportsTableCorrelationNames() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
696 return true; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
697 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
698 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
699 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
700 * 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
|
701 * be different from the names of the tables? |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
702 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
703 * @return true if so; false otherwise |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
704 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
705 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
706 public boolean supportsDifferentTableCorrelationNames() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
707 return false; |
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 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
710 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
711 * Are expressions in "ORDER BY" lists supported? |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
712 * 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
|
713 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
714 * MonetDB supports this, try: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
715 * 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
|
716 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
717 * @return true if so |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
718 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
719 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
720 public boolean supportsExpressionsInOrderBy() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
721 return true; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
722 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
723 |
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 * 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
|
726 * MonetDB differs from SQL03 => true |
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 * @return true if so |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
729 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
730 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
731 public boolean supportsOrderByUnrelated() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
732 return true; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
733 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
734 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
735 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
736 * Is some form of "GROUP BY" clause supported? |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
737 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
738 * @return true since MonetDB supports it |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
739 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
740 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
741 public boolean supportsGroupBy() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
742 return true; |
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 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
746 * 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
|
747 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
748 * @return true since that also is supported |
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 supportsGroupByUnrelated() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
752 return true; |
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 * 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
|
757 * it specifies all the columns in the SELECT? |
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 already supports the more difficult supportsGroupByUnrelated(), |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
760 * so this is a piece of cake) |
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 supportsGroupByBeyondSelect() { |
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 /** |
213
115f6351bf4b
Update some documentation text
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
200
diff
changeset
|
770 * Is the escape character in "LIKE" clauses supported? |
231
68b9452f1215
Fix warnings:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
222
diff
changeset
|
771 * 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
|
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 supportsLikeEscapeClause() { |
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 * Are multiple ResultSets from a single execute 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 if so |
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 supportsMultipleResultSets() { |
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 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
|
792 * connections?) |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
793 * 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
|
794 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
795 * @return true if so |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
796 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
797 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
798 public boolean supportsMultipleTransactions() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
799 return true; |
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 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
802 /** |
213
115f6351bf4b
Update some documentation text
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
200
diff
changeset
|
803 * Can columns be defined as non-nullable. |
231
68b9452f1215
Fix warnings:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
222
diff
changeset
|
804 * 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
|
805 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
806 * @return true if so |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
807 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
808 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
809 public boolean supportsNonNullableColumns() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
810 return true; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
811 } |
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 * 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
|
815 * grammar is defined at: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
816 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
817 * 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
|
818 * 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
|
819 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
820 * @return true if so |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
821 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
822 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
823 public boolean supportsMinimumSQLGrammar() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
824 return true; |
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 |
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 * 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
|
829 * SQL-92 conformance for this. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
830 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
831 * @return true if so |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
832 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
833 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
834 public boolean supportsCoreSQLGrammar() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
835 return true; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
836 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
837 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
838 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
839 * 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
|
840 * 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
|
841 * conform to the Extended SQL Grammar. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
842 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
843 * @return true if so |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
844 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
845 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
846 public boolean supportsExtendedSQLGrammar() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
847 return false; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
848 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
849 |
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 * 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
|
852 * 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
|
853 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
854 * @return true if so |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
855 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
856 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
857 public boolean supportsANSI92EntryLevelSQL() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
858 return true; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
859 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
860 |
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 * 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
|
863 * grammar? |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
864 * probably not |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
865 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
866 * @return true if so |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
867 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
868 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
869 public boolean supportsANSI92IntermediateSQL() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
870 return false; |
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 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
874 * 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
|
875 * Would be good if it was like that |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
876 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
877 * @return true if so |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
878 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
879 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
880 public boolean supportsANSI92FullSQL() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
881 return false; |
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 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
885 * 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
|
886 * |
43ea6c50483e
Correct return value for supportsIntegrityEnhancementFacility()
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
265
diff
changeset
|
887 * 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
|
888 * 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
|
889 * 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
|
890 * 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
|
891 * 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
|
892 * 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
|
893 * |
43ea6c50483e
Correct return value for supportsIntegrityEnhancementFacility()
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
265
diff
changeset
|
894 * 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
|
895 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
896 * @return true if so |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
897 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
898 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
899 public boolean supportsIntegrityEnhancementFacility() { |
267
43ea6c50483e
Correct return value for supportsIntegrityEnhancementFacility()
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
265
diff
changeset
|
900 return false; |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
901 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
902 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
903 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
904 * Is some form of outer join supported? |
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 * @return true if so |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
907 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
908 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
909 public boolean supportsOuterJoins(){ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
910 return true; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
911 } |
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 /** |
15
6e48d0fae766
Corrected return values of DatabaseMetaData methods nullsAreSortedHigh(), nullsAreSortedLow(),
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
7
diff
changeset
|
914 * Are full nested outer joins supported? |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
915 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
916 * @return true if so |
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 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
919 public boolean supportsFullOuterJoins() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
920 return true; |
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 |
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 * Is there limited support for outer joins? |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
925 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
926 * @return true if so |
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 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
929 public boolean supportsLimitedOuterJoins() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
930 return false; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
931 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
932 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
933 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
934 * 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
|
935 * MonetDB uses the term "schema". |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
936 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
937 * @return the vendor term |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
938 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
939 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
940 public String getSchemaTerm() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
941 return "schema"; |
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 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
944 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
945 * 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
|
946 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
947 * @return the vendor term |
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 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
950 public String getProcedureTerm() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
951 return "procedure"; |
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 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
954 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
955 * 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
|
956 * |
eabbc5bf7cdb
Corrected the return value of getCatalogTerm();
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
352
diff
changeset
|
957 * 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
|
958 * Only SQL schemas are supported. |
eabbc5bf7cdb
Corrected the return value of getCatalogTerm();
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
352
diff
changeset
|
959 * 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
|
960 * 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
|
961 * 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
|
962 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
963 * @return the vendor term |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
964 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
965 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
966 public String getCatalogTerm() { |
356
eabbc5bf7cdb
Corrected the return value of getCatalogTerm();
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
352
diff
changeset
|
967 // 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
|
968 // 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
|
969 // 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
|
970 return "cat"; |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
971 } |
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 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
974 * 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
|
975 * (Otherwise it appears at the end). |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
976 * 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
|
977 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
978 * @return true if so |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
979 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
980 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
981 public boolean isCatalogAtStart() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
982 // 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
|
983 // 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
|
984 return true; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
985 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
986 |
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 * What is the Catalog separator. |
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 * @return the catalog separator string |
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 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
993 public String getCatalogSeparator() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
994 // 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
|
995 return null; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
996 } |
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 * 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
|
1000 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1001 * @return true if so |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1002 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1003 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1004 public boolean supportsSchemasInDataManipulation() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1005 return true; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1006 } |
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 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1009 * 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
|
1010 * 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
|
1011 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1012 * @return true if so |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1013 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1014 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1015 public boolean supportsSchemasInProcedureCalls() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1016 return true; |
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 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1020 * 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
|
1021 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1022 * @return true if so |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1023 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1024 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1025 public boolean supportsSchemasInTableDefinitions() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1026 return true; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1027 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1028 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1029 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1030 * 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
|
1031 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1032 * @return true if so |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1033 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1034 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1035 public boolean supportsSchemasInIndexDefinitions() { |
294
894abb249de1
Corrected 3 MonetDatabaseMetaData methods
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
286
diff
changeset
|
1036 // 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
|
1037 // 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
|
1038 return false; |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1039 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1040 |
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 * 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
|
1043 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1044 * @return true if so |
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 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1047 public boolean supportsSchemasInPrivilegeDefinitions() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1048 return true; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1049 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1050 |
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 * 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
|
1053 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1054 * @return true if so |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1055 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1056 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1057 public boolean supportsCatalogsInDataManipulation() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1058 return false; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1059 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1060 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1061 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1062 * 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
|
1063 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1064 * @return true if so |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1065 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1066 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1067 public boolean supportsCatalogsInProcedureCalls() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1068 return false; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1069 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1070 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1071 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1072 * 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
|
1073 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1074 * @return true if so |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1075 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1076 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1077 public boolean supportsCatalogsInTableDefinitions() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1078 return false; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1079 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1080 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1081 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1082 * 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
|
1083 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1084 * @return true if so |
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 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1087 public boolean supportsCatalogsInIndexDefinitions() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1088 return false; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1089 } |
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 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1092 * 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
|
1093 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1094 * @return true if so |
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 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1097 public boolean supportsCatalogsInPrivilegeDefinitions() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1098 return false; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1099 } |
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 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1102 * MonetDB doesn't support positioned DELETEs I guess |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1103 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1104 * @return true if so |
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 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1107 public boolean supportsPositionedDelete() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1108 return false; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1109 } |
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 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1112 * Is positioned UPDATE supported? (same as above) |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1113 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1114 * @return true if so |
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 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1117 public boolean supportsPositionedUpdate() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1118 return false; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1119 } |
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 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1122 * Is SELECT FOR UPDATE supported? |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1123 * My test resulted in a negative answer |
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 * @return true if so; false otherwise |
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 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1128 public boolean supportsSelectForUpdate(){ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1129 return false; |
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 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1132 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1133 * 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
|
1134 * syntax supported? |
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 * @return true if so; false otherwise |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1137 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1138 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1139 public boolean supportsStoredProcedures() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1140 return true; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1141 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1142 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1143 /** |
213
115f6351bf4b
Update some documentation text
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
200
diff
changeset
|
1144 * Are subqueries in comparison expressions supported? |
231
68b9452f1215
Fix warnings:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
222
diff
changeset
|
1145 * 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
|
1146 * MonetDB also supports this |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1147 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1148 * @return true if so; false otherwise |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1149 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1150 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1151 public boolean supportsSubqueriesInComparisons() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1152 return true; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1153 } |
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 /** |
213
115f6351bf4b
Update some documentation text
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
200
diff
changeset
|
1156 * Are subqueries in 'exists' expressions supported? |
231
68b9452f1215
Fix warnings:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
222
diff
changeset
|
1157 * 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
|
1158 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1159 * @return true if so; false otherwise |
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 supportsSubqueriesInExists() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1163 return true; |
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 /** |
213
115f6351bf4b
Update some documentation text
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
200
diff
changeset
|
1167 * Are subqueries in 'in' statements supported? |
231
68b9452f1215
Fix warnings:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
222
diff
changeset
|
1168 * 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
|
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 supportsSubqueriesInIns() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1174 return true; |
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 /** |
213
115f6351bf4b
Update some documentation text
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
200
diff
changeset
|
1178 * Are subqueries in quantified expressions supported? |
231
68b9452f1215
Fix warnings:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
222
diff
changeset
|
1179 * 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
|
1180 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1181 * (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
|
1182 * subquerying.) |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1183 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1184 * @return true if so; false otherwise |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1185 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1186 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1187 public boolean supportsSubqueriesInQuantifieds() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1188 return true; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1189 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1190 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1191 /** |
213
115f6351bf4b
Update some documentation text
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
200
diff
changeset
|
1192 * Are correlated subqueries supported? |
231
68b9452f1215
Fix warnings:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
222
diff
changeset
|
1193 * 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
|
1194 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1195 * (a.k.a. subselect in from?) |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1196 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1197 * @return true if so; false otherwise |
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 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1200 public boolean supportsCorrelatedSubqueries() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1201 return true; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1202 } |
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 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1205 * Is SQL UNION supported? |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1206 * since 2004-03-20 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1207 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1208 * @return true if so |
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 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1211 public boolean supportsUnion() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1212 return true; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1213 } |
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 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1216 * Is SQL UNION ALL supported? |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1217 * since 2004-03-20 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1218 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1219 * @return true if so |
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 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1222 public boolean supportsUnionAll() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1223 return true; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1224 } |
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 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1227 * 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
|
1228 * implicit commit. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1229 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1230 * @return true if so |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1231 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1232 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1233 public boolean supportsOpenCursorsAcrossCommit() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1234 return true; |
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 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1237 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1238 * Same as above |
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 * @return true if so |
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 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1243 public boolean supportsOpenCursorsAcrossRollback() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1244 return true; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1245 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1246 |
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 * 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
|
1249 * this driver cannot guarentee that. In further reflection. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1250 * 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
|
1251 * 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
|
1252 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1253 * @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
|
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 supportsOpenStatementsAcrossCommit() { |
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 * 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
|
1262 * this driver cannot guarentee that. In further contemplation, |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1263 * 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
|
1264 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1265 * @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
|
1266 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1267 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1268 public boolean supportsOpenStatementsAcrossRollback() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1269 return true; |
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 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1273 * 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
|
1274 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1275 * @return the max literal length |
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 int getMaxBinaryLiteralLength() { |
15
6e48d0fae766
Corrected return values of DatabaseMetaData methods nullsAreSortedHigh(), nullsAreSortedLow(),
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
7
diff
changeset
|
1279 return 2*1024*1024*1024 - 2; // 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
|
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 * 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
|
1284 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1285 * @return the max literal length |
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 int getMaxCharLiteralLength() { |
15
6e48d0fae766
Corrected return values of DatabaseMetaData methods nullsAreSortedHigh(), nullsAreSortedLow(),
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
7
diff
changeset
|
1289 return 2*1024*1024*1024 - 2; // 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
|
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 * Whats the limit on column name length. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1294 * 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
|
1295 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1296 * @return the maximum column name length |
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 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1299 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
|
1300 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
|
1301 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1302 |
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 * 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
|
1305 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1306 * @return the max number of columns |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1307 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1308 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1309 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
|
1310 return 0; // no specific limit known |
0
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 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1313 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1314 * 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
|
1315 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1316 * @return max number of columns |
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 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1319 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
|
1320 return 0; // no specific limit known |
0
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 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1323 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1324 * 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
|
1325 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1326 * @return the max columns |
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 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1329 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
|
1330 return 0; // no specific limit known |
0
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 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1333 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1334 * 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
|
1335 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1336 * @return the max columns |
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 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1339 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
|
1340 return 0; // no specific limit known |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1341 } |
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 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1344 * 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
|
1345 * |
6e48d0fae766
Corrected return values of DatabaseMetaData methods nullsAreSortedHigh(), nullsAreSortedLow(),
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
7
diff
changeset
|
1346 * 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
|
1347 * 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
|
1348 * 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
|
1349 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1350 * @return the max columns |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1351 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1352 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1353 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
|
1354 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
|
1355 } |
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 /** |
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
|
1358 * 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
|
1359 * |
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
|
1360 * @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
|
1361 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1362 @Override |
7
b3ca1157be73
Improve DatabaseMetaData.getDatabaseProductVersion() to never return a null String.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
0
diff
changeset
|
1363 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
|
1364 return con.getMaxConnections(); |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1365 } |
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 * What is the maximum cursor name length |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1369 * 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
|
1370 * a precaution for maybe the future. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1371 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1372 * @return max cursor name length in bytes |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1373 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1374 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1375 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
|
1376 return 0; // no specific limit known |
0
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 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1380 * 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
|
1381 * of the parts of the index. |
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 * @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
|
1384 * 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
|
1385 * 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
|
1386 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1387 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1388 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
|
1389 return 0; // no specific limit known |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1390 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1391 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1392 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1393 * 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
|
1394 * allows in a schema name. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1395 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1396 * @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
|
1397 * limit is unknown. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1398 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1399 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1400 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
|
1401 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
|
1402 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1403 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1404 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1405 * 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
|
1406 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1407 * @return the max name length in bytes |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1408 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1409 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1410 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
|
1411 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
|
1412 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1413 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1414 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1415 * What is the maximum length of a catalog |
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 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
|
1418 * 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
|
1419 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1420 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1421 public int getMaxCatalogNameLength() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1422 return 0; // MonetDB does not support catalog names |
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 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1426 * 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
|
1427 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1428 * @return max row size in bytes |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1429 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1430 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1431 public int getMaxRowSize() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1432 return 0; // very long I hope... |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1433 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1434 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1435 /** |
15
6e48d0fae766
Corrected return values of DatabaseMetaData methods nullsAreSortedHigh(), nullsAreSortedLow(),
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
7
diff
changeset
|
1436 * 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
|
1437 * blobs? |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1438 * Yes I thought so... |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1439 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1440 * @return true if so |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1441 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1442 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1443 public boolean doesMaxRowSizeIncludeBlobs() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1444 return true; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1445 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1446 |
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 * 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
|
1449 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1450 * @return max length in bytes |
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 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1453 public int getMaxStatementLength() { |
15
6e48d0fae766
Corrected return values of DatabaseMetaData methods nullsAreSortedHigh(), nullsAreSortedLow(),
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
7
diff
changeset
|
1454 return 2*1024*1024*1024 - 2; // 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
|
1455 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1456 |
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 * 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
|
1459 * this database? Basically, since each Statement downloads |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1460 * 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
|
1461 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1462 * @return the maximum |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1463 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1464 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1465 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
|
1466 return 0; // no specific limit known |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1467 } |
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 * 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
|
1471 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1472 * @return max name length in bytes |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1473 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1474 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1475 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
|
1476 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
|
1477 } |
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 * 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
|
1481 * in a SELECT? |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1482 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1483 * @return the maximum |
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 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1486 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
|
1487 return 0; // no specific limit known |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1488 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1489 |
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 * 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
|
1492 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1493 * @return the max name length in bytes |
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 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1496 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
|
1497 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
|
1498 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1499 |
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 * 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
|
1502 * 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
|
1503 * reads can occur. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1504 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1505 * @return the default isolation level |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1506 * @see Connection |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1507 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1508 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1509 public int getDefaultTransactionIsolation() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1510 return Connection.TRANSACTION_SERIALIZABLE; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1511 } |
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 * 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
|
1515 * 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
|
1516 * transactions. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1517 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1518 * @return true if transactions are supported |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1519 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1520 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1521 public boolean supportsTransactions() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1522 return true; |
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 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1526 * 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
|
1527 * 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
|
1528 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1529 * @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
|
1530 * @return true if so |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1531 * @see Connection |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1532 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1533 @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
|
1534 public boolean supportsTransactionIsolationLevel(final int level) { |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1535 return level == Connection.TRANSACTION_SERIALIZABLE; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1536 } |
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 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1539 * Are both data definition and data manipulation transactions |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1540 * supported? |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1541 * 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
|
1542 * yes it is. |
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 * @return true if so |
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 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1547 public boolean supportsDataDefinitionAndDataManipulationTransactions() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1548 return true; |
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 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1551 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1552 * Are only data manipulation statements within a transaction |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1553 * supported? |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1554 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1555 * @return true if so |
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 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1558 public boolean supportsDataManipulationTransactionsOnly() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1559 return false; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1560 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1561 |
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 * 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
|
1564 * 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
|
1565 * |
194
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
1566 * <pre> |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1567 * CREATE TABLE T (A INT); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1568 * INSERT INTO T (A) VALUES (2); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1569 * BEGIN; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1570 * UPDATE T SET A = A + 1; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1571 * CREATE TABLE X (A INT); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1572 * SELECT A FROM T INTO X; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1573 * COMMIT; |
194
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
1574 * </pre> |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1575 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1576 * 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
|
1577 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1578 * @return true if so |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1579 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1580 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1581 public boolean dataDefinitionCausesTransactionCommit() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1582 return false; |
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 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1585 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1586 * 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
|
1587 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1588 * @return true if so |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1589 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1590 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1591 public boolean dataDefinitionIgnoredInTransactions() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1592 return false; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1593 } |
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 * 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
|
1597 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1598 * <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
|
1599 * 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
|
1600 * PROCEDURE_NAME and SPECIFIC_NAME. |
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 * <p>Each procedure description has the following columns: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1603 * <ol> |
194
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
1604 * <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
|
1605 * <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
|
1606 * <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
|
1607 * <li><b>Field4</b> reserved (make it null) |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1608 * <li><b>Field5</b> reserved (make it null) |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1609 * <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
|
1610 * <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
|
1611 * <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
|
1612 * <ul> |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1613 * <li> procedureResultUnknown - May return a result |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1614 * <li> procedureNoResult - Does not return a result |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1615 * <li> procedureReturnsResult - Returns a result |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1616 * </ul> |
194
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
1617 * <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
|
1618 * </ol> |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1619 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1620 * @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
|
1621 * "" retrieves those without a catalog; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1622 * 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
|
1623 * @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
|
1624 * "" retrieves those without a schema; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1625 * 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
|
1626 * @param procedureNamePattern - a procedure name pattern; must match the procedure name as it is stored in the database |
245
55375d489024
Corrected return values of DatabaseMetaData methods allTablesAreSelectable() and allProceduresAreCallable().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
231
diff
changeset
|
1627 * 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
|
1628 * @return ResultSet - each row is a procedure description |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1629 * @throws SQLException if a database access error occurs |
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 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1632 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
|
1633 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
|
1634 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
|
1635 final String procedureNamePattern |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1636 ) throws SQLException |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1637 { |
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
|
1638 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
|
1639 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
|
1640 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
|
1641 "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
|
1642 "f.\"name\" AS \"PROCEDURE_NAME\", " + |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1643 "cast(null as char(1)) AS \"Field4\", " + |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1644 "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
|
1645 "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
|
1646 .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
|
1647 // in MonetDB procedures have no return value by design. |
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
|
1648 "cast(").append(DatabaseMetaData.procedureNoResult).append(" AS smallint) AS \"PROCEDURE_TYPE\", " + |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1649 // 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
|
1650 "cast(f.\"id\" as varchar(10)) AS \"SPECIFIC_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
|
1651 "FROM \"sys\".\"functions\" f 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
|
1652 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
|
1653 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
|
1654 } |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1655 // 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
|
1656 query.append("WHERE f.\"type\" = 2"); |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1657 |
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
|
1658 if (catalog != null && !catalog.isEmpty()) { |
299
1f0324072b0c
Correcting typo in comment
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
298
diff
changeset
|
1659 // non-empty catalog selection. |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1660 // 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
|
1661 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
|
1662 } 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
|
1663 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
|
1664 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
|
1665 } |
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
|
1666 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
|
1667 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
|
1668 } |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1669 } |
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
|
1670 |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1671 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
|
1672 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1673 return executeMetaDataQuery(query.toString()); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1674 } |
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 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1677 * 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
|
1678 * and result columns. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1679 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1680 * <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
|
1681 * 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
|
1682 * 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
|
1683 * 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
|
1684 * column descriptions follow in column number order. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1685 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1686 * <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
|
1687 * description with the following fields: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1688 * <ol> |
194
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
1689 * <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
|
1690 * <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
|
1691 * <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
|
1692 * <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
|
1693 * <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
|
1694 * <ul><li>procedureColumnUnknown - nobody knows |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1695 * <li>procedureColumnIn - IN parameter |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1696 * <li>procedureColumnInOut - INOUT parameter |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1697 * <li>procedureColumnOut - OUT parameter |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1698 * <li>procedureColumnReturn - procedure return value |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1699 * <li>procedureColumnResult - result column in ResultSet |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1700 * </ul> |
194
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
1701 * <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
|
1702 * <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
|
1703 * <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
|
1704 * <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
|
1705 * <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
|
1706 * <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
|
1707 * <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
|
1708 * <ul><li>procedureNoNulls - does not allow NULL values |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1709 * <li>procedureNullable - allows NULL values |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1710 * <li>procedureNullableUnknown - nullability unknown |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1711 * </ul> |
194
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
1712 * <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
|
1713 * <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
|
1714 * 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
|
1715 * 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
|
1716 * 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
|
1717 * <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
|
1718 * <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
|
1719 * <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
|
1720 * <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
|
1721 * 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
|
1722 * 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
|
1723 * <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
|
1724 * <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
|
1725 * <li>NO --- if the parameter cannot include NULLs |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1726 * <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
|
1727 * </ul> |
194
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
1728 * <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
|
1729 * </ol> |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1730 * @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
|
1731 * "" retrieves those without a catalog; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1732 * 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
|
1733 * @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
|
1734 * "" retrieves those without a schema; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1735 * 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
|
1736 * @param procedureNamePattern - a procedure name pattern; must match the procedure name as it is stored in the database |
245
55375d489024
Corrected return values of DatabaseMetaData methods allTablesAreSelectable() and allProceduresAreCallable().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
231
diff
changeset
|
1737 * 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
|
1738 * @param columnNamePattern - a column name pattern; must match the column name as it is stored in the database |
245
55375d489024
Corrected return values of DatabaseMetaData methods allTablesAreSelectable() and allProceduresAreCallable().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
231
diff
changeset
|
1739 * 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
|
1740 * @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
|
1741 * @throws SQLException if a database-access error occurs |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1742 * @see #getSearchStringEscape |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1743 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1744 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1745 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
|
1746 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
|
1747 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
|
1748 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
|
1749 final String columnNamePattern |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1750 ) 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
|
1751 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
|
1752 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
|
1753 "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
|
1754 "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
|
1755 "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
|
1756 "cast(CASE a.\"inout\"" + |
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
|
1757 " WHEN 0 THEN (CASE a.\"number\" WHEN 0 THEN ").append(DatabaseMetaData.procedureColumnReturn).append(" ELSE ").append(DatabaseMetaData.procedureColumnOut).append(" END)" + |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1758 " WHEN 1 THEN ").append(DatabaseMetaData.procedureColumnIn) |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1759 .append(" ELSE ").append(DatabaseMetaData.procedureColumnUnknown).append(" 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
|
1760 "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
|
1761 "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
|
1762 "CASE a.\"type\" WHEN 'tinyint' THEN 3 WHEN 'smallint' THEN 5 WHEN 'int' THEN 10 WHEN 'bigint' THEN 19 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
|
1763 "CASE a.\"type\" WHEN 'tinyint' THEN 1 WHEN 'smallint' THEN 2 WHEN 'int' THEN 4 WHEN 'bigint' THEN 8 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
|
1764 "cast(CASE WHEN a.\"type\" IN ('tinyint','smallint','int','bigint','hugeint','oid','wrd','decimal','numeric','time','timetz','timestamp','timestamptz','sec_interval') THEN a.\"type_scale\" ELSE NULL END AS smallint) AS \"SCALE\", " + |
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
|
1765 "cast(CASE WHEN a.\"type\" IN ('tinyint','smallint','int','bigint','hugeint','oid','wrd','decimal','numeric') THEN 10 WHEN a.\"type\" IN ('real','float','double') THEN 2 ELSE NULL END AS smallint) AS \"RADIX\", " + |
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
|
1766 "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
|
1767 "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
|
1768 "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
|
1769 "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
|
1770 "cast(0 as int) AS \"SQL_DATETIME_SUB\", " + |
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
|
1771 "cast(CASE WHEN a.\"type\" IN ('char','varchar','clob') THEN a.\"type_digits\" ELSE NULL END as int) AS \"CHAR_OCTET_LENGTH\", " + |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1772 // 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
|
1773 "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
|
1774 "cast('' as varchar(3)) AS \"IS_NULLABLE\", " + |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1775 // 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
|
1776 "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
|
1777 "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
|
1778 "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
|
1779 "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
|
1780 // 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
|
1781 "WHERE f.\"type\" = 2"); |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1782 |
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
|
1783 if (catalog != null && !catalog.isEmpty()) { |
299
1f0324072b0c
Correcting typo in comment
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
298
diff
changeset
|
1784 // non-empty catalog selection. |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1785 // 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
|
1786 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
|
1787 } 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
|
1788 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
|
1789 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
|
1790 } |
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
|
1791 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
|
1792 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
|
1793 } |
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
|
1794 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
|
1795 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
|
1796 } |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1797 } |
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
|
1798 |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1799 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
|
1800 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1801 return executeMetaDataQuery(query.toString()); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1802 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1803 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1804 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1805 * 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
|
1806 * 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
|
1807 * 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
|
1808 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1809 * <p>Each table description has the following columns: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1810 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1811 * <ol> |
194
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
1812 * <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
|
1813 * <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
|
1814 * <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
|
1815 * <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
|
1816 * "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
|
1817 * <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
|
1818 * <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
|
1819 * <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
|
1820 * <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
|
1821 * <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
|
1822 * <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
|
1823 * </ol> |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1824 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1825 * @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
|
1826 * "" 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
|
1827 * 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
|
1828 * @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
|
1829 * in the database; "" retrieves those without a schema; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1830 * 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
|
1831 * @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
|
1832 * For all tables this should be "%" |
245
55375d489024
Corrected return values of DatabaseMetaData methods allTablesAreSelectable() and allProceduresAreCallable().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
231
diff
changeset
|
1833 * 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
|
1834 * @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
|
1835 * from getTableTypes(),to include; null returns all types |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1836 * @return ResultSet - each row is a table description |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1837 * @throws SQLException if a database-access error occurs. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1838 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1839 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1840 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
|
1841 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
|
1842 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
|
1843 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
|
1844 final String types[] |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1845 ) throws SQLException |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1846 { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1847 // as of Jul2015 release the sys.tables.type values (0 through 6) is extended with new values 10, 11, 20, and 30 (for system and temp tables/views). |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1848 // as of Jul2015 release we also have a new table: sys.table_types with names for the new table types |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1849 // for correct behavior we need to know if the server is using the old (pre Jul2015) or new sys.tables.type values |
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
|
1850 final boolean preJul2015 = ("11.19.15".compareTo(getDatabaseProductVersion()) >= 0); |
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
|
1851 // for debug: System.out.println("getDatabaseProductVersion() is " + getDatabaseProductVersion() + " preJul2015 is " + preJul2015); |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1852 |
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
|
1853 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
|
1854 final StringBuilder query = new StringBuilder(1600); |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1855 if (preJul2015 && types != null && types.length > 0) { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1856 // we need to filter on the constructed "TABLE_TYPE" expression, this is only possible when we use a subquery in the FROM |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1857 query.append("SELECT * FROM ("); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1858 } |
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
|
1859 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
|
1860 "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
|
1861 "t.\"name\" AS \"TABLE_NAME\", "); |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1862 if (preJul2015) { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1863 query.append( |
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
|
1864 "CASE WHEN t.\"system\" = true AND t.\"type\" IN (0, 10) AND t.\"temporary\" = 0 THEN 'SYSTEM TABLE' " + |
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
|
1865 "WHEN t.\"system\" = true AND t.\"type\" IN (1, 11) AND t.\"temporary\" = 0 THEN 'SYSTEM VIEW' " + |
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
|
1866 "WHEN t.\"system\" = false AND t.\"type\" = 0 AND t.\"temporary\" = 0 THEN 'TABLE' " + |
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
|
1867 "WHEN t.\"system\" = false AND t.\"type\" = 1 AND t.\"temporary\" = 0 THEN 'VIEW' " + |
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
|
1868 "WHEN t.\"system\" = true AND t.\"type\" IN (0, 20) AND t.\"temporary\" = 1 THEN 'SYSTEM SESSION TABLE' " + |
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
|
1869 "WHEN t.\"system\" = true AND t.\"type\" IN (1, 21) AND t.\"temporary\" = 1 THEN 'SYSTEM SESSION VIEW' " + |
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
|
1870 "WHEN t.\"system\" = false AND t.\"type\" IN (0, 30) AND t.\"temporary\" = 1 THEN 'SESSION TABLE' " + |
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
|
1871 "WHEN t.\"system\" = false AND t.\"type\" IN (1, 31) AND t.\"temporary\" = 1 THEN 'SESSION VIEW' " + |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1872 "END AS \"TABLE_TYPE\", "); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1873 } else { |
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
|
1874 query.append("tt.\"table_type_name\" AS \"TABLE_TYPE\", "); |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1875 } |
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
|
1876 query.append(useCommentsTable ? "COALESCE(cm.\"remark\", t.\"query\")" : "t.\"query\"").append(" AS \"REMARKS\", " + |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1877 "cast(null as char(1)) AS \"TYPE_CAT\", " + |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1878 "cast(null as char(1)) AS \"TYPE_SCHEM\", " + |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1879 "cast(null as char(1)) AS \"TYPE_NAME\", " + |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1880 "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
|
1881 "cast(null as char(1)) AS \"REF_GENERATION\" " + |
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
|
1882 "FROM \"sys\".\"tables\" t "); |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1883 if (!preJul2015) { |
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
|
1884 query.append("JOIN \"sys\".\"table_types\" tt ON t.\"type\" = tt.\"table_type_id\" "); |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1885 } |
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
|
1886 query.append("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
|
1887 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
|
1888 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
|
1889 } |
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
|
1890 query.append("WHERE 1=1"); |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1891 |
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
|
1892 if (catalog != null && !catalog.isEmpty()) { |
299
1f0324072b0c
Correcting typo in comment
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
298
diff
changeset
|
1893 // non-empty catalog selection. |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1894 // 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
|
1895 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
|
1896 } 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
|
1897 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
|
1898 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
|
1899 } |
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
|
1900 if (tableNamePattern != null && !tableNamePattern.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
|
1901 query.append(" AND 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
|
1902 } |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1903 } |
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
|
1904 |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1905 if (types != null && types.length > 0) { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1906 if (preJul2015) { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1907 query.append(") AS \"getTables\" WHERE \"TABLE_TYPE\" IN ("); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1908 } else { |
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
|
1909 query.append(" AND tt.\"table_type_name\" IN ("); |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1910 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1911 for (int i = 0; i < types.length; i++) { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1912 if (i > 0) { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1913 query.append(", "); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1914 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1915 query.append("'").append(types[i]).append("'"); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1916 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1917 query.append(")"); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1918 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1919 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1920 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
|
1921 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1922 return executeMetaDataQuery(query.toString()); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1923 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1924 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1925 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1926 * 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
|
1927 * are ordered by schema name. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1928 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1929 * <P>The schema column is: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1930 * <OL> |
194
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
1931 * <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
|
1932 * <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
|
1933 * </OL> |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1934 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1935 * @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
|
1936 * 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
|
1937 * 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
|
1938 * narrow down the search. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1939 * @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
|
1940 * 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
|
1941 * 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
|
1942 * @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
|
1943 * schema name |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1944 * @throws SQLException if a database error occurs |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1945 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1946 @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
|
1947 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
|
1948 throws SQLException |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1949 { |
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
|
1950 final StringBuilder query = new StringBuilder(170); |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1951 query.append("SELECT \"name\" AS \"TABLE_SCHEM\", " + |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1952 "cast(null as char(1)) AS \"TABLE_CATALOG\" " + |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1953 "FROM \"sys\".\"schemas\""); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1954 |
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
|
1955 if (catalog != null && !catalog.isEmpty()) { |
299
1f0324072b0c
Correcting typo in comment
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
298
diff
changeset
|
1956 // non-empty catalog selection. |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1957 // 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
|
1958 query.append(" WHERE 1=0"); |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1959 } 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
|
1960 if (schemaPattern != null && !schemaPattern.equals("%")) { |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1961 query.append(" WHERE \"name\" ").append(composeMatchPart(schemaPattern)); |
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 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1964 query.append(" ORDER BY \"TABLE_SCHEM\""); |
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 return executeMetaDataQuery(query.toString()); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1967 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1968 |
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 * 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
|
1971 * are ordered by catalog name. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1972 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1973 * <P>The catalog column is: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1974 * <OL> |
194
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
1975 * <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
|
1976 * </OL> |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1977 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1978 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1979 * @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
|
1980 * catalog name |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1981 * @throws SQLException if a database error occurs |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1982 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1983 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1984 public ResultSet getCatalogs() throws SQLException { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1985 // MonetDB does NOT support catalogs. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1986 // 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
|
1987 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
|
1988 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1989 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1990 /** |
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
|
1991 * 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
|
1992 * The results are ordered by table type. |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1993 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1994 * <P>The table type is: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1995 * <OL> |
194
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
1996 * <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
|
1997 * "VIEW", "SYSTEM TABLE", "GLOBAL TEMPORARY", |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1998 * "LOCAL TEMPORARY", "ALIAS", "SYNONYM". |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1999 * </OL> |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2000 * |
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
|
2001 * @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
|
2002 * @throws SQLException if a database error occurs |
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 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2005 public ResultSet getTableTypes() throws SQLException { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2006 // as of Jul2015 release we have a new table: sys.table_types with more table types |
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
|
2007 String query = "SELECT \"table_type_name\" AS \"TABLE_TYPE\" FROM \"sys\".\"table_types\" ORDER BY 1"; |
a91168efdf27
Small code and doc improvements. Moved helper functions to the bottom.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
302
diff
changeset
|
2008 |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2009 // For old (pre jul2015) servers fall back to old behavior. |
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
|
2010 if ("11.19.15".compareTo(getDatabaseProductVersion()) >= 0) |
a91168efdf27
Small code and doc improvements. Moved helper functions to the bottom.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
302
diff
changeset
|
2011 query = "SELECT 'SESSION TABLE' AS \"TABLE_TYPE\" UNION ALL " + |
a91168efdf27
Small code and doc improvements. Moved helper functions to the bottom.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
302
diff
changeset
|
2012 "SELECT 'SESSION VIEW' UNION ALL " + |
a91168efdf27
Small code and doc improvements. Moved helper functions to the bottom.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
302
diff
changeset
|
2013 "SELECT 'SYSTEM SESSION TABLE' UNION ALL " + |
a91168efdf27
Small code and doc improvements. Moved helper functions to the bottom.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
302
diff
changeset
|
2014 "SELECT 'SYSTEM SESSION VIEW' UNION ALL " + |
a91168efdf27
Small code and doc improvements. Moved helper functions to the bottom.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
302
diff
changeset
|
2015 "SELECT 'SYSTEM TABLE' UNION ALL " + |
a91168efdf27
Small code and doc improvements. Moved helper functions to the bottom.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
302
diff
changeset
|
2016 "SELECT 'SYSTEM VIEW' UNION ALL " + |
a91168efdf27
Small code and doc improvements. Moved helper functions to the bottom.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
302
diff
changeset
|
2017 "SELECT 'TABLE' UNION ALL " + |
a91168efdf27
Small code and doc improvements. Moved helper functions to the bottom.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
302
diff
changeset
|
2018 "SELECT 'VIEW' ORDER BY 1"; |
0
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 executeMetaDataQuery(query); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2021 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2022 |
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 * 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
|
2025 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2026 * <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
|
2027 * 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
|
2028 * TABLE_SCHEM, TABLE_NAME and ORDINAL_POSITION. |
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 * <P>Each column description has the following columns: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2031 * <OL> |
194
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
2032 * <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
|
2033 * <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
|
2034 * <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
|
2035 * <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
|
2036 * <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
|
2037 * <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
|
2038 * <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
|
2039 * 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
|
2040 * decimal types this is precision. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2041 * <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
|
2042 * <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
|
2043 * <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
|
2044 * <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
|
2045 * <UL> |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2046 * <LI> columnNoNulls - might not allow NULL values |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2047 * <LI> columnNullable - definitely allows NULL values |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2048 * <LI> columnNullableUnknown - nullability unknown |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2049 * </UL> |
194
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
2050 * <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
|
2051 * <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
|
2052 * <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
|
2053 * <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
|
2054 * <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
|
2055 * 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
|
2056 * <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
|
2057 * (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
|
2058 * <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
|
2059 * 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
|
2060 * 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
|
2061 * <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
|
2062 * <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
|
2063 * <LI><B>SCOPE_TABLE</B> String => table name that this 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
|
2064 * <LI><B>SOURCE_DATA_TYPE</B> short => source type of a distinct type or user-generated Ref type, SQL type from java.sql.Types (null if DATA_TYPE isn't DISTINCT or user-generated REF) |
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
2065 * <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
|
2066 * <UL> |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2067 * <LI> YES --- if the column is auto incremented |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2068 * <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
|
2069 * <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
|
2070 * </UL> |
194
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
2071 * <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
|
2072 * <UL> |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2073 * <LI> YES --- if this a generated column |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2074 * <LI> NO --- if this not a generated column |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2075 * <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
|
2076 * </UL> |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2077 * </OL> |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2078 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2079 * @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
|
2080 * "" 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
|
2081 * 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
|
2082 * @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
|
2083 * in the database; "" retrieves those without a schema; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2084 * 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
|
2085 * @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
|
2086 * For all tables this should be "%" |
245
55375d489024
Corrected return values of DatabaseMetaData methods allTablesAreSelectable() and allProceduresAreCallable().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
231
diff
changeset
|
2087 * 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
|
2088 * @param columnNamePattern - a column name pattern; must match the column name as it is stored in the database |
245
55375d489024
Corrected return values of DatabaseMetaData methods allTablesAreSelectable() and allProceduresAreCallable().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
231
diff
changeset
|
2089 * 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
|
2090 * @return ResultSet - each row is a column description |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2091 * @throws SQLException if a database error occurs |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2092 * @see #getSearchStringEscape |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2093 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2094 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2095 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
|
2096 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
|
2097 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
|
2098 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
|
2099 final String columnNamePattern |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2100 ) throws SQLException |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2101 { |
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
|
2102 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
|
2103 final StringBuilder query = new StringBuilder(2450); |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2104 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
|
2105 "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
|
2106 "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
|
2107 "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
|
2108 "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
|
2109 "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
|
2110 "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
|
2111 "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
|
2112 "c.\"type_scale\" AS \"DECIMAL_DIGITS\", " + |
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
|
2113 "cast(CASE WHEN c.\"type\" IN ('decimal', 'numeric', 'sec_interval') THEN 10 " + |
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
|
2114 "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
|
2115 "ELSE 0 END AS int) AS \"NUM_PREC_RADIX\", " + |
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
|
2116 "cast(CASE c.\"null\" WHEN true THEN ").append(ResultSetMetaData.columnNullable) |
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
|
2117 .append(" WHEN false THEN ").append(ResultSetMetaData.columnNoNulls).append(" 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
|
2118 .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
|
2119 "c.\"default\" AS \"COLUMN_DEF\", " + |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2120 "cast(0 as int) AS \"SQL_DATA_TYPE\", " + |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2121 "cast(0 as int) AS \"SQL_DATETIME_SUB\", " + |
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
|
2122 "cast(CASE WHEN c.\"type\" IN ('char','varchar','clob') THEN c.\"type_digits\" ELSE NULL END as int) AS \"CHAR_OCTET_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
|
2123 "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
|
2124 "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
|
2125 "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
|
2126 "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
|
2127 "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
|
2128 "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
|
2129 "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
|
2130 "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
|
2131 "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
|
2132 "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
|
2133 "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
|
2134 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
|
2135 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
|
2136 } |
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
|
2137 query.append("WHERE 1=1"); |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2138 |
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
|
2139 if (catalog != null && !catalog.isEmpty()) { |
299
1f0324072b0c
Correcting typo in comment
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
298
diff
changeset
|
2140 // non-empty catalog selection. |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2141 // 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
|
2142 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
|
2143 } 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
|
2144 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
|
2145 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
|
2146 } |
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
|
2147 if (tableNamePattern != null && !tableNamePattern.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
|
2148 query.append(" AND 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
|
2149 } |
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
|
2150 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
|
2151 query.append(" AND 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
|
2152 } |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2153 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2154 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2155 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
|
2156 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2157 return executeMetaDataQuery(query.toString()); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2158 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2159 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2160 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2161 * 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
|
2162 * 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
|
2163 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2164 * <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
|
2165 * 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
|
2166 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2167 * <P>Each privilige description has the following columns: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2168 * <OL> |
194
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
2169 * <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
|
2170 * <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
|
2171 * <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
|
2172 * <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
|
2173 * <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
|
2174 * <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
|
2175 * <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
|
2176 * 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
|
2177 * <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
|
2178 * 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
|
2179 * </OL> |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2180 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2181 * @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
|
2182 * @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
|
2183 * @param tableNamePattern a table name |
245
55375d489024
Corrected return values of DatabaseMetaData methods allTablesAreSelectable() and allProceduresAreCallable().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
231
diff
changeset
|
2184 * 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
|
2185 * @param columnNamePattern a column name pattern |
245
55375d489024
Corrected return values of DatabaseMetaData methods allTablesAreSelectable() and allProceduresAreCallable().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
231
diff
changeset
|
2186 * 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
|
2187 * @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
|
2188 * @see #getSearchStringEscape |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2189 * @throws SQLException if a database error occurs |
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 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2192 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
|
2193 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
|
2194 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
|
2195 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
|
2196 final String columnNamePattern |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2197 ) throws SQLException |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2198 { |
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
|
2199 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
|
2200 final StringBuilder query = new StringBuilder(1100); |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2201 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
|
2202 "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
|
2203 "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
|
2204 "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
|
2205 "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
|
2206 "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
|
2207 .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
|
2208 "cast(CASE p.\"privileges\" " + |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2209 "WHEN 1 THEN 'SELECT' " + |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2210 "WHEN 2 THEN 'UPDATE' " + |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2211 "WHEN 4 THEN 'INSERT' " + |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2212 "WHEN 8 THEN 'DELETE' " + |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2213 "WHEN 16 THEN 'EXECUTE' " + |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2214 "WHEN 32 THEN 'GRANT' " + |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2215 "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
|
2216 "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
|
2217 "cast(CASE p.\"grantable\" " + |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2218 "WHEN 0 THEN 'NO' " + |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2219 "WHEN 1 THEN 'YES' " + |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2220 "ELSE NULL " + |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2221 "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
|
2222 "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
|
2223 "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
|
2224 "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
|
2225 "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
|
2226 "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
|
2227 "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
|
2228 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
|
2229 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
|
2230 } |
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
|
2231 query.append("WHERE 1=1"); |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2232 |
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
|
2233 if (catalog != null && !catalog.isEmpty()) { |
299
1f0324072b0c
Correcting typo in comment
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
298
diff
changeset
|
2234 // non-empty catalog selection. |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2235 // 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
|
2236 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
|
2237 } 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
|
2238 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
|
2239 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
|
2240 } |
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
|
2241 if (tableNamePattern != null && !tableNamePattern.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
|
2242 query.append(" AND 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
|
2243 } |
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
|
2244 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
|
2245 query.append(" AND 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
|
2246 } |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2247 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2248 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2249 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
|
2250 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2251 return executeMetaDataQuery(query.toString()); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2252 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2253 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2254 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2255 * 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
|
2256 * in a catalog. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2257 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2258 * <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
|
2259 * 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
|
2260 * TABLE_NAME, and PRIVILEGE. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2261 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2262 * <P>Each privilege description has the following columns: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2263 * <OL> |
194
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
2264 * <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
|
2265 * <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
|
2266 * <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
|
2267 * <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
|
2268 * <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
|
2269 * <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
|
2270 * 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
|
2271 * <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
|
2272 * 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
|
2273 * </OL> |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2274 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2275 * @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
|
2276 * @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
|
2277 * @param tableNamePattern a table name pattern |
245
55375d489024
Corrected return values of DatabaseMetaData methods allTablesAreSelectable() and allProceduresAreCallable().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
231
diff
changeset
|
2278 * 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
|
2279 * @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
|
2280 * @see #getSearchStringEscape |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2281 * @throws SQLException if a database error occurs |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2282 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2283 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2284 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
|
2285 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
|
2286 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
|
2287 final String tableNamePattern |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2288 ) throws SQLException |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2289 { |
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
|
2290 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
|
2291 final StringBuilder query = new StringBuilder(1000); |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2292 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
|
2293 "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
|
2294 "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
|
2295 "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
|
2296 "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
|
2297 .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
|
2298 "cast(CASE p.\"privileges\" " + |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2299 "WHEN 1 THEN 'SELECT' " + |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2300 "WHEN 2 THEN 'UPDATE' " + |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2301 "WHEN 4 THEN 'INSERT' " + |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2302 "WHEN 8 THEN 'DELETE' " + |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2303 "WHEN 16 THEN 'EXECUTE' " + |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2304 "WHEN 32 THEN 'GRANT' " + |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2305 "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
|
2306 "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
|
2307 "cast(CASE p.\"grantable\" " + |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2308 "WHEN 0 THEN 'NO' " + |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2309 "WHEN 1 THEN 'YES' " + |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2310 "ELSE NULL " + |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2311 "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
|
2312 "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
|
2313 "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
|
2314 "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
|
2315 "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
|
2316 "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
|
2317 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
|
2318 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
|
2319 } |
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
|
2320 query.append("WHERE 1=1"); |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2321 |
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
|
2322 if (catalog != null && !catalog.isEmpty()) { |
299
1f0324072b0c
Correcting typo in comment
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
298
diff
changeset
|
2323 // non-empty catalog selection. |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2324 // 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
|
2325 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
|
2326 } 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
|
2327 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
|
2328 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
|
2329 } |
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
|
2330 if (tableNamePattern != null && !tableNamePattern.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
|
2331 query.append(" AND 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
|
2332 } |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2333 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2334 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2335 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
|
2336 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2337 return executeMetaDataQuery(query.toString()); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2338 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2339 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2340 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2341 * 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
|
2342 * 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
|
2343 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2344 * <P>Each column description has the following columns: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2345 * <OL> |
194
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
2346 * <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
|
2347 * <UL> |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2348 * <LI> bestRowTemporary - very temporary, while using row |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2349 * <LI> bestRowTransaction - valid for remainder of current transaction |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2350 * <LI> bestRowSession - valid for remainder of current session |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2351 * </UL> |
194
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
2352 * <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
|
2353 * <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
|
2354 * <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
|
2355 * <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
|
2356 * <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
|
2357 * <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
|
2358 * <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
|
2359 * like an Oracle ROWID |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2360 * <UL> |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2361 * <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
|
2362 * <LI> bestRowNotPseudo - is NOT a pseudo column |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2363 * <LI> bestRowPseudo - is a pseudo column |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2364 * </UL> |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2365 * </OL> |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2366 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2367 * @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
|
2368 * @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
|
2369 * @param table a table name |
245
55375d489024
Corrected return values of DatabaseMetaData methods allTablesAreSelectable() and allProceduresAreCallable().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
231
diff
changeset
|
2370 * 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
|
2371 * @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
|
2372 * @param nullable include columns that are nullable? |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2373 * @return ResultSet each row is a column description |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2374 * @throws SQLException if a database error occurs |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2375 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2376 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2377 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
|
2378 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
|
2379 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
|
2380 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
|
2381 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
|
2382 final boolean nullable |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2383 ) throws SQLException |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2384 { |
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
|
2385 // first find out if the table has a Primary Key, If it does, we should return only those columns |
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
|
2386 boolean hasPK = false; |
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
|
2387 ResultSet pkey = null; |
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
|
2388 try { |
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
|
2389 pkey = getPrimaryKeys(catalog, schema, table); |
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
|
2390 if (pkey != null && pkey.next()) { |
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
|
2391 hasPK = true; |
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
|
2392 } |
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
|
2393 } catch (SQLException e) { |
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
|
2394 // ignore |
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
|
2395 } finally { |
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
|
2396 MonetConnection.closeResultsetStatement(pkey, null); |
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
|
2397 } |
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
|
2398 |
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
|
2399 final StringBuilder query = new StringBuilder(1500); |
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
|
2400 // Note: DISTINCT is needed to filter out possible duplicate column names from multiple unique constraints |
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
|
2401 query.append("SELECT DISTINCT cast(").append(DatabaseMetaData.bestRowSession).append(" AS smallint) AS \"SCOPE\", " + |
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
|
2402 "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
|
2403 "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
|
2404 "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
|
2405 "c.\"type_digits\" AS \"COLUMN_SIZE\", " + |
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
|
2406 "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
|
2407 "cast(c.\"type_scale\" AS smallint) AS \"DECIMAL_DIGITS\", " + |
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
|
2408 "cast(").append(DatabaseMetaData.bestRowNotPseudo).append(" AS smallint) AS \"PSEUDO_COLUMN\" " + |
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
|
2409 "FROM \"sys\".\"keys\" k " + |
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
|
2410 "JOIN \"sys\".\"objects\" o ON k.\"id\" = o.\"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
|
2411 "JOIN \"sys\".\"columns\" c ON (k.\"table_id\" = c.\"table_id\" AND o.\"name\" = c.\"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
|
2412 "JOIN \"sys\".\"tables\" t ON k.\"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
|
2413 "JOIN \"sys\".\"schemas\" s ON t.\"schema_id\" = s.\"id\" " + |
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
|
2414 "WHERE k.\"type\" = ").append(hasPK ? "0" : "1"); // the primary key (type = 0) or else any unique key (type = 1) |
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
|
2415 // TODO: when there is no PK and there are multiple unique constraints, pick only the unique constraint which has a) the least number of columns and b) the smallest total(size in bytes) |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2416 |
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
|
2417 if (catalog != null && !catalog.isEmpty()) { |
299
1f0324072b0c
Correcting typo in comment
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
298
diff
changeset
|
2418 // non-empty catalog selection. |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2419 // 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
|
2420 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
|
2421 } 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
|
2422 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
|
2423 || 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
|
2424 || scope == DatabaseMetaData.bestRowTemporary) { |
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
|
2425 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
|
2426 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
|
2427 } |
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
|
2428 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
|
2429 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
|
2430 } |
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
|
2431 if (!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
|
2432 query.append(" AND c.\"null\" = 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
|
2433 } |
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
|
2434 } else { |
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
|
2435 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
|
2436 } |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2437 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2438 |
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
|
2439 query.append(" ORDER BY \"SCOPE\", o.\"nr\", \"COLUMN_NAME\""); |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2440 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2441 return executeMetaDataQuery(query.toString()); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2442 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2443 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2444 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2445 * 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
|
2446 * 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
|
2447 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2448 * <P>Each column description has the following columns: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2449 * <OL> |
194
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
2450 * <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
|
2451 * <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
|
2452 * <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
|
2453 * <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
|
2454 * <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
|
2455 * <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
|
2456 * <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
|
2457 * <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
|
2458 * <UL> |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2459 * <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
|
2460 * <LI> versionColumnNotPseudo - is NOT a pseudo column |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2461 * <LI> versionColumnPseudo - is a pseudo column |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2462 * </UL> |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2463 * </OL> |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2464 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2465 * @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
|
2466 * @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
|
2467 * @param table a table name |
245
55375d489024
Corrected return values of DatabaseMetaData methods allTablesAreSelectable() and allProceduresAreCallable().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
231
diff
changeset
|
2468 * 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
|
2469 * @return ResultSet each row is a column description |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2470 * @throws SQLException if a database error occurs |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2471 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2472 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2473 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
|
2474 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
|
2475 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
|
2476 final String table |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2477 ) throws SQLException |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2478 { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2479 // 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
|
2480 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
|
2481 "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
|
2482 "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
|
2483 "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
|
2484 "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
|
2485 "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
|
2486 "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
|
2487 "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
|
2488 "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
|
2489 "WHERE 1=0"; |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2490 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2491 return executeMetaDataQuery(query); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2492 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2493 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2494 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2495 * 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
|
2496 * are ordered by COLUMN_NAME. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2497 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2498 * <P>Each column description has the following columns: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2499 * <OL> |
194
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
2500 * <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
|
2501 * <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
|
2502 * <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
|
2503 * <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
|
2504 * <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
|
2505 * <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
|
2506 * </OL> |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2507 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2508 * @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
|
2509 * @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
|
2510 * @param table a table name |
245
55375d489024
Corrected return values of DatabaseMetaData methods allTablesAreSelectable() and allProceduresAreCallable().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
231
diff
changeset
|
2511 * 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
|
2512 * @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
|
2513 * @throws SQLException if a database error occurs |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2514 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2515 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2516 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
|
2517 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
|
2518 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
|
2519 final String table |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2520 ) throws SQLException |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2521 { |
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
|
2522 final StringBuilder query = new StringBuilder(600); |
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
|
2523 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
|
2524 "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
|
2525 "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
|
2526 "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
|
2527 "cast(1 + o.\"nr\" AS smallint) AS \"KEY_SEQ\", " + |
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
|
2528 " k.\"name\" AS \"PK_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
|
2529 "FROM \"sys\".\"keys\" k " + |
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
|
2530 "JOIN \"sys\".\"objects\" o ON k.\"id\" = o.\"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
|
2531 "JOIN \"sys\".\"tables\" t ON k.\"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
|
2532 "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
|
2533 "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
|
2534 |
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
|
2535 if (catalog != null && !catalog.isEmpty()) { |
299
1f0324072b0c
Correcting typo in comment
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
298
diff
changeset
|
2536 // non-empty catalog selection. |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2537 // 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
|
2538 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
|
2539 } 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
|
2540 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
|
2541 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
|
2542 } |
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
|
2543 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
|
2544 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
|
2545 } |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2546 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2547 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2548 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
|
2549 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2550 return executeMetaDataQuery(query.toString()); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2551 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2552 |
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
|
2553 // 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
|
2554 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
|
2555 "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
|
2556 "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
|
2557 "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
|
2558 "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
|
2559 "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
|
2560 "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
|
2561 "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
|
2562 "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
|
2563 "cast(1 + \"pkkeycol\".\"nr\" AS smallint) AS \"KEY_SEQ\", " + |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2564 DatabaseMetaData.importedKeyNoAction + " AS \"UPDATE_RULE\", " + |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2565 DatabaseMetaData.importedKeyNoAction + " 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
|
2566 "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
|
2567 "pkkey.\"name\" AS \"PK_NAME\", " + |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2568 DatabaseMetaData.importedKeyNotDeferrable + " 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
|
2569 "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
|
2570 "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
|
2571 "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
|
2572 "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
|
2573 "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
|
2574 "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
|
2575 "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
|
2576 "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
|
2577 "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
|
2578 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2579 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2580 * 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
|
2581 * 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
|
2582 * 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
|
2583 * PKTABLE_SCHEM, PKTABLE_NAME, and KEY_SEQ. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2584 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2585 * <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
|
2586 * <OL> |
194
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
2587 * <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
|
2588 * 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
|
2589 * <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
|
2590 * 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
|
2591 * <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
|
2592 * being imported |
194
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
2593 * <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
|
2594 * being imported |
194
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
2595 * <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
|
2596 * <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
|
2597 * <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
|
2598 * <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
|
2599 * <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
|
2600 * (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). |
194
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
2601 * <LI><B>UPDATE_RULE</B> short => What happens to |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2602 * foreign key when primary is updated: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2603 * <UL> |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2604 * <LI> importedKeyNoAction - do not allow update of primary key if it has been imported |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2605 * <LI> importedKeyCascade - change imported key to agree |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2606 * with primary key update |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2607 * <LI> importedKeyRestrict - do not allow update of primary |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2608 * key if it has been imported |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2609 * <LI> importedKeySetNull - change imported key to NULL if |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2610 * its primary key has been updated |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2611 * </UL> |
194
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
2612 * <LI><B>DELETE_RULE</B> short => What happens to |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2613 * the foreign key when primary is deleted. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2614 * <UL> |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2615 * <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
|
2616 * <LI> importedKeyCascade - delete rows that import a deleted key |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2617 * <LI> importedKeyRestrict - do not allow delete of primary |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2618 * key if it has been imported |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2619 * <LI> importedKeySetNull - change imported key to NULL if |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2620 * its primary key has been deleted |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2621 * </UL> |
194
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
2622 * <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
|
2623 * <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
|
2624 * <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
|
2625 * <UL> |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2626 * <LI> importedKeyInitiallyDeferred - see SQL92 for definition |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2627 * <LI> importedKeyInitiallyImmediate - see SQL92 for definition |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2628 * <LI> importedKeyNotDeferrable - see SQL92 for definition |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2629 * </UL> |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2630 * </OL> |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2631 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2632 * @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
|
2633 * @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
|
2634 * @param table a table name |
245
55375d489024
Corrected return values of DatabaseMetaData methods allTablesAreSelectable() and allProceduresAreCallable().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
231
diff
changeset
|
2635 * 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
|
2636 * @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
|
2637 * @see #getExportedKeys |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2638 * @throws SQLException if a database error occurs |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2639 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2640 @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
|
2641 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
|
2642 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
|
2643 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
|
2644 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
|
2645 ) throws SQLException |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2646 { |
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
|
2647 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
|
2648 query.append(keyQuery); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2649 |
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
|
2650 if (catalog != null && !catalog.isEmpty()) { |
299
1f0324072b0c
Correcting typo in comment
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
298
diff
changeset
|
2651 // non-empty catalog selection. |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2652 // 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
|
2653 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
|
2654 } 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
|
2655 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
|
2656 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
|
2657 } |
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
|
2658 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
|
2659 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
|
2660 } |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2661 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2662 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2663 query.append(" ORDER BY \"PKTABLE_SCHEM\", \"PKTABLE_NAME\", \"PK_NAME\", \"KEY_SEQ\""); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2664 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2665 return executeMetaDataQuery(query.toString()); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2666 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2667 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2668 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2669 * 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
|
2670 * 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
|
2671 * 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
|
2672 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2673 * <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
|
2674 * <OL> |
194
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
2675 * <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
|
2676 * <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
|
2677 * <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
|
2678 * <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
|
2679 * <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
|
2680 * 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
|
2681 * <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
|
2682 * 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
|
2683 * <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
|
2684 * being exported |
194
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
2685 * <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
|
2686 * being exported |
194
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
2687 * <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
|
2688 * (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). |
194
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
2689 * <LI><B>UPDATE_RULE</B> short => What happens to |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2690 * foreign key when primary is updated: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2691 * <UL> |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2692 * <LI> importedKeyNoAction - do not allow update of primary key if it has been imported |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2693 * <LI> importedKeyCascade - change imported key to agree |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2694 * with primary key update |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2695 * <LI> importedKeyRestrict - do not allow update of primary |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2696 * key if it has been imported |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2697 * <LI> importedKeySetNull - change imported key to NULL if |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2698 * its primary key has been updated |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2699 * </UL> |
194
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
2700 * <LI><B>DELETE_RULE</B> short => What happens to |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2701 * the foreign key when primary is deleted. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2702 * <UL> |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2703 * <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
|
2704 * <LI> importedKeyCascade - delete rows that import a deleted key |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2705 * <LI> importedKeyRestrict - do not allow delete of primary |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2706 * key if it has been imported |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2707 * <LI> importedKeySetNull - change imported key to NULL if |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2708 * its primary key has been deleted |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2709 * </UL> |
194
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
2710 * <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
|
2711 * <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
|
2712 * <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
|
2713 * <UL> |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2714 * <LI> importedKeyInitiallyDeferred - see SQL92 for definition |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2715 * <LI> importedKeyInitiallyImmediate - see SQL92 for definition |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2716 * <LI> importedKeyNotDeferrable - see SQL92 for definition |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2717 * </UL> |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2718 * </OL> |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2719 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2720 * @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
|
2721 * @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
|
2722 * @param table a table name |
245
55375d489024
Corrected return values of DatabaseMetaData methods allTablesAreSelectable() and allProceduresAreCallable().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
231
diff
changeset
|
2723 * 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
|
2724 * @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
|
2725 * @see #getImportedKeys |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2726 * @throws SQLException if a database error occurs |
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 @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
|
2729 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
|
2730 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
|
2731 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
|
2732 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
|
2733 ) throws SQLException |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2734 { |
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
|
2735 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
|
2736 query.append(keyQuery); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2737 |
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
|
2738 if (catalog != null && !catalog.isEmpty()) { |
299
1f0324072b0c
Correcting typo in comment
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
298
diff
changeset
|
2739 // non-empty catalog selection. |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2740 // 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
|
2741 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
|
2742 } 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
|
2743 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
|
2744 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
|
2745 } |
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
|
2746 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
|
2747 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
|
2748 } |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2749 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2750 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2751 query.append(" ORDER BY \"FKTABLE_SCHEM\", \"FKTABLE_NAME\", \"FK_NAME\", \"KEY_SEQ\""); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2752 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2753 return executeMetaDataQuery(query.toString()); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2754 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2755 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2756 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2757 * 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
|
2758 * 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
|
2759 * 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
|
2760 * 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
|
2761 * (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
|
2762 * 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
|
2763 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2764 * <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
|
2765 * <OL> |
194
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
2766 * <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
|
2767 * <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
|
2768 * <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
|
2769 * <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
|
2770 * <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
|
2771 * 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
|
2772 * <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
|
2773 * 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
|
2774 * <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
|
2775 * being exported |
194
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
2776 * <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
|
2777 * being exported |
194
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
2778 * <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
|
2779 * (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). |
194
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
2780 * <LI><B>UPDATE_RULE</B> short => What happens to |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2781 * foreign key when primary is updated: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2782 * <UL> |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2783 * <LI> importedKeyNoAction - do not allow update of primary key if it has been imported |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2784 * <LI> importedKeyCascade - change imported key to agree |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2785 * with primary key update |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2786 * <LI> importedKeyRestrict - do not allow update of primary |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2787 * key if it has been imported |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2788 * <LI> importedKeySetNull - change imported key to NULL if |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2789 * its primary key has been updated |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2790 * </UL> |
194
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
2791 * <LI><B>DELETE_RULE</B> short => What happens to |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2792 * the foreign key when primary is deleted. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2793 * <UL> |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2794 * <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
|
2795 * <LI> importedKeyCascade - delete rows that import a deleted key |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2796 * <LI> importedKeyRestrict - do not allow delete of primary |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2797 * key if it has been imported |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2798 * <LI> importedKeySetNull - change imported key to NULL if |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2799 * its primary key has been deleted |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2800 * </UL> |
194
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
2801 * <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
|
2802 * <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
|
2803 * <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
|
2804 * <UL> |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2805 * <LI> importedKeyInitiallyDeferred - see SQL92 for definition |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2806 * <LI> importedKeyInitiallyImmediate - see SQL92 for definition |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2807 * <LI> importedKeyNotDeferrable - see SQL92 for definition |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2808 * </UL> |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2809 * </OL> |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2810 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2811 * @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
|
2812 * @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
|
2813 * @param ptable primary key table name |
245
55375d489024
Corrected return values of DatabaseMetaData methods allTablesAreSelectable() and allProceduresAreCallable().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
231
diff
changeset
|
2814 * 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
|
2815 * @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
|
2816 * @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
|
2817 * @param ftable koreign key table name |
245
55375d489024
Corrected return values of DatabaseMetaData methods allTablesAreSelectable() and allProceduresAreCallable().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
231
diff
changeset
|
2818 * 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
|
2819 * @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
|
2820 * @throws SQLException if a database error occurs |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2821 * @see #getImportedKeys |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2822 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2823 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2824 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
|
2825 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
|
2826 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
|
2827 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
|
2828 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
|
2829 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
|
2830 final String ftable |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2831 ) throws SQLException |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2832 { |
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
|
2833 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
|
2834 query.append(keyQuery); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2835 |
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
|
2836 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
|
2837 || (fcatalog != null && !fcatalog.isEmpty())) { |
299
1f0324072b0c
Correcting typo in comment
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
298
diff
changeset
|
2838 // non-empty catalog selection. |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2839 // 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
|
2840 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
|
2841 } 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
|
2842 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
|
2843 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
|
2844 } |
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
|
2845 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
|
2846 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
|
2847 } |
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
|
2848 |
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
|
2849 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
|
2850 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
|
2851 } |
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
|
2852 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
|
2853 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
|
2854 } |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2855 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2856 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2857 query.append(" ORDER BY \"FKTABLE_SCHEM\", \"FKTABLE_NAME\", \"FK_NAME\", \"KEY_SEQ\""); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2858 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2859 return executeMetaDataQuery(query.toString()); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2860 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2861 |
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 * 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
|
2864 * 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
|
2865 * 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
|
2866 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2867 * 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
|
2868 * 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
|
2869 * 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
|
2870 * 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
|
2871 * 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
|
2872 * 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
|
2873 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2874 * <P>Each type description has the following columns: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2875 * <OL> |
194
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
2876 * <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
|
2877 * <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
|
2878 * <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
|
2879 * <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
|
2880 * <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
|
2881 * <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
|
2882 * 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
|
2883 * <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
|
2884 * <UL> |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2885 * <LI> typeNoNulls - does not allow NULL values |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2886 * <LI> typeNullable - allows NULL values |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2887 * <LI> typeNullableUnknown - nullability unknown |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2888 * </UL> |
194
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
2889 * <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
|
2890 * <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
|
2891 * <UL> |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2892 * <LI> typePredNone - No support |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2893 * <LI> typePredChar - Only supported with WHERE .. LIKE |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2894 * <LI> typePredBasic - Supported except for WHERE .. LIKE |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2895 * <LI> typeSearchable - Supported for all WHERE .. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2896 * </UL> |
194
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
2897 * <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
|
2898 * <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
|
2899 * <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
|
2900 * 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
|
2901 * <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
|
2902 * (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
|
2903 * <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
|
2904 * <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
|
2905 * <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
|
2906 * <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
|
2907 * <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
|
2908 * </OL> |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2909 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2910 * @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
|
2911 * @throws SQLException if a database error occurs |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2912 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2913 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2914 public ResultSet getTypeInfo() 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
|
2915 final StringBuilder query = new StringBuilder(2300); |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2916 query.append("SELECT \"sqlname\" AS \"TYPE_NAME\", " + |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2917 "cast(").append(MonetDriver.getSQLTypeMap("\"sqlname\"")).append(" AS int) AS \"DATA_TYPE\", " + |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2918 "\"digits\" AS \"PRECISION\", " + // note that when radix is 2 the precision shows the number of bits |
265
177f3d1a791d
Corrected MonetDatabaseMetaData method getTypeInfo() for result column
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
264
diff
changeset
|
2919 "cast(CASE WHEN \"systemname\" IN ('str','inet','json','url','uuid','blob','sqlblob') THEN ''''" + |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2920 " ELSE NULL END AS varchar(2)) AS \"LITERAL_PREFIX\", " + |
265
177f3d1a791d
Corrected MonetDatabaseMetaData method getTypeInfo() for result column
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
264
diff
changeset
|
2921 "cast(CASE WHEN \"systemname\" IN ('str','inet','json','url','uuid','blob','sqlblob') THEN ''''" + |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2922 " ELSE NULL END AS varchar(2)) AS \"LITERAL_SUFFIX\", " + |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2923 "CASE WHEN \"sqlname\" IN ('char', 'varchar') THEN 'max length'" + |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2924 " WHEN \"sqlname\" = 'decimal' THEN 'precision, scale'" + |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2925 " WHEN \"sqlname\" IN ('time', 'timetz', 'timestamp', 'timestamptz', 'sec_interval') THEN 'precision'" + |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2926 " ELSE NULL END AS \"CREATE_PARAMS\", " + |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2927 "cast(CASE WHEN \"systemname\" = 'oid' THEN ").append(DatabaseMetaData.typeNoNulls) |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2928 .append(" ELSE ").append(DatabaseMetaData.typeNullable).append(" END AS smallint) AS \"NULLABLE\", " + |
265
177f3d1a791d
Corrected MonetDatabaseMetaData method getTypeInfo() for result column
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
264
diff
changeset
|
2929 "CASE WHEN \"systemname\" IN ('str','json','url') THEN true ELSE false END AS \"CASE_SENSITIVE\", " + |
177f3d1a791d
Corrected MonetDatabaseMetaData method getTypeInfo() for result column
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
264
diff
changeset
|
2930 "cast(CASE WHEN \"systemname\" IN ('str','inet','json','url','uuid','blob','sqlblob') THEN ").append(DatabaseMetaData.typeSearchable) |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2931 .append(" ELSE ").append(DatabaseMetaData.typePredBasic).append(" END AS smallint) AS \"SEARCHABLE\", " + |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2932 "CASE WHEN \"sqlname\" IN ('tinyint','smallint','int','bigint','hugeint','decimal','real','double','sec_interval','month_interval') THEN false ELSE true END AS \"UNSIGNED_ATTRIBUTE\", " + |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2933 "CASE \"sqlname\" WHEN 'decimal' THEN true ELSE false END AS \"FIXED_PREC_SCALE\", " + |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2934 "CASE WHEN \"sqlname\" IN ('tinyint','smallint','int','bigint','hugeint','decimal','oid','wrd') THEN true ELSE false END AS \"AUTO_INCREMENT\", " + |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2935 "\"systemname\" AS \"LOCAL_TYPE_NAME\", " + |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2936 "cast(0 AS smallint) AS \"MINIMUM_SCALE\", " + |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2937 "cast(CASE WHEN \"sqlname\" = 'decimal' THEN (CASE \"systemname\" WHEN 'lng' THEN 18 WHEN 'hge' THEN 38 WHEN 'int' THEN 9 WHEN 'sht' THEN 4 WHEN 'bte' THEN 2 ELSE 0 END)" + |
23
e8cced5f7283
Correct the maximum precision of fractions of a second to 6 (was 9) and included it for the missing time and timetz.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
19
diff
changeset
|
2938 " WHEN \"sqlname\" IN ('time', 'timetz', 'timestamp', 'timestamptz', 'sec_interval') THEN 6 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
|
2939 "cast(0 AS int) AS \"SQL_DATA_TYPE\", " + |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2940 "cast(0 AS int) AS \"SQL_DATETIME_SUB\", " + |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2941 "cast(\"radix\" as int) AS \"NUM_PREC_RADIX\" " + |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2942 "FROM \"sys\".\"types\" " + |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2943 "ORDER BY \"DATA_TYPE\", \"sqlname\", \"id\""); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2944 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2945 return executeMetaDataQuery(query.toString()); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2946 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2947 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2948 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2949 * 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
|
2950 * 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
|
2951 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2952 * <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
|
2953 * <OL> |
194
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
2954 * <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
|
2955 * <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
|
2956 * <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
|
2957 * <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
|
2958 * 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
|
2959 * <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
|
2960 * 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
|
2961 * <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
|
2962 * tableIndexStatistic |
194
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
2963 * <LI><B>TYPE</B> short => index type: |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2964 * <UL> |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2965 * <LI> tableIndexStatistic - this identifies table statistics that are |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2966 * 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
|
2967 * <LI> tableIndexClustered - this is a clustered index |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2968 * <LI> tableIndexHashed - this is a hashed index |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2969 * <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
|
2970 * </UL> |
194
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
2971 * <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
|
2972 * 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
|
2973 * <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
|
2974 * tableIndexStatistic |
194
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
2975 * <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
|
2976 * "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
|
2977 * 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
|
2978 * <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
|
2979 * 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
|
2980 * 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
|
2981 * <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
|
2982 * 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
|
2983 * 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
|
2984 * <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
|
2985 * (may be null) |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2986 * </OL> |
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 * @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
|
2989 * @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
|
2990 * @param table a table name |
245
55375d489024
Corrected return values of DatabaseMetaData methods allTablesAreSelectable() and allProceduresAreCallable().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
231
diff
changeset
|
2991 * 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
|
2992 * @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
|
2993 * 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
|
2994 * @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
|
2995 * 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
|
2996 * accurate |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2997 * @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
|
2998 * @throws SQLException if a database occurs |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
2999 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3000 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3001 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
|
3002 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
|
3003 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
|
3004 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
|
3005 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
|
3006 final boolean approximate |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3007 ) throws SQLException |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3008 { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3009 String table_row_count = "0"; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3010 |
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
|
3011 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
|
3012 && 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
|
3013 && table != null && !table.isEmpty() && !table.contains("%")) { |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3014 // 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
|
3015 ResultSet count = null; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3016 try { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3017 count = executeMetaDataQuery("SELECT COUNT(*) FROM \"" + schema + "\".\"" + table + "\""); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3018 if (count != null && count.next()) { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3019 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
|
3020 if (count_value != null && !count_value.isEmpty()) |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3021 table_row_count = count_value; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3022 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3023 } catch (SQLException e) { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3024 // ignore |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3025 } 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
|
3026 MonetConnection.closeResultsetStatement(count, null); |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3027 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3028 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3029 |
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
|
3030 final StringBuilder query = new StringBuilder(1250); |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3031 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
|
3032 "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
|
3033 "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
|
3034 "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
|
3035 "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
|
3036 "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
|
3037 "i.\"name\" AS \"INDEX_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
|
3038 "CASE i.\"type\" WHEN 0 THEN ").append(DatabaseMetaData.tableIndexHashed).append(" ELSE ").append(DatabaseMetaData.tableIndexOther).append(" END AS \"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
|
3039 "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
|
3040 "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
|
3041 "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
|
3042 "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
|
3043 "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
|
3044 "cast(null AS char(1)) AS \"FILTER_CONDITION\" " + |
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
|
3045 "FROM \"sys\".\"idxs\" i " + |
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
|
3046 "JOIN \"sys\".\"tables\" t ON i.\"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
|
3047 "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
|
3048 "JOIN \"sys\".\"objects\" o ON i.\"id\" = o.\"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
|
3049 "JOIN \"sys\".\"columns\" c ON (t.\"id\" = c.\"table_id\" AND o.\"name\" = c.\"name\") " + |
306
7c79ef41b840
Undo change cf372fae2adb. The problem was in the dump code in JdbcClient.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
304
diff
changeset
|
3050 "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 |
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
|
3051 "WHERE 1=1"); |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3052 |
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
|
3053 if (catalog != null && !catalog.isEmpty()) { |
299
1f0324072b0c
Correcting typo in comment
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
298
diff
changeset
|
3054 // non-empty catalog selection. |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3055 // 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
|
3056 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
|
3057 } 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
|
3058 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
|
3059 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
|
3060 } |
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
|
3061 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
|
3062 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
|
3063 } |
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
|
3064 if (unique) { |
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
|
3065 query.append(" AND 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
|
3066 } |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3067 } |
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
|
3068 |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3069 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
|
3070 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3071 return executeMetaDataQuery(query.toString()); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3072 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3073 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3074 //== 1.2 methods (JDBC 2) |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3075 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3076 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3077 * 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
|
3078 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3079 * @param type - defined in java.sql.ResultSet |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3080 * @return true if so; false otherwise |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3081 * @throws SQLException - if a database access error occurs |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3082 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3083 @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
|
3084 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
|
3085 // The only type we don't support |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3086 return type != ResultSet.TYPE_SCROLL_SENSITIVE; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3087 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3088 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3089 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3090 * 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
|
3091 * with the given result set type? |
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 * @param type - defined in java.sql.ResultSet |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3094 * @param concurrency - type defined in java.sql.ResultSet |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3095 * @return true if so; false otherwise |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3096 * @throws SQLException - if a database access error occurs |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3097 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3098 @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
|
3099 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
|
3100 throws SQLException |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3101 { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3102 // These combinations are not supported! |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3103 if (type == ResultSet.TYPE_SCROLL_SENSITIVE) |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3104 return false; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3105 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3106 // We do only support Read Only ResultSets |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3107 if (concurrency != ResultSet.CONCUR_READ_ONLY) |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3108 return false; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3109 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3110 // 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
|
3111 return true; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3112 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3113 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3114 /* lots of unsupported stuff... (no updatable ResultSet!) */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3115 @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
|
3116 public boolean ownUpdatesAreVisible(final int type) { |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3117 return false; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3118 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3119 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3120 @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
|
3121 public boolean ownDeletesAreVisible(final int type) { |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3122 return false; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3123 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3124 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3125 @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
|
3126 public boolean ownInsertsAreVisible(final int type) { |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3127 return false; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3128 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3129 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3130 @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
|
3131 public boolean othersUpdatesAreVisible(final int type) { |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3132 return false; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3133 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3134 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3135 @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
|
3136 public boolean othersDeletesAreVisible(final int i) { |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3137 return false; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3138 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3139 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3140 @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
|
3141 public boolean othersInsertsAreVisible(final int type) { |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3142 return false; |
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 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3145 @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
|
3146 public boolean updatesAreDetected(final int type) { |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3147 return false; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3148 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3149 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3150 @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
|
3151 public boolean deletesAreDetected(final int i) { |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3152 return false; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3153 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3154 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3155 @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
|
3156 public boolean insertsAreDetected(final int type) { |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3157 return false; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3158 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3159 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3160 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3161 * Indicates whether the driver supports batch updates. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3162 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3163 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3164 public boolean supportsBatchUpdates() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3165 return true; |
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 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3168 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3169 * 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
|
3170 * 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
|
3171 * 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
|
3172 * 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
|
3173 * 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
|
3174 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3175 * Each type description has the following columns: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3176 * |
194
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
3177 * 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
|
3178 * 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
|
3179 * 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
|
3180 * 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
|
3181 * 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
|
3182 * 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
|
3183 * 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
|
3184 * 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
|
3185 * 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
|
3186 * |
194
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
3187 * @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
|
3188 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3189 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3190 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
|
3191 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
|
3192 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
|
3193 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
|
3194 final int[] types |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3195 ) throws SQLException |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3196 { |
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
|
3197 final StringBuilder query = new StringBuilder(990); |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3198 if (types != null && types.length > 0) { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3199 query.append("SELECT * FROM ("); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3200 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3201 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
|
3202 "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
|
3203 "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
|
3204 "CASE t.\"sqlname\"" + |
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
|
3205 // next 4 UDTs are standard |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3206 " WHEN 'inet' THEN 'nl.cwi.monetdb.jdbc.types.INET'" + |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3207 " WHEN 'json' THEN 'java.lang.String'" + |
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
|
3208 " WHEN 'url' THEN 'nl.cwi.monetdb.jdbc.types.URL'" + |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3209 " WHEN 'uuid' THEN 'java.lang.String'" + |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3210 " ELSE 'java.lang.Object' END AS \"CLASS_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
|
3211 "cast(CASE WHEN t.\"sqlname\" IN ('inet', 'json', 'url', 'uuid') THEN ").append(Types.JAVA_OBJECT) |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3212 .append(" ELSE ").append(Types.STRUCT).append(" 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
|
3213 "t.\"systemname\" AS \"REMARKS\", " + |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3214 "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
|
3215 "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
|
3216 "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
|
3217 // exclude the built-in types (I assume they always have id <= 99 and eclass < 15) |
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
|
3218 "WHERE t.\"id\" > 99 AND t.\"eclass\" >= 15"); |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3219 |
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
|
3220 if (catalog != null && !catalog.isEmpty()) { |
299
1f0324072b0c
Correcting typo in comment
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
298
diff
changeset
|
3221 // non-empty catalog selection. |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3222 // 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
|
3223 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
|
3224 } 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
|
3225 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
|
3226 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
|
3227 } |
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
|
3228 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
|
3229 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
|
3230 } |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3231 } |
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
|
3232 |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3233 if (types != null && types.length > 0) { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3234 query.append(") AS getUDTs WHERE \"DATA_TYPE\" IN ("); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3235 for (int i = 0; i < types.length; i++) { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3236 if (i > 0) { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3237 query.append(", "); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3238 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3239 query.append(types[i]); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3240 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3241 query.append(")"); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3242 } |
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
|
3243 |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3244 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
|
3245 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3246 return executeMetaDataQuery(query.toString()); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3247 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3248 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3249 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3250 * Retrieves the connection that produced this metadata object. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3251 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3252 * @return the connection that produced this metadata object |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3253 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3254 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3255 public Connection getConnection() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3256 return con; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3257 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3258 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3259 /* I don't find these in the spec!?! */ |
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
|
3260 public boolean rowChangesAreDetected(final int type) { |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3261 return false; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3262 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3263 |
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
|
3264 public boolean rowChangesAreVisible(final int type) { |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3265 return false; |
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 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3268 //== 1.4 methods (JDBC 3) |
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 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3271 * Retrieves whether this database supports savepoints. |
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 * @return <code>true</code> if savepoints are supported; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3274 * <code>false</code> otherwise |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3275 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3276 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3277 public boolean supportsSavepoints() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3278 return true; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3279 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3280 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3281 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3282 * 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
|
3283 * statements. |
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 * @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
|
3286 * <code>false</code> otherwise |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3287 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3288 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3289 public boolean supportsNamedParameters() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3290 return false; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3291 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3292 |
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 * 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
|
3295 * returned from a <code>CallableStatement</code> object |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3296 * simultaneously. |
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 * @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
|
3299 * can return multiple <code>ResultSet</code> objects |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3300 * simultaneously; <code>false</code> otherwise |
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 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3303 public boolean supportsMultipleOpenResults() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3304 return true; |
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 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3307 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3308 * 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
|
3309 * a statement has been executed. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3310 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3311 * @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
|
3312 * 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
|
3313 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3314 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3315 public boolean supportsGetGeneratedKeys() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3316 return true; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3317 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3318 |
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 * 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
|
3321 * 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
|
3322 * 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
|
3323 * <P> |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3324 * Only supertype information for UDTs matching the catalog, |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3325 * 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
|
3326 * 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
|
3327 * 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
|
3328 * ignored. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3329 * <P> |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3330 * 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
|
3331 * 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
|
3332 * 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
|
3333 * columns: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3334 * <OL> |
194
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
3335 * <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
|
3336 * <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
|
3337 * <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
|
3338 * <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
|
3339 * (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
|
3340 * <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
|
3341 * (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
|
3342 * <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
|
3343 * </OL> |
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 * <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
|
3346 * empty result set is returned. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3347 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3348 * @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
|
3349 * <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
|
3350 * @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
|
3351 * @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
|
3352 * @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
|
3353 * about the designated UDT |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3354 * @throws SQLException if a database access error occurs |
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 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3357 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
|
3358 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
|
3359 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
|
3360 final String typeNamePattern |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3361 ) throws SQLException |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3362 { |
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
|
3363 final String query = |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3364 "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
|
3365 "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
|
3366 "WHERE 1=0"; |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3367 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3368 return executeMetaDataQuery(query); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3369 } |
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 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3372 * 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
|
3373 * schema in this database. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3374 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3375 * <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
|
3376 * 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
|
3377 * 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
|
3378 * 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
|
3379 * 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
|
3380 * 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
|
3381 * this information for the supertable. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3382 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3383 * <P>Each type description has the following columns: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3384 * <OL> |
194
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
3385 * <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
|
3386 * <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
|
3387 * <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
|
3388 * <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
|
3389 * </OL> |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3390 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3391 * <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
|
3392 * empty result set is returned. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3393 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3394 * @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
|
3395 * <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
|
3396 * @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
|
3397 * @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
|
3398 * @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
|
3399 * @throws SQLException if a database access error occurs |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3400 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3401 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3402 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
|
3403 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
|
3404 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
|
3405 final String tableNamePattern |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3406 ) throws SQLException |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3407 { |
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
|
3408 final String query = |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3409 "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
|
3410 "'' 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
|
3411 "WHERE 1=0"; |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3412 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3413 return executeMetaDataQuery(query); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3414 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3415 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3416 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3417 * 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
|
3418 * 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
|
3419 * and catalog. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3420 * <P> |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3421 * 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
|
3422 * 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
|
3423 * 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
|
3424 * does not contain inherited attributes. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3425 * <P> |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3426 * 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
|
3427 * columns: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3428 * <OL> |
194
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
3429 * <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
|
3430 * <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
|
3431 * <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
|
3432 * <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
|
3433 * <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
|
3434 * <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
|
3435 * 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
|
3436 * 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
|
3437 * <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
|
3438 * 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
|
3439 * 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
|
3440 * <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
|
3441 * <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
|
3442 * <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
|
3443 * <UL> |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3444 * <LI> attributeNoNulls - might not allow NULL values |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3445 * <LI> attributeNullable - definitely allows NULL values |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3446 * <LI> attributeNullableUnknown - nullability unknown |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3447 * </UL> |
194
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
3448 * <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
|
3449 * <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
|
3450 * <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
|
3451 * <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
|
3452 * <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
|
3453 * 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
|
3454 * <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
|
3455 * (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
|
3456 * <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
|
3457 * 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
|
3458 * 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
|
3459 * <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
|
3460 * 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
|
3461 * <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
|
3462 * 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
|
3463 * <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
|
3464 * 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
|
3465 * <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
|
3466 * 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
|
3467 * isn't DISTINCT or user-generated REF) |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3468 * </OL> |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3469 * @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
|
3470 * 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
|
3471 * <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
|
3472 * the search |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3473 * @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
|
3474 * 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
|
3475 * <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
|
3476 * the search |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3477 * @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
|
3478 * 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
|
3479 * @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
|
3480 * name as it is declared in the database |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3481 * @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
|
3482 * attribute description |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3483 * @throws SQLException if a database access error occurs |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3484 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3485 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3486 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
|
3487 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
|
3488 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
|
3489 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
|
3490 final String attributeNamePattern |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3491 ) throws SQLException |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3492 { |
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
|
3493 final String query = |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3494 "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
|
3495 "'' 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
|
3496 "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
|
3497 "'' 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
|
3498 "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
|
3499 "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
|
3500 "'' 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
|
3501 "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
|
3502 "WHERE 1=0"; |
0
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 return executeMetaDataQuery(query); |
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 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3507 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3508 * 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
|
3509 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3510 * @param holdability one of the following constants: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3511 * <code>ResultSet.HOLD_CURSORS_OVER_COMMIT</code> or |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3512 * <code>ResultSet.CLOSE_CURSORS_AT_COMMIT</code> |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3513 * @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
|
3514 * @see Connection |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3515 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3516 @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
|
3517 public boolean supportsResultSetHoldability(final int holdability) { |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3518 // 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
|
3519 // 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
|
3520 return holdability == ResultSet.HOLD_CURSORS_OVER_COMMIT; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3521 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3522 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3523 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3524 * 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
|
3525 * object. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3526 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3527 * @return the default holdability; either |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3528 * <code>ResultSet.HOLD_CURSORS_OVER_COMMIT</code> or |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3529 * <code>ResultSet.CLOSE_CURSORS_AT_COMMIT</code> |
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 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3532 public int getResultSetHoldability() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3533 return ResultSet.HOLD_CURSORS_OVER_COMMIT; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3534 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3535 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3536 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3537 * 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
|
3538 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3539 * @return the underlying database's major version |
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 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
|
3544 return con.getDatabaseMajorVersion(); |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3545 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3546 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3547 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3548 * 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
|
3549 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3550 * @return underlying database's minor version |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3551 * @throws SQLException if a database access error occurs |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3552 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3553 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3554 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
|
3555 return con.getDatabaseMinorVersion(); |
0
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 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3559 * 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
|
3560 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3561 * @return JDBC version major number |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3562 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3563 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3564 public int getJDBCMajorVersion() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3565 return 4; // This class implements JDBC 4.1 (at least we try to) |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3566 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3567 |
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 * 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
|
3570 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3571 * @return JDBC version minor number |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3572 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3573 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3574 public int getJDBCMinorVersion() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3575 return 1; // This class implements JDBC 4.1 (at least we try to) |
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 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3578 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3579 * 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
|
3580 * 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
|
3581 * @return the type of SQLSTATEs, one of: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3582 * sqlStateXOpen or |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3583 * sqlStateSQL |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3584 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3585 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3586 public int getSQLStateType() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3587 // 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
|
3588 return DatabaseMetaData.sqlStateSQL; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3589 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3590 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3591 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3592 * 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
|
3593 * to the LOB. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3594 * @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
|
3595 * <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
|
3596 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3597 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3598 public boolean locatorsUpdateCopy() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3599 // 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
|
3600 return true; |
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 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3604 * Retrieves whether this database supports statement pooling. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3605 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3606 * @return <code>true</code> is so; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3607 <code>false</code> otherwise |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3608 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3609 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3610 public boolean supportsStatementPooling() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3611 // For the moment, I don't think so |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3612 return false; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3613 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3614 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3615 //== 1.6 methods (JDBC 4) |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3616 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3617 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3618 * 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
|
3619 * 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
|
3620 * valid. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3621 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3622 * @return ROWID_UNSUPPORTED for now |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3623 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3624 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3625 public RowIdLifetime getRowIdLifetime() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3626 // I believe we don't do rowids |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3627 return RowIdLifetime.ROWID_UNSUPPORTED; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3628 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3629 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3630 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3631 * 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
|
3632 * are ordered by schema name. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3633 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3634 * <P>The schema column is: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3635 * <OL> |
194
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
3636 * <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
|
3637 * <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
|
3638 * </OL> |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3639 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3640 * @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
|
3641 * schema name |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3642 * @throws SQLException if a database error occurs |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3643 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3644 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3645 public ResultSet getSchemas() throws SQLException { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3646 return getSchemas(null, null); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3647 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3648 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3649 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3650 * 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
|
3651 * vendor functions using the stored procedure escape syntax. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3652 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3653 * @return true if so; false otherwise |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3654 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3655 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3656 public boolean supportsStoredFunctionsUsingCallSyntax() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3657 return false; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3658 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3659 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3660 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3661 * Retrieves whether a SQLException while autoCommit is true |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3662 * 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
|
3663 * 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
|
3664 * 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
|
3665 * 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
|
3666 * 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
|
3667 * or not holdable ResultSets are closed. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3668 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3669 * @return true if so; false otherwise |
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 boolean autoCommitFailureClosesAllResultSets() { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3673 // 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
|
3674 // 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
|
3675 // failure either. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3676 return false; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3677 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3678 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3679 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3680 * Retrieves a list of the client info properties that the driver |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3681 * supports. The result set contains the following columns |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3682 * |
194
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
3683 * 1. NAME String => The name of the client info property |
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
3684 * 2. MAX_LEN int => The maximum length of the value for the |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3685 * property |
194
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
3686 * 3. DEFAULT_VALUE String => The default value of the |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3687 * property |
194
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
3688 * 4. DESCRIPTION String => A description of the |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3689 * property. This will typically contain information as |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3690 * to where this property is stored in the database. |
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 * The ResultSet is sorted by the NAME column |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3693 * |
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
|
3694 * @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
|
3695 * @throws SQLException if a database access error occurs |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3696 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3697 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3698 public ResultSet getClientInfoProperties() throws SQLException { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3699 // for a list of connection properties see also MonetConnection.java constructor MonetConnection(Properties props) |
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
|
3700 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
|
3701 "SELECT 'host' AS \"NAME\", cast(1024 as int) AS \"MAX_LEN\", 'localhost' AS \"DEFAULT_VALUE\", 'DSN or IP-address of machine running MonetDB' AS \"DESCRIPTION\" UNION ALL " + |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3702 "SELECT 'port', 5, '50000', 'communication port number of MonetDB server process' UNION ALL " + |
15
6e48d0fae766
Corrected return values of DatabaseMetaData methods nullsAreSortedHigh(), nullsAreSortedLow(),
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
7
diff
changeset
|
3703 "SELECT 'user', 1024, '', 'user name to login to MonetDB server' UNION ALL " + |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3704 "SELECT 'password', 128, '', 'password for user name to login to MonetDB server' UNION ALL " + |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3705 "SELECT 'language', 16, 'sql', 'language (sql or mal) used to parse commands in MonetDB server' UNION ALL " + |
46
5d4524c27902
Added missing database connection property to output of method getClientInfoProperties()
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
25
diff
changeset
|
3706 "SELECT 'database', 1024, 'demo', 'name of database. It matches the dbfarm subdirectory name' UNION ALL " + |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3707 "SELECT 'debug', 5, 'false', 'boolean flag true or false' UNION ALL " + |
177
4959b85b981c
Extend DatabaseMetaData.getClientInfoProperties() with new property: treat_clob_as_varchar
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
168
diff
changeset
|
3708 "SELECT 'logfile', 1024, 'monet_######.log', 'name of logfile used when debug is enabled' UNION ALL " + |
363
34ce6e1b1be8
Remove support for deprecated MD5 encryption algorithm in MapiSocket.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
356
diff
changeset
|
3709 "SELECT 'hash', 128, '', 'hash methods list to use in server connection. Supported are SHA512, SHA384, SHA256 and SHA1' UNION ALL " + |
177
4959b85b981c
Extend DatabaseMetaData.getClientInfoProperties() with new property: treat_clob_as_varchar
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
168
diff
changeset
|
3710 "SELECT 'treat_blob_as_binary', 5, 'false', 'should blob columns be mapped to Types.VARBINARY instead of default Types.BLOB in ResultSets and PreparedStatements' UNION ALL " + |
4959b85b981c
Extend DatabaseMetaData.getClientInfoProperties() with new property: treat_clob_as_varchar
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
168
diff
changeset
|
3711 "SELECT 'treat_clob_as_varchar', 5, 'false', 'should clob columns be mapped to Types.VARCHAR instead of default Types.CLOB in ResultSets and PreparedStatements' UNION ALL " + |
53
6cc63d6cb224
Implemented fix as suggested in Bug 3973
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
46
diff
changeset
|
3712 "SELECT 'so_timeout', 10, '0', 'timeout (in milliseconds) of communication socket. 0 means no timeout is set' " + |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3713 "ORDER BY \"NAME\""; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3714 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3715 return executeMetaDataQuery(query); |
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 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3718 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3719 * 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
|
3720 * available in the given catalog. |
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 * 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
|
3723 * 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
|
3724 * 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
|
3725 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3726 * Each function description has the the following columns: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3727 * |
194
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
3728 * 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
|
3729 * 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
|
3730 * 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
|
3731 * 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
|
3732 * 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
|
3733 * 5. FUNCTION_TYPE short => kind of function: |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3734 * * functionResultUnknown - Cannot determine if a return |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3735 * value or table will be returned |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3736 * * functionNoTable- Does not return a table |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3737 * * 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
|
3738 * 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
|
3739 * 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
|
3740 * 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
|
3741 * FUNCTION_NAME for example with overload functions |
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 * 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
|
3744 * that are returned by getFunctions. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3745 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3746 * @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
|
3747 * 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
|
3748 * 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
|
3749 * used to narrow the search |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3750 * @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
|
3751 * 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
|
3752 * 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
|
3753 * not be used to narrow the search |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3754 * @param functionNamePattern a function name pattern; must match |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3755 * the function name as it is stored in the database |
245
55375d489024
Corrected return values of DatabaseMetaData methods allTablesAreSelectable() and allProceduresAreCallable().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
231
diff
changeset
|
3756 * 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
|
3757 * @return ResultSet - each row is a function description |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3758 * @throws SQLException if a database access error occurs |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3759 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3760 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3761 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
|
3762 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
|
3763 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
|
3764 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
|
3765 ) throws SQLException |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3766 { |
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
|
3767 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
|
3768 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
|
3769 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
|
3770 "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
|
3771 "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
|
3772 .append(useCommentsTable ? "COALESCE(cm.\"remark\", cast(f.\"func\" as varchar(9999)))" : "cast(f.\"func\" 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
|
3773 "CASE f.\"type\"" + |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3774 " WHEN 1 THEN ").append(DatabaseMetaData.functionNoTable) |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3775 .append(" WHEN 2 THEN ").append(DatabaseMetaData.functionNoTable) |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3776 .append(" WHEN 3 THEN ").append(DatabaseMetaData.functionNoTable) |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3777 .append(" WHEN 4 THEN ").append(DatabaseMetaData.functionNoTable) |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3778 .append(" WHEN 5 THEN ").append(DatabaseMetaData.functionReturnsTable) |
218
5cc7101c5c8d
Corrected method DatabaseMetaData.getFunctions().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
217
diff
changeset
|
3779 .append(" WHEN 6 THEN ").append(DatabaseMetaData.functionNoTable) |
222
75a5b5754020
Correction: Loader functions (type = 7) should return a table.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
220
diff
changeset
|
3780 .append(" WHEN 7 THEN ").append(DatabaseMetaData.functionReturnsTable) |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3781 .append(" ELSE ").append(DatabaseMetaData.functionResultUnknown).append(" END AS \"FUNCTION_TYPE\", " + |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3782 // 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
|
3783 "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
|
3784 "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
|
3785 "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
|
3786 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
|
3787 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
|
3788 } |
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
|
3789 // 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
|
3790 query.append("WHERE f.\"type\" <> 2"); |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3791 |
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
|
3792 if (catalog != null && !catalog.isEmpty()) { |
299
1f0324072b0c
Correcting typo in comment
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
298
diff
changeset
|
3793 // non-empty catalog selection. |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3794 // 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
|
3795 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
|
3796 } 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
|
3797 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
|
3798 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
|
3799 } |
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
|
3800 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
|
3801 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
|
3802 } |
0
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 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3805 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
|
3806 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3807 return executeMetaDataQuery(query.toString()); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3808 } |
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 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3811 * 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
|
3812 * function parameters and return type. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3813 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3814 * 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
|
3815 * 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
|
3816 * 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
|
3817 * The column descriptions follow in column number order. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3818 * |
194
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
3819 * 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
|
3820 * 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
|
3821 * 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
|
3822 * 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
|
3823 * 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
|
3824 * functionColumnUnknown - nobody knows |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3825 * functionColumnIn - IN parameter |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3826 * functionColumnInOut - INOUT parameter |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3827 * functionColumnOut - OUT parameter |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3828 * functionColumnReturn - function return value |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3829 * 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
|
3830 * 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
|
3831 * 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
|
3832 * 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
|
3833 * 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
|
3834 * 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
|
3835 * 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
|
3836 * 12. NULLABLE short => can it contain NULL. |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3837 * functionNoNulls - does not allow NULL values |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3838 * functionNullable - allows NULL values |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3839 * 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
|
3840 * 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
|
3841 * 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
|
3842 * 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
|
3843 * 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
|
3844 * 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
|
3845 * 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
|
3846 * 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
|
3847 * 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
|
3848 * 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
|
3849 * 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
|
3850 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3851 * @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
|
3852 * 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
|
3853 * 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
|
3854 * used to narrow the search |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3855 * @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
|
3856 * 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
|
3857 * 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
|
3858 * not be used to narrow the search |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3859 * @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
|
3860 * function name as it is stored in the database |
245
55375d489024
Corrected return values of DatabaseMetaData methods allTablesAreSelectable() and allProceduresAreCallable().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
231
diff
changeset
|
3861 * 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
|
3862 * @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
|
3863 * parameter or column name as it is stored in the database |
245
55375d489024
Corrected return values of DatabaseMetaData methods allTablesAreSelectable() and allProceduresAreCallable().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
231
diff
changeset
|
3864 * 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
|
3865 * @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
|
3866 * column or return type |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3867 * @throws SQLException - if a database access error occurs |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3868 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3869 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3870 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
|
3871 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
|
3872 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
|
3873 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
|
3874 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
|
3875 ) throws SQLException |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3876 { |
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
|
3877 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
|
3878 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
|
3879 "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
|
3880 "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
|
3881 "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
|
3882 "cast(CASE a.\"inout\"" + |
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
|
3883 " WHEN 0 THEN (CASE a.\"number\" WHEN 0 THEN ") |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3884 .append(DatabaseMetaData.functionReturn).append(" ELSE ").append(DatabaseMetaData.functionColumnOut).append(" END)" + |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3885 " WHEN 1 THEN ").append(DatabaseMetaData.functionColumnIn) |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3886 .append(" ELSE ").append(DatabaseMetaData.functionColumnUnknown).append(" 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
|
3887 "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
|
3888 "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
|
3889 "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
|
3890 " 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
|
3891 "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
|
3892 " 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
|
3893 "cast(CASE WHEN a.\"type\" IN ('tinyint','smallint','int','bigint','hugeint','oid','wrd','decimal','numeric'," + |
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
|
3894 "'time','timetz','timestamp','timestamptz','sec_interval') THEN a.\"type_scale\" ELSE NULL END AS smallint) AS \"SCALE\", " + |
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
|
3895 "cast(CASE WHEN a.\"type\" IN ('tinyint','smallint','int','bigint','hugeint','oid','wrd','decimal','numeric') THEN 10" + |
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
|
3896 " WHEN a.\"type\" IN ('real','float','double') THEN 2 ELSE NULL END AS smallint) AS \"RADIX\", " + |
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
|
3897 "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
|
3898 "cast(null as char(1)) AS \"REMARKS\", " + |
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
|
3899 "cast(CASE WHEN a.\"type\" IN ('char','varchar','clob') THEN a.\"type_digits\" ELSE NULL END as int) AS \"CHAR_OCTET_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
|
3900 "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
|
3901 "cast('' as varchar(3)) AS \"IS_NULLABLE\", " + |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3902 // 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
|
3903 "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
|
3904 "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
|
3905 "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
|
3906 "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
|
3907 // 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
|
3908 "WHERE f.\"type\" <> 2"); |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3909 |
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
|
3910 if (catalog != null && !catalog.isEmpty()) { |
299
1f0324072b0c
Correcting typo in comment
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
298
diff
changeset
|
3911 // non-empty catalog selection. |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3912 // 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
|
3913 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
|
3914 } 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
|
3915 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
|
3916 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
|
3917 } |
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
|
3918 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
|
3919 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
|
3920 } |
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
|
3921 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
|
3922 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
|
3923 } |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3924 } |
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
|
3925 |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3926 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
|
3927 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3928 return executeMetaDataQuery(query.toString()); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3929 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3930 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3931 //== 1.7 methods (JDBC 4.1) |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3932 |
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 * 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
|
3935 * 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
|
3936 * 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
|
3937 * 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
|
3938 * 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
|
3939 * necessarily be able to be modified. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3940 * 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
|
3941 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3942 * 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
|
3943 * 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
|
3944 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3945 * Each column description has the following columns: |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3946 * |
194
1296dbcc4958
Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
186
diff
changeset
|
3947 * 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
|
3948 * 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
|
3949 * 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
|
3950 * 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
|
3951 * 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
|
3952 * 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
|
3953 * 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
|
3954 * 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
|
3955 * 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
|
3956 * 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
|
3957 * 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
|
3958 * 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
|
3959 * YES --- if the column can include NULLs |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3960 * NO --- if the column cannot include NULLs |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3961 * 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
|
3962 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3963 * @param catalog a catalog name |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3964 * @param schemaPattern a schema name pattern |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3965 * @param tableNamePattern a table name pattern |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3966 * @param columnNamePattern a column name pattern |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3967 * @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
|
3968 * @throws SQLException if a database access error occurs |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3969 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3970 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3971 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
|
3972 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
|
3973 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
|
3974 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
|
3975 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
|
3976 ) throws SQLException |
0
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 // 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
|
3979 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
|
3980 "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
|
3981 "'' 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
|
3982 "'' 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
|
3983 "'' 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
|
3984 "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
|
3985 "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
|
3986 "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
|
3987 "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
|
3988 "'' 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
|
3989 "'' 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
|
3990 "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
|
3991 "'' 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
|
3992 "WHERE 1=0"; |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3993 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3994 return executeMetaDataQuery(query); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3995 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3996 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3997 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
3998 * 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
|
3999 * 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
|
4000 * 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
|
4001 * 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
|
4002 * generated key. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
4003 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
4004 * @return true if so, false otherwise |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
4005 * @throws SQLException - if a database access error occurs |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
4006 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
4007 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
4008 public boolean generatedKeyAlwaysReturned() throws SQLException { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
4009 return true; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
4010 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
4011 |
264
d31b99f06b26
Implemented two new 1.8 methods (JDBC 4.2)
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
263
diff
changeset
|
4012 //== 1.8 methods (JDBC 4.2) |
d31b99f06b26
Implemented two new 1.8 methods (JDBC 4.2)
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
263
diff
changeset
|
4013 |
d31b99f06b26
Implemented two new 1.8 methods (JDBC 4.2)
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
263
diff
changeset
|
4014 /** |
d31b99f06b26
Implemented two new 1.8 methods (JDBC 4.2)
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
263
diff
changeset
|
4015 * 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
|
4016 * The default implementation will return 0 |
d31b99f06b26
Implemented two new 1.8 methods (JDBC 4.2)
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
263
diff
changeset
|
4017 * @return the maximum number of bytes |
d31b99f06b26
Implemented two new 1.8 methods (JDBC 4.2)
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
263
diff
changeset
|
4018 */ |
d31b99f06b26
Implemented two new 1.8 methods (JDBC 4.2)
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
263
diff
changeset
|
4019 @Override |
d31b99f06b26
Implemented two new 1.8 methods (JDBC 4.2)
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
263
diff
changeset
|
4020 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
|
4021 return 0; |
d31b99f06b26
Implemented two new 1.8 methods (JDBC 4.2)
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
263
diff
changeset
|
4022 } |
d31b99f06b26
Implemented two new 1.8 methods (JDBC 4.2)
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
263
diff
changeset
|
4023 |
d31b99f06b26
Implemented two new 1.8 methods (JDBC 4.2)
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
263
diff
changeset
|
4024 /** |
d31b99f06b26
Implemented two new 1.8 methods (JDBC 4.2)
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
263
diff
changeset
|
4025 * 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
|
4026 * The default implementation will return false |
d31b99f06b26
Implemented two new 1.8 methods (JDBC 4.2)
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
263
diff
changeset
|
4027 * @return true if so, false otherwise |
d31b99f06b26
Implemented two new 1.8 methods (JDBC 4.2)
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
263
diff
changeset
|
4028 */ |
d31b99f06b26
Implemented two new 1.8 methods (JDBC 4.2)
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
263
diff
changeset
|
4029 @Override |
d31b99f06b26
Implemented two new 1.8 methods (JDBC 4.2)
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
263
diff
changeset
|
4030 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
|
4031 return false; |
d31b99f06b26
Implemented two new 1.8 methods (JDBC 4.2)
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
263
diff
changeset
|
4032 } |
d31b99f06b26
Implemented two new 1.8 methods (JDBC 4.2)
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
263
diff
changeset
|
4033 |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
4034 //== 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
|
4035 |
a91168efdf27
Small code and doc improvements. Moved helper functions to the bottom.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
302
diff
changeset
|
4036 |
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
|
4037 //== 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
|
4038 |
e8962bdaa206
Moved utility methods and associated caches from DatabaseMetaData to Connection object.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
331
diff
changeset
|
4039 /** |
e8962bdaa206
Moved utility methods and associated caches from DatabaseMetaData to Connection object.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
331
diff
changeset
|
4040 * 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
|
4041 * 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
|
4042 * we set it to close (and free server resources) when the ResultSet object 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
|
4043 */ |
e8962bdaa206
Moved utility methods and associated caches from DatabaseMetaData to Connection object.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
331
diff
changeset
|
4044 private ResultSet executeMetaDataQuery(final String query) throws SQLException { |
e8962bdaa206
Moved utility methods and associated caches from DatabaseMetaData to Connection object.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
331
diff
changeset
|
4045 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
|
4046 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
|
4047 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
|
4048 // 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
|
4049 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
|
4050 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
|
4051 /* 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
|
4052 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
|
4053 } 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
|
4054 /* 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
|
4055 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
|
4056 } |
e8962bdaa206
Moved utility methods and associated caches from DatabaseMetaData to Connection object.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
331
diff
changeset
|
4057 } |
e8962bdaa206
Moved utility methods and associated caches from DatabaseMetaData to Connection object.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
331
diff
changeset
|
4058 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
|
4059 } |
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
|
4060 |
a91168efdf27
Small code and doc improvements. Moved helper functions to the bottom.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
302
diff
changeset
|
4061 /** |
a91168efdf27
Small code and doc improvements. Moved helper functions to the bottom.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
302
diff
changeset
|
4062 * Returns a SQL match part string where depending on the input value we |
a91168efdf27
Small code and doc improvements. Moved helper functions to the bottom.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
302
diff
changeset
|
4063 * compose an exact match (use =) or match with wildcards (use LIKE) or 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
|
4064 * |
a91168efdf27
Small code and doc improvements. Moved helper functions to the bottom.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
302
diff
changeset
|
4065 * @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
|
4066 * @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
|
4067 */ |
a91168efdf27
Small code and doc improvements. Moved helper functions to the bottom.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
302
diff
changeset
|
4068 private static final String composeMatchPart(final String in) { |
a91168efdf27
Small code and doc improvements. Moved helper functions to the bottom.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
302
diff
changeset
|
4069 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
|
4070 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
|
4071 |
a91168efdf27
Small code and doc improvements. Moved helper functions to the bottom.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
302
diff
changeset
|
4072 String cmp = "= '"; |
a91168efdf27
Small code and doc improvements. Moved helper functions to the bottom.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
302
diff
changeset
|
4073 // check if SQL wildcards are used in the input, if so use LIKE |
a91168efdf27
Small code and doc improvements. Moved helper functions to the bottom.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
302
diff
changeset
|
4074 if (in.contains("%") || in.contains("_")) |
a91168efdf27
Small code and doc improvements. Moved helper functions to the bottom.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
302
diff
changeset
|
4075 cmp = "LIKE '"; |
a91168efdf27
Small code and doc improvements. Moved helper functions to the bottom.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
302
diff
changeset
|
4076 |
a91168efdf27
Small code and doc improvements. Moved helper functions to the bottom.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
302
diff
changeset
|
4077 String val = in; |
a91168efdf27
Small code and doc improvements. Moved helper functions to the bottom.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
302
diff
changeset
|
4078 if (in.contains("\\") || in.contains("'")) |
a91168efdf27
Small code and doc improvements. Moved helper functions to the bottom.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
302
diff
changeset
|
4079 // all slashes and single quotes in input are escaped with a slash. |
a91168efdf27
Small code and doc improvements. Moved helper functions to the bottom.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
302
diff
changeset
|
4080 val = in.replaceAll("\\\\", "\\\\\\\\").replaceAll("'", "\\\\'"); |
a91168efdf27
Small code and doc improvements. Moved helper functions to the bottom.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
302
diff
changeset
|
4081 |
a91168efdf27
Small code and doc improvements. Moved helper functions to the bottom.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
302
diff
changeset
|
4082 return cmp + val + "'"; |
a91168efdf27
Small code and doc improvements. Moved helper functions to the bottom.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
302
diff
changeset
|
4083 } |
a91168efdf27
Small code and doc improvements. Moved helper functions to the bottom.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
302
diff
changeset
|
4084 |
a91168efdf27
Small code and doc improvements. Moved helper functions to the bottom.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
302
diff
changeset
|
4085 /** |
a91168efdf27
Small code and doc improvements. Moved helper functions to the bottom.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
302
diff
changeset
|
4086 * Returns the given string between two double quotes for usage as |
a91168efdf27
Small code and doc improvements. Moved helper functions to the bottom.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
302
diff
changeset
|
4087 * exact column or table name in SQL queries. |
a91168efdf27
Small code and doc improvements. Moved helper functions to the bottom.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
302
diff
changeset
|
4088 * |
a91168efdf27
Small code and doc improvements. Moved helper functions to the bottom.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
302
diff
changeset
|
4089 * @param in the string to quote |
a91168efdf27
Small code and doc improvements. Moved helper functions to the bottom.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
302
diff
changeset
|
4090 * @return the quoted 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
|
4091 */ |
a91168efdf27
Small code and doc improvements. Moved helper functions to the bottom.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
302
diff
changeset
|
4092 // @SuppressWarnings("unused") |
a91168efdf27
Small code and doc improvements. Moved helper functions to the bottom.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
302
diff
changeset
|
4093 // private static final String dq(String in) { |
a91168efdf27
Small code and doc improvements. Moved helper functions to the bottom.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
302
diff
changeset
|
4094 // return "\"" + in.replaceAll("\\\\", "\\\\\\\\").replaceAll("\"", "\\\\\"") + "\""; |
a91168efdf27
Small code and doc improvements. Moved helper functions to the bottom.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
302
diff
changeset
|
4095 // } |
a91168efdf27
Small code and doc improvements. Moved helper functions to the bottom.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
302
diff
changeset
|
4096 |
a91168efdf27
Small code and doc improvements. Moved helper functions to the bottom.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
302
diff
changeset
|
4097 //== end helper methods |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
4098 } |