117c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpepackage SQLite.JDBC2z;
2417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
3417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughesimport java.sql.*;
4417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughesimport java.util.Hashtable;
5417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
6417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughespublic class JDBCDatabaseMetaData implements DatabaseMetaData {
7417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
8417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    private JDBCConnection conn;
9417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
10417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public JDBCDatabaseMetaData(JDBCConnection conn) {
117a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	this.conn = conn;
12417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
13417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
14417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public boolean allProceduresAreCallable() throws SQLException {
157a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	return false;
16417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
17417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
18417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public boolean allTablesAreSelectable() throws SQLException {
197a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	return true;
20417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
21417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
22417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public String getURL() throws SQLException {
237a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	return conn.url;
24417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
25417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
26417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public String getUserName() throws SQLException {
277a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	return "";
28417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
29417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
30417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public boolean isReadOnly() throws SQLException {
317a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	return false;
32417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
33417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
34417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public boolean nullsAreSortedHigh() throws SQLException {
357a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	return false;
36417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
37417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
38417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public boolean nullsAreSortedLow() throws SQLException {
397a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	return false;
40417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
41417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
42417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public boolean nullsAreSortedAtStart() throws SQLException {
437a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	return false;
44417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
45417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
46417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public boolean nullsAreSortedAtEnd() throws SQLException {
477a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	return false;
48417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
49417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
50417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public String getDatabaseProductName() throws SQLException {
517a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	return "SQLite";
52417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
53417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
54417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public String getDatabaseProductVersion() throws SQLException {
557a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	return SQLite.Database.version();
56417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
57417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
58417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public String getDriverName() throws SQLException {
597a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	return "SQLite/JDBC";
60417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
61417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
62417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public String getDriverVersion() throws SQLException {
637a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	return "" + SQLite.JDBCDriver.MAJORVERSION + "." +
647a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    SQLite.Constants.drv_minor;
65417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
66417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
67417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public int getDriverMajorVersion() {
687a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	return SQLite.JDBCDriver.MAJORVERSION;
69417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
70417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
71417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public int getDriverMinorVersion() {
727a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	return SQLite.Constants.drv_minor;
73417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
74417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
75417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public boolean usesLocalFiles() throws SQLException {
767a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	return true;
77417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
78417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
79417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public boolean usesLocalFilePerTable() throws SQLException {
807a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	return false;
81417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
82417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
83417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public boolean supportsMixedCaseIdentifiers() throws SQLException {
847a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	return false;
85417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
86417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
87417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public boolean storesUpperCaseIdentifiers() throws SQLException {
887a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	return false;
89417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
90417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
91417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public boolean storesLowerCaseIdentifiers() throws SQLException {
927a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	return false;
93417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
94417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
95417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public boolean storesMixedCaseIdentifiers() throws SQLException {
967a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	return true;
97417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
98417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
99417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public boolean supportsMixedCaseQuotedIdentifiers() throws SQLException {
1007a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	return false;
101417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
102417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
103417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public boolean storesUpperCaseQuotedIdentifiers() throws SQLException {
1047a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	return false;
105417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
106417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
107417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public boolean storesLowerCaseQuotedIdentifiers() throws SQLException {
1087a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	return false;
109417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
110417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
111417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public boolean storesMixedCaseQuotedIdentifiers() throws SQLException {
1127a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	return true;
113417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
114417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
115417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public String getIdentifierQuoteString() throws SQLException {
1167a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	return "\"";
117417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
118417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
119417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public String getSQLKeywords() throws SQLException {
1207a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	return "SELECT,UPDATE,CREATE,TABLE,VIEW,DELETE,FROM,WHERE" +
1217a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    ",COMMIT,ROLLBACK,TRIGGER";
122417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
123417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
124417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public String getNumericFunctions() throws SQLException {
1257a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	return "";
126417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
127417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
128417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public String getStringFunctions() throws SQLException {
1297a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	return "";
130417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
131417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
132417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public String getSystemFunctions() throws SQLException {
1337a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	return "";
134417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
135417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
136417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public String getTimeDateFunctions() throws SQLException {
1377a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	return "";
138417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
139417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
140417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public String getSearchStringEscape() throws SQLException {
1417a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	return "\\";
142417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
143417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
144417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public String getExtraNameCharacters() throws SQLException {
1457a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	return "";
146417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
147417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
148417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public boolean supportsAlterTableWithAddColumn() throws SQLException {
1497a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	return false;
150417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
151417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
152417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public boolean supportsAlterTableWithDropColumn() throws SQLException {
1537a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	return false;
154417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
155417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
156417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public boolean supportsColumnAliasing() throws SQLException {
1577a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	return true;
158417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
159417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
160417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public boolean nullPlusNonNullIsNull() throws SQLException {
1617a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	return false;
162417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
163417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
164417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public boolean supportsConvert() throws SQLException {
1657a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	return false;
166417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
167417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
168417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public boolean supportsConvert(int fromType, int toType)
1697a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	throws SQLException {
1707a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	return false;
171417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
172417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
173417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public boolean supportsTableCorrelationNames() throws SQLException {
1747a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	return true;
175417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
176417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
177417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public boolean supportsDifferentTableCorrelationNames()
1787a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	throws SQLException {
1797a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	return false;
180417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
181417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
182417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public boolean supportsExpressionsInOrderBy() throws SQLException {
1837a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	return true;
184417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
185417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
186417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public boolean supportsOrderByUnrelated() throws SQLException {
1877a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	return true;
188417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
189417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
190417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public boolean supportsGroupBy() throws SQLException {
1917a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	return true;
192417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
193417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
194417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public boolean supportsGroupByUnrelated() throws SQLException {
1957a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	return true;
196417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
197417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
198417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public boolean supportsGroupByBeyondSelect() throws SQLException {
1997a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	return false;
200417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
201417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
202417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public boolean supportsLikeEscapeClause() throws SQLException {
2037a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	return false;
204417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
205417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
206417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public boolean supportsMultipleResultSets() throws SQLException {
2077a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	return false;
208417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
209417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
210417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public boolean supportsMultipleTransactions() throws SQLException {
2117a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	return false;
212417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
213417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
214417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public boolean supportsNonNullableColumns() throws SQLException {
2157a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	return true;
216417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
217417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
218417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public boolean supportsMinimumSQLGrammar() throws SQLException {
2197a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	return true;
220417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
221417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
222417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public boolean supportsCoreSQLGrammar() throws SQLException {
2237a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	return false;
224417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
225417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
226417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public boolean supportsExtendedSQLGrammar() throws SQLException {
2277a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	return false;
228417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
229417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
230417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public boolean supportsANSI92EntryLevelSQL() throws SQLException {
2317a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	return true;
232417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
233417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
234417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public boolean supportsANSI92IntermediateSQL() throws SQLException {
2357a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	return false;
236417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
237417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
238417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public boolean supportsANSI92FullSQL() throws SQLException {
2397a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	return false;
240417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
241417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
242417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public boolean supportsIntegrityEnhancementFacility()
2437a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	throws SQLException {
2447a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	return false;
245417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
246417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
247417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public boolean supportsOuterJoins() throws SQLException {
2487a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	return false;
249417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
250417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
251417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public boolean supportsFullOuterJoins() throws SQLException {
2527a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	return false;
253417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
254417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
255417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public boolean supportsLimitedOuterJoins() throws SQLException {
2567a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	return false;
257417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
258417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
259417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public String getSchemaTerm() throws SQLException {
2607a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	return "";
261417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
262417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
263417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public String getProcedureTerm() throws SQLException {
2647a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	return "";
265417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
266417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
267417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public String getCatalogTerm() throws SQLException {
2687a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	return "";
269417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
270417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
271417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public boolean isCatalogAtStart() throws SQLException {
2727a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	return false;
273417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
274417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
275417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public String getCatalogSeparator() throws SQLException {
2767a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	return "";
277417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
278417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
279417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public boolean supportsSchemasInDataManipulation() throws SQLException {
2807a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	return false;
281417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
282417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
283417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public boolean supportsSchemasInProcedureCalls() throws SQLException {
2847a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	return false;
285417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
286417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
287417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public boolean supportsSchemasInTableDefinitions() throws SQLException {
2887a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	return false;
289417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
290417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
291417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public boolean supportsSchemasInIndexDefinitions() throws SQLException {
2927a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	return false;
293417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
294417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
295417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public boolean supportsSchemasInPrivilegeDefinitions()
2967a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	throws SQLException {
2977a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	return false;
298417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
299417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
300417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public boolean supportsCatalogsInDataManipulation() throws SQLException {
3017a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	return false;
302417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
303417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
304417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public boolean supportsCatalogsInProcedureCalls() throws SQLException {
3057a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	return false;
306417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
307417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
308417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public boolean supportsCatalogsInTableDefinitions() throws SQLException {
3097a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	return false;
310417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
311417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
312417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public boolean supportsCatalogsInIndexDefinitions() throws SQLException {
3137a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	return false;
314417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
315417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
316417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public boolean supportsCatalogsInPrivilegeDefinitions()
3177a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	throws SQLException {
3187a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	return false;
319417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
320417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
321417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public boolean supportsPositionedDelete() throws SQLException {
3227a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	return false;
323417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
324417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
325417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public boolean supportsPositionedUpdate() throws SQLException {
3267a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	return false;
327417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
328417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
329417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public boolean supportsSelectForUpdate() throws SQLException {
3307a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	return false;
331417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
332417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
333417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public boolean supportsStoredProcedures() throws SQLException {
3347a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	return false;
335417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
336417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
337417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public boolean supportsSubqueriesInComparisons() throws SQLException {
3387a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	return true;
339417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
340417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
341417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public boolean supportsSubqueriesInExists() throws SQLException {
3427a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	return true;
343417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
344417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
345417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public boolean supportsSubqueriesInIns() throws SQLException {
3467a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	return true;
347417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
348417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
349417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public boolean supportsSubqueriesInQuantifieds() throws SQLException {
3507a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	return false;
351417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
352417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
353417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public boolean supportsCorrelatedSubqueries() throws SQLException {
3547a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	return false;
355417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
356417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
357417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public boolean supportsUnion() throws SQLException {
3587a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	return true;
359417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
360417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
361417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public boolean supportsUnionAll() throws SQLException {
3627a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	return true;
363417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
364417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
365417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public boolean supportsOpenCursorsAcrossCommit() throws SQLException {
3667a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	return false;
367417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
368417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
369417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public boolean supportsOpenCursorsAcrossRollback() throws SQLException {
3707a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	return false;
371417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
372417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
373417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public boolean supportsOpenStatementsAcrossCommit() throws SQLException {
3747a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	return false;
375417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
376417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
377417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public boolean supportsOpenStatementsAcrossRollback() throws SQLException {
3787a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	return false;
379417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
380417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
381417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public int getMaxBinaryLiteralLength() throws SQLException {
3827a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	return 0;
383417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
384417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
385417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public int getMaxCharLiteralLength() throws SQLException {
3867a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	return 0;
387417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
388417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
389417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public int getMaxColumnNameLength() throws SQLException {
3907a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	return 0;
391417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
392417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
393417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public int getMaxColumnsInGroupBy() throws SQLException {
3947a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	return 0;
395417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
396417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
397417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public int getMaxColumnsInIndex() throws SQLException {
3987a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	return 0;
399417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
400417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
401417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public int getMaxColumnsInOrderBy() throws SQLException {
4027a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	return 0;
403417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
404417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
405417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public int getMaxColumnsInSelect() throws SQLException {
4067a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	return 0;
407417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
408417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
409417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public int getMaxColumnsInTable() throws SQLException {
4107a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	return 0;
411417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
412417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
413417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public int getMaxConnections() throws SQLException {
4147a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	return 0;
415417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
416417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
417417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public int getMaxCursorNameLength() throws SQLException {
4187a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	return 8;
419417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
420417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
421417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public int getMaxIndexLength() throws SQLException {
4227a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	return 0;
423417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
424417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
425417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public int getMaxSchemaNameLength() throws SQLException {
4267a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	return 0;
427417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
428417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
429417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public int getMaxProcedureNameLength() throws SQLException {
4307a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	return 0;
431417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
432417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
433417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public int getMaxCatalogNameLength() throws SQLException {
4347a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	return 0;
435417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
436417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
437417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public int getMaxRowSize() throws SQLException {
4387a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	return 0;
439417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
440417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
441417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public boolean doesMaxRowSizeIncludeBlobs() throws SQLException {
4427a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	return true;
443417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
444417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
445417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public int getMaxStatementLength() throws SQLException {
4467a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	return 0;
447417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
448417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
449417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public int getMaxStatements() throws SQLException {
4507a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	return 0;
451417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
452417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
453417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public int getMaxTableNameLength() throws SQLException {
4547a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	return 0;
455417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
456417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
457417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public int getMaxTablesInSelect() throws SQLException {
4587a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	return 0;
459417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
460417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
461417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public int getMaxUserNameLength() throws SQLException {
4627a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	return 0;
463417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
464417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
465417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public int getDefaultTransactionIsolation() throws SQLException {
4667a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	return Connection.TRANSACTION_SERIALIZABLE;
467417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
468417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
469417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public boolean supportsTransactions() throws SQLException {
4707a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	return true;
471417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
472417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
473417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public boolean supportsTransactionIsolationLevel(int level)
4747a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	throws SQLException {
4757a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	return level == Connection.TRANSACTION_SERIALIZABLE;
476417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
477417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
478417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public boolean supportsDataDefinitionAndDataManipulationTransactions()
4797a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	throws SQLException {
4807a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	return true;
481417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
482417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
483417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public boolean supportsDataManipulationTransactionsOnly()
4847a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	throws SQLException {
4857a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	return false;
486417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
487417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
488417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public boolean dataDefinitionCausesTransactionCommit()
4897a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	throws SQLException {
4907a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	return false;
491417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
492417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
493417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public boolean dataDefinitionIgnoredInTransactions() throws SQLException {
4947a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	return false;
495417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
496417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
497417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public ResultSet getProcedures(String catalog, String schemaPattern,
4987a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes				   String procedureNamePattern)
4997a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	throws SQLException {
5007a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	return null;
501417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
502417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
503417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public ResultSet getProcedureColumns(String catalog,
5047a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes					 String schemaPattern,
5057a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes					 String procedureNamePattern,
5067a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes					 String columnNamePattern)
5077a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	throws SQLException {
5087a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	return null;
509417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
510417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
511417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public ResultSet getTables(String catalog, String schemaPattern,
5127a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes			       String tableNamePattern, String types[])
5137a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	throws SQLException {
5147a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	JDBCStatement s = new JDBCStatement(conn);
5157a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	StringBuffer sb = new StringBuffer();
5167a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	sb.append("SELECT '' AS 'TABLE_CAT', " +
5177a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		  "'' AS 'TABLE_SCHEM', " +
5187a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		  "tbl_name AS 'TABLE_NAME', " +
5197a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		  "upper(type) AS 'TABLE_TYPE', " +
5207a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		  "'' AS REMARKS FROM sqlite_master " +
5217a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		  "WHERE tbl_name like ");
5227a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	if (tableNamePattern != null) {
5237a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    sb.append(SQLite.Shell.sql_quote(tableNamePattern));
5247a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	} else {
5257a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    sb.append("'%'");
5267a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	}
5277a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	sb.append(" AND ");
5287a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	if (types == null || types.length == 0) {
5297a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    sb.append("(type = 'table' or type = 'view')");
5307a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	} else {
5317a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    sb.append("(");
5327a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    String sep = "";
5337a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    for (int i = 0; i < types.length; i++) {
5347a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		sb.append(sep);
5357a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		sb.append("type = ");
5367a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		sb.append(SQLite.Shell.sql_quote(types[i].toLowerCase()));
5377a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		sep = " or ";
5387a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    }
5397a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    sb.append(")");
5407a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	}
5417a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	ResultSet rs = null;
5427a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	try {
5437a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    rs = s.executeQuery(sb.toString());
5447a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    s.close();
5457a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	} catch (SQLException e) {
5467a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    throw e;
5477a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	} finally {
5487a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    s.close();
5497a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	}
5507a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	return rs;
551417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
552417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
553417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public ResultSet getSchemas() throws SQLException {
5547a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	String cols[] = { "TABLE_SCHEM" };
5557a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	SQLite.TableResult tr = new SQLite.TableResult();
5567a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	tr.columns(cols);
5577a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	String row[] = { "" };
5587a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	tr.newrow(row);
5597a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	JDBCResultSet rs = new JDBCResultSet(tr, null);
5607a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	return (ResultSet) rs;
561417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
562417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
563417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public ResultSet getCatalogs() throws SQLException {
5647a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	String cols[] = { "TABLE_CAT" };
5657a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	SQLite.TableResult tr = new SQLite.TableResult();
5667a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	tr.columns(cols);
5677a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	String row[] = { "" };
5687a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	tr.newrow(row);
5697a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	JDBCResultSet rs = new JDBCResultSet(tr, null);
5707a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	return (ResultSet) rs;
571417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
572417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
573417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public ResultSet getTableTypes() throws SQLException {
5747a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	String cols[] = { "TABLE_TYPE" };
5757a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	SQLite.TableResult tr = new SQLite.TableResult();
5767a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	tr.columns(cols);
5777a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	String row[] = new String[1];
5787a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	row[0] = "TABLE";
5797a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	tr.newrow(row);
5807a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	row = new String[1];
5817a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	row[0] = "VIEW";
5827a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	tr.newrow(row);
5837a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	JDBCResultSet rs = new JDBCResultSet(tr, null);
5847a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	return (ResultSet) rs;
585417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
586417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
587417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public ResultSet getColumns(String catalog, String schemaPattern,
5887a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes				String tableNamePattern,
5897a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes				String columnNamePattern)
5907a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	throws SQLException {
5914538aff6d563d32cd1c5d2f7b349809384a0a540Jeremy Sharpe	if (conn.db == null) {
5924538aff6d563d32cd1c5d2f7b349809384a0a540Jeremy Sharpe	    throw new SQLException("connection closed.");
5934538aff6d563d32cd1c5d2f7b349809384a0a540Jeremy Sharpe	}
5947a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	JDBCStatement s = new JDBCStatement(conn);
5957a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	JDBCResultSet rs0 = null;
5967a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	try {
5977a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    try {
5987a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		conn.db.exec("SELECT 1 FROM sqlite_master LIMIT 1", null);
5997a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    } catch (SQLite.Exception se) {
6007a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		throw new SQLException("schema reload failed");
6017a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    }
6027a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    rs0 = (JDBCResultSet)
6037a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		(s.executeQuery("PRAGMA table_info(" +
6047a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes				SQLite.Shell.sql_quote(tableNamePattern) +
6057a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes				")"));
6067a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    s.close();
6077a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	} catch (SQLException e) {
6087a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    throw e;
6097a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	} finally {
6107a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    s.close();
6117a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	}
6127a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	if (rs0.tr.nrows < 1) {
6137a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    throw new SQLException("no such table: " + tableNamePattern);
6147a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	}
6157a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	String cols[] = {
6167a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    "TABLE_CAT", "TABLE_SCHEM", "TABLE_NAME",
6177a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    "COLUMN_NAME", "DATA_TYPE", "TYPE_NAME",
6187a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    "COLUMN_SIZE", "BUFFER_LENGTH", "DECIMAL_DIGITS",
6197a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    "NUM_PREC_RADIX", "NULLABLE", "REMARKS",
6207a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    "COLUMN_DEF", "SQL_DATA_TYPE", "SQL_DATETIME_SUB",
6217a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    "CHAR_OCTET_LENGTH", "ORDINAL_POSITION", "IS_NULLABLE"
6227a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	};
6237a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	int types[] = {
6247a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    Types.VARCHAR, Types.VARCHAR, Types.VARCHAR,
6257a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    Types.VARCHAR, Types.SMALLINT, Types.VARCHAR,
6267a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    Types.INTEGER, Types.INTEGER, Types.INTEGER,
6277a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    Types.INTEGER, Types.INTEGER, Types.VARCHAR,
6287a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    Types.VARCHAR, Types.INTEGER, Types.INTEGER,
6297a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    Types.INTEGER, Types.INTEGER, Types.VARCHAR
6307a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	};
6317a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	TableResultX tr = new TableResultX();
6327a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	tr.columns(cols);
6337a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	tr.sql_types(types);
6347a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	JDBCResultSet rs = new JDBCResultSet((SQLite.TableResult) tr, null);
6357a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	if (rs0 != null && rs0.tr != null && rs0.tr.nrows > 0) {
6367a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    Hashtable<String, Integer> h = new Hashtable<String, Integer>();
6377a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    for (int i = 0; i < rs0.tr.ncolumns; i++) {
638b0164f69fd6c6b76b72c28c0bf0b876028515c04Elliott Hughes		h.put(rs0.tr.column[i], Integer.valueOf(i)); // android-changed
6397a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    }
6407a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    if (columnNamePattern != null &&
6417a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		columnNamePattern.charAt(0) == '%') {
6427a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		columnNamePattern = null;
6437a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    }
6447a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    for (int i = 0; i < rs0.tr.nrows; i++) {
6457a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		String r0[] = (String [])(rs0.tr.rows.elementAt(i));
6467a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		int col = ((Integer) h.get("name")).intValue();
6477a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		if (columnNamePattern != null) {
6487a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		    if (r0[col].compareTo(columnNamePattern) != 0) {
6497a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes			continue;
6507a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		    }
6517a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		}
6527a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		String row[] = new String[cols.length];
6537a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		row[0]  = "";
6547a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		row[1]  = "";
6557a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		row[2]  = tableNamePattern;
6567a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		row[3]  = r0[col];
6577a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		col = ((Integer) h.get("type")).intValue();
6587a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		String typeStr = r0[col];
6597a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		int type = mapSqlType(typeStr);
6607a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		row[4]  = "" + type;
6617a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		row[5]  = mapTypeName(type);
6627a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		row[6]  = "" + getD(typeStr, type);
6637a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		row[7]  = "" + getM(typeStr, type);
6647a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		row[8]  = "10";
6657a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		row[9]  = "0";
6667a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		row[11] = null;
6677a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		col = ((Integer) h.get("dflt_value")).intValue();
6687a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		row[12] = r0[col];
6697a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		row[13] = "0";
6707a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		row[14] = "0";
6717a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		row[15] = "65536";
6727a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		col = ((Integer) h.get("cid")).intValue();
673b0164f69fd6c6b76b72c28c0bf0b876028515c04Elliott Hughes		row[16] = Integer.toString(Integer.parseInt(r0[col]) + 1); // android-changed
6747a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		col = ((Integer) h.get("notnull")).intValue();
6757a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		row[17] = (r0[col].charAt(0) == '0') ? "YES" : "NO";
6767a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		row[10] = (r0[col].charAt(0) == '0') ? "" + columnNullable :
6777a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes			  "" + columnNoNulls;
6787a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		tr.newrow(row);
6797a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    }
6807a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	}
6817a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	return rs;
682417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
683417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
684417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public ResultSet getColumnPrivileges(String catalog, String schema,
6857a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes					 String table,
6867a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes					 String columnNamePattern)
6877a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	throws SQLException {
6887a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	String cols[] = {
6897a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    "TABLE_CAT", "TABLE_SCHEM", "TABLE_NAME",
6907a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    "COLUMN_NAME", "GRANTOR", "GRANTEE",
6917a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    "PRIVILEGE", "IS_GRANTABLE"
6927a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	};
6937a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	int types[] = {
6947a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    Types.VARCHAR, Types.VARCHAR, Types.VARCHAR,
6957a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    Types.VARCHAR, Types.VARCHAR, Types.VARCHAR,
6967a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    Types.VARCHAR, Types.VARCHAR
6977a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	};
6987a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	TableResultX tr = new TableResultX();
6997a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	tr.columns(cols);
7007a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	tr.sql_types(types);
7017a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	JDBCResultSet rs = new JDBCResultSet((SQLite.TableResult) tr, null);
7027a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	return rs;
703417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
704417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
705417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public ResultSet getTablePrivileges(String catalog, String schemaPattern,
7067a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes					String tableNamePattern)
7077a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	throws SQLException {
7087a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	String cols[] = {
7097a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    "TABLE_CAT", "TABLE_SCHEM", "TABLE_NAME",
7107a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    "COLUMN_NAME", "GRANTOR", "GRANTEE",
7117a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    "PRIVILEGE", "IS_GRANTABLE"
7127a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	};
7137a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	int types[] = {
7147a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    Types.VARCHAR, Types.VARCHAR, Types.VARCHAR,
7157a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    Types.VARCHAR, Types.VARCHAR, Types.VARCHAR,
7167a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    Types.VARCHAR, Types.VARCHAR
7177a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	};
7187a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	TableResultX tr = new TableResultX();
7197a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	tr.columns(cols);
7207a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	tr.sql_types(types);
7217a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	JDBCResultSet rs = new JDBCResultSet((SQLite.TableResult) tr, null);
7227a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	return rs;
723417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
724417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
725417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public ResultSet getBestRowIdentifier(String catalog, String schema,
7267a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes					  String table, int scope,
7277a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes					  boolean nullable)
7287a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	throws SQLException {
7297a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	JDBCStatement s0 = new JDBCStatement(conn);
7307a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	JDBCResultSet rs0 = null;
7317a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	JDBCStatement s1 = new JDBCStatement(conn);
7327a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	JDBCResultSet rs1 = null;
7337a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	try {
7347a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    try {
7357a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		conn.db.exec("SELECT 1 FROM sqlite_master LIMIT 1", null);
7367a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    } catch (SQLite.Exception se) {
7377a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		throw new SQLException("schema reload failed");
7387a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    }
7397a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    rs0 = (JDBCResultSet)
7407a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		(s0.executeQuery("PRAGMA index_list(" +
7417a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes				 SQLite.Shell.sql_quote(table) + ")"));
7427a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    rs1 = (JDBCResultSet)
7437a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		(s1.executeQuery("PRAGMA table_info(" +
7447a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes				 SQLite.Shell.sql_quote(table) + ")"));
7457a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	} catch (SQLException e) {
7467a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    throw e;
7477a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	} finally {
7487a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    s0.close();
7497a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    s1.close();
7507a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	}
7517a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	String cols[] = {
7527a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    "SCOPE", "COLUMN_NAME", "DATA_TYPE",
7537a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    "TYPE_NAME", "COLUMN_SIZE", "BUFFER_LENGTH",
7547a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    "DECIMAL_DIGITS", "PSEUDO_COLUMN"
7557a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	};
7567a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	int types[] = {
7577a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    Types.SMALLINT, Types.VARCHAR, Types.SMALLINT,
7587a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    Types.VARCHAR, Types.INTEGER, Types.INTEGER,
7597a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    Types.SMALLINT, Types.SMALLINT
7607a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	};
7617a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	TableResultX tr = new TableResultX();
7627a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	tr.columns(cols);
7637a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	tr.sql_types(types);
7647a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	JDBCResultSet rs = new JDBCResultSet((SQLite.TableResult) tr, null);
7657a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	if (rs0 != null && rs0.tr != null && rs0.tr.nrows > 0 &&
7667a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    rs1 != null && rs1.tr != null && rs1.tr.nrows > 0) {
7677a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    Hashtable<String, Integer> h0 = new Hashtable<String, Integer>();
7687a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    for (int i = 0; i < rs0.tr.ncolumns; i++) {
769b0164f69fd6c6b76b72c28c0bf0b876028515c04Elliott Hughes		h0.put(rs0.tr.column[i], Integer.valueOf(i)); // android-changed
7707a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    }
7717a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    Hashtable<String, Integer> h1 = new Hashtable<String, Integer>();
7727a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    for (int i = 0; i < rs1.tr.ncolumns; i++) {
773b0164f69fd6c6b76b72c28c0bf0b876028515c04Elliott Hughes		h1.put(rs1.tr.column[i], Integer.valueOf(i)); // android-changed
7747a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    }
7757a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    for (int i = 0; i < rs0.tr.nrows; i++) {
7767a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		String r0[] = (String [])(rs0.tr.rows.elementAt(i));
7777a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		int col = ((Integer) h0.get("unique")).intValue();
7787a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		String uniq = r0[col];
7797a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		col = ((Integer) h0.get("name")).intValue();
7807a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		String iname = r0[col];
7817a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		if (uniq.charAt(0) == '0') {
7827a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		    continue;
7837a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		}
7847a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		JDBCStatement s2 = new JDBCStatement(conn);
7857a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		JDBCResultSet rs2 = null;
7867a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		try {
7877a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		    rs2 = (JDBCResultSet)
7887a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes			(s2.executeQuery("PRAGMA index_info(" +
7897a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes					 SQLite.Shell.sql_quote(iname) + ")"));
7907a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		} catch (SQLException e) {
7917a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		} finally {
7927a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		    s2.close();
7937a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		}
7947a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		if (rs2 == null || rs2.tr == null || rs2.tr.nrows <= 0) {
7957a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		    continue;
7967a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		}
7977a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		Hashtable<String, Integer> h2 =
7987a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		    new Hashtable<String, Integer>();
7997a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		for (int k = 0; k < rs2.tr.ncolumns; k++) {
800b0164f69fd6c6b76b72c28c0bf0b876028515c04Elliott Hughes		    h2.put(rs2.tr.column[k], Integer.valueOf(k)); // android-changed
8017a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		}
8027a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		for (int k = 0; k < rs2.tr.nrows; k++) {
8037a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		    String r2[] = (String [])(rs2.tr.rows.elementAt(k));
8047a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		    col = ((Integer) h2.get("name")).intValue();
8057a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		    String cname = r2[col];
8067a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		    for (int m = 0; m < rs1.tr.nrows; m++) {
8077a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes			String r1[] = (String [])(rs1.tr.rows.elementAt(m));
8087a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes			col = ((Integer) h1.get("name")).intValue();
8097a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes			if (cname.compareTo(r1[col]) == 0) {
8107a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes			    String row[] = new String[cols.length];
8117a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes			    row[0] = "" + scope;
8127a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes			    row[1] = cname;
8137a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes			    row[2] = "" + Types.VARCHAR;
8147a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes			    row[3] = "VARCHAR";
8157a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes			    row[4] = "65536";
8167a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes			    row[5] = "0";
8177a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes			    row[6] = "0";
8187a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes			    row[7] = "" + bestRowNotPseudo;
8197a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes			    tr.newrow(row);
8207a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes			}
8217a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		    }
8227a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		}
8237a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    }
8247a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	}
8257a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	if (tr.nrows <= 0) {
8267a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    String row[] = new String[cols.length];
8277a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    row[0] = "" + scope;
8287a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    row[1] = "_ROWID_";
8297a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    row[2] = "" + Types.INTEGER;
8307a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    row[3] = "INTEGER";
8317a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    row[4] = "10";
8327a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    row[5] = "0";
8337a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    row[6] = "0";
8347a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    row[7] = "" + bestRowPseudo;
8357a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    tr.newrow(row);
8367a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	}
8377a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	return rs;
838417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
839417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
840417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public ResultSet getVersionColumns(String catalog, String schema,
8417a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes				       String table) throws SQLException {
8427a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	String cols[] = {
8437a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    "SCOPE", "COLUMN_NAME", "DATA_TYPE",
8447a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    "TYPE_NAME", "COLUMN_SIZE", "BUFFER_LENGTH",
8457a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    "DECIMAL_DIGITS", "PSEUDO_COLUMN"
8467a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	};
8477a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	int types[] = {
8487a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    Types.SMALLINT, Types.VARCHAR, Types.SMALLINT,
8497a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    Types.VARCHAR, Types.INTEGER, Types.INTEGER,
8507a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    Types.SMALLINT, Types.SMALLINT
8517a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	};
8527a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	TableResultX tr = new TableResultX();
8537a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	tr.columns(cols);
8547a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	tr.sql_types(types);
8557a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	JDBCResultSet rs = new JDBCResultSet((SQLite.TableResult) tr, null);
8567a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	return rs;
857417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
858417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
859417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public ResultSet getPrimaryKeys(String catalog, String schema,
8607a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes				    String table) throws SQLException {
8617a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	JDBCStatement s0 = new JDBCStatement(conn);
8627a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	JDBCResultSet rs0 = null;
8637a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	try {
8647a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    try {
8657a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		conn.db.exec("SELECT 1 FROM sqlite_master LIMIT 1", null);
8667a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    } catch (SQLite.Exception se) {
8677a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		throw new SQLException("schema reload failed");
8687a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    }
8697a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    rs0 = (JDBCResultSet)
8707a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		(s0.executeQuery("PRAGMA index_list(" +
8717a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes				 SQLite.Shell.sql_quote(table) + ")"));
8727a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	} catch (SQLException e) {
8737a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    throw e;
8747a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	} finally {
8757a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    s0.close();
8767a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	}
8777a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	String cols[] = {
8787a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    "TABLE_CAT", "TABLE_SCHEM", "TABLE_NAME",
8797a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    "COLUMN_NAME", "KEY_SEQ", "PK_NAME"
8807a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	};
8817a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	int types[] = {
8827a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    Types.VARCHAR, Types.VARCHAR, Types.VARCHAR,
8837a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    Types.VARCHAR, Types.SMALLINT, Types.VARCHAR
8847a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	};
8857a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	TableResultX tr = new TableResultX();
8867a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	tr.columns(cols);
8877a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	tr.sql_types(types);
8887a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	JDBCResultSet rs = new JDBCResultSet((SQLite.TableResult) tr, null);
8897a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	if (rs0 != null && rs0.tr != null && rs0.tr.nrows > 0) {
8907a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    Hashtable<String, Integer> h0 = new Hashtable<String, Integer>();
8917a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    for (int i = 0; i < rs0.tr.ncolumns; i++) {
892b0164f69fd6c6b76b72c28c0bf0b876028515c04Elliott Hughes		h0.put(rs0.tr.column[i], Integer.valueOf(i)); // android-changed
8937a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    }
8947a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    for (int i = 0; i < rs0.tr.nrows; i++) {
8957a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		String r0[] = (String [])(rs0.tr.rows.elementAt(i));
8967a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		int col = ((Integer) h0.get("unique")).intValue();
8977a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		String uniq = r0[col];
8987a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		col = ((Integer) h0.get("name")).intValue();
8997a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		String iname = r0[col];
9007a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		if (uniq.charAt(0) == '0') {
9017a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		    continue;
9027a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		}
9037a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		JDBCStatement s1 = new JDBCStatement(conn);
9047a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		JDBCResultSet rs1 = null;
9057a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		try {
9067a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		    rs1 = (JDBCResultSet)
9077a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes			(s1.executeQuery("PRAGMA index_info(" +
9087a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes					 SQLite.Shell.sql_quote(iname) + ")"));
9097a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		} catch (SQLException e) {
9107a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		} finally {
9117a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		    s1.close();
9127a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		}
9137a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		if (rs1 == null || rs1.tr == null || rs1.tr.nrows <= 0) {
9147a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		    continue;
9157a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		}
9167a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		Hashtable<String, Integer> h1 =
9177a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		    new Hashtable<String, Integer>();
9187a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		for (int k = 0; k < rs1.tr.ncolumns; k++) {
919b0164f69fd6c6b76b72c28c0bf0b876028515c04Elliott Hughes		    h1.put(rs1.tr.column[k], Integer.valueOf(k)); // android-changed
9207a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		}
9217a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		for (int k = 0; k < rs1.tr.nrows; k++) {
9227a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		    String r1[] = (String [])(rs1.tr.rows.elementAt(k));
9237a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		    String row[] = new String[cols.length];
9247a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		    row[0]  = "";
9257a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		    row[1]  = "";
9267a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		    row[2]  = table;
9277a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		    col = ((Integer) h1.get("name")).intValue();
9287a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		    row[3] = r1[col];
9297a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		    col = ((Integer) h1.get("seqno")).intValue();
9304538aff6d563d32cd1c5d2f7b349809384a0a540Jeremy Sharpe		    row[4]  = Integer.toString(Integer.parseInt(r1[col]) + 1);
9317a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		    row[5]  = iname;
9327a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		    tr.newrow(row);
9337a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		}
9347a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    }
9357a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	}
9367a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	if (tr.nrows > 0) {
9377a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    return rs;
9387a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	}
9397a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	JDBCStatement s1 = new JDBCStatement(conn);
9407a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	try {
9417a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    rs0 = (JDBCResultSet)
9427a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		(s1.executeQuery("PRAGMA table_info(" +
9437a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes				 SQLite.Shell.sql_quote(table) + ")"));
9447a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	} catch (SQLException e) {
9457a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    throw e;
9467a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	} finally {
9477a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    s1.close();
9487a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	}
9497a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	if (rs0 != null && rs0.tr != null && rs0.tr.nrows > 0) {
9507a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    Hashtable<String, Integer> h0 = new Hashtable<String, Integer>();
9517a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    for (int i = 0; i < rs0.tr.ncolumns; i++) {
952b0164f69fd6c6b76b72c28c0bf0b876028515c04Elliott Hughes		h0.put(rs0.tr.column[i], Integer.valueOf(i)); // android-changed
9537a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    }
9547a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    for (int i = 0; i < rs0.tr.nrows; i++) {
9557a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		String r0[] = (String [])(rs0.tr.rows.elementAt(i));
9567a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		int col = ((Integer) h0.get("type")).intValue();
9577a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		String type = r0[col];
9587a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		if (!type.equalsIgnoreCase("integer")) {
9597a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		    continue;
9607a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		}
9617a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		col = ((Integer) h0.get("pk")).intValue();
9627a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		String pk = r0[col];
9637a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		if (pk.charAt(0) == '0') {
9647a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		    continue;
9657a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		}
9667a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		String row[] = new String[cols.length];
9677a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		row[0]  = "";
9687a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		row[1]  = "";
9697a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		row[2]  = table;
9707a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		col = ((Integer) h0.get("name")).intValue();
9717a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		row[3] = r0[col];
9727a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		col = ((Integer) h0.get("cid")).intValue();
9734538aff6d563d32cd1c5d2f7b349809384a0a540Jeremy Sharpe		row[4] = Integer.toString(Integer.parseInt(r0[col]) + 1);
9747a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		row[5] = "";
9757a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		tr.newrow(row);
9767a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    }
9777a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	}
9787a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	return rs;
979417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
980417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
981417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    private void internalImportedKeys(String table, String pktable,
9827a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes				      JDBCResultSet in, TableResultX out) {
9837a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	Hashtable<String, Integer> h0 = new Hashtable<String, Integer>();
9847a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	for (int i = 0; i < in.tr.ncolumns; i++) {
985b0164f69fd6c6b76b72c28c0bf0b876028515c04Elliott Hughes	    h0.put(in.tr.column[i], Integer.valueOf(i)); // android-changed
9867a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	}
9877a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	for (int i = 0; i < in.tr.nrows; i++) {
9887a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    String r0[] = (String [])(in.tr.rows.elementAt(i));
9897a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    int col = ((Integer) h0.get("table")).intValue();
9907a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    String pktab = r0[col];
9917a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    if (pktable != null && !pktable.equalsIgnoreCase(pktab)) {
9927a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		continue;
9937a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    }
9947a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    col = ((Integer) h0.get("from")).intValue();
9957a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    String fkcol = r0[col];
9967a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    col = ((Integer) h0.get("to")).intValue();
9977a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    String pkcol = r0[col];
9987a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    col = ((Integer) h0.get("seq")).intValue();
9997a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    String seq = r0[col];
10007a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    String row[] = new String[out.ncolumns];
10017a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    row[0]  = "";
10027a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    row[1]  = "";
10037a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    row[2]  = pktab;
10047a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    row[3]  = pkcol;
10057a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    row[4]  = "";
10067a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    row[5]  = "";
10077a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    row[6]  = table;
10087a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    row[7]  = fkcol == null ? pkcol : fkcol;
10094538aff6d563d32cd1c5d2f7b349809384a0a540Jeremy Sharpe	    row[8]  = Integer.toString(Integer.parseInt(seq) + 1);
10107a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    row[9]  =
10117a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		"" + java.sql.DatabaseMetaData.importedKeyNoAction;
10127a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    row[10] =
10137a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		"" + java.sql.DatabaseMetaData.importedKeyNoAction;
10147a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    row[11] = null;
10157a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    row[12] = null;
10167a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    row[13] =
10177a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		"" + java.sql.DatabaseMetaData.importedKeyNotDeferrable;
10187a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    out.newrow(row);
10197a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	}
1020417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
1021417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
1022417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public ResultSet getImportedKeys(String catalog, String schema,
10237a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes				     String table) throws SQLException {
10247a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	JDBCStatement s0 = new JDBCStatement(conn);
10257a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	JDBCResultSet rs0 = null;
10267a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	try {
10277a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    try {
10287a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		conn.db.exec("SELECT 1 FROM sqlite_master LIMIT 1", null);
10297a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    } catch (SQLite.Exception se) {
10307a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		throw new SQLException("schema reload failed");
10317a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    }
10327a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    rs0 = (JDBCResultSet)
10337a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		(s0.executeQuery("PRAGMA foreign_key_list(" +
10347a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes				 SQLite.Shell.sql_quote(table) + ")"));
10357a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	} catch (SQLException e) {
10367a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    throw e;
10377a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	} finally {
10387a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    s0.close();
10397a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	}
10407a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	String cols[] = {
10417a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    "PKTABLE_CAT", "PKTABLE_SCHEM", "PKTABLE_NAME",
10427a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    "PKCOLUMN_NAME", "FKTABLE_CAT", "FKTABLE_SCHEM",
10437a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    "FKTABLE_NAME", "FKCOLUMN_NAME", "KEY_SEQ",
10447a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    "UPDATE_RULE", "DELETE_RULE", "FK_NAME",
10457a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    "PK_NAME", "DEFERRABILITY"
10467a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	};
10477a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	int types[] = {
10487a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    Types.VARCHAR, Types.VARCHAR, Types.VARCHAR,
10497a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    Types.VARCHAR, Types.VARCHAR, Types.VARCHAR,
10507a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    Types.VARCHAR, Types.VARCHAR, Types.SMALLINT,
10517a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    Types.SMALLINT, Types.SMALLINT, Types.VARCHAR,
10527a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    Types.VARCHAR, Types.SMALLINT
10537a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	};
10547a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	TableResultX tr = new TableResultX();
10557a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	tr.columns(cols);
10567a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	tr.sql_types(types);
10577a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	JDBCResultSet rs = new JDBCResultSet((SQLite.TableResult) tr, null);
10587a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	if (rs0 != null && rs0.tr != null && rs0.tr.nrows > 0) {
10597a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    internalImportedKeys(table, null, rs0, tr);
10607a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	}
10617a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	return rs;
1062417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
1063417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
1064417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public ResultSet getExportedKeys(String catalog, String schema,
10657a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes				     String table) throws SQLException {
10667a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	String cols[] = {
10677a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    "PKTABLE_CAT", "PKTABLE_SCHEM", "PKTABLE_NAME",
10687a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    "PKCOLUMN_NAME", "FKTABLE_CAT", "FKTABLE_SCHEM",
10697a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    "FKTABLE_NAME", "FKCOLUMN_NAME", "KEY_SEQ",
10707a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    "UPDATE_RULE", "DELETE_RULE", "FK_NAME",
10717a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    "PK_NAME", "DEFERRABILITY"
10727a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	};
10737a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	int types[] = {
10747a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    Types.VARCHAR, Types.VARCHAR, Types.VARCHAR,
10757a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    Types.VARCHAR, Types.VARCHAR, Types.VARCHAR,
10767a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    Types.VARCHAR, Types.VARCHAR, Types.SMALLINT,
10777a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    Types.SMALLINT, Types.SMALLINT, Types.VARCHAR,
10787a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    Types.VARCHAR, Types.SMALLINT
10797a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	};
10807a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	TableResultX tr = new TableResultX();
10817a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	tr.columns(cols);
10827a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	tr.sql_types(types);
10837a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	JDBCResultSet rs = new JDBCResultSet(tr, null);
10847a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	return rs;
1085417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
1086417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
1087417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public ResultSet getCrossReference(String primaryCatalog,
10887a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes				       String primarySchema,
10897a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes				       String primaryTable,
10907a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes				       String foreignCatalog,
10917a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes				       String foreignSchema,
10927a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes				       String foreignTable)
10937a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	throws SQLException {
10947a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	JDBCResultSet rs0 = null;
10957a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	if (foreignTable != null && foreignTable.charAt(0) != '%') {
10967a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    JDBCStatement s0 = new JDBCStatement(conn);
10977a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    try {
10987a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		try {
10997a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		    conn.db.exec("SELECT 1 FROM sqlite_master LIMIT 1", null);
11007a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		} catch (SQLite.Exception se) {
11017a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		    throw new SQLException("schema reload failed");
11027a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		}
11037a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		rs0 = (JDBCResultSet)
11047a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		    (s0.executeQuery("PRAGMA foreign_key_list(" +
11057a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes				     SQLite.Shell.sql_quote(foreignTable) + ")"));
11067a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    } catch (SQLException e) {
11077a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		throw e;
11087a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    } finally {
11097a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		s0.close();
11107a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    }
11117a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	}
11127a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	String cols[] = {
11137a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    "PKTABLE_CAT", "PKTABLE_SCHEM", "PKTABLE_NAME",
11147a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    "PKCOLUMN_NAME", "FKTABLE_CAT", "FKTABLE_SCHEM",
11157a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    "FKTABLE_NAME", "FKCOLUMN_NAME", "KEY_SEQ",
11167a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    "UPDATE_RULE", "DELETE_RULE", "FK_NAME",
11177a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    "PK_NAME", "DEFERRABILITY"
11187a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	};
11197a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	int types[] = {
11207a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    Types.VARCHAR, Types.VARCHAR, Types.VARCHAR,
11217a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    Types.VARCHAR, Types.VARCHAR, Types.VARCHAR,
11227a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    Types.VARCHAR, Types.VARCHAR, Types.SMALLINT,
11237a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    Types.SMALLINT, Types.SMALLINT, Types.VARCHAR,
11247a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    Types.VARCHAR, Types.SMALLINT
11257a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	};
11267a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	TableResultX tr = new TableResultX();
11277a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	tr.columns(cols);
11287a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	tr.sql_types(types);
11297a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	JDBCResultSet rs = new JDBCResultSet(tr, null);
11307a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	if (rs0 != null && rs0.tr != null && rs0.tr.nrows > 0) {
11317a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    String pktable = null;
11327a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    if (primaryTable != null && primaryTable.charAt(0) != '%') {
11337a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		pktable = primaryTable;
11347a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    }
11357a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    internalImportedKeys(foreignTable, pktable, rs0, tr);
11367a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	}
11377a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	return rs;
1138417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
1139417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
1140417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public ResultSet getTypeInfo() throws SQLException {
11417a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	String cols[] = {
11427a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    "TYPE_NAME", "DATA_TYPE", "PRECISION",
11437a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    "LITERAL_PREFIX", "LITERAL_SUFFIX", "CREATE_PARAMS",
11447a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    "NULLABLE", "CASE_SENSITIVE", "SEARCHABLE",
11457a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    "UNSIGNED_ATTRIBUTE", "FIXED_PREC_SCALE", "AUTO_INCREMENT",
11467a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    "LOCAL_TYPE_NAME", "MINIMUM_SCALE", "MAXIMUM_SCALE",
11477a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    "SQL_DATA_TYPE", "SQL_DATETIME_SUB", "NUM_PREC_RADIX"
11487a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	};
11497a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	int types[] = {
11507a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    Types.VARCHAR, Types.SMALLINT, Types.INTEGER,
11517a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    Types.VARCHAR, Types.VARCHAR, Types.VARCHAR,
11527a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    Types.SMALLINT, Types.BIT, Types.SMALLINT,
11537a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    Types.BIT, Types.BIT, Types.BIT,
11547a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    Types.VARCHAR, Types.SMALLINT, Types.SMALLINT,
11557a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    Types.INTEGER, Types.INTEGER, Types.INTEGER
11567a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	};
11577a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	TableResultX tr = new TableResultX();
11587a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	tr.columns(cols);
11597a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	tr.sql_types(types);
11607a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	JDBCResultSet rs = new JDBCResultSet(tr, null);
11617a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	String row1[] = {
11627a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    "VARCHAR", "" + Types.VARCHAR, "65536",
11637a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    "'", "'", null,
11647a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    "" + typeNullable, "1", "" + typeSearchable,
11657a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    "0", "0", "0",
11667a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    null, "0", "0",
11677a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    "0", "0", "0"
11687a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	};
11697a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	tr.newrow(row1);
11707a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	String row2[] = {
11717a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    "INTEGER", "" + Types.INTEGER, "32",
11727a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    null, null, null,
11737a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    "" + typeNullable, "0", "" + typeSearchable,
11747a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    "0", "0", "1",
11757a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    null, "0", "0",
11767a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    "0", "0", "2"
11777a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	};
11787a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	tr.newrow(row2);
11797a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	String row3[] = {
11807a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    "DOUBLE", "" + Types.DOUBLE, "16",
11817a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    null, null, null,
11827a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    "" + typeNullable, "0", "" + typeSearchable,
11837a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    "0", "0", "1",
11847a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    null, "0", "0",
11857a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    "0", "0", "10"
11867a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	};
11877a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	tr.newrow(row3);
11887a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	String row4[] = {
11897a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    "FLOAT", "" + Types.FLOAT, "7",
11907a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    null, null, null,
11917a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    "" + typeNullable, "0", "" + typeSearchable,
11927a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    "0", "0", "1",
11937a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    null, "0", "0",
11947a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    "0", "0", "10"
11957a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	};
11967a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	tr.newrow(row4);
11977a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	String row5[] = {
11987a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    "SMALLINT", "" + Types.SMALLINT, "16",
11997a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    null, null, null,
12007a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    "" + typeNullable, "0", "" + typeSearchable,
12017a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    "0", "0", "1",
12027a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    null, "0", "0",
12037a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    "0", "0", "2"
12047a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	};
12057a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	tr.newrow(row5);
12067a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	String row6[] = {
12077a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    "BIT", "" + Types.BIT, "1",
12087a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    null, null, null,
12097a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    "" + typeNullable, "0", "" + typeSearchable,
12107a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    "0", "0", "1",
12117a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    null, "0", "0",
12127a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    "0", "0", "2"
12137a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	};
12147a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	tr.newrow(row6);
12157a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	String row7[] = {
12167a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    "TIMESTAMP", "" + Types.TIMESTAMP, "30",
12177a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    null, null, null,
12187a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    "" + typeNullable, "0", "" + typeSearchable,
12197a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    "0", "0", "1",
12207a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    null, "0", "0",
12217a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    "0", "0", "0"
12227a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	};
12237a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	tr.newrow(row7);
12247a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	String row8[] = {
12257a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    "DATE", "" + Types.DATE, "10",
12267a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    null, null, null,
12277a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    "" + typeNullable, "0", "" + typeSearchable,
12287a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    "0", "0", "1",
12297a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    null, "0", "0",
12307a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    "0", "0", "0"
12317a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	};
12327a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	tr.newrow(row8);
12337a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	String row9[] = {
12347a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    "TIME", "" + Types.TIME, "8",
12357a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    null, null, null,
12367a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    "" + typeNullable, "0", "" + typeSearchable,
12377a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    "0", "0", "1",
12387a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    null, "0", "0",
12397a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    "0", "0", "0"
12407a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	};
12417a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	tr.newrow(row9);
12427a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	String row10[] = {
12437a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    "BINARY", "" + Types.BINARY, "65536",
12447a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    null, null, null,
12457a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    "" + typeNullable, "0", "" + typeSearchable,
12467a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    "0", "0", "1",
12477a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    null, "0", "0",
12487a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    "0", "0", "0"
12497a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	};
12507a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	tr.newrow(row10);
12517a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	String row11[] = {
12527a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    "VARBINARY", "" + Types.VARBINARY, "65536",
12537a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    null, null, null,
12547a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    "" + typeNullable, "0", "" + typeSearchable,
12557a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    "0", "0", "1",
12567a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    null, "0", "0",
12577a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    "0", "0", "0"
12587a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	};
12597a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	tr.newrow(row11);
12607a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	String row12[] = {
12617a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    "REAL", "" + Types.REAL, "16",
12627a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    null, null, null,
12637a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    "" + typeNullable, "0", "" + typeSearchable,
12647a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    "0", "0", "1",
12657a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    null, "0", "0",
12667a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    "0", "0", "10"
12677a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	};
12687a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	tr.newrow(row12);
12697a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	return rs;
1270417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
1271417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
1272417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public ResultSet getIndexInfo(String catalog, String schema, String table,
12737a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes				  boolean unique, boolean approximate)
12747a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	throws SQLException {
12757a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	JDBCStatement s0 = new JDBCStatement(conn);
12767a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	JDBCResultSet rs0 = null;
12777a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	try {
12787a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    try {
12797a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		conn.db.exec("SELECT 1 FROM sqlite_master LIMIT 1", null);
12807a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    } catch (SQLite.Exception se) {
12817a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		throw new SQLException("schema reload failed");
12827a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    }
12837a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    rs0 = (JDBCResultSet)
12847a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		(s0.executeQuery("PRAGMA index_list(" +
12857a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes				 SQLite.Shell.sql_quote(table) + ")"));
12867a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	} catch (SQLException e) {
12877a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    throw e;
12887a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	} finally {
12897a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    s0.close();
12907a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	}
12917a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	String cols[] = {
12927a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    "TABLE_CAT", "TABLE_SCHEM", "TABLE_NAME",
12937a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    "NON_UNIQUE", "INDEX_QUALIFIER", "INDEX_NAME",
12947a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    "TYPE", "ORDINAL_POSITION", "COLUMN_NAME",
12957a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    "ASC_OR_DESC", "CARDINALITY", "PAGES",
12967a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    "FILTER_CONDITION"
12977a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	};
12987a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	int types[] = {
12997a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    Types.VARCHAR, Types.VARCHAR, Types.VARCHAR,
13007a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    Types.BIT, Types.VARCHAR, Types.VARCHAR,
13017a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    Types.SMALLINT, Types.SMALLINT, Types.VARCHAR,
13027a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    Types.VARCHAR, Types.INTEGER, Types.INTEGER,
13037a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    Types.VARCHAR
13047a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	};
13057a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	TableResultX tr = new TableResultX();
13067a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	tr.columns(cols);
13077a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	tr.sql_types(types);
13087a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	JDBCResultSet rs = new JDBCResultSet(tr, null);
13097a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	if (rs0 != null && rs0.tr != null && rs0.tr.nrows > 0) {
13107a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    Hashtable<String, Integer> h0 = new Hashtable<String, Integer>();
13117a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    for (int i = 0; i < rs0.tr.ncolumns; i++) {
1312b0164f69fd6c6b76b72c28c0bf0b876028515c04Elliott Hughes		h0.put(rs0.tr.column[i], Integer.valueOf(i)); // android-changed
13137a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    }
13147a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    for (int i = 0; i < rs0.tr.nrows; i++) {
13157a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		String r0[] = (String [])(rs0.tr.rows.elementAt(i));
13167a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		int col = ((Integer) h0.get("unique")).intValue();
13177a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		String uniq = r0[col];
13187a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		col = ((Integer) h0.get("name")).intValue();
13197a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		String iname = r0[col];
13207a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		if (unique && uniq.charAt(0) == '0') {
13217a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		    continue;
13227a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		}
13237a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		JDBCStatement s1 = new JDBCStatement(conn);
13247a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		JDBCResultSet rs1 = null;
13257a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		try {
13267a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		    rs1 = (JDBCResultSet)
13277a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes			(s1.executeQuery("PRAGMA index_info(" +
13287a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes					 SQLite.Shell.sql_quote(iname) + ")"));
13297a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		} catch (SQLException e) {
13307a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		} finally {
13317a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		    s1.close();
13327a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		}
13337a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		if (rs1 == null || rs1.tr == null || rs1.tr.nrows <= 0) {
13347a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		    continue;
13357a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		}
13367a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		Hashtable<String, Integer> h1 =
13377a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		    new Hashtable<String, Integer>();
13387a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		for (int k = 0; k < rs1.tr.ncolumns; k++) {
1339b0164f69fd6c6b76b72c28c0bf0b876028515c04Elliott Hughes		    h1.put(rs1.tr.column[k], Integer.valueOf(k)); // android-changed
13407a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		}
13417a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		for (int k = 0; k < rs1.tr.nrows; k++) {
13427a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		    String r1[] = (String [])(rs1.tr.rows.elementAt(k));
13437a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		    String row[] = new String[cols.length];
13447a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		    row[0]  = "";
13457a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		    row[1]  = "";
13467a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		    row[2]  = table;
13477a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		    row[3]  = (uniq.charAt(0) != '0' ||
13487a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes			(iname.charAt(0) == '(' &&
13497a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes			 iname.indexOf(" autoindex ") > 0)) ? "0" : "1";
13507a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		    row[4]  = "";
13517a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		    row[5]  = iname;
13527a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		    row[6]  = "" + tableIndexOther;
13537a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		    col = ((Integer) h1.get("seqno")).intValue();
13544538aff6d563d32cd1c5d2f7b349809384a0a540Jeremy Sharpe		    row[7]  = Integer.toString(Integer.parseInt(r1[col]) + 1);
13557a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		    col = ((Integer) h1.get("name")).intValue();
13567a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		    row[8]  = r1[col];
13577a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		    row[9]  = "A";
13587a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		    row[10] = "0";
13597a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		    row[11] = "0";
13607a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		    row[12] = null;
13617a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		    tr.newrow(row);
13627a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		}
13637a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    }
13647a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	}
13657a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	return rs;
1366417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
1367417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
1368417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public boolean supportsResultSetType(int type) throws SQLException {
13697a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	return type == ResultSet.TYPE_FORWARD_ONLY ||
13707a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    type == ResultSet.TYPE_SCROLL_INSENSITIVE ||
13717a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    type == ResultSet.TYPE_SCROLL_SENSITIVE;
1372417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
1373417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
1374417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public boolean supportsResultSetConcurrency(int type, int concurrency)
13757a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	throws SQLException {
13767a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	if (type == ResultSet.TYPE_FORWARD_ONLY ||
13777a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    type == ResultSet.TYPE_SCROLL_INSENSITIVE ||
13787a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    type == ResultSet.TYPE_SCROLL_SENSITIVE) {
13797a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    return concurrency == ResultSet.CONCUR_READ_ONLY ||
13807a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		concurrency == ResultSet.CONCUR_UPDATABLE;
13817a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	}
13827a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	return false;
1383417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
1384417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
1385417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public boolean ownUpdatesAreVisible(int type) throws SQLException {
13867a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	if (type == ResultSet.TYPE_FORWARD_ONLY ||
13877a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    type == ResultSet.TYPE_SCROLL_INSENSITIVE ||
13887a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    type == ResultSet.TYPE_SCROLL_SENSITIVE) {
13897a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    return true;
13907a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	}
13917a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	return false;
1392417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
1393417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
1394417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public boolean ownDeletesAreVisible(int type) throws SQLException {
13957a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	if (type == ResultSet.TYPE_FORWARD_ONLY ||
13967a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    type == ResultSet.TYPE_SCROLL_INSENSITIVE ||
13977a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    type == ResultSet.TYPE_SCROLL_SENSITIVE) {
13987a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    return true;
13997a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	}
14007a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	return false;
1401417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
1402417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
1403417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public boolean ownInsertsAreVisible(int type) throws SQLException {
14047a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	if (type == ResultSet.TYPE_FORWARD_ONLY ||
14057a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    type == ResultSet.TYPE_SCROLL_INSENSITIVE ||
14067a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    type == ResultSet.TYPE_SCROLL_SENSITIVE) {
14077a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    return true;
14087a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	}
14097a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	return false;
1410417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
1411417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
1412417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public boolean othersUpdatesAreVisible(int type) throws SQLException {
14137a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	return false;
1414417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
1415417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
1416417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public boolean othersDeletesAreVisible(int type) throws SQLException {
14177a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	return false;
1418417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
1419417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
1420417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public boolean othersInsertsAreVisible(int type) throws SQLException {
14217a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	return false;
1422417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
1423417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
1424417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public boolean updatesAreDetected(int type) throws SQLException {
14257a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	return false;
1426417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
1427417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
1428417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public boolean deletesAreDetected(int type) throws SQLException {
14297a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	return false;
1430417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
1431417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
1432417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public boolean insertsAreDetected(int type) throws SQLException {
14337a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	return false;
1434417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
1435417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
1436417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public boolean supportsBatchUpdates() throws SQLException {
14377a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	return true;
1438417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
1439417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
1440417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public ResultSet getUDTs(String catalog, String schemaPattern,
14417a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		      String typeNamePattern, int[] types)
14427a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	throws SQLException {
14437a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	return null;
1444417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
1445417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
1446417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public Connection getConnection() throws SQLException {
14477a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	return conn;
1448417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
1449417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
1450417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    static String mapTypeName(int type) {
14517a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	switch (type) {
14527a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	case Types.INTEGER:	return "integer";
14537a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	case Types.SMALLINT:	return "smallint";
14547a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	case Types.FLOAT:	return "float";
14557a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	case Types.DOUBLE:	return "double";
14567a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	case Types.TIMESTAMP:	return "timestamp";
14577a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	case Types.DATE:	return "date";
14587a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	case Types.TIME:	return "time";
14597a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	case Types.BINARY:	return "binary";
14607a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	case Types.VARBINARY:	return "varbinary";
14617a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	case Types.REAL:	return "real";
14627a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	}
14637a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	return "varchar";
1464417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
1465417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
1466417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    static int mapSqlType(String type) {
14677a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	if (type == null) {
14687a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    return Types.VARCHAR;
14697a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	}
14707a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	type = type.toLowerCase();
14717a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	if (type.startsWith("inter")) {
14727a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    return Types.VARCHAR;
14737a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	}
14747a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	if (type.startsWith("numeric") ||
14757a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    type.startsWith("int")) {
14767a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    return Types.INTEGER;
14777a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	}
14787a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	if (type.startsWith("tinyint") ||
14797a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    type.startsWith("smallint")) {
14807a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    return Types.SMALLINT;
14817a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	}
14827a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	if (type.startsWith("float")) {
14837a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    return Types.FLOAT;
14847a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	}
14857a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	if (type.startsWith("double")) {
14867a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    return Types.DOUBLE;
14877a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	}
14887a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	if (type.startsWith("datetime") ||
14897a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    type.startsWith("timestamp")) {
14907a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    return Types.TIMESTAMP;
14917a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	}
14927a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	if (type.startsWith("date")) {
14937a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    return Types.DATE;
14947a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	}
14957a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	if (type.startsWith("time")) {
14967a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    return Types.TIME;
14977a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	}
14987a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	if (type.startsWith("blob")) {
14997a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    return Types.BINARY;
15007a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	}
15017a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	if (type.startsWith("binary")) {
15027a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    return Types.BINARY;
15037a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	}
15047a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	if (type.startsWith("varbinary")) {
15057a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    return Types.VARBINARY;
15067a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	}
15077a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	if (type.startsWith("real")) {
15087a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    return Types.REAL;
15097a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	}
15107a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	return Types.VARCHAR;
1511417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
1512417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
1513417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    static int getM(String typeStr, int type) {
15147a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	int m = 65536;
15157a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	switch (type) {
15167a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	case Types.INTEGER:	m = 11; break;
15177a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	case Types.SMALLINT:	m = 6;  break;
15187a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	case Types.FLOAT:	m = 25; break;
15197a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	case Types.REAL:
15207a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	case Types.DOUBLE:	m = 54; break;
15217a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	case Types.TIMESTAMP:	return 30;
15227a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	case Types.DATE:	return 10;
15237a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	case Types.TIME:	return 8;
15247a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	}
15257a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	typeStr = typeStr.toLowerCase();
15267a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	int i1 = typeStr.indexOf('(');
15277a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	if (i1 > 0) {
15287a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    ++i1;
15297a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    int i2 = typeStr.indexOf(',', i1);
15307a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    if (i2 < 0) {
15317a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		i2 = typeStr.indexOf(')', i1);
15327a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    }
15337a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    if (i2 - i1 > 0) {
15347a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		String num = typeStr.substring(i1, i2);
15357a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		try {
15367a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		    m = java.lang.Integer.parseInt(num, 10);
15377a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		} catch (NumberFormatException e) {
15387a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		}
15397a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    }
15407a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	}
15417a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	return m;
1542417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
1543417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
1544417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    static int getD(String typeStr, int type) {
15457a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	int d = 0;
15467a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	switch (type) {
15477a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	case Types.INTEGER:	d = 10; break;
15487a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	case Types.SMALLINT:	d = 5;  break;
15497a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	case Types.FLOAT:	d = 24; break;
15507a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	case Types.REAL:
15517a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	case Types.DOUBLE:	d = 53; break;
15527a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	default:		return getM(typeStr, type);
15537a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	}
15547a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	typeStr = typeStr.toLowerCase();
15557a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	int i1 = typeStr.indexOf('(');
15567a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	if (i1 > 0) {
15577a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    ++i1;
15587a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    int i2 = typeStr.indexOf(',', i1);
15597a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    if (i2 < 0) {
15607a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		return getM(typeStr, type);
15617a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    }
15627a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    i1 = i2;
15637a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    i2 = typeStr.indexOf(')', i1);
15647a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    if (i2 - i1 > 0) {
15657a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		String num = typeStr.substring(i1, i2);
15667a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		try {
15677a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		    d = java.lang.Integer.parseInt(num, 10);
15687a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		} catch (NumberFormatException e) {
15697a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes		}
15707a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    }
15717a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	}
15727a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	return d;
1573417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
1574417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
1575417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public boolean supportsSavepoints() {
15767a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	return false;
1577417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
1578417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
1579417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public boolean supportsNamedParameters() {
15807a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	return false;
1581417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
1582417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
1583417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public boolean supportsMultipleOpenResults() {
15847a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	return false;
1585417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
1586417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
1587417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public boolean supportsGetGeneratedKeys() {
15887a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	return false;
1589417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
1590417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
1591417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public boolean supportsResultSetHoldability(int x) {
15927a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	return false;
1593417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
1594417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
1595417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public boolean supportsStatementPooling() {
15967a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	return false;
1597417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
1598417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
1599417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public boolean locatorsUpdateCopy() throws SQLException {
16007a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	throw new SQLException("not supported");
1601417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
1602417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
1603417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public ResultSet getSuperTypes(String catalog, String schemaPattern,
16047a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes			    String typeNamePattern)
16057a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	throws SQLException {
16067a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	throw new SQLException("not supported");
1607417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
1608417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
1609417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public ResultSet getSuperTables(String catalog, String schemaPattern,
16107a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes				    String tableNamePattern)
16117a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	throws SQLException {
16127a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	throw new SQLException("not supported");
1613417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
1614417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
1615417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public ResultSet getAttributes(String catalog, String schemaPattern,
16167a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes				   String typeNamePattern,
16177a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes				   String attributeNamePattern)
16187a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	throws SQLException {
16197a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	throw new SQLException("not supported");
1620417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
1621417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
1622417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public int getResultSetHoldability() throws SQLException {
16237a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	return ResultSet.HOLD_CURSORS_OVER_COMMIT;
1624417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
1625417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
1626417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public int getDatabaseMajorVersion() {
16277a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	return SQLite.JDBCDriver.MAJORVERSION;
1628417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
1629417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
1630417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public int getDatabaseMinorVersion() {
16317a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	return SQLite.Constants.drv_minor;
1632417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
1633417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
1634417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public int getJDBCMajorVersion() {
16357a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	return 1;
1636417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
1637417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
1638417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public int getJDBCMinorVersion() {
16397a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	return 0;
1640417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
1641417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
1642417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public int getSQLStateType() throws SQLException {
16437a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	return sqlStateXOpen;
1644417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
1645417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
164617c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe    public RowIdLifetime getRowIdLifetime() throws SQLException {
164717c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe	return RowIdLifetime.ROWID_UNSUPPORTED;
164817c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe    }
164917c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe
165017c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe    public ResultSet getSchemas(String cat, String schema)
165117c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe	throws SQLException {
165217c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe	throw new SQLException("not supported");
165317c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe    }
165417c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe
165517c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe    public boolean supportsStoredFunctionsUsingCallSyntax()
165617c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe	throws SQLException {
165717c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe	return false;
165817c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe    }
165917c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe
166017c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe    public boolean autoCommitFailureClosesAllResultSets()
166117c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe	throws SQLException {
166217c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe	return false;
166317c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe    }
166417c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe
166517c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe    public ResultSet getClientInfoProperties() throws SQLException {
166617c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe	throw new SQLException("unsupported");
166717c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe    }
166817c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe
166917c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe    public ResultSet getFunctions(String cat, String schema, String func)
167017c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe	throws SQLException {
167117c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe	throw new SQLException("unsupported");
167217c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe    }
167317c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe
167417c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe    public ResultSet getFunctionColumns(String cat, String schema,
167517c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe					String func, String colpat)
167617c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe	throws SQLException {
167717c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe	throw new SQLException("unsupported");
167817c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe    }
167917c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe
168017c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe    public <T> T unwrap(java.lang.Class<T> iface) throws SQLException {
168117c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe	throw new SQLException("unsupported");
168217c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe    }
168317c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe
168417c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe    public boolean isWrapperFor(java.lang.Class iface) throws SQLException {
168517c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe	return false;
168617c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe    }
168717c83b1a74c906c9a36257a3a99cd1e3730b002eJeremy Sharpe
1688417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes}
1689