*** empty log message ***
[csql.git] / src / jdbc / JdbcSqlDatabaseMetaData.java
blob5b1a5099b304b7df3106aaa1e1b7b90fe0700828
1 /*
2 * To change this template, choose Tools | Templates
3 * and open the template in the editor.
4 */
6 package csql.jdbc;
8 import java.sql.Connection;
9 import java.sql.DatabaseMetaData;
10 import java.sql.ResultSet;
11 import java.sql.RowIdLifetime;
12 import java.sql.SQLException;
13 import java.util.ArrayList;
15 /**
17 * @author bijaya
19 public class JdbcSqlDatabaseMetaData extends JSqlError implements DatabaseMetaData, JSqlErrorType
22 private boolean isClosed;
23 private JdbcSqlConnection conn;
24 private JdbcSqlStatement stmt;
25 JdbcSqlDatabaseMetaData(JdbcSqlConnection con)
27 this.conn = con;
28 stmt = new JdbcSqlStatement(con);
29 isClosed=false;
33 public boolean allProceduresAreCallable() throws SQLException
35 if(this.isClosed)
36 throw getException( CSQL_INVALID_STATE );
37 return false;
40 public boolean allTablesAreSelectable() throws SQLException
42 if(this.isClosed)
43 throw getException(CSQL_INVALID_STATE );
44 return true;
47 public boolean autoCommitFailureClosesAllResultSets() throws SQLException
49 if(this.isClosed)
50 throw getException( CSQL_INVALID_STATE );
51 return false;
54 public boolean dataDefinitionCausesTransactionCommit() throws SQLException
56 if(this.isClosed)
57 throw getException( CSQL_INVALID_STATE );
58 return false;
61 public boolean dataDefinitionIgnoredInTransactions() throws SQLException
63 if(this.isClosed)
64 throw getException( CSQL_INVALID_STATE );
65 return false;
68 public boolean deletesAreDetected(int type) throws SQLException
70 if(this.isClosed)
71 throw getException( CSQL_INVALID_STATE );
72 return false;
74 public boolean doesMaxRowSizeIncludeBlobs() throws SQLException
76 return false;
79 public ResultSet getAttributes(String catalog,String schemaPattern,String typeNamePattern,String attributeNamePattern) throws SQLException
81 if(isClosed) throw getException(CSQL_INVALID_STATE);
82 FieldInfo[] fields = new FieldInfo[21];
83 fields[0] = new FieldInfo("", "TYPE_CAT", 30, 32,false);
84 fields[1] = new FieldInfo("", "TYPE_SCHEM", 30, 32,false);
85 fields[2] = new FieldInfo("", "TYPE_NAME", 30, 32,true);
86 fields[3] = new FieldInfo("", "ATTR_NAME", 30, 32,true);
87 fields[4] = new FieldInfo("", "DATA_TYPE", 3, 32,true);
88 fields[5] = new FieldInfo("", "ATTR_TYPE_NAME", 30, 32,true);
89 fields[6] = new FieldInfo("", "ATTR_SIZE", 0, 32,true);
90 fields[7] = new FieldInfo("", "DECIMAL_DIGITS", 0, 32,true);
91 fields[8] = new FieldInfo("", "NUM_PREC_RADIX", 0, 32,true);
92 fields[9] = new FieldInfo("", "NULLABLE ", 0, 32,true);
93 fields[10] = new FieldInfo("", "REMARKS", 30, 32,true);
94 fields[11] = new FieldInfo("", "ATTR_DEF", 30, 32,true);
95 fields[12] = new FieldInfo("", "SQL_DATA_TYPE", 0, 32,true);
96 fields[13] = new FieldInfo("", "SQL_DATETIME_SUB", 0, 32,true);
97 fields[14] = new FieldInfo("", "CHAR_OCTET_LENGTH", 0, 32,true);
98 fields[15] = new FieldInfo("", "ORDINAL_POSITION", 0, 32,true);
99 fields[16] = new FieldInfo("", "IS_NULLABLE", 30, 32, true);
100 fields[17] = new FieldInfo("", "SCOPE_CATALOG", 30, 32, true);
101 fields[18] = new FieldInfo("", "SCOPE_SCHEMA", 30, 32, true);
102 fields[19] = new FieldInfo("", "SCOPE_TABLE", 30, 32, true);
103 fields[20] = new FieldInfo("", "SOURCE_DATA_TYPE", 3, 32,true);
104 ResultSet rs = new JdbcSqlResultSet(fields, null);
105 if(rs==null){ throw getException(CSQL_INVALID_STATE);}
106 return rs;
109 public ResultSet getBestRowIdentifier(String catalog, String schema,String table,int scope, boolean nullable) throws SQLException
111 //TODO: Check with other database
112 if(isClosed) throw getException(CSQL_INVALID_STATE);
113 FieldInfo[] fields = new FieldInfo[8];
114 fields[0] = new FieldInfo("", "SCOPE", 3, 5, true);
115 fields[1] = new FieldInfo("", "COLUMN_NAME", 30, 32, true);
116 fields[2] = new FieldInfo("", "DATA_TYPE", 3, 32, true);
117 fields[3] = new FieldInfo("", "TYPE_NAME", 30, 32, true);
118 fields[4] = new FieldInfo("", "COLUMN_SIZE", 0, 10, true);
119 fields[5] = new FieldInfo("", "BUFFER_LENGTH", 0, 10, true);
120 fields[6] = new FieldInfo("", "DECIMAL_DIGITS", 0, 10, true);
121 fields[7] = new FieldInfo("", "PSEUDO_COLUMN", 3, 5, true);
122 ResultSet rs = new JdbcSqlResultSet(fields, null);
123 if(rs==null){ throw getException(CSQL_INVALID_STATE);}
124 return rs;
127 public String getCatalogSeparator() throws SQLException
129 return ".";
132 public String getCatalogTerm() throws SQLException
134 return "database";
138 public ResultSet getCatalogs() throws SQLException
140 if(isClosed) throw getException(CSQL_INVALID_STATE);
141 if(stmt!=null) stmt.close();
142 ResultSet rs = stmt.executeQuery("getCatalogs");
143 if(rs==null){ throw getException(CSQL_INVALID_STATE);}
144 return rs;
147 public ResultSet getClientInfoProperties() throws SQLException
149 if(isClosed) throw getException(CSQL_INVALID_STATE);
150 FieldInfo[] fields = new FieldInfo[4];
151 fields[0] = new FieldInfo("", "NAME", 30, 64, true);
152 fields[1] = new FieldInfo("", "MAX_LEN", 0, 4, true);
153 fields[2] = new FieldInfo("", "DEFAULT_VALUE", 30, 64, true);
154 fields[3] = new FieldInfo("", "DESCRIPTION", 30, 64, true);
155 ResultSet rs = new JdbcSqlResultSet(fields, null);
156 if(rs==null){ throw getException(CSQL_INVALID_STATE);}
157 return rs;
161 public ResultSet getColumnPrivileges(String catalog, String schema, String table, String columnNamePattern) throws SQLException
163 if(isClosed) throw getException(CSQL_INVALID_STATE);
164 FieldInfo[] fields = new FieldInfo[8];
165 fields[0] = new FieldInfo("", "TABLE_CAT", 30, 64, false);
166 fields[1] = new FieldInfo("", "TABLE_SCHEM", 30, 64, false);
167 fields[2] = new FieldInfo("", "TABLE_NAME", 30, 64, true);
168 fields[3] = new FieldInfo("", "COLUMN_NAME", 30, 64, true);
169 fields[4] = new FieldInfo("", "GRANTOR", 30, 77, true);
170 fields[5] = new FieldInfo("", "GRANTEE", 30, 77, true);
171 fields[6] = new FieldInfo("", "PRIVILEGE", 30, 64, true);
172 fields[7] = new FieldInfo("", "IS_GRANTABLE", 30, 3, true);
173 ResultSet rs = new JdbcSqlResultSet(fields, null);
174 if(rs==null){ throw getException(CSQL_INVALID_STATE);}
175 return rs;
178 public ResultSet getColumns(String catalog, String schemaPattern, String tableNamePattern, String columnNamePattern) throws SQLException
180 if(isClosed) throw getException(CSQL_INVALID_STATE);
181 //conn.setAutoCommit(false);
182 //Statement stmt = conn.createStatement();
183 if(stmt!=null) stmt.close();
184 ResultSet rs = stmt.executeQuery("describe "+ tableNamePattern);
185 if(rs==null){ throw getException(CSQL_INVALID_STATE);}
186 return rs;
189 public Connection getConnection() throws SQLException
191 if(this.isClosed)
192 throw getException( CSQL_INVALID_STATE );
193 return this.conn;
196 public ResultSet getCrossReference(String parentCatalog, String parentSchema, String parentTable, String foreignCatalog, String foreignSchema, String foreignTable) throws SQLException
198 //TODO
199 if(isClosed) throw getException(CSQL_INVALID_STATE);
200 FieldInfo[] fields = new FieldInfo[14];
201 fields[0] = new FieldInfo("", "PKTABLE_CAT", 30, 255, false);
202 fields[1] = new FieldInfo("", "PKTABLE_SCHEM", 30, 0,false);
203 fields[2] = new FieldInfo("", "PKTABLE_NAME", 30, 255, true);
204 fields[3] = new FieldInfo("", "PKCOLUMN_NAME", 30, 32, true);
205 fields[4] = new FieldInfo("", "FKTABLE_CAT", 30, 255, true);
206 fields[5] = new FieldInfo("", "FKTABLE_SCHEM", 30, 0, true);
207 fields[6] = new FieldInfo("", "FKTABLE_NAME", 30, 255, true);
208 fields[7] = new FieldInfo("", "FKCOLUMN_NAME", 30, 32, true);
209 fields[8] = new FieldInfo("", "KEY_SEQ", 3, 2, true);
210 fields[9] = new FieldInfo("", "UPDATE_RULE", 3, 2, true);
211 fields[10] = new FieldInfo("", "DELETE_RULE", 3, 2, true);
212 fields[11] = new FieldInfo("", "FK_NAME", 30, 0, true);
213 fields[12] = new FieldInfo("", "PK_NAME", 30, 0, true);
214 fields[13] = new FieldInfo("", "DEFERRABILITY", 0, 2, true);
215 ResultSet rs = new JdbcSqlResultSet(fields, null);
216 if(rs==null){ throw getException(CSQL_INVALID_STATE);}
217 return rs;
220 public int getDatabaseMajorVersion() throws SQLException
222 return 2;
225 public int getDatabaseMinorVersion() throws SQLException
227 return 6;
230 public String getDatabaseProductName() throws SQLException
232 return "CSQL";
235 public String getDatabaseProductVersion() throws SQLException
237 return "csql.src.2.6Beta";
240 public int getDefaultTransactionIsolation() throws SQLException
242 if(isClosed) throw getException(CSQL_INVALID_STATE);
243 return java.sql.Connection.TRANSACTION_READ_COMMITTED;
246 public int getDriverMajorVersion()
248 return 2;
251 public int getDriverMinorVersion()
253 return 6;
256 public String getDriverName() throws SQLException
258 if(isClosed) throw getException(CSQL_INVALID_STATE);
259 return "csql.jdbc.JdbcSqlDriver";
262 public String getDriverVersion() throws SQLException
264 if(isClosed) throw getException(CSQL_INVALID_STATE);
265 return "CSQL JDBC 2.6";
268 public ResultSet getExportedKeys(String catalog, String schema, String table) throws SQLException
270 if(isClosed) throw getException(CSQL_INVALID_STATE);
271 if(stmt!=null) stmt.close();
272 ResultSet rs = stmt.executeQuery("ExportedKey "+ table);
273 if(rs==null){ throw getException(CSQL_INVALID_STATE);}
274 return rs;
277 public String getExtraNameCharacters() throws SQLException
279 return "";
282 public ResultSet getFunctionColumns(String catalog, String schemaPattern, String functionNamePattern, String columnNamePattern) throws SQLException
284 if(isClosed) throw getException(CSQL_INVALID_STATE);
285 FieldInfo[] fields = {
286 new FieldInfo("", "FUNCTION_CAT", 30, 64, false),
287 new FieldInfo("", "FUNCTION_SCHEM", 30, 64,false),
288 new FieldInfo("", "FUNCTION_NAME", 30, 64, true),
289 new FieldInfo("", "COLUMN_NAME", 30, 64, true),
290 new FieldInfo("", "COLUMN_TYPE", 30, 64, true),
291 new FieldInfo("", "DATA_TYPE", 3, 4, true),
292 new FieldInfo("", "TYPE_NAME", 30, 64, true),
293 new FieldInfo("", "PRECISION", 3, 4, true),
294 new FieldInfo("", "LENGTH", 3, 4, true),
295 new FieldInfo("", "SCALE", 3, 4, true),
296 new FieldInfo("", "RADIX", 3, 4, true),
297 new FieldInfo("", "NULLABLE", 3, 4, true),
298 new FieldInfo("", "REMARKS", 30, 64, true),
299 new FieldInfo("", "CHAR_OCTET_LENGTH", 3, 64, true),
300 new FieldInfo("", "ORDINAL_POSITION", 3, 64, true),
301 new FieldInfo("", "IS_NULLABLE", 30, 3, true),
302 new FieldInfo("", "SPECIFIC_NAME", 30, 64, true)};
303 ResultSet rs = new JdbcSqlResultSet(fields, null);
304 if(rs==null){ throw getException(CSQL_INVALID_STATE);}
305 return rs;
308 public ResultSet getFunctions(String catalog, String schemaPattern, String functionNamePattern) throws SQLException
310 if(isClosed) throw getException(CSQL_INVALID_STATE);
311 FieldInfo[] fields = new FieldInfo[6];
312 fields[0] = new FieldInfo("", "FUNCTION_CAT", 30, 64, false);
313 fields[1] = new FieldInfo("", "FUNCTION_SCHEM", 30, 64,false);
314 fields[2] = new FieldInfo("", "FUNCTION_NAME", 30, 64, true);
315 fields[3] = new FieldInfo("", "REMARKS", 30, 32, true);
316 fields[4] = new FieldInfo("", "FUNCTION_TYPE", 3, 4, true);
317 fields[5] = new FieldInfo("", "SPECIFIC_NAME", 30, 64, true);
318 ResultSet rs = new JdbcSqlResultSet(fields, null);
319 if(rs==null){ throw getException(CSQL_INVALID_STATE);}
320 return rs;
323 public String getIdentifierQuoteString() throws SQLException
325 return "`";
328 public ResultSet getImportedKeys(String catalog, String schema, String table) throws SQLException
330 if(isClosed) throw getException(CSQL_INVALID_STATE);
331 if(stmt!=null) stmt.close();
332 ResultSet rs = stmt.executeQuery("ImportedKey "+ table);
333 if(rs==null){ throw getException(CSQL_INVALID_STATE);}
334 return rs;
337 public ResultSet getIndexInfo(String catalog, String schema, String table,boolean unique, boolean approximate) throws SQLException
339 if(isClosed) throw getException(CSQL_INVALID_STATE);
340 if(stmt!=null) stmt.close();
341 ResultSet rs = stmt.executeQuery("describe index "+ table);
342 if(rs==null){ throw getException(CSQL_INVALID_STATE);}
343 return rs;
346 public int getJDBCMajorVersion() throws SQLException
348 return 3;
351 public int getJDBCMinorVersion() throws SQLException
353 return 0;
356 public int getMaxBinaryLiteralLength() throws SQLException
358 return 0;
361 public int getMaxCatalogNameLength() throws SQLException
363 return 64;
366 public int getMaxCharLiteralLength() throws SQLException
368 return 0;
372 public int getMaxColumnNameLength() throws SQLException
374 return 64;
377 public int getMaxColumnsInGroupBy() throws SQLException
379 return 64;
382 public int getMaxColumnsInIndex() throws SQLException
384 return 16;
387 public int getMaxColumnsInOrderBy() throws SQLException
389 return 64;
393 public int getMaxColumnsInSelect() throws SQLException
395 return 256;
399 public int getMaxColumnsInTable() throws SQLException
401 return 256;
404 public int getMaxConnections() throws SQLException
406 return 100;
409 public int getMaxCursorNameLength() throws SQLException
411 return 64;
414 public int getMaxIndexLength() throws SQLException
416 return 0;
419 public int getMaxProcedureNameLength() throws SQLException
421 return 64;
424 public int getMaxRowSize() throws SQLException
426 return 2147483639;
429 public int getMaxSchemaNameLength() throws SQLException
431 return 64;
434 public int getMaxStatementLength() throws SQLException
436 return 2048;
439 public int getMaxStatements() throws SQLException
441 return 100;
444 public int getMaxTableNameLength() throws SQLException
446 return 64;
449 public int getMaxTablesInSelect() throws SQLException
451 return 32;
454 public int getMaxUserNameLength() throws SQLException
456 return 64;
459 public String getNumericFunctions() throws SQLException
461 return "";
464 public ResultSet getPrimaryKeys(String catalog, String schema, String table) throws SQLException
466 if(isClosed) throw getException(CSQL_INVALID_STATE);
467 if(stmt!=null) stmt.close();
468 ResultSet rs = stmt.executeQuery("getprimarykey "+ table);
469 if(rs==null){ throw getException(CSQL_INVALID_STATE);}
470 return rs;
474 public ResultSet getProcedureColumns(String catalog, String schemaPattern, String procedureNamePattern, String columnNamePattern) throws SQLException
476 if(isClosed) throw getException(CSQL_INVALID_STATE);
477 FieldInfo[] fields = new FieldInfo[13];
478 fields[0] = new FieldInfo("", "PROCEDURE_CAT", 30, 10, false);
479 fields[1] = new FieldInfo("", "PROCEDURE_SCHEM", 30, 10, false);
480 fields[2] = new FieldInfo("", "PROCEDURE_NAME", 30, 10, true);
481 fields[3] = new FieldInfo("", "COLUMN_NAME", 30, 10, true);
482 fields[4] = new FieldInfo("", "COLUMN_TYPE", 30, 10, true);
483 fields[5] = new FieldInfo("", "DATA_TYPE", 3, 4, true);
484 fields[6] = new FieldInfo("", "TYPE_NAME", 30, 10, true);
485 fields[7] = new FieldInfo("", "PRECISION", 0, 4, true);
486 fields[8] = new FieldInfo("", "LENGTH", 0, 4, true);
487 fields[9] = new FieldInfo("", "SCALE", 3, 4, true);
488 fields[10] = new FieldInfo("", "RADIX", 3, 4, true);
489 fields[11] = new FieldInfo("", "NULLABLE", 3, 4, true);
490 fields[12] = new FieldInfo("", "REMARKS", 30, 10, true);
491 ResultSet rs = new JdbcSqlResultSet(fields, null);
492 if(rs==null){ throw getException(CSQL_INVALID_STATE);}
493 return rs;
496 public String getProcedureTerm() throws SQLException
498 return "";
501 public ResultSet getProcedures(String catalog, String schemaPattern, String procedureNamePattern) throws SQLException
503 if(isClosed) throw getException(CSQL_INVALID_STATE);
504 FieldInfo[] fields = new FieldInfo[9];
505 fields[0] = new FieldInfo("", "PROCEDURE_CAT", 30, 255,false);
506 fields[1] = new FieldInfo("", "PROCEDURE_SCHEM", 30, 255, false);
507 fields[2] = new FieldInfo("", "PROCEDURE_NAME", 30, 255, true);
508 fields[3] = new FieldInfo("", "reserved1", 30, 0, true);
509 fields[4] = new FieldInfo("", "reserved2", 30, 0, true);
510 fields[5] = new FieldInfo("", "reserved3", 30, 0, true);
511 fields[6] = new FieldInfo("", "REMARKS", 30, 255, true);
512 fields[7] = new FieldInfo("", "PROCEDURE_TYPE", 3, 6, true);
513 fields[8] = new FieldInfo("", "SPECIFIC_NAME", 30, 255, true);
514 ResultSet rs = new JdbcSqlResultSet(fields, null);
515 if(rs==null){ throw getException(CSQL_INVALID_STATE);}
516 return rs;
519 public int getResultSetHoldability() throws SQLException
521 return ResultSet.HOLD_CURSORS_OVER_COMMIT;
525 public RowIdLifetime getRowIdLifetime() throws SQLException
527 return RowIdLifetime.ROWID_UNSUPPORTED;
530 public String getSQLKeywords() throws SQLException
532 return "SELECT, FROM, AS, WHERE, BETWEEN, IN, AND, OR, NOT, INSERT, INTO, VALUES, DELETE, UPDATE, SET, NULL, CREATE, DROP, TABLE, PRIMARY, INDEX, ON, HASH, TREE, UNIQUE, KEY, DEFAULT, INT, INTEGER, LONG, DOUBLE, REAL, SHORT, SMALLINT, DATE, TIME, TIMESTAMP, BINARY, CHAR, BIGINT, TINYINT, FLOAT, MIN, MAX, SUM, AVG, COUNT, GROUP, ORDER, ASC, DESC, DISTINCT, BY, HAVING, LIMIT, OFFSET, INNER, OUTER, CROSS, LEFT, JOIN, GETALLTABLES, DESCRIBE, GETPRIMARYKEY, AUTO_INCREMENT, SIZE, FOREIGN, REFERENCES, CACHE, UNCACHE, CONDITION, FIELDLIST, PK, DIRECT, DSN, NOSCHEMA, COMPACT, IS, EXPLAIN, PLAN, GETCATALOGS, GETSCHEMAS";
535 public int getSQLStateType() throws SQLException
537 return 2;
540 public String getSchemaTerm() throws SQLException
542 return "";
546 public ResultSet getSchemas() throws SQLException
548 if(isClosed) throw getException(CSQL_INVALID_STATE);
549 FieldInfo[] fields = new FieldInfo[2];
550 fields[0] = new FieldInfo("", "TABLE_SCHEM", 30, 64,true);
551 fields[1] = new FieldInfo("", "TABLE_CATALOG", 30, 64, false);
552 ResultSet rs = new JdbcSqlResultSet(fields, null);
553 if(rs==null){ throw getException(CSQL_INVALID_STATE);}
554 return rs;
558 public ResultSet getSchemas(String catalog, String schemaPattern) throws SQLException
560 if(isClosed) throw getException(CSQL_INVALID_STATE);
561 FieldInfo[] fields = new FieldInfo[2];
562 fields[0] = new FieldInfo("", "TABLE_SCHEM", 30, 64,true);
563 fields[1] = new FieldInfo("", "TABLE_CATALOG", 30, 64, false);
564 ResultSet rs = new JdbcSqlResultSet(fields, null);
565 if(rs==null){ throw getException(CSQL_INVALID_STATE);}
566 return rs;
569 public String getSearchStringEscape() throws SQLException
571 return "";
574 public String getStringFunctions() throws SQLException
576 return "";
580 public ResultSet getSuperTables(String catalog, String schemaPattern, String tableNamePattern) throws SQLException
582 if(isClosed) throw getException(CSQL_INVALID_STATE);
583 FieldInfo[] fields = new FieldInfo[4];
584 fields[0] = new FieldInfo("", "TABLE_CAT", 30, 32, false);
585 fields[1] = new FieldInfo("", "TABLE_SCHEM", 30, 32,false);
586 fields[2] = new FieldInfo("", "TABLE_NAME", 30, 32, true);
587 fields[3] = new FieldInfo("", "SUPERTABLE_NAME", 30, 32, true);
588 ResultSet rs = new JdbcSqlResultSet(fields, null);
589 if(rs==null){ throw getException(CSQL_INVALID_STATE);}
590 return rs;
594 public ResultSet getSuperTypes(String catalog, String schemaPattern, String typeNamePattern) throws SQLException
596 if(isClosed) throw getException(CSQL_INVALID_STATE);
597 FieldInfo[] fields = new FieldInfo[6];
598 fields[0] = new FieldInfo("", "TABLE_CAT", 30, 32, false);
599 fields[1] = new FieldInfo("", "TABLE_SCHEM", 30, 32,false);
600 fields[2] = new FieldInfo("", "TYPE_NAME", 30, 32, true);
601 fields[3] = new FieldInfo("", "SUPERTYPE_CAT", 30, 32, true);
602 fields[4] = new FieldInfo("", "SUPERTYPE_SCHEM", 30, 32, true);
603 fields[5] = new FieldInfo("", "SUPERTYPE_NAME", 30, 32, true);
604 ResultSet rs = new JdbcSqlResultSet(fields, null);
605 if(rs==null){ throw getException(CSQL_INVALID_STATE);}
606 return rs;
609 public String getSystemFunctions() throws SQLException
611 return "";
614 public ResultSet getTablePrivileges(String catalog, String schemaPattern, String tableNamePattern) throws SQLException
616 if(isClosed) throw getException(CSQL_INVALID_STATE);
617 FieldInfo[] fields = new FieldInfo[7];
618 fields[0] = new FieldInfo("", "TABLE_CAT", 30, 64,false);
619 fields[1] = new FieldInfo("", "TABLE_SCHEM", 30, 1,false);
620 fields[2] = new FieldInfo("", "TABLE_NAME", 30, 64, true);
621 fields[3] = new FieldInfo("", "GRANTOR", 30, 77, false);
622 fields[4] = new FieldInfo("", "GRANTEE", 30, 77, true);
623 fields[5] = new FieldInfo("", "PRIVILEGE", 30, 64, true);
624 fields[6] = new FieldInfo("", "IS_GRANTABLE", 30, 3, true);
625 ResultSet rs = new JdbcSqlResultSet(fields, null);
626 if(rs==null){ throw getException(CSQL_INVALID_STATE);}
627 return rs;
630 public ResultSet getTableTypes() throws SQLException
632 //TODO: NAtive call
633 if(isClosed) throw getException(CSQL_INVALID_STATE);
634 if(stmt!=null) stmt.close();
635 ResultSet rs = stmt.executeQuery("GetTableTypes");
636 if(rs==null){ throw getException(CSQL_INVALID_STATE);}
637 return rs;
640 public ResultSet getTables(String catalog, String schemaPattern, String tableNamePattern, String[] types) throws SQLException
642 if(isClosed) throw getException(CSQL_INVALID_STATE);
643 //conn.setAutoCommit(false);
644 //Statement stmt = conn.createStatement();
645 if(stmt != null) stmt.close();
646 ResultSet rs = stmt.executeQuery("GetAllTables");
647 if(rs==null){ throw getException(CSQL_INVALID_STATE);}
648 return rs;
651 public String getTimeDateFunctions() throws SQLException
653 return "";
656 public ResultSet getTypeInfo() throws SQLException
658 if(isClosed) throw getException(CSQL_INVALID_STATE);
659 if(stmt!=null) stmt.close();
660 ResultSet rs = stmt.executeQuery("GetDataTypes");
661 if(rs==null){ throw getException(CSQL_INVALID_STATE);}
662 return rs;
667 public ResultSet getUDTs(String catalog, String schemaPattern, String typeNamePattern, int[] types) throws SQLException
669 if(isClosed) throw getException(CSQL_INVALID_STATE);
670 FieldInfo[] fields = new FieldInfo[6];
671 fields[0] = new FieldInfo("", "TYPE_CAT", 30, 32, false);
672 fields[1] = new FieldInfo("", "TYPE_SCHEM", 30, 32,false);
673 fields[2] = new FieldInfo("", "TYPE_NAME", 30, 32, true);
674 fields[3] = new FieldInfo("", "CLASS_NAME", 30, 32, true);
675 fields[4] = new FieldInfo("", "DATA_TYPE", 30, 32, true);
676 fields[5] = new FieldInfo("", "REMARKS", 30, 32, true);
677 ResultSet rs = new JdbcSqlResultSet(fields, null);
678 if(rs==null){ throw getException(CSQL_INVALID_STATE);}
679 return rs;
683 public String getURL() throws SQLException
685 return conn.getUrl();
688 public String getUserName() throws SQLException
690 return "root";
693 public ResultSet getVersionColumns(String catalog, String schema, String table) throws SQLException
695 if(isClosed) throw getException(CSQL_INVALID_STATE);
696 FieldInfo[] fields = new FieldInfo[8];
697 fields[0] = new FieldInfo("", "SCOPE",3, 5,false);
698 fields[1] = new FieldInfo("", "COLUMN_NAME", 30, 32, true);
699 fields[2] = new FieldInfo("", "DATA_TYPE", 3, 5, true);
700 fields[3] = new FieldInfo("", "TYPE_NAME", 30, 16, true);
701 fields[4] = new FieldInfo("", "COLUMN_SIZE", 30, 16, true);
702 fields[5] = new FieldInfo("", "BUFFER_LENGTH", 30, 16, true);
703 fields[6] = new FieldInfo("", "DECIMAL_DIGITS", 30, 16,false);
704 fields[7] = new FieldInfo("", "PSEUDO_COLUMN", 3, 5, true);
705 ResultSet rs = new JdbcSqlResultSet(fields, null);
706 if(rs==null){ throw getException(CSQL_INVALID_STATE);}
707 return rs;
711 public boolean insertsAreDetected(int type) throws SQLException
713 return false;
716 public boolean isCatalogAtStart() throws SQLException
718 return false;
722 public boolean isReadOnly() throws SQLException
724 return true;
727 public boolean locatorsUpdateCopy() throws SQLException
729 return false;
732 public boolean nullPlusNonNullIsNull() throws SQLException
734 return false;
738 public boolean nullsAreSortedAtEnd() throws SQLException
740 return false;
743 public boolean nullsAreSortedAtStart() throws SQLException
745 return true;
748 public boolean nullsAreSortedHigh() throws SQLException
750 return true;
753 public boolean nullsAreSortedLow() throws SQLException
755 return true;
758 public boolean othersDeletesAreVisible(int type) throws SQLException
760 return false;
763 public boolean othersInsertsAreVisible(int type) throws SQLException
765 return false;
768 public boolean othersUpdatesAreVisible(int type) throws SQLException
770 return false;
773 public boolean ownDeletesAreVisible(int type) throws SQLException
775 return true;
779 public boolean ownInsertsAreVisible(int type) throws SQLException
781 return true;
784 public boolean ownUpdatesAreVisible(int type) throws SQLException
786 return true;
790 public boolean storesLowerCaseIdentifiers() throws SQLException
792 return true;
795 public boolean storesLowerCaseQuotedIdentifiers() throws SQLException
797 return false;
800 public boolean storesMixedCaseIdentifiers() throws SQLException
802 return true;
805 public boolean storesMixedCaseQuotedIdentifiers() throws SQLException
807 return false;
810 public boolean storesUpperCaseIdentifiers() throws SQLException
812 return true;
815 public boolean storesUpperCaseQuotedIdentifiers() throws SQLException
817 return true;
821 public boolean supportsANSI92EntryLevelSQL() throws SQLException
823 return true;
826 public boolean supportsANSI92FullSQL() throws SQLException
828 return false;
831 public boolean supportsANSI92IntermediateSQL() throws SQLException
833 return true;
837 public boolean supportsAlterTableWithAddColumn() throws SQLException
839 return false;
842 public boolean supportsAlterTableWithDropColumn() throws SQLException
844 return false;
847 public boolean supportsBatchUpdates() throws SQLException
849 return false;
852 public boolean supportsCatalogsInDataManipulation() throws SQLException
854 return false;
857 public boolean supportsCatalogsInIndexDefinitions() throws SQLException
859 return false;
862 public boolean supportsCatalogsInPrivilegeDefinitions() throws SQLException
864 return false;
868 public boolean supportsCatalogsInProcedureCalls() throws SQLException
870 return false;
873 public boolean supportsCatalogsInTableDefinitions() throws SQLException
875 return false;
878 public boolean supportsColumnAliasing() throws SQLException
880 return true;
883 public boolean supportsConvert() throws SQLException
885 return false;
888 public boolean supportsConvert(int fromType,int toType) throws SQLException
890 return false;
893 public boolean supportsCoreSQLGrammar() throws SQLException
895 return true;
898 public boolean supportsCorrelatedSubqueries() throws SQLException
900 return false;
903 public boolean supportsDataDefinitionAndDataManipulationTransactions() throws SQLException
905 return false;
908 public boolean supportsDataManipulationTransactionsOnly() throws SQLException
910 return true;
913 public boolean supportsDifferentTableCorrelationNames() throws SQLException
915 return false;
918 public boolean supportsExpressionsInOrderBy() throws SQLException
920 return false;
923 public boolean supportsExtendedSQLGrammar() throws SQLException
925 return false;
928 public boolean supportsFullOuterJoins() throws SQLException
930 return false;
933 public boolean supportsGetGeneratedKeys() throws SQLException
935 return true;
938 public boolean supportsGroupBy() throws SQLException
940 return true;
943 public boolean supportsGroupByBeyondSelect() throws SQLException
945 return true;
948 public boolean supportsGroupByUnrelated() throws SQLException
950 return false;
953 public boolean supportsIntegrityEnhancementFacility() throws SQLException
955 //TODO: Check for other database
956 return false;
959 public boolean supportsLikeEscapeClause() throws SQLException
961 return true;
964 public boolean supportsLimitedOuterJoins() throws SQLException
966 return false;
969 public boolean supportsMinimumSQLGrammar() throws SQLException
971 return true;
974 public boolean supportsMixedCaseIdentifiers() throws SQLException
976 return true;
979 public boolean supportsMixedCaseQuotedIdentifiers() throws SQLException
981 return true;
984 public boolean supportsMultipleOpenResults() throws SQLException
986 return true;
989 public boolean supportsMultipleResultSets() throws SQLException
991 return true;
994 public boolean supportsMultipleTransactions() throws SQLException
996 return false;
999 public boolean supportsNamedParameters() throws SQLException
1001 return false;
1004 public boolean supportsNonNullableColumns() throws SQLException
1006 return true;
1009 public boolean supportsOpenCursorsAcrossCommit() throws SQLException
1011 return true;
1015 public boolean supportsOpenCursorsAcrossRollback() throws SQLException
1017 return true;
1020 public boolean supportsOpenStatementsAcrossCommit() throws SQLException
1022 return true;
1025 public boolean supportsOpenStatementsAcrossRollback() throws SQLException
1027 return true;
1030 public boolean supportsOrderByUnrelated() throws SQLException
1032 return false;
1035 public boolean supportsOuterJoins() throws SQLException
1037 return true;
1040 public boolean supportsPositionedDelete() throws SQLException
1042 return false;
1045 public boolean supportsPositionedUpdate() throws SQLException
1047 return false;
1050 public boolean supportsResultSetConcurrency(int type, int concurrency) throws SQLException
1052 return false;
1054 public boolean supportsResultSetHoldability(int holdability) throws SQLException
1056 return false;
1059 public boolean supportsResultSetType(int type) throws SQLException
1061 return (type == ResultSet.TYPE_FORWARD_ONLY);
1064 public boolean supportsSavepoints() throws SQLException
1066 return false;
1069 public boolean supportsSchemasInDataManipulation() throws SQLException
1071 return false;
1074 public boolean supportsSchemasInIndexDefinitions() throws SQLException
1076 return false;
1079 public boolean supportsSchemasInPrivilegeDefinitions() throws SQLException
1081 return false;
1084 public boolean supportsSchemasInProcedureCalls() throws SQLException
1086 return false;
1089 public boolean supportsSchemasInTableDefinitions() throws SQLException
1091 return false;
1094 public boolean supportsSelectForUpdate() throws SQLException
1096 return false;
1099 public boolean supportsStatementPooling() throws SQLException
1101 return false;
1104 public boolean supportsStoredFunctionsUsingCallSyntax() throws SQLException
1106 return false;
1109 public boolean supportsStoredProcedures() throws SQLException
1111 return false;
1114 public boolean supportsSubqueriesInComparisons() throws SQLException
1116 return false;
1119 public boolean supportsSubqueriesInExists() throws SQLException
1121 return false;
1124 public boolean supportsSubqueriesInIns() throws SQLException
1126 return false;
1129 public boolean supportsSubqueriesInQuantifieds() throws SQLException
1131 return false;
1134 public boolean supportsTableCorrelationNames() throws SQLException
1136 return true;
1139 public boolean supportsTransactionIsolationLevel(int level) throws SQLException
1141 return true;
1144 public boolean supportsTransactions() throws SQLException
1146 return true;
1149 public boolean supportsUnion() throws SQLException
1151 return false;
1153 public boolean supportsUnionAll() throws SQLException
1155 return false;
1158 public boolean updatesAreDetected(int type) throws SQLException
1160 return false;
1163 public boolean usesLocalFilePerTable() throws SQLException
1165 return false;
1169 public boolean usesLocalFiles() throws SQLException
1171 return false;
1174 public boolean isWrapperFor(Class ifact) throws SQLException
1176 if (JSqlError.isDebug) System.out.println("DatabaseMetadata::isWrapperFor called");
1177 throw getException(CSQL_NOT_SUPPORTED);
1179 public Class unwrap(Class iface) throws SQLException
1181 if (JSqlError.isDebug) System.out.println("DatabaseMetadata::unwrap called");
1182 throw getException(CSQL_NOT_SUPPORTED);