1 24 25 package com.mckoi.database.jdbc; 26 27 import java.sql.*; 28 29 34 35 public class MDatabaseMetaData implements DatabaseMetaData { 36 37 40 private MConnection connection; 41 42 45 private String database_name, database_version; 46 47 50 MDatabaseMetaData(MConnection connection) { 51 this.connection = connection; 52 } 53 54 57 private void queryProductInformation() throws SQLException { 58 if (database_name == null || 59 database_version == null) { 60 Statement statement = connection.createStatement(); 61 ResultSet result = statement.executeQuery("SHOW PRODUCT"); 62 result.next(); 63 database_name = result.getString("name"); 64 database_version = result.getString("version"); 65 statement.close(); 66 result.close(); 67 } 68 } 69 70 71 72 75 public boolean allProceduresAreCallable() throws SQLException { 76 return false; 78 } 79 80 public boolean allTablesAreSelectable() throws SQLException { 81 return false; 83 } 84 85 public String getURL() throws SQLException { 86 return connection.getURL(); 87 } 88 89 public String getUserName() throws SQLException { 90 Statement statement = connection.createStatement(); 91 ResultSet result_set = statement.executeQuery("SELECT USER()"); 92 result_set.next(); 93 String username = result_set.getString(1); 94 result_set.close(); 95 statement.close(); 96 return username; 97 } 98 99 public boolean isReadOnly() throws SQLException { 100 Statement statement = connection.createStatement(); 101 ResultSet result_set = statement.executeQuery( 102 " SELECT * FROM SYS_INFO.sUSRDatabaseStatistics " + 103 " WHERE \"stat_name\" = 'DatabaseSystem.read_only' "); 104 boolean read_only = result_set.next(); 105 result_set.close(); 106 statement.close(); 107 return read_only; 108 } 109 110 public boolean nullsAreSortedHigh() throws SQLException { 111 return false; 112 } 113 114 public boolean nullsAreSortedLow() throws SQLException { 115 return true; 116 } 117 118 public boolean nullsAreSortedAtStart() throws SQLException { 119 return false; 120 } 121 122 public boolean nullsAreSortedAtEnd() throws SQLException { 123 return false; 124 } 125 126 public String getDatabaseProductName() throws SQLException { 127 queryProductInformation(); 128 return database_name; 129 } 130 131 public String getDatabaseProductVersion() throws SQLException { 132 queryProductInformation(); 133 return database_version; 134 } 135 136 public String getDriverName() throws SQLException { 137 return MDriver.DRIVER_NAME; 138 } 139 140 public String getDriverVersion() throws SQLException { 141 return MDriver.DRIVER_VERSION; 142 } 143 144 public int getDriverMajorVersion() { 145 return MDriver.DRIVER_MAJOR_VERSION; 146 } 147 148 public int getDriverMinorVersion() { 149 return MDriver.DRIVER_MINOR_VERSION; 150 } 151 152 public boolean usesLocalFiles() throws SQLException { 153 if (getURL().toLowerCase().startsWith(":jdbc:mckoi:local://")) { 157 return true; 158 } 159 else { 160 return false; 161 } 162 } 163 164 public boolean usesLocalFilePerTable() throws SQLException { 165 return false; 168 } 169 170 public boolean supportsMixedCaseIdentifiers() throws SQLException { 171 return true; 172 } 173 174 public boolean storesUpperCaseIdentifiers() throws SQLException { 175 return false; 176 } 177 178 public boolean storesLowerCaseIdentifiers() throws SQLException { 179 return false; 180 } 181 182 public boolean storesMixedCaseIdentifiers() throws SQLException { 183 return true; 184 } 185 186 public boolean supportsMixedCaseQuotedIdentifiers() throws SQLException { 187 return true; 188 } 189 190 public boolean storesUpperCaseQuotedIdentifiers() throws SQLException { 191 return false; 192 } 193 194 public boolean storesLowerCaseQuotedIdentifiers() throws SQLException { 195 return false; 196 } 197 198 public boolean storesMixedCaseQuotedIdentifiers() throws SQLException { 199 return true; 200 } 201 202 public String getIdentifierQuoteString() throws SQLException { 203 return "\""; 204 } 205 206 public String getSQLKeywords() throws SQLException { 207 return "show"; 209 } 210 211 public String getNumericFunctions() throws SQLException { 212 return ""; 216 } 217 218 public String getStringFunctions() throws SQLException { 219 return ""; 223 } 224 225 public String getSystemFunctions() throws SQLException { 226 return ""; 228 } 229 230 public String getTimeDateFunctions() throws SQLException { 231 return ""; 235 } 236 237 public String getSearchStringEscape() throws SQLException { 238 return "\\"; 239 } 240 241 public String getExtraNameCharacters() throws SQLException { 242 return ""; 243 } 244 245 248 public boolean supportsAlterTableWithAddColumn() throws SQLException { 249 return true; 250 } 251 252 public boolean supportsAlterTableWithDropColumn() throws SQLException { 253 return true; 254 } 255 256 public boolean supportsColumnAliasing() throws SQLException { 257 return true; 258 } 259 260 public boolean nullPlusNonNullIsNull() throws SQLException { 261 return true; 262 } 263 264 public boolean supportsConvert() throws SQLException { 265 return false; 266 } 267 268 public boolean supportsConvert(int fromType, int toType) throws SQLException { 269 return false; 270 } 271 272 public boolean supportsTableCorrelationNames() throws SQLException { 273 return true; 276 } 277 278 public boolean supportsDifferentTableCorrelationNames() throws SQLException { 279 return false; 283 } 284 285 public boolean supportsExpressionsInOrderBy() throws SQLException { 286 return true; 287 } 288 289 public boolean supportsOrderByUnrelated() throws SQLException { 290 return true; 291 } 292 293 public boolean supportsGroupBy() throws SQLException { 294 return true; 295 } 296 297 public boolean supportsGroupByUnrelated() throws SQLException { 298 return true; 299 } 300 301 public boolean supportsGroupByBeyondSelect() throws SQLException { 302 return false; 304 } 305 306 public boolean supportsLikeEscapeClause() throws SQLException { 307 return true; 308 } 309 310 public boolean supportsMultipleResultSets() throws SQLException { 311 return false; 312 } 313 314 public boolean supportsMultipleTransactions() throws SQLException { 315 return true; 317 } 318 319 public boolean supportsNonNullableColumns() throws SQLException { 320 return true; 321 } 322 323 public boolean supportsMinimumSQLGrammar() throws SQLException { 324 return false; 327 } 328 329 public boolean supportsCoreSQLGrammar() throws SQLException { 330 return false; 332 } 333 334 public boolean supportsExtendedSQLGrammar() throws SQLException { 335 return false; 336 } 337 338 public boolean supportsANSI92EntryLevelSQL() throws SQLException { 339 return false; 341 } 342 343 public boolean supportsANSI92IntermediateSQL() throws SQLException { 344 return false; 345 } 346 347 public boolean supportsANSI92FullSQL() throws SQLException { 348 return false; 349 } 350 351 public boolean supportsIntegrityEnhancementFacility() throws SQLException { 352 return false; 354 } 355 356 public boolean supportsOuterJoins() throws SQLException { 357 return true; 358 } 359 360 public boolean supportsFullOuterJoins() throws SQLException { 361 return false; 362 } 363 364 public boolean supportsLimitedOuterJoins() throws SQLException { 365 return true; 366 } 367 368 public String getSchemaTerm() throws SQLException { 369 return "Schema"; 370 } 371 372 public String getProcedureTerm() throws SQLException { 373 return "Procedure"; 374 } 375 376 public String getCatalogTerm() throws SQLException { 377 return "Catalog"; 378 } 379 380 public boolean isCatalogAtStart() throws SQLException { 381 return false; 383 } 384 385 public String getCatalogSeparator() throws SQLException { 386 return ""; 387 } 388 389 public boolean supportsSchemasInDataManipulation() throws SQLException { 390 return true; 391 } 392 393 public boolean supportsSchemasInProcedureCalls() throws SQLException { 394 return true; 396 } 397 398 public boolean supportsSchemasInTableDefinitions() throws SQLException { 399 return true; 400 } 401 402 public boolean supportsSchemasInIndexDefinitions() throws SQLException { 403 return true; 404 } 405 406 public boolean supportsSchemasInPrivilegeDefinitions() throws SQLException { 407 return true; 408 } 409 410 public boolean supportsCatalogsInDataManipulation() throws SQLException { 411 return false; 412 } 413 414 public boolean supportsCatalogsInProcedureCalls() throws SQLException { 415 return false; 416 } 417 418 public boolean supportsCatalogsInTableDefinitions() throws SQLException { 419 return false; 420 } 421 422 public boolean supportsCatalogsInIndexDefinitions() throws SQLException { 423 return false; 424 } 425 426 public boolean supportsCatalogsInPrivilegeDefinitions() throws SQLException { 427 return false; 428 } 429 430 public boolean supportsPositionedDelete() throws SQLException { 431 return false; 433 } 434 435 public boolean supportsPositionedUpdate() throws SQLException { 436 return false; 438 } 439 440 public boolean supportsSelectForUpdate() throws SQLException { 441 return false; 443 } 444 445 public boolean supportsStoredProcedures() throws SQLException { 446 return false; 447 } 448 449 public boolean supportsSubqueriesInComparisons() throws SQLException { 450 return false; 452 } 453 454 public boolean supportsSubqueriesInExists() throws SQLException { 455 return false; 457 } 458 459 public boolean supportsSubqueriesInIns() throws SQLException { 460 return true; 461 } 462 463 public boolean supportsSubqueriesInQuantifieds() throws SQLException { 464 return false; 466 } 467 468 public boolean supportsCorrelatedSubqueries() throws SQLException { 469 return false; 471 } 472 473 public boolean supportsUnion() throws SQLException { 474 return false; 475 } 476 477 public boolean supportsUnionAll() throws SQLException { 478 return false; 479 } 480 481 public boolean supportsOpenCursorsAcrossCommit() throws SQLException { 482 return true; 484 } 485 486 public boolean supportsOpenCursorsAcrossRollback() throws SQLException { 487 return true; 489 } 490 491 public boolean supportsOpenStatementsAcrossCommit() throws SQLException { 492 return true; 493 } 494 495 public boolean supportsOpenStatementsAcrossRollback() throws SQLException { 496 return true; 497 } 498 499 505 public int getMaxBinaryLiteralLength() throws SQLException { 506 return 0; 508 } 509 510 public int getMaxCharLiteralLength() throws SQLException { 511 return 32768; 513 } 514 515 public int getMaxColumnNameLength() throws SQLException { 516 return 256; 518 } 519 520 public int getMaxColumnsInGroupBy() throws SQLException { 521 return getMaxColumnsInSelect(); 523 } 524 525 public int getMaxColumnsInIndex() throws SQLException { 526 return 1; 528 } 529 530 public int getMaxColumnsInOrderBy() throws SQLException { 531 return getMaxColumnsInSelect(); 533 } 534 535 public int getMaxColumnsInSelect() throws SQLException { 536 return 4096; 538 } 539 540 public int getMaxColumnsInTable() throws SQLException { 541 return 4096; 543 } 544 545 public int getMaxConnections() throws SQLException { 546 return 8000; 549 } 550 551 public int getMaxCursorNameLength() throws SQLException { 552 return 0; 554 } 555 556 public int getMaxIndexLength() throws SQLException { 557 return 0; 559 } 560 561 public int getMaxSchemaNameLength() throws SQLException { 562 return 0; 564 } 565 566 public int getMaxProcedureNameLength() throws SQLException { 567 return 0; 569 } 570 571 public int getMaxCatalogNameLength() throws SQLException { 572 return 0; 574 } 575 576 public int getMaxRowSize() throws SQLException { 577 return 16 * 1024 * 1024; 580 } 581 582 public boolean doesMaxRowSizeIncludeBlobs() throws SQLException { 583 return false; 584 } 585 586 public int getMaxStatementLength() throws SQLException { 587 return 60000; 589 } 590 591 public int getMaxStatements() throws SQLException { 592 return 1024; 594 } 595 596 public int getMaxTableNameLength() throws SQLException { 597 return 50; 600 } 601 602 public int getMaxTablesInSelect() throws SQLException { 603 return 512; 605 } 606 607 public int getMaxUserNameLength() throws SQLException { 608 return 50; 611 } 612 613 615 public int getDefaultTransactionIsolation() throws SQLException { 616 return Connection.TRANSACTION_SERIALIZABLE; 618 } 619 620 public boolean supportsTransactions() throws SQLException { 621 return true; 623 } 624 625 public boolean supportsTransactionIsolationLevel(int level) 626 throws SQLException { 627 return (level == Connection.TRANSACTION_SERIALIZABLE); 628 } 629 630 public boolean supportsDataDefinitionAndDataManipulationTransactions() 631 throws SQLException { 632 return true; 633 } 634 635 public boolean supportsDataManipulationTransactionsOnly() 636 throws SQLException { 637 return false; 638 } 639 640 public boolean dataDefinitionCausesTransactionCommit() 641 throws SQLException { 642 return false; 643 } 644 645 public boolean dataDefinitionIgnoredInTransactions() 646 throws SQLException { 647 return false; 648 } 649 650 public ResultSet getProcedures(String catalog, String schemaPattern, 651 String procedureNamePattern) throws SQLException { 652 653 PreparedStatement statement = connection.prepareStatement( 654 "SHOW JDBC_PROCEDURES ( ?, ?, ? )"); 655 statement.setString(1, catalog); 656 statement.setString(2, schemaPattern); 657 statement.setString(3, procedureNamePattern); 658 659 return statement.executeQuery(); 660 } 661 662 public ResultSet getProcedureColumns(String catalog, 663 String schemaPattern, 664 String procedureNamePattern, 665 String columnNamePattern) throws SQLException { 666 667 PreparedStatement statement = connection.prepareStatement( 668 "SHOW JDBC_PROCEDURE_COLUMNS ( ?, ?, ?, ? )"); 669 statement.setString(1, catalog); 670 statement.setString(2, schemaPattern); 671 statement.setString(3, procedureNamePattern); 672 statement.setString(4, columnNamePattern); 673 674 return statement.executeQuery(); 675 } 676 677 public ResultSet getTables(String catalog, String schemaPattern, 678 String tableNamePattern, String [] types) throws SQLException { 679 680 if (tableNamePattern == null) { 681 tableNamePattern = "%"; 682 } 683 if (schemaPattern == null) { 684 schemaPattern = "%"; 685 } 686 687 String type_part = ""; 689 int type_size = 0; 690 if (types != null && types.length > 0) { 691 StringBuffer buf = new StringBuffer (); 692 buf.append(" AND \"TABLE_TYPE\" IN ( "); 693 for (int i = 0; i < types.length - 1; ++i) { 694 buf.append("?, "); 695 } 696 buf.append("? ) \n"); 697 type_size = types.length; 698 type_part = new String (buf); 699 } 700 701 703 PreparedStatement stmt = connection.prepareStatement( 704 " SELECT * \n" + 705 " FROM \"SYS_JDBC.Tables\" \n" + 706 " WHERE \"TABLE_SCHEM\" LIKE ? \n" + 707 " AND \"TABLE_NAME\" LIKE ? \n" + 708 type_part + 709 " ORDER BY \"TABLE_TYPE\", \"TABLE_SCHEM\", \"TABLE_NAME\" \n" 710 ); 711 stmt.setString(1, schemaPattern); 712 stmt.setString(2, tableNamePattern); 713 if (type_size > 0) { 714 for (int i = 0; i < type_size; ++i) { 715 stmt.setString(3 + i, types[i]); 716 } 717 } 718 719 return stmt.executeQuery(); 720 721 } 722 723 public ResultSet getSchemas() throws SQLException { 724 Statement statement = connection.createStatement(); 725 return statement.executeQuery( 726 " SELECT * \n" + 727 " FROM SYS_JDBC.Schemas \n" + 728 " ORDER BY \"TABLE_SCHEM\" " 729 ); 730 } 731 732 public ResultSet getCatalogs() throws SQLException { 733 Statement statement = connection.createStatement(); 734 return statement.executeQuery("SHOW JDBC_CATALOGS"); 735 } 736 737 public ResultSet getTableTypes() throws SQLException { 738 Statement statement = connection.createStatement(); 739 return statement.executeQuery("SHOW JDBC_TABLE_TYPES"); 740 } 741 742 public ResultSet getColumns(String catalog, String schemaPattern, 743 String tableNamePattern, String columnNamePattern) 744 throws SQLException { 745 746 if (tableNamePattern == null) { 747 tableNamePattern = "%"; 748 } 749 if (schemaPattern == null) { 750 schemaPattern = "%"; 751 } 752 if (columnNamePattern == null) { 753 columnNamePattern = "%"; 754 } 755 756 PreparedStatement statement = connection.prepareStatement( 757 " SELECT * \n" + 758 " FROM SYS_JDBC.Columns \n" + 759 " WHERE \"TABLE_SCHEM\" LIKE ? \n" + 760 " AND \"TABLE_NAME\" LIKE ? \n" + 761 " AND \"COLUMN_NAME\" LIKE ? \n" + 762 "ORDER BY \"TABLE_SCHEM\", \"TABLE_NAME\", \"ORDINAL_POSITION\"" 763 ); 764 765 statement.setString(1, schemaPattern); 766 statement.setString(2, tableNamePattern); 767 statement.setString(3, columnNamePattern); 768 769 return statement.executeQuery(); 770 } 771 772 public ResultSet getColumnPrivileges(String catalog, String schema, 773 String table, String columnNamePattern) throws SQLException { 774 775 if (columnNamePattern == null) { 776 columnNamePattern = "%"; 777 } 778 779 PreparedStatement statement = connection.prepareStatement( 780 " SELECT * FROM SYS_JDBC.ColumnPrivileges \n" + 781 " WHERE (? IS NOT NULL OR \"TABLE_SCHEM\" = ? ) \n" + 782 " AND (? IS NOT NULL OR \"TABLE_NAME\" = ? ) \n" + 783 " AND \"COLUMN_NAME\" LIKE ? \n" + 784 " ORDER BY \"COLUMN_NAME\", \"PRIVILEGE\" " 785 ); 786 787 statement.setString(1, schema); 788 statement.setString(2, schema); 789 statement.setString(3, table); 790 statement.setString(4, table); 791 statement.setString(5, columnNamePattern); 792 793 return statement.executeQuery(); 794 } 795 796 public ResultSet getTablePrivileges(String catalog, String schemaPattern, 797 String tableNamePattern) throws SQLException { 798 799 if (schemaPattern == null) { 800 schemaPattern = "%"; 801 } 802 if (tableNamePattern == null) { 803 tableNamePattern = "%"; 804 } 805 806 PreparedStatement statement = connection.prepareStatement( 807 " SELECT * FROM SYS_JDBC.TablePrivileges \n" + 808 " WHERE \"TABLE_SCHEM\" LIKE ? \n" + 809 " AND \"TABLE_NAME\" LIKE ? \n" + 810 " ORDER BY \"TABLE_SCHEM\", \"TABLE_NAME\", \"PRIVILEGE\" " 811 ); 812 813 statement.setString(1, schemaPattern); 814 statement.setString(2, tableNamePattern); 815 816 return statement.executeQuery(); 817 } 818 819 public ResultSet getBestRowIdentifier(String catalog, String schema, 820 String table, int scope, boolean nullable) throws SQLException { 821 822 PreparedStatement statement = connection.prepareStatement( 823 "SHOW JDBC_BEST_ROW_IDENTIFIER ( ?, ?, ?, ?, ? )"); 824 statement.setString(1, catalog); 825 statement.setString(2, schema); 826 statement.setString(3, table); 827 statement.setInt(4, scope); 828 statement.setBoolean(5, nullable); 829 830 return statement.executeQuery(); 831 } 832 833 public ResultSet getVersionColumns(String catalog, String schema, 834 String table) throws SQLException { 835 836 PreparedStatement statement = connection.prepareStatement( 837 "SHOW JDBC_VERSION_COLUMNS ( ?, ?, ? )"); 838 statement.setString(1, catalog); 839 statement.setString(2, schema); 840 statement.setString(3, table); 841 842 return statement.executeQuery(); 843 } 844 845 public ResultSet getPrimaryKeys(String catalog, String schema, 846 String table) throws SQLException { 847 848 PreparedStatement stmt = connection.prepareStatement( 849 " SELECT * \n" + 850 " FROM SYS_JDBC.PrimaryKeys \n" + 851 " WHERE ( ? IS NULL OR \"TABLE_SCHEM\" = ? ) \n" + 852 " AND \"TABLE_NAME\" = ? \n" + 853 " ORDER BY \"COLUMN_NAME\"" 854 ); 855 stmt.setString(1, schema); 856 stmt.setString(2, schema); 857 stmt.setString(3, table); 858 859 return stmt.executeQuery(); 860 861 } 862 863 public ResultSet getImportedKeys(String catalog, String schema, 864 String table) throws SQLException { 865 866 PreparedStatement stmt = connection.prepareStatement( 867 " SELECT * FROM SYS_JDBC.ImportedKeys \n" + 868 " WHERE ( ? IS NULL OR \"FKTABLE_SCHEM\" = ? )\n" + 869 " AND \"FKTABLE_NAME\" = ? \n" + 870 "ORDER BY \"FKTABLE_SCHEM\", \"FKTABLE_NAME\", \"KEY_SEQ\"" 871 ); 872 stmt.setString(1, schema); 873 stmt.setString(2, schema); 874 stmt.setString(3, table); 875 876 return stmt.executeQuery(); 877 } 878 879 public ResultSet getExportedKeys(String catalog, String schema, 880 String table) throws SQLException { 881 882 PreparedStatement stmt = connection.prepareStatement( 883 " SELECT * FROM SYS_JDBC.ImportedKeys \n" + 884 " WHERE ( ? IS NULL OR \"PKTABLE_SCHEM\" = ? ) \n" + 885 " AND \"PKTABLE_NAME\" = ? \n" + 886 "ORDER BY \"FKTABLE_SCHEM\", \"FKTABLE_NAME\", \"KEY_SEQ\"" 887 ); 888 stmt.setString(1, schema); 889 stmt.setString(2, schema); 890 stmt.setString(3, table); 891 892 return stmt.executeQuery(); 893 } 894 895 public ResultSet getCrossReference( 896 String primaryCatalog, String primarySchema, String primaryTable, 897 String foreignCatalog, String foreignSchema, String foreignTable 898 ) throws SQLException { 899 900 PreparedStatement stmt = connection.prepareStatement( 901 " SELECT * FROM SYS_JDBC.ImportedKeys \n" + 902 " WHERE ( ? IS NULL OR \"PKTABLE_SCHEM\" = ? )\n" + 903 " AND \"PKTABLE_NAME\" = ?\n" + 904 " AND ( ? IS NULL OR \"FKTABLE_SCHEM\" = ? )\n" + 905 " AND \"FKTABLE_NAME\" = ?\n" + 906 "ORDER BY \"FKTABLE_SCHEM\", \"FKTABLE_NAME\", \"KEY_SEQ\"\n" 907 ); 908 stmt.setString(1, primarySchema); 909 stmt.setString(2, primarySchema); 910 stmt.setString(3, primaryTable); 911 stmt.setString(4, foreignSchema); 912 stmt.setString(5, foreignSchema); 913 stmt.setString(6, foreignTable); 914 915 return stmt.executeQuery(); 916 } 917 918 public ResultSet getTypeInfo() throws SQLException { 919 return connection.createStatement().executeQuery( 920 "SELECT * FROM SYS_INFO.sUSRSQLTypeInfo"); 921 } 922 923 public ResultSet getIndexInfo(String catalog, String schema, String table, 924 boolean unique, boolean approximate) 925 throws SQLException { 926 927 PreparedStatement statement = connection.prepareStatement( 928 "SHOW JDBC_INDEX_INFO ( ?, ?, ?, ?, ? )"); 929 statement.setString(1, catalog); 930 statement.setString(2, schema); 931 statement.setString(3, table); 932 statement.setBoolean(4, unique); 933 statement.setBoolean(5, approximate); 934 935 return statement.executeQuery(); 936 } 937 938 940 942 public boolean supportsResultSetType(int type) throws SQLException { 943 return (type == ResultSet.TYPE_FORWARD_ONLY || 944 type == ResultSet.TYPE_SCROLL_INSENSITIVE); 945 } 946 947 public boolean supportsResultSetConcurrency(int type, int concurrency) 948 throws SQLException { 949 if (type == ResultSet.TYPE_SCROLL_INSENSITIVE && 950 concurrency == ResultSet.CONCUR_READ_ONLY) { 951 return true; 952 } 953 return false; 954 } 955 956 public boolean ownUpdatesAreVisible(int type) throws SQLException { 957 return false; 958 } 959 960 public boolean ownDeletesAreVisible(int type) throws SQLException { 961 return false; 962 } 963 964 public boolean ownInsertsAreVisible(int type) throws SQLException { 965 return false; 966 } 967 968 public boolean othersUpdatesAreVisible(int type) throws SQLException { 969 return false; 970 } 971 972 public boolean othersDeletesAreVisible(int type) throws SQLException { 973 return false; 974 } 975 976 public boolean othersInsertsAreVisible(int type) throws SQLException { 977 return false; 978 } 979 980 public boolean updatesAreDetected(int type) throws SQLException { 981 return false; 982 } 983 984 public boolean deletesAreDetected(int type) throws SQLException { 985 return false; 986 } 987 988 public boolean insertsAreDetected(int type) throws SQLException { 989 return false; 990 } 991 992 public boolean supportsBatchUpdates() throws SQLException { 993 return true; 994 } 995 996 public ResultSet getUDTs(String catalog, String schemaPattern, 997 String typeNamePattern, int[] types) 998 throws SQLException { 999 1000 String where_clause = "true"; 1001 if (types != null) { 1002 for (int i = 0; i < types.length; ++i) { 1003 1004 int t = types[i]; 1005 String tstr = "JAVA_OBJECT"; 1006 if (t == Types.STRUCT) { 1007 tstr = "STRUCT"; 1008 } 1009 else if (t == Types.DISTINCT) { 1010 tstr = "DISTINCT"; 1011 } 1012 1013 if (i != 0) { 1014 where_clause += " AND"; 1015 } 1016 where_clause += " DATA_TYPE = '" + 1017 MckoiConnection.quote(tstr) + "'"; 1018 } 1019 } 1020 1021 PreparedStatement statement = connection.prepareStatement( 1022 "SHOW JDBC_UDTS ( ?, ?, ? ) WHERE " + where_clause); 1023 statement.setString(1, catalog); 1024 statement.setString(2, schemaPattern); 1025 statement.setString(3, typeNamePattern); 1026 1027 return statement.executeQuery(); 1028 } 1029 1030 public Connection getConnection() throws SQLException { 1031 return connection; 1032 } 1033 1034 1036 1038 1040 public boolean supportsSavepoints() throws SQLException { 1041 return false; 1043 } 1044 1045 public boolean supportsNamedParameters() throws SQLException { 1046 return false; 1047 } 1048 1049 public boolean supportsMultipleOpenResults() throws SQLException { 1050 return false; 1051 } 1052 1053 public boolean supportsGetGeneratedKeys() throws SQLException { 1054 return false; 1055 } 1056 1057 public ResultSet getSuperTypes(String catalog, String schemaPattern, 1058 String typeNamePattern) throws SQLException { 1059 throw MSQLException.unsupported(); 1060 } 1061 1062 public ResultSet getSuperTables(String catalog, String schemaPattern, 1063 String tableNamePattern) throws SQLException { 1064 throw MSQLException.unsupported(); 1065 } 1066 1067 public ResultSet getAttributes(String catalog, String schemaPattern, 1068 String typeNamePattern, String attributeNamePattern) 1069 throws SQLException { 1070 throw MSQLException.unsupported(); 1071 } 1072 1073 public boolean supportsResultSetHoldability(int holdability) 1074 throws SQLException { 1075 return holdability == ResultSet.HOLD_CURSORS_OVER_COMMIT; 1076 } 1077 1078 public int getResultSetHoldability() throws SQLException { 1079 return ResultSet.HOLD_CURSORS_OVER_COMMIT; 1082 } 1083 1084 public int getDatabaseMajorVersion() throws SQLException { 1085 throw MSQLException.unsupported(); 1086 } 1087 1088 public int getDatabaseMinorVersion() throws SQLException { 1089 throw MSQLException.unsupported(); 1090 } 1091 1092 public int getJDBCMajorVersion() throws SQLException { 1093 return 3; 1094 } 1095 1096 public int getJDBCMinorVersion() throws SQLException { 1097 return 0; 1098 } 1099 1100 public int getSQLStateType() throws SQLException { 1101 throw MSQLException.unsupported(); 1103 } 1104 1105 public boolean locatorsUpdateCopy() throws SQLException { 1106 throw MSQLException.unsupported(); 1108 } 1109 1110 public boolean supportsStatementPooling() throws SQLException { 1111 return true; 1112 } 1113 1114 1116} 1117 | Popular Tags |