1. /*
  2. * @(#)DatabaseMetaData.java 1.21 01/11/29
  3. *
  4. * Copyright 2002 Sun Microsystems, Inc. All rights reserved.
  5. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
  6. */
  7. package java.sql;
  8. /**
  9. * Comprehensive information about the database as a whole.
  10. *
  11. * <P>Many of the methods here return lists of information in
  12. * the form of <code>ResultSet</code> objects.
  13. * You can use the normal ResultSet methods such as getString and getInt
  14. * to retrieve the data from these ResultSets. If a given form of
  15. * metadata is not available, these methods should throw an SQLException.
  16. *
  17. * <P>Some of these methods take arguments that are String patterns. These
  18. * arguments all have names such as fooPattern. Within a pattern String, "%"
  19. * means match any substring of 0 or more characters, and "_" means match
  20. * any one character. Only metadata entries matching the search pattern
  21. * are returned. If a search pattern argument is set to a null ref,
  22. * that argument's criteria will be dropped from the search.
  23. *
  24. * <P>An <code>SQLException</code> will be thrown if a driver does not support a meta
  25. * data method. In the case of methods that return a ResultSet,
  26. * either a ResultSet (which may be empty) is returned or a
  27. * SQLException is thrown.
  28. */
  29. public interface DatabaseMetaData {
  30. //----------------------------------------------------------------------
  31. // First, a variety of minor information about the target database.
  32. /**
  33. * Can all the procedures returned by getProcedures be called by the
  34. * current user?
  35. *
  36. * @return <code>true</code> if so; <code>false</code> otherwise
  37. * @exception SQLException if a database access error occurs
  38. */
  39. boolean allProceduresAreCallable() throws SQLException;
  40. /**
  41. * Can all the tables returned by getTable be SELECTed by the
  42. * current user?
  43. *
  44. * @return <code>true</code> if so; <code>false</code> otherwise
  45. * @exception SQLException if a database access error occurs
  46. */
  47. boolean allTablesAreSelectable() throws SQLException;
  48. /**
  49. * What's the url for this database?
  50. *
  51. * @return the url or null if it cannot be generated
  52. * @exception SQLException if a database access error occurs
  53. */
  54. String getURL() throws SQLException;
  55. /**
  56. * What's our user name as known to the database?
  57. *
  58. * @return our database user name
  59. * @exception SQLException if a database access error occurs
  60. */
  61. String getUserName() throws SQLException;
  62. /**
  63. * Is the database in read-only mode?
  64. *
  65. * @return <code>true</code> if so; <code>false</code> otherwise
  66. * @exception SQLException if a database access error occurs
  67. */
  68. boolean isReadOnly() throws SQLException;
  69. /**
  70. * Are NULL values sorted high?
  71. *
  72. * @return <code>true</code> if so; <code>false</code> otherwise
  73. * @exception SQLException if a database access error occurs
  74. */
  75. boolean nullsAreSortedHigh() throws SQLException;
  76. /**
  77. * Are NULL values sorted low?
  78. *
  79. * @return <code>true</code> if so; <code>false</code> otherwise
  80. * @exception SQLException if a database access error occurs
  81. */
  82. boolean nullsAreSortedLow() throws SQLException;
  83. /**
  84. * Are NULL values sorted at the start regardless of sort order?
  85. *
  86. * @return <code>true</code> if so; <code>false</code> otherwise
  87. * @exception SQLException if a database access error occurs
  88. */
  89. boolean nullsAreSortedAtStart() throws SQLException;
  90. /**
  91. * Are NULL values sorted at the end regardless of sort order?
  92. *
  93. * @return <code>true</code> if so; <code>false</code> otherwise
  94. * @exception SQLException if a database access error occurs
  95. */
  96. boolean nullsAreSortedAtEnd() throws SQLException;
  97. /**
  98. * What's the name of this database product?
  99. *
  100. * @return database product name
  101. * @exception SQLException if a database access error occurs
  102. */
  103. String getDatabaseProductName() throws SQLException;
  104. /**
  105. * What's the version of this database product?
  106. *
  107. * @return database version
  108. * @exception SQLException if a database access error occurs
  109. */
  110. String getDatabaseProductVersion() throws SQLException;
  111. /**
  112. * What's the name of this JDBC driver?
  113. *
  114. * @return JDBC driver name
  115. * @exception SQLException if a database access error occurs
  116. */
  117. String getDriverName() throws SQLException;
  118. /**
  119. * What's the version of this JDBC driver?
  120. *
  121. * @return JDBC driver version
  122. * @exception SQLException if a database access error occurs
  123. */
  124. String getDriverVersion() throws SQLException;
  125. /**
  126. * What's this JDBC driver's major version number?
  127. *
  128. * @return JDBC driver major version
  129. */
  130. int getDriverMajorVersion();
  131. /**
  132. * What's this JDBC driver's minor version number?
  133. *
  134. * @return JDBC driver minor version number
  135. */
  136. int getDriverMinorVersion();
  137. /**
  138. * Does the database store tables in a local file?
  139. *
  140. * @return <code>true</code> if so; <code>false</code> otherwise
  141. * @exception SQLException if a database access error occurs
  142. */
  143. boolean usesLocalFiles() throws SQLException;
  144. /**
  145. * Does the database use a file for each table?
  146. *
  147. * @return true if the database uses a local file for each table
  148. * @exception SQLException if a database access error occurs
  149. */
  150. boolean usesLocalFilePerTable() throws SQLException;
  151. /**
  152. * Does the database treat mixed case unquoted SQL identifiers as
  153. * case sensitive and as a result store them in mixed case?
  154. *
  155. * A JDBC Compliant<sup><font size=-2>TM</font></sup> driver will always return false.
  156. *
  157. * @return <code>true</code> if so; <code>false</code> otherwise
  158. * @exception SQLException if a database access error occurs
  159. */
  160. boolean supportsMixedCaseIdentifiers() throws SQLException;
  161. /**
  162. * Does the database treat mixed case unquoted SQL identifiers as
  163. * case insensitive and store them in upper case?
  164. *
  165. * @return <code>true</code> if so; <code>false</code> otherwise
  166. * @exception SQLException if a database access error occurs
  167. */
  168. boolean storesUpperCaseIdentifiers() throws SQLException;
  169. /**
  170. * Does the database treat mixed case unquoted SQL identifiers as
  171. * case insensitive and store them in lower case?
  172. *
  173. * @return <code>true</code> if so; <code>false</code> otherwise
  174. * @exception SQLException if a database access error occurs
  175. */
  176. boolean storesLowerCaseIdentifiers() throws SQLException;
  177. /**
  178. * Does the database treat mixed case unquoted SQL identifiers as
  179. * case insensitive and store them in mixed case?
  180. *
  181. * @return <code>true</code> if so; <code>false</code> otherwise
  182. * @exception SQLException if a database access error occurs
  183. */
  184. boolean storesMixedCaseIdentifiers() throws SQLException;
  185. /**
  186. * Does the database treat mixed case quoted SQL identifiers as
  187. * case sensitive and as a result store them in mixed case?
  188. *
  189. * A JDBC Compliant<sup><font size=-2>TM</font></sup> driver will always return true.
  190. *
  191. * @return <code>true</code> if so; <code>false</code> otherwise
  192. * @exception SQLException if a database access error occurs
  193. */
  194. boolean supportsMixedCaseQuotedIdentifiers() throws SQLException;
  195. /**
  196. * Does the database treat mixed case quoted SQL identifiers as
  197. * case insensitive and store them in upper case?
  198. *
  199. * @return <code>true</code> if so; <code>false</code> otherwise
  200. * @exception SQLException if a database access error occurs
  201. */
  202. boolean storesUpperCaseQuotedIdentifiers() throws SQLException;
  203. /**
  204. * Does the database treat mixed case quoted SQL identifiers as
  205. * case insensitive and store them in lower case?
  206. *
  207. * @return <code>true</code> if so; <code>false</code> otherwise
  208. * @exception SQLException if a database access error occurs
  209. */
  210. boolean storesLowerCaseQuotedIdentifiers() throws SQLException;
  211. /**
  212. * Does the database treat mixed case quoted SQL identifiers as
  213. * case insensitive and store them in mixed case?
  214. *
  215. * @return <code>true</code> if so; <code>false</code> otherwise
  216. * @exception SQLException if a database access error occurs
  217. */
  218. boolean storesMixedCaseQuotedIdentifiers() throws SQLException;
  219. /**
  220. * What's the string used to quote SQL identifiers?
  221. * This returns a space " " if identifier quoting isn't supported.
  222. *
  223. * A JDBC Compliant<sup><font size=-2>TM</font></sup>
  224. * driver always uses a double quote character.
  225. *
  226. * @return the quoting string
  227. * @exception SQLException if a database access error occurs
  228. */
  229. String getIdentifierQuoteString() throws SQLException;
  230. /**
  231. * Gets a comma-separated list of all a database's SQL keywords
  232. * that are NOT also SQL92 keywords.
  233. *
  234. * @return the list
  235. * @exception SQLException if a database access error occurs
  236. */
  237. String getSQLKeywords() throws SQLException;
  238. /**
  239. * Gets a comma-separated list of math functions. These are the
  240. * X/Open CLI math function names used in the JDBC function escape
  241. * clause.
  242. *
  243. * @return the list
  244. * @exception SQLException if a database access error occurs
  245. */
  246. String getNumericFunctions() throws SQLException;
  247. /**
  248. * Gets a comma-separated list of string functions. These are the
  249. * X/Open CLI string function names used in the JDBC function escape
  250. * clause.
  251. *
  252. * @return the list
  253. * @exception SQLException if a database access error occurs
  254. */
  255. String getStringFunctions() throws SQLException;
  256. /**
  257. * Gets a comma-separated list of system functions. These are the
  258. * X/Open CLI system function names used in the JDBC function escape
  259. * clause.
  260. *
  261. * @return the list
  262. * @exception SQLException if a database access error occurs
  263. */
  264. String getSystemFunctions() throws SQLException;
  265. /**
  266. * Gets a comma-separated list of time and date functions.
  267. *
  268. * @return the list
  269. * @exception SQLException if a database access error occurs
  270. */
  271. String getTimeDateFunctions() throws SQLException;
  272. /**
  273. * Gets the string that can be used to escape wildcard characters.
  274. * This is the string that can be used to escape '_' or '%' in
  275. * the string pattern style catalog search parameters.
  276. *
  277. * <P>The '_' character represents any single character.
  278. * <P>The '%' character represents any sequence of zero or
  279. * more characters.
  280. *
  281. * @return the string used to escape wildcard characters
  282. * @exception SQLException if a database access error occurs
  283. */
  284. String getSearchStringEscape() throws SQLException;
  285. /**
  286. * Gets all the "extra" characters that can be used in unquoted
  287. * identifier names (those beyond a-z, A-Z, 0-9 and _).
  288. *
  289. * @return the string containing the extra characters
  290. * @exception SQLException if a database access error occurs
  291. */
  292. String getExtraNameCharacters() throws SQLException;
  293. //--------------------------------------------------------------------
  294. // Functions describing which features are supported.
  295. /**
  296. * Is "ALTER TABLE" with add column supported?
  297. *
  298. * @return <code>true</code> if so; <code>false</code> otherwise
  299. * @exception SQLException if a database access error occurs
  300. */
  301. boolean supportsAlterTableWithAddColumn() throws SQLException;
  302. /**
  303. * Is "ALTER TABLE" with drop column supported?
  304. *
  305. * @return <code>true</code> if so; <code>false</code> otherwise
  306. * @exception SQLException if a database access error occurs
  307. */
  308. boolean supportsAlterTableWithDropColumn() throws SQLException;
  309. /**
  310. * Is column aliasing supported?
  311. *
  312. * <P>If so, the SQL AS clause can be used to provide names for
  313. * computed columns or to provide alias names for columns as
  314. * required.
  315. *
  316. * A JDBC Compliant<sup><font size=-2>TM</font></sup> driver always returns true.
  317. *
  318. * @return <code>true</code> if so; <code>false</code> otherwise
  319. * @exception SQLException if a database access error occurs
  320. */
  321. boolean supportsColumnAliasing() throws SQLException;
  322. /**
  323. * Are concatenations between NULL and non-NULL values NULL?
  324. *
  325. * A JDBC Compliant<sup><font size=-2>TM</font></sup> driver always returns true.
  326. *
  327. * @return <code>true</code> if so; <code>false</code> otherwise
  328. * @exception SQLException if a database access error occurs
  329. */
  330. boolean nullPlusNonNullIsNull() throws SQLException;
  331. /**
  332. * Is the CONVERT function between SQL types supported?
  333. *
  334. * @return <code>true</code> if so; <code>false</code> otherwise
  335. * @exception SQLException if a database access error occurs
  336. */
  337. boolean supportsConvert() throws SQLException;
  338. /**
  339. * Is CONVERT between the given SQL types supported?
  340. *
  341. * @param fromType the type to convert from
  342. * @param toType the type to convert to
  343. * @return <code>true</code> if so; <code>false</code> otherwise
  344. * @exception SQLException if a database access error occurs
  345. * @see Types
  346. */
  347. boolean supportsConvert(int fromType, int toType) throws SQLException;
  348. /**
  349. * Are table correlation names supported?
  350. *
  351. * A JDBC Compliant<sup><font size=-2>TM</font></sup> driver always returns true.
  352. *
  353. * @return <code>true</code> if so; <code>false</code> otherwise
  354. * @exception SQLException if a database access error occurs
  355. */
  356. boolean supportsTableCorrelationNames() throws SQLException;
  357. /**
  358. * If table correlation names are supported, are they restricted
  359. * to be different from the names of the tables?
  360. *
  361. * @return <code>true</code> if so; <code>false</code> otherwise
  362. * @exception SQLException if a database access error occurs
  363. */
  364. boolean supportsDifferentTableCorrelationNames() throws SQLException;
  365. /**
  366. * Are expressions in "ORDER BY" lists supported?
  367. *
  368. * @return <code>true</code> if so; <code>false</code> otherwise
  369. * @exception SQLException if a database access error occurs
  370. */
  371. boolean supportsExpressionsInOrderBy() throws SQLException;
  372. /**
  373. * Can an "ORDER BY" clause use columns not in the SELECT statement?
  374. *
  375. * @return <code>true</code> if so; <code>false</code> otherwise
  376. * @exception SQLException if a database access error occurs
  377. */
  378. boolean supportsOrderByUnrelated() throws SQLException;
  379. /**
  380. * Is some form of "GROUP BY" clause supported?
  381. *
  382. * @return <code>true</code> if so; <code>false</code> otherwise
  383. * @exception SQLException if a database access error occurs
  384. */
  385. boolean supportsGroupBy() throws SQLException;
  386. /**
  387. * Can a "GROUP BY" clause use columns not in the SELECT?
  388. *
  389. * @return <code>true</code> if so; <code>false</code> otherwise
  390. * @exception SQLException if a database access error occurs
  391. */
  392. boolean supportsGroupByUnrelated() throws SQLException;
  393. /**
  394. * Can a "GROUP BY" clause add columns not in the SELECT
  395. * provided it specifies all the columns in the SELECT?
  396. *
  397. * @return <code>true</code> if so; <code>false</code> otherwise
  398. * @exception SQLException if a database access error occurs
  399. */
  400. boolean supportsGroupByBeyondSelect() throws SQLException;
  401. /**
  402. * Is the escape character in "LIKE" clauses supported?
  403. *
  404. * A JDBC Compliant<sup><font size=-2>TM</font></sup> driver always returns true.
  405. *
  406. * @return <code>true</code> if so; <code>false</code> otherwise
  407. * @exception SQLException if a database access error occurs
  408. */
  409. boolean supportsLikeEscapeClause() throws SQLException;
  410. /**
  411. * Are multiple ResultSets from a single execute supported?
  412. *
  413. * @return <code>true</code> if so; <code>false</code> otherwise
  414. * @exception SQLException if a database access error occurs
  415. */
  416. boolean supportsMultipleResultSets() throws SQLException;
  417. /**
  418. * Can we have multiple transactions open at once (on different
  419. * connections)?
  420. *
  421. * @return <code>true</code> if so; <code>false</code> otherwise
  422. * @exception SQLException if a database access error occurs
  423. */
  424. boolean supportsMultipleTransactions() throws SQLException;
  425. /**
  426. * Can columns be defined as non-nullable?
  427. *
  428. * A JDBC Compliant<sup><font size=-2>TM</font></sup> driver always returns true.
  429. *
  430. * @return <code>true</code> if so; <code>false</code> otherwise
  431. * @exception SQLException if a database access error occurs
  432. */
  433. boolean supportsNonNullableColumns() throws SQLException;
  434. /**
  435. * Is the ODBC Minimum SQL grammar supported?
  436. *
  437. * All JDBC Compliant<sup><font size=-2>TM</font></sup> drivers must return true.
  438. *
  439. * @return <code>true</code> if so; <code>false</code> otherwise
  440. * @exception SQLException if a database access error occurs
  441. */
  442. boolean supportsMinimumSQLGrammar() throws SQLException;
  443. /**
  444. * Is the ODBC Core SQL grammar supported?
  445. *
  446. * @return <code>true</code> if so; <code>false</code> otherwise
  447. * @exception SQLException if a database access error occurs
  448. */
  449. boolean supportsCoreSQLGrammar() throws SQLException;
  450. /**
  451. * Is the ODBC Extended SQL grammar supported?
  452. *
  453. * @return <code>true</code> if so; <code>false</code> otherwise
  454. * @exception SQLException if a database access error occurs
  455. */
  456. boolean supportsExtendedSQLGrammar() throws SQLException;
  457. /**
  458. * Is the ANSI92 entry level SQL grammar supported?
  459. *
  460. * All JDBC Compliant<sup><font size=-2>TM</font></sup> drivers must return true.
  461. *
  462. * @return <code>true</code> if so; <code>false</code> otherwise
  463. * @exception SQLException if a database access error occurs
  464. */
  465. boolean supportsANSI92EntryLevelSQL() throws SQLException;
  466. /**
  467. * Is the ANSI92 intermediate SQL grammar supported?
  468. *
  469. * @return <code>true</code> if so; <code>false</code> otherwise
  470. * @exception SQLException if a database access error occurs
  471. */
  472. boolean supportsANSI92IntermediateSQL() throws SQLException;
  473. /**
  474. * Is the ANSI92 full SQL grammar supported?
  475. *
  476. * @return <code>true</code> if so; <code>false</code> otherwise
  477. * @exception SQLException if a database access error occurs
  478. */
  479. boolean supportsANSI92FullSQL() throws SQLException;
  480. /**
  481. * Is the SQL Integrity Enhancement Facility supported?
  482. *
  483. * @return <code>true</code> if so; <code>false</code> otherwise
  484. * @exception SQLException if a database access error occurs
  485. */
  486. boolean supportsIntegrityEnhancementFacility() throws SQLException;
  487. /**
  488. * Is some form of outer join supported?
  489. *
  490. * @return <code>true</code> if so; <code>false</code> otherwise
  491. * @exception SQLException if a database access error occurs
  492. */
  493. boolean supportsOuterJoins() throws SQLException;
  494. /**
  495. * Are full nested outer joins supported?
  496. *
  497. * @return <code>true</code> if so; <code>false</code> otherwise
  498. * @exception SQLException if a database access error occurs
  499. */
  500. boolean supportsFullOuterJoins() throws SQLException;
  501. /**
  502. * Is there limited support for outer joins? (This will be true
  503. * if supportFullOuterJoins is true.)
  504. *
  505. * @return <code>true</code> if so; <code>false</code> otherwise
  506. * @exception SQLException if a database access error occurs
  507. */
  508. boolean supportsLimitedOuterJoins() throws SQLException;
  509. /**
  510. * What's the database vendor's preferred term for "schema"?
  511. *
  512. * @return the vendor term
  513. * @exception SQLException if a database access error occurs
  514. */
  515. String getSchemaTerm() throws SQLException;
  516. /**
  517. * What's the database vendor's preferred term for "procedure"?
  518. *
  519. * @return the vendor term
  520. * @exception SQLException if a database access error occurs
  521. */
  522. String getProcedureTerm() throws SQLException;
  523. /**
  524. * What's the database vendor's preferred term for "catalog"?
  525. *
  526. * @return the vendor term
  527. * @exception SQLException if a database access error occurs
  528. */
  529. String getCatalogTerm() throws SQLException;
  530. /**
  531. * Does a catalog appear at the start of a qualified table name?
  532. * (Otherwise it appears at the end)
  533. *
  534. * @return true if it appears at the start
  535. * @exception SQLException if a database access error occurs
  536. */
  537. boolean isCatalogAtStart() throws SQLException;
  538. /**
  539. * What's the separator between catalog and table name?
  540. *
  541. * @return the separator string
  542. * @exception SQLException if a database access error occurs
  543. */
  544. String getCatalogSeparator() throws SQLException;
  545. /**
  546. * Can a schema name be used in a data manipulation statement?
  547. *
  548. * @return <code>true</code> if so; <code>false</code> otherwise
  549. * @exception SQLException if a database access error occurs
  550. */
  551. boolean supportsSchemasInDataManipulation() throws SQLException;
  552. /**
  553. * Can a schema name be used in a procedure call statement?
  554. *
  555. * @return <code>true</code> if so; <code>false</code> otherwise
  556. * @exception SQLException if a database access error occurs
  557. */
  558. boolean supportsSchemasInProcedureCalls() throws SQLException;
  559. /**
  560. * Can a schema name be used in a table definition statement?
  561. *
  562. * @return <code>true</code> if so; <code>false</code> otherwise
  563. * @exception SQLException if a database access error occurs
  564. */
  565. boolean supportsSchemasInTableDefinitions() throws SQLException;
  566. /**
  567. * Can a schema name be used in an index definition statement?
  568. *
  569. * @return <code>true</code> if so; <code>false</code> otherwise
  570. * @exception SQLException if a database access error occurs
  571. */
  572. boolean supportsSchemasInIndexDefinitions() throws SQLException;
  573. /**
  574. * Can a schema name be used in a privilege definition statement?
  575. *
  576. * @return <code>true</code> if so; <code>false</code> otherwise
  577. * @exception SQLException if a database access error occurs
  578. */
  579. boolean supportsSchemasInPrivilegeDefinitions() throws SQLException;
  580. /**
  581. * Can a catalog name be used in a data manipulation statement?
  582. *
  583. * @return <code>true</code> if so; <code>false</code> otherwise
  584. * @exception SQLException if a database access error occurs
  585. */
  586. boolean supportsCatalogsInDataManipulation() throws SQLException;
  587. /**
  588. * Can a catalog name be used in a procedure call statement?
  589. *
  590. * @return <code>true</code> if so; <code>false</code> otherwise
  591. * @exception SQLException if a database access error occurs
  592. */
  593. boolean supportsCatalogsInProcedureCalls() throws SQLException;
  594. /**
  595. * Can a catalog name be used in a table definition statement?
  596. *
  597. * @return <code>true</code> if so; <code>false</code> otherwise
  598. * @exception SQLException if a database access error occurs
  599. */
  600. boolean supportsCatalogsInTableDefinitions() throws SQLException;
  601. /**
  602. * Can a catalog name be used in an index definition statement?
  603. *
  604. * @return <code>true</code> if so; <code>false</code> otherwise
  605. * @exception SQLException if a database access error occurs
  606. */
  607. boolean supportsCatalogsInIndexDefinitions() throws SQLException;
  608. /**
  609. * Can a catalog name be used in a privilege definition statement?
  610. *
  611. * @return <code>true</code> if so; <code>false</code> otherwise
  612. * @exception SQLException if a database access error occurs
  613. */
  614. boolean supportsCatalogsInPrivilegeDefinitions() throws SQLException;
  615. /**
  616. * Is positioned DELETE supported?
  617. *
  618. * @return <code>true</code> if so; <code>false</code> otherwise
  619. * @exception SQLException if a database access error occurs
  620. */
  621. boolean supportsPositionedDelete() throws SQLException;
  622. /**
  623. * Is positioned UPDATE supported?
  624. *
  625. * @return <code>true</code> if so; <code>false</code> otherwise
  626. * @exception SQLException if a database access error occurs
  627. */
  628. boolean supportsPositionedUpdate() throws SQLException;
  629. /**
  630. * Is SELECT for UPDATE supported?
  631. *
  632. * @return <code>true</code> if so; <code>false</code> otherwise
  633. * @exception SQLException if a database access error occurs
  634. */
  635. boolean supportsSelectForUpdate() throws SQLException;
  636. /**
  637. * Are stored procedure calls using the stored procedure escape
  638. * syntax supported?
  639. *
  640. * @return <code>true</code> if so; <code>false</code> otherwise
  641. * @exception SQLException if a database access error occurs
  642. */
  643. boolean supportsStoredProcedures() throws SQLException;
  644. /**
  645. * Are subqueries in comparison expressions supported?
  646. *
  647. * A JDBC Compliant<sup><font size=-2>TM</font></sup> driver always returns true.
  648. *
  649. * @return <code>true</code> if so; <code>false</code> otherwise
  650. * @exception SQLException if a database access error occurs
  651. */
  652. boolean supportsSubqueriesInComparisons() throws SQLException;
  653. /**
  654. * Are subqueries in 'exists' expressions supported?
  655. *
  656. * A JDBC Compliant<sup><font size=-2>TM</font></sup> driver always returns true.
  657. *
  658. * @return <code>true</code> if so; <code>false</code> otherwise
  659. * @exception SQLException if a database access error occurs
  660. */
  661. boolean supportsSubqueriesInExists() throws SQLException;
  662. /**
  663. * Are subqueries in 'in' statements supported?
  664. *
  665. * A JDBC Compliant<sup><font size=-2>TM</font></sup> driver always returns true.
  666. *
  667. * @return <code>true</code> if so; <code>false</code> otherwise
  668. * @exception SQLException if a database access error occurs
  669. */
  670. boolean supportsSubqueriesInIns() throws SQLException;
  671. /**
  672. * Are subqueries in quantified expressions supported?
  673. *
  674. * A JDBC Compliant<sup><font size=-2>TM</font></sup> driver always returns true.
  675. *
  676. * @return <code>true</code> if so; <code>false</code> otherwise
  677. * @exception SQLException if a database access error occurs
  678. */
  679. boolean supportsSubqueriesInQuantifieds() throws SQLException;
  680. /**
  681. * Are correlated subqueries supported?
  682. *
  683. * A JDBC Compliant<sup><font size=-2>TM</font></sup> driver always returns true.
  684. *
  685. * @return <code>true</code> if so; <code>false</code> otherwise
  686. * @exception SQLException if a database access error occurs
  687. */
  688. boolean supportsCorrelatedSubqueries() throws SQLException;
  689. /**
  690. * Is SQL UNION supported?
  691. *
  692. * @return <code>true</code> if so; <code>false</code> otherwise
  693. * @exception SQLException if a database access error occurs
  694. */
  695. boolean supportsUnion() throws SQLException;
  696. /**
  697. * Is SQL UNION ALL supported?
  698. *
  699. * @return <code>true</code> if so; <code>false</code> otherwise
  700. * @exception SQLException if a database access error occurs
  701. */
  702. boolean supportsUnionAll() throws SQLException;
  703. /**
  704. * Can cursors remain open across commits?
  705. *
  706. * @return <code>true</code> if cursors always remain open;
  707. * <code>false</code> if they might not remain open
  708. * @exception SQLException if a database access error occurs
  709. */
  710. boolean supportsOpenCursorsAcrossCommit() throws SQLException;
  711. /**
  712. * Can cursors remain open across rollbacks?
  713. *
  714. * @return <code>true</code> if cursors always remain open;
  715. * <code>false</code> if they might not remain open
  716. * @exception SQLException if a database access error occurs
  717. */
  718. boolean supportsOpenCursorsAcrossRollback() throws SQLException;
  719. /**
  720. * Can statements remain open across commits?
  721. *
  722. * @return <code>true</code> if statements always remain open;
  723. * <code>false</code> if they might not remain open
  724. * @exception SQLException if a database access error occurs
  725. */
  726. boolean supportsOpenStatementsAcrossCommit() throws SQLException;
  727. /**
  728. * Can statements remain open across rollbacks?
  729. *
  730. * @return <code>true</code> if statements always remain open;
  731. * <code>false</code> if they might not remain open
  732. * @exception SQLException if a database access error occurs
  733. */
  734. boolean supportsOpenStatementsAcrossRollback() throws SQLException;
  735. //----------------------------------------------------------------------
  736. // The following group of methods exposes various limitations
  737. // based on the target database with the current driver.
  738. // Unless otherwise specified, a result of zero means there is no
  739. // limit, or the limit is not known.
  740. /**
  741. * How many hex characters can you have in an inline binary literal?
  742. *
  743. * @return max binary literal length in hex characters;
  744. * a result of zero means that there is no limit or the limit is not known
  745. * @exception SQLException if a database access error occurs
  746. */
  747. int getMaxBinaryLiteralLength() throws SQLException;
  748. /**
  749. * What's the max length for a character literal?
  750. *
  751. * @return max literal length;
  752. * a result of zero means that there is no limit or the limit is not known
  753. * @exception SQLException if a database access error occurs
  754. */
  755. int getMaxCharLiteralLength() throws SQLException;
  756. /**
  757. * What's the limit on column name length?
  758. *
  759. * @return max column name length;
  760. * a result of zero means that there is no limit or the limit is not known
  761. * @exception SQLException if a database access error occurs
  762. */
  763. int getMaxColumnNameLength() throws SQLException;
  764. /**
  765. * What's the maximum number of columns in a "GROUP BY" clause?
  766. *
  767. * @return max number of columns;
  768. * a result of zero means that there is no limit or the limit is not known
  769. * @exception SQLException if a database access error occurs
  770. */
  771. int getMaxColumnsInGroupBy() throws SQLException;
  772. /**
  773. * What's the maximum number of columns allowed in an index?
  774. *
  775. * @return max number of columns;
  776. * a result of zero means that there is no limit or the limit is not known
  777. * @exception SQLException if a database access error occurs
  778. */
  779. int getMaxColumnsInIndex() throws SQLException;
  780. /**
  781. * What's the maximum number of columns in an "ORDER BY" clause?
  782. *
  783. * @return max number of columns;
  784. * a result of zero means that there is no limit or the limit is not known
  785. * @exception SQLException if a database access error occurs
  786. */
  787. int getMaxColumnsInOrderBy() throws SQLException;
  788. /**
  789. * What's the maximum number of columns in a "SELECT" list?
  790. *
  791. * @return max number of columns;
  792. * a result of zero means that there is no limit or the limit is not known
  793. * @exception SQLException if a database access error occurs
  794. */
  795. int getMaxColumnsInSelect() throws SQLException;
  796. /**
  797. * What's the maximum number of columns in a table?
  798. *
  799. * @return max number of columns;
  800. * a result of zero means that there is no limit or the limit is not known
  801. * @exception SQLException if a database access error occurs
  802. */
  803. int getMaxColumnsInTable() throws SQLException;
  804. /**
  805. * How many active connections can we have at a time to this database?
  806. *
  807. * @return max number of active connections;
  808. * a result of zero means that there is no limit or the limit is not known
  809. * @exception SQLException if a database access error occurs
  810. */
  811. int getMaxConnections() throws SQLException;
  812. /**
  813. * What's the maximum cursor name length?
  814. *
  815. * @return max cursor name length in bytes;
  816. * a result of zero means that there is no limit or the limit is not known
  817. * @exception SQLException if a database access error occurs
  818. */
  819. int getMaxCursorNameLength() throws SQLException;
  820. /**
  821. * What's the maximum length of an index (in bytes)?
  822. *
  823. * @return max index length in bytes;
  824. * a result of zero means that there is no limit or the limit is not known
  825. * @exception SQLException if a database access error occurs
  826. */
  827. int getMaxIndexLength() throws SQLException;
  828. /**
  829. * What's the maximum length allowed for a schema name?
  830. *
  831. * @return max name length in bytes;
  832. * a result of zero means that there is no limit or the limit is not known
  833. * @exception SQLException if a database access error occurs
  834. */
  835. int getMaxSchemaNameLength() throws SQLException;
  836. /**
  837. * What's the maximum length of a procedure name?
  838. *
  839. * @return max name length in bytes;
  840. * a result of zero means that there is no limit or the limit is not known
  841. * @exception SQLException if a database access error occurs
  842. */
  843. int getMaxProcedureNameLength() throws SQLException;
  844. /**
  845. * What's the maximum length of a catalog name?
  846. *
  847. * @return max name length in bytes;
  848. * a result of zero means that there is no limit or the limit is not known
  849. * @exception SQLException if a database access error occurs
  850. */
  851. int getMaxCatalogNameLength() throws SQLException;
  852. /**
  853. * What's the maximum length of a single row?
  854. *
  855. * @return max row size in bytes;
  856. * a result of zero means that there is no limit or the limit is not known
  857. * @exception SQLException if a database access error occurs
  858. */
  859. int getMaxRowSize() throws SQLException;
  860. /**
  861. * Did getMaxRowSize() include LONGVARCHAR and LONGVARBINARY
  862. * blobs?
  863. *
  864. * @return <code>true</code> if so; <code>false</code> otherwise
  865. * @exception SQLException if a database access error occurs
  866. */
  867. boolean doesMaxRowSizeIncludeBlobs() throws SQLException;
  868. /**
  869. * What's the maximum length of a SQL statement?
  870. *
  871. * @return max length in bytes;
  872. * a result of zero means that there is no limit or the limit is not known
  873. * @exception SQLException if a database access error occurs
  874. */
  875. int getMaxStatementLength() throws SQLException;
  876. /**
  877. * How many active statements can we have open at one time to this
  878. * database?
  879. *
  880. * @return the maximum number of statements that can be open at one time;
  881. * a result of zero means that there is no limit or the limit is not known
  882. * @exception SQLException if a database access error occurs
  883. */
  884. int getMaxStatements() throws SQLException;
  885. /**
  886. * What's the maximum length of a table name?
  887. *
  888. * @return max name length in bytes;
  889. * a result of zero means that there is no limit or the limit is not known
  890. * @exception SQLException if a database access error occurs
  891. */
  892. int getMaxTableNameLength() throws SQLException;
  893. /**
  894. * What's the maximum number of tables in a SELECT statement?
  895. *
  896. * @return the maximum number of tables allowed in a SELECT statement;
  897. * a result of zero means that there is no limit or the limit is not known
  898. * @exception SQLException if a database access error occurs
  899. */
  900. int getMaxTablesInSelect() throws SQLException;
  901. /**
  902. * What's the maximum length of a user name?
  903. *
  904. * @return max user name length in bytes;
  905. * a result of zero means that there is no limit or the limit is not known
  906. * @exception SQLException if a database access error occurs
  907. */
  908. int getMaxUserNameLength() throws SQLException;
  909. //----------------------------------------------------------------------
  910. /**
  911. * What's the database's default transaction isolation level? The
  912. * values are defined in <code>java.sql.Connection</code>.
  913. *
  914. * @return the default isolation level
  915. * @exception SQLException if a database access error occurs
  916. * @see Connection
  917. */
  918. int getDefaultTransactionIsolation() throws SQLException;
  919. /**
  920. * Are transactions supported? If not, invoking the method
  921. * <code>commit</code> is a noop and the
  922. * isolation level is TRANSACTION_NONE.
  923. *
  924. * @return <code>true</code> if transactions are supported; <code>false</code> otherwise
  925. * @exception SQLException if a database access error occurs
  926. */
  927. boolean supportsTransactions() throws SQLException;
  928. /**
  929. * Does this database support the given transaction isolation level?
  930. *
  931. * @param level the values are defined in <code>java.sql.Connection</code>
  932. * @return <code>true</code> if so; <code>false</code> otherwise
  933. * @exception SQLException if a database access error occurs
  934. * @see Connection
  935. */
  936. boolean supportsTransactionIsolationLevel(int level)
  937. throws SQLException;
  938. /**
  939. * Are both data definition and data manipulation statements
  940. * within a transaction supported?
  941. *
  942. * @return <code>true</code> if so; <code>false</code> otherwise
  943. * @exception SQLException if a database access error occurs
  944. */
  945. boolean supportsDataDefinitionAndDataManipulationTransactions()
  946. throws SQLException;
  947. /**
  948. * Are only data manipulation statements within a transaction
  949. * supported?
  950. *
  951. * @return <code>true</code> if so; <code>false</code> otherwise
  952. * @exception SQLException if a database access error occurs
  953. */
  954. boolean supportsDataManipulationTransactionsOnly()
  955. throws SQLException;
  956. /**
  957. * Does a data definition statement within a transaction force the
  958. * transaction to commit?
  959. *
  960. * @return <code>true</code> if so; <code>false</code> otherwise
  961. * @exception SQLException if a database access error occurs
  962. */
  963. boolean dataDefinitionCausesTransactionCommit()
  964. throws SQLException;
  965. /**
  966. * Is a data definition statement within a transaction ignored?
  967. *
  968. * @return <code>true</code> if so; <code>false</code> otherwise
  969. * @exception SQLException if a database access error occurs
  970. */
  971. boolean dataDefinitionIgnoredInTransactions()
  972. throws SQLException;
  973. /**
  974. * Gets a description of the stored procedures available in a
  975. * catalog.
  976. *
  977. * <P>Only procedure descriptions matching the schema and
  978. * procedure name criteria are returned. They are ordered by
  979. * PROCEDURE_SCHEM, and PROCEDURE_NAME.
  980. *
  981. * <P>Each procedure description has the the following columns:
  982. * <OL>
  983. * <LI><B>PROCEDURE_CAT</B> String => procedure catalog (may be null)
  984. * <LI><B>PROCEDURE_SCHEM</B> String => procedure schema (may be null)
  985. * <LI><B>PROCEDURE_NAME</B> String => procedure name
  986. * <LI> reserved for future use
  987. * <LI> reserved for future use
  988. * <LI> reserved for future use
  989. * <LI><B>REMARKS</B> String => explanatory comment on the procedure
  990. * <LI><B>PROCEDURE_TYPE</B> short => kind of procedure:
  991. * <UL>
  992. * <LI> procedureResultUnknown - May return a result
  993. * <LI> procedureNoResult - Does not return a result
  994. * <LI> procedureReturnsResult - Returns a result
  995. * </UL>
  996. * </OL>
  997. *
  998. * @param catalog a catalog name; "" retrieves those without a
  999. * catalog; null means drop catalog name from the selection criteria
  1000. * @param schemaPattern a schema name pattern; "" retrieves those
  1001. * without a schema
  1002. * @param procedureNamePattern a procedure name pattern
  1003. * @return ResultSet - each row is a procedure description
  1004. * @exception SQLException if a database access error occurs
  1005. * @see #getSearchStringEscape
  1006. */
  1007. ResultSet getProcedures(String catalog, String schemaPattern,
  1008. String procedureNamePattern) throws SQLException;
  1009. /**
  1010. * A possible value for column <code>PROCEDURE_TYPE</code> in the
  1011. * <code>ResultSet</code> object returned by the method
  1012. * <code>getProcedures</code>.
  1013. * <p> Indicates that it is not known whether the procedure returns
  1014. * a result.
  1015. */
  1016. int procedureResultUnknown = 0;
  1017. /**
  1018. * A possible value for column <code>PROCEDURE_TYPE</code> in the
  1019. * <code>ResultSet</code> object returned by the method
  1020. * <code>getProcedures</code>.
  1021. * <p> Indicates that the procedure does not return
  1022. * a result.
  1023. */
  1024. int procedureNoResult = 1;
  1025. /**
  1026. * A possible value for column <code>PROCEDURE_TYPE</code> in the
  1027. * <code>ResultSet</code> object returned by the method
  1028. * <code>getProcedures</code>.
  1029. * <p> Indicates that the procedure returns
  1030. * a result.
  1031. */
  1032. int procedureReturnsResult = 2;
  1033. /**
  1034. * Gets a description of a catalog's stored procedure parameters
  1035. * and result columns.
  1036. *
  1037. * <P>Only descriptions matching the schema, procedure and
  1038. * parameter name criteria are returned. They are ordered by
  1039. * PROCEDURE_SCHEM and PROCEDURE_NAME. Within this, the return value,
  1040. * if any, is first. Next are the parameter descriptions in call
  1041. * order. The column descriptions follow in column number order.
  1042. *
  1043. * <P>Each row in the ResultSet is a parameter description or
  1044. * column description with the following fields:
  1045. * <OL>
  1046. * <LI><B>PROCEDURE_CAT</B> String => procedure catalog (may be null)
  1047. * <LI><B>PROCEDURE_SCHEM</B> String => procedure schema (may be null)
  1048. * <LI><B>PROCEDURE_NAME</B> String => procedure name
  1049. * <LI><B>COLUMN_NAME</B> String => column/parameter name
  1050. * <LI><B>COLUMN_TYPE</B> Short => kind of column/parameter:
  1051. * <UL>
  1052. * <LI> procedureColumnUnknown - nobody knows
  1053. * <LI> procedureColumnIn - IN parameter
  1054. * <LI> procedureColumnInOut - INOUT parameter
  1055. * <LI> procedureColumnOut - OUT parameter
  1056. * <LI> procedureColumnReturn - procedure return value
  1057. * <LI> procedureColumnResult - result column in ResultSet
  1058. * </UL>
  1059. * <LI><B>DATA_TYPE</B> short => SQL type from java.sql.Types
  1060. * <LI><B>TYPE_NAME</B> String => SQL type name, for a UDT type the
  1061. * type name is fully qualified
  1062. * <LI><B>PRECISION</B> int => precision
  1063. * <LI><B>LENGTH</B> int => length in bytes of data
  1064. * <LI><B>SCALE</B> short => scale
  1065. * <LI><B>RADIX</B> short => radix
  1066. * <LI><B>NULLABLE</B> short => can it contain NULL?
  1067. * <UL>
  1068. * <LI> procedureNoNulls - does not allow NULL values
  1069. * <LI> procedureNullable - allows NULL values
  1070. * <LI> procedureNullableUnknown - nullability unknown
  1071. * </UL>
  1072. * <LI><B>REMARKS</B> String => comment describing parameter/column
  1073. * </OL>
  1074. *
  1075. * <P><B>Note:</B> Some databases may not return the column
  1076. * descriptions for a procedure. Additional columns beyond
  1077. * REMARKS can be defined by the database.
  1078. *
  1079. * @param catalog a catalog name; "" retrieves those without a
  1080. * catalog; null means drop catalog name from the selection criteria
  1081. * @param schemaPattern a schema name pattern; "" retrieves those
  1082. * without a schema
  1083. * @param procedureNamePattern a procedure name pattern
  1084. * @param columnNamePattern a column name pattern
  1085. * @return ResultSet - each row describes a stored procedure parameter or
  1086. * column
  1087. * @exception SQLException if a database access error occurs
  1088. * @see #getSearchStringEscape
  1089. */
  1090. ResultSet getProcedureColumns(String catalog,
  1091. String schemaPattern,
  1092. String procedureNamePattern,
  1093. String columnNamePattern) throws SQLException;
  1094. /**
  1095. * Indicates that type of the column is unknown.
  1096. * A possible value for the column
  1097. * <code>COLUMN_TYPE</code>
  1098. * in the <code>ResultSet</code>
  1099. * returned by the method <code>getProcedureColumns</code>.
  1100. */
  1101. int procedureColumnUnknown = 0;
  1102. /**
  1103. * Indicates that the column stores IN parameters.
  1104. * A possible value for the column
  1105. * <code>COLUMN_TYPE</code>
  1106. * in the <code>ResultSet</code>
  1107. * returned by the method <code>getProcedureColumns</code>.
  1108. */
  1109. int procedureColumnIn = 1;
  1110. /**
  1111. * Indicates that the column stores INOUT parameters.
  1112. * A possible value for the column
  1113. * <code>COLUMN_TYPE</code>
  1114. * in the <code>ResultSet</code>
  1115. * returned by the method <code>getProcedureColumns</code>.
  1116. */
  1117. int procedureColumnInOut = 2;
  1118. /**
  1119. * Indicates that the column stores OUT parameters.
  1120. * A possible value for the column
  1121. * <code>COLUMN_TYPE</code>
  1122. * in the <code>ResultSet</code>
  1123. * returned by the method <code>getProcedureColumns</code>.
  1124. */
  1125. int procedureColumnOut = 4;
  1126. /**
  1127. * Indicates that the column stores return values.
  1128. * A possible value for the column
  1129. * <code>COLUMN_TYPE</code>
  1130. * in the <code>ResultSet</code>
  1131. * returned by the method <code>getProcedureColumns</code>.
  1132. */
  1133. int procedureColumnReturn = 5;
  1134. /**
  1135. * Indicates that the column stores results.
  1136. * A possible value for the column
  1137. * <code>COLUMN_TYPE</code>
  1138. * in the <code>ResultSet</code>
  1139. * returned by the method <code>getProcedureColumns</code>.
  1140. */
  1141. int procedureColumnResult = 3;
  1142. /**
  1143. * Indicates that <code>NULL</code> values are not allowed.
  1144. * A possible value for the column
  1145. * <code>NULLABLE</code>
  1146. * in the <code>ResultSet</code>
  1147. * returned by the method <code>getProcedureColumns</code>.
  1148. */
  1149. int procedureNoNulls = 0;
  1150. /**
  1151. * Indicates that <code>NULL</code> values are allowed.
  1152. * A possible value for the column
  1153. * <code>NULLABLE</code>
  1154. * in the <code>ResultSet</code>
  1155. * returned by the method <code>getProcedureColumns</code>.
  1156. */
  1157. int procedureNullable = 1;
  1158. /**
  1159. * Indicates that whether <code>NULL</code> values are allowed
  1160. * is unknown.
  1161. * A possible value for the column
  1162. * <code>NULLABLE</code>
  1163. * in the <code>ResultSet</code>
  1164. * returned by the method <code>getProcedureColumns</code>.
  1165. */
  1166. int procedureNullableUnknown = 2;
  1167. /**
  1168. * Gets a description of tables available in a catalog.
  1169. *
  1170. * <P>Only table descriptions matching the catalog, schema, table
  1171. * name and type criteria are returned. They are ordered by
  1172. * TABLE_TYPE, TABLE_SCHEM and TABLE_NAME.
  1173. *
  1174. * <P>Each table description has the following columns:
  1175. * <OL>
  1176. * <LI><B>TABLE_CAT</B> String => table catalog (may be null)
  1177. * <LI><B>TABLE_SCHEM</B> String => table schema (may be null)
  1178. * <LI><B>TABLE_NAME</B> String => table name
  1179. * <LI><B>TABLE_TYPE</B> String => table type. Typical types are "TABLE",
  1180. * "VIEW", "SYSTEM TABLE", "GLOBAL TEMPORARY",
  1181. * "LOCAL TEMPORARY", "ALIAS", "SYNONYM".
  1182. * <LI><B>REMARKS</B> String => explanatory comment on the table
  1183. * </OL>
  1184. *
  1185. * <P><B>Note:</B> Some databases may not return information for
  1186. * all tables.
  1187. *
  1188. * @param catalog a catalog name; "" retrieves those without a
  1189. * catalog; null means drop catalog name from the selection criteria
  1190. * @param schemaPattern a schema name pattern; "" retrieves those
  1191. * without a schema
  1192. * @param tableNamePattern a table name pattern
  1193. * @param types a list of table types to include; null returns all types
  1194. * @return ResultSet - each row is a table description
  1195. * @exception SQLException if a database access error occurs
  1196. * @see #getSearchStringEscape
  1197. */
  1198. ResultSet getTables(String catalog, String schemaPattern,
  1199. String tableNamePattern, String types[]) throws SQLException;
  1200. /**
  1201. * Gets the schema names available in this database. The results
  1202. * are ordered by schema name.
  1203. *
  1204. * <P>The schema column is:
  1205. * <OL>
  1206. * <LI><B>TABLE_SCHEM</B> String => schema name
  1207. * </OL>
  1208. *
  1209. * @return ResultSet - each row has a single String column that is a
  1210. * schema name
  1211. * @exception SQLException if a database access error occurs
  1212. */
  1213. ResultSet getSchemas() throws SQLException;
  1214. /**
  1215. * Gets the catalog names available in this database. The results
  1216. * are ordered by catalog name.
  1217. *
  1218. * <P>The catalog column is:
  1219. * <OL>
  1220. * <LI><B>TABLE_CAT</B> String => catalog name
  1221. * </OL>
  1222. *
  1223. * @return ResultSet - each row has a single String column that is a
  1224. * catalog name
  1225. * @exception SQLException if a database access error occurs
  1226. */
  1227. ResultSet getCatalogs() throws SQLException;
  1228. /**
  1229. * Gets the table types available in this database. The results
  1230. * are ordered by table type.
  1231. *
  1232. * <P>The table type is:
  1233. * <OL>
  1234. * <LI><B>TABLE_TYPE</B> String => table type. Typical types are "TABLE",
  1235. * "VIEW", "SYSTEM TABLE", "GLOBAL TEMPORARY",
  1236. * "LOCAL TEMPORARY", "ALIAS", "SYNONYM".
  1237. * </OL>
  1238. *
  1239. * @return ResultSet - each row has a single String column that is a
  1240. * table type
  1241. * @exception SQLException if a database access error occurs
  1242. */
  1243. ResultSet getTableTypes() throws SQLException;
  1244. /**
  1245. * Gets a description of table columns available in
  1246. * the specified catalog.
  1247. *
  1248. * <P>Only column descriptions matching the catalog, schema, table
  1249. * and column name criteria are returned. They are ordered by
  1250. * TABLE_SCHEM, TABLE_NAME and ORDINAL_POSITION.
  1251. *
  1252. * <P>Each column description has the following columns:
  1253. * <OL>
  1254. * <LI><B>TABLE_CAT</B> String => table catalog (may be null)
  1255. * <LI><B>TABLE_SCHEM</B> String => table schema (may be null)
  1256. * <LI><B>TABLE_NAME</B> String => table name
  1257. * <LI><B>COLUMN_NAME</B> String => column name
  1258. * <LI><B>DATA_TYPE</B> short => SQL type from java.sql.Types
  1259. * <LI><B>TYPE_NAME</B> String => Data source dependent type name,
  1260. * for a UDT the type name is fully qualified
  1261. * <LI><B>COLUMN_SIZE</B> int => column size. For char or date
  1262. * types this is the maximum number of characters, for numeric or
  1263. * decimal types this is precision.
  1264. * <LI><B>BUFFER_LENGTH</B> is not used.
  1265. * <LI><B>DECIMAL_DIGITS</B> int => the number of fractional digits
  1266. * <LI><B>NUM_PREC_RADIX</B> int => Radix (typically either 10 or 2)
  1267. * <LI><B>NULLABLE</B> int => is NULL allowed?
  1268. * <UL>
  1269. * <LI> columnNoNulls - might not allow NULL values
  1270. * <LI> columnNullable - definitely allows NULL values
  1271. * <LI> columnNullableUnknown - nullability unknown
  1272. * </UL>
  1273. * <LI><B>REMARKS</B> String => comment describing column (may be null)
  1274. * <LI><B>COLUMN_DEF</B> String => default value (may be null)
  1275. * <LI><B>SQL_DATA_TYPE</B> int => unused
  1276. * <LI><B>SQL_DATETIME_SUB</B> int => unused
  1277. * <LI><B>CHAR_OCTET_LENGTH</B> int => for char types the
  1278. * maximum number of bytes in the column
  1279. * <LI><B>ORDINAL_POSITION</B> int => index of column in table
  1280. * (starting at 1)
  1281. * <LI><B>IS_NULLABLE</B> String => "NO" means column definitely
  1282. * does not allow NULL values; "YES" means the column might
  1283. * allow NULL values. An empty string means nobody knows.
  1284. * </OL>
  1285. *
  1286. * @param catalog a catalog name; "" retrieves those without a
  1287. * catalog; null means drop catalog name from the selection criteria
  1288. * @param schemaPattern a schema name pattern; "" retrieves those
  1289. * without a schema
  1290. * @param tableNamePattern a table name pattern
  1291. * @param columnNamePattern a column name pattern
  1292. * @return ResultSet - each row is a column description
  1293. * @exception SQLException if a database access error occurs
  1294. * @see #getSearchStringEscape
  1295. */
  1296. ResultSet getColumns(String catalog, String schemaPattern,
  1297. String tableNamePattern, String columnNamePattern)
  1298. throws SQLException;
  1299. /**
  1300. * Indicates that the column might not allow NULL values.
  1301. * A possible value for the column
  1302. * <code>NULLABLE</code>
  1303. * in the <code>ResultSet</code> returned by the method
  1304. * <code>getColumns</code>.
  1305. */
  1306. int columnNoNulls = 0;
  1307. /**
  1308. * Indicates that the column definitely allows <code>NULL</code> values.
  1309. * A possible value for the column
  1310. * <code>NULLABLE</code>
  1311. * in the <code>ResultSet</code> returned by the method
  1312. * <code>getColumns</code>.
  1313. */
  1314. int columnNullable = 1;
  1315. /**
  1316. * Indicates that the nullability of columns is unknown.
  1317. * A possible value for the column
  1318. * <code>NULLABLE</code>
  1319. * in the <code>ResultSet</code> returned by the method
  1320. * <code>getColumns</code>.
  1321. */
  1322. int columnNullableUnknown = 2;
  1323. /**
  1324. * Gets a description of the access rights for a table's columns.
  1325. *
  1326. * <P>Only privileges matching the column name criteria are
  1327. * returned. They are ordered by COLUMN_NAME and PRIVILEGE.
  1328. *
  1329. * <P>Each privilige description has the following columns:
  1330. * <OL>
  1331. * <LI><B>TABLE_CAT</B> String => table catalog (may be null)
  1332. * <LI><B>TABLE_SCHEM</B> String => table schema (may be null)
  1333. * <LI><B>TABLE_NAME</B> String => table name
  1334. * <LI><B>COLUMN_NAME</B> String => column name
  1335. * <LI><B>GRANTOR</B> => grantor of access (may be null)
  1336. * <LI><B>GRANTEE</B> String => grantee of access
  1337. * <LI><B>PRIVILEGE</B> String => name of access (SELECT,
  1338. * INSERT, UPDATE, REFRENCES, ...)
  1339. * <LI><B>IS_GRANTABLE</B> String => "YES" if grantee is permitted
  1340. * to grant to others; "NO" if not; null if unknown
  1341. * </OL>
  1342. *
  1343. * @param catalog a catalog name; "" retrieves those without a
  1344. * catalog; null means drop catalog name from the selection criteria
  1345. * @param schema a schema name; "" retrieves those without a schema
  1346. * @param table a table name
  1347. * @param columnNamePattern a column name pattern
  1348. * @return ResultSet - each row is a column privilege description
  1349. * @exception SQLException if a database access error occurs
  1350. * @see #getSearchStringEscape
  1351. */
  1352. ResultSet getColumnPrivileges(String catalog, String schema,
  1353. String table, String columnNamePattern) throws SQLException;
  1354. /**
  1355. * Gets a description of the access rights for each table available
  1356. * in a catalog. Note that a table privilege applies to one or
  1357. * more columns in the table. It would be wrong to assume that
  1358. * this priviledge applies to all columns (this may be true for
  1359. * some systems but is not true for all.)
  1360. *
  1361. * <P>Only privileges matching the schema and table name
  1362. * criteria are returned. They are ordered by TABLE_SCHEM,
  1363. * TABLE_NAME, and PRIVILEGE.
  1364. *
  1365. * <P>Each privilige description has the following columns:
  1366. * <OL>
  1367. * <LI><B>TABLE_CAT</B> String => table catalog (may be null)
  1368. * <LI><B>TABLE_SCHEM</B> String => table schema (may be null)
  1369. * <LI><B>TABLE_NAME</B> String => table name
  1370. * <LI><B>GRANTOR</B> => grantor of access (may be null)
  1371. * <LI><B>GRANTEE</B> String => grantee of access
  1372. * <LI><B>PRIVILEGE</B> String => name of access (SELECT,
  1373. * INSERT, UPDATE, REFRENCES, ...)
  1374. * <LI><B>IS_GRANTABLE</B> String => "YES" if grantee is permitted
  1375. * to grant to others; "NO" if not; null if unknown
  1376. * </OL>
  1377. *
  1378. * @param catalog a catalog name; "" retrieves those without a
  1379. * catalog; null means drop catalog name from the selection criteria
  1380. * @param schemaPattern a schema name pattern; "" retrieves those
  1381. * without a schema
  1382. * @param tableNamePattern a table name pattern
  1383. * @return ResultSet - each row is a table privilege description
  1384. * @exception SQLException if a database access error occurs
  1385. * @see #getSearchStringEscape
  1386. */
  1387. ResultSet getTablePrivileges(String catalog, String schemaPattern,
  1388. String tableNamePattern) throws SQLException;
  1389. /**
  1390. * Gets a description of a table's optimal set of columns that
  1391. * uniquely identifies a row. They are ordered by SCOPE.
  1392. *
  1393. * <P>Each column description has the following columns:
  1394. * <OL>
  1395. * <LI><B>SCOPE</B> short => actual scope of result
  1396. * <UL>
  1397. * <LI> bestRowTemporary - very temporary, while using row
  1398. * <LI> bestRowTransaction - valid for remainder of current transaction
  1399. * <LI> bestRowSession - valid for remainder of current session
  1400. * </UL>
  1401. * <LI><B>COLUMN_NAME</B> String => column name
  1402. * <LI><B>DATA_TYPE</B> short => SQL data type from java.sql.Types
  1403. * <LI><B>TYPE_NAME</B> String => Data source dependent type name,
  1404. * for a UDT the type name is fully qualified
  1405. * <LI><B>COLUMN_SIZE</B> int => precision
  1406. * <LI><B>BUFFER_LENGTH</B> int => not used
  1407. * <LI><B>DECIMAL_DIGITS</B> short => scale
  1408. * <LI><B>PSEUDO_COLUMN</B> short => is this a pseudo column
  1409. * like an Oracle ROWID
  1410. * <UL>
  1411. * <LI> bestRowUnknown - may or may not be pseudo column
  1412. * <LI> bestRowNotPseudo - is NOT a pseudo column
  1413. * <LI> bestRowPseudo - is a pseudo column
  1414. * </UL>
  1415. * </OL>
  1416. *
  1417. * @param catalog a catalog name; "" retrieves those without a
  1418. * catalog; null means drop catalog name from the selection criteria
  1419. * @param schema a schema name; "" retrieves those without a schema
  1420. * @param table a table name
  1421. * @param scope the scope of interest; use same values as SCOPE
  1422. * @param nullable include columns that are nullable?
  1423. * @return ResultSet - each row is a column description
  1424. * @exception SQLException if a database access error occurs
  1425. */
  1426. ResultSet getBestRowIdentifier(String catalog, String schema,
  1427. String table, int scope, boolean nullable) throws SQLException;
  1428. /**
  1429. * Indicates that the scope of the best row identifier is
  1430. * very temporary, lasting only while the
  1431. * row is being used.
  1432. * A possible value for the column
  1433. * <code>SCOPE</code>
  1434. * in the <code>ResultSet</code> object
  1435. * returned by the method <code>getBestRowIdentifier</code>.
  1436. */
  1437. int bestRowTemporary = 0;
  1438. /**
  1439. * Indicates that the scope of the best row identifier is
  1440. * the remainder of the current transaction.
  1441. * A possible value for the column
  1442. * <code>SCOPE</code>
  1443. * in the <code>ResultSet</code> object
  1444. * returned by the method <code>getBestRowIdentifier</code>.
  1445. */
  1446. int bestRowTransaction = 1;
  1447. /**
  1448. * Indicates that the scope of the best row identifier is
  1449. * the remainder of the current session.
  1450. * A possible value for the column
  1451. * <code>SCOPE</code>
  1452. * in the <code>ResultSet</code> object
  1453. * returned by the method <code>getBestRowIdentifier</code>.
  1454. */
  1455. int bestRowSession = 2;
  1456. /**
  1457. * Indicates that the best row identifier may or may not be a pseudo column.
  1458. * A possible value for the column
  1459. * <code>PSEUDO_COLUMN</code>
  1460. * in the <code>ResultSet</code> object
  1461. * returned by the method <code>getBestRowIdentifier</code>.
  1462. */
  1463. int bestRowUnknown = 0;
  1464. /**
  1465. * Indicates that the best row identifier is NOT a pseudo column.
  1466. * A possible value for the column
  1467. * <code>PSEUDO_COLUMN</code>
  1468. * in the <code>ResultSet</code> object
  1469. * returned by the method <code>getBestRowIdentifier</code>.
  1470. */
  1471. int bestRowNotPseudo = 1;
  1472. /**
  1473. * Indicates that the best row identifier is a pseudo column.
  1474. * A possible value for the column
  1475. * <code>PSEUDO_COLUMN</code>
  1476. * in the <code>ResultSet</code> object
  1477. * returned by the method <code>getBestRowIdentifier</code>.
  1478. */
  1479. int bestRowPseudo = 2;
  1480. /**
  1481. * Gets a description of a table's columns that are automatically
  1482. * updated when any value in a row is updated. They are
  1483. * unordered.
  1484. *
  1485. * <P>Each column description has the following columns:
  1486. * <OL>
  1487. * <LI><B>SCOPE</B> short => is not used
  1488. * <LI><B>COLUMN_NAME</B> String => column name
  1489. * <LI><B>DATA_TYPE</B> short => SQL data type from java.sql.Types
  1490. * <LI><B>TYPE_NAME</B> String => Data source dependent type name
  1491. * <LI><B>COLUMN_SIZE</B> int => precision
  1492. * <LI><B>BUFFER_LENGTH</B> int => length of column value in bytes
  1493. * <LI><B>DECIMAL_DIGITS</B> short => scale
  1494. * <LI><B>PSEUDO_COLUMN</B> short => is this a pseudo column
  1495. * like an Oracle ROWID
  1496. * <UL>
  1497. * <LI> versionColumnUnknown - may or may not be pseudo column
  1498. * <LI> versionColumnNotPseudo - is NOT a pseudo column
  1499. * <LI> versionColumnPseudo - is a pseudo column
  1500. * </UL>
  1501. * </OL>
  1502. *
  1503. * @param catalog a catalog name; "" retrieves those without a
  1504. * catalog; null means drop catalog name from the selection criteria
  1505. * @param schema a schema name; "" retrieves those without a schema
  1506. * @param table a table name
  1507. * @return ResultSet - each row is a column description
  1508. * @exception SQLException if a database access error occurs
  1509. */
  1510. ResultSet getVersionColumns(String catalog, String schema,
  1511. String table) throws SQLException;
  1512. /**
  1513. * Indicates that this version column may or may not be a pseudo column.
  1514. * A possible value for the column
  1515. * <code>PSEUDO_COLUMN</code>
  1516. * in the <code>ResultSet</code> object
  1517. * returned by the method <code>getVersionColumns</code>.
  1518. */
  1519. int versionColumnUnknown = 0;
  1520. /**
  1521. * Indicates that this version column is NOT a pseudo column.
  1522. * A possible value for the column
  1523. * <code>PSEUDO_COLUMN</code>
  1524. * in the <code>ResultSet</code> object
  1525. * returned by the method <code>getVersionColumns</code>.
  1526. */
  1527. int versionColumnNotPseudo = 1;
  1528. /**
  1529. * Indicates that this version column is a pseudo column.
  1530. * A possible value for the column
  1531. * <code>PSEUDO_COLUMN</code>
  1532. * in the <code>ResultSet</code> object
  1533. * returned by the method <code>getVersionColumns</code>.
  1534. */
  1535. int versionColumnPseudo = 2;
  1536. /**
  1537. * Gets a description of a table's primary key columns. They
  1538. * are ordered by COLUMN_NAME.
  1539. *
  1540. * <P>Each primary key column description has the following columns:
  1541. * <OL>
  1542. * <LI><B>TABLE_CAT</B> String => table catalog (may be null)
  1543. * <LI><B>TABLE_SCHEM</B> String => table schema (may be null)
  1544. * <LI><B>TABLE_NAME</B> String => table name
  1545. * <LI><B>COLUMN_NAME</B> String => column name
  1546. * <LI><B>KEY_SEQ</B> short => sequence number within primary key
  1547. * <LI><B>PK_NAME</B> String => primary key name (may be null)
  1548. * </OL>
  1549. *
  1550. * @param catalog a catalog name; "" retrieves those without a
  1551. * catalog; null means drop catalog name from the selection criteria
  1552. * @param schema a schema name; "" retrieves those
  1553. * without a schema
  1554. * @param table a table name
  1555. * @return ResultSet - each row is a primary key column description
  1556. * @exception SQLException if a database access error occurs
  1557. */
  1558. ResultSet getPrimaryKeys(String catalog, String schema,
  1559. String table) throws SQLException;
  1560. /**
  1561. * Gets a description of the primary key columns that are
  1562. * referenced by a table's foreign key columns (the primary keys
  1563. * imported by a table). They are ordered by PKTABLE_CAT,
  1564. * PKTABLE_SCHEM, PKTABLE_NAME, and KEY_SEQ.
  1565. *
  1566. * <P>Each primary key column description has the following columns:
  1567. * <OL>
  1568. * <LI><B>PKTABLE_CAT</B> String => primary key table catalog
  1569. * being imported (may be null)
  1570. * <LI><B>PKTABLE_SCHEM</B> String => primary key table schema
  1571. * being imported (may be null)
  1572. * <LI><B>PKTABLE_NAME</B> String => primary key table name
  1573. * being imported
  1574. * <LI><B>PKCOLUMN_NAME</B> String => primary key column name
  1575. * being imported
  1576. * <LI><B>FKTABLE_CAT</B> String => foreign key table catalog (may be null)
  1577. * <LI><B>FKTABLE_SCHEM</B> String => foreign key table schema (may be null)
  1578. * <LI><B>FKTABLE_NAME</B> String => foreign key table name
  1579. * <LI><B>FKCOLUMN_NAME</B> String => foreign key column name
  1580. * <LI><B>KEY_SEQ</B> short => sequence number within foreign key
  1581. * <LI><B>UPDATE_RULE</B> short => What happens to
  1582. * foreign key when primary is updated:
  1583. * <UL>
  1584. * <LI> importedNoAction - do not allow update of primary
  1585. * key if it has been imported
  1586. * <LI> importedKeyCascade - change imported key to agree
  1587. * with primary key update
  1588. * <LI> importedKeySetNull - change imported key to NULL if
  1589. * its primary key has been updated
  1590. * <LI> importedKeySetDefault - change imported key to default values
  1591. * if its primary key has been updated
  1592. * <LI> importedKeyRestrict - same as importedKeyNoAction
  1593. * (for ODBC 2.x compatibility)
  1594. * </UL>
  1595. * <LI><B>DELETE_RULE</B> short => What happens to
  1596. * the foreign key when primary is deleted.
  1597. * <UL>
  1598. * <LI> importedKeyNoAction - do not allow delete of primary
  1599. * key if it has been imported
  1600. * <LI> importedKeyCascade - delete rows that import a deleted key
  1601. * <LI> importedKeySetNull - change imported key to NULL if
  1602. * its primary key has been deleted
  1603. * <LI> importedKeyRestrict - same as importedKeyNoAction
  1604. * (for ODBC 2.x compatibility)
  1605. * <LI> importedKeySetDefault - change imported key to default if
  1606. * its primary key has been deleted
  1607. * </UL>
  1608. * <LI><B>FK_NAME</B> String => foreign key name (may be null)
  1609. * <LI><B>PK_NAME</B> String => primary key name (may be null)
  1610. * <LI><B>DEFERRABILITY</B> short => can the evaluation of foreign key
  1611. * constraints be deferred until commit
  1612. * <UL>
  1613. * <LI> importedKeyInitiallyDeferred - see SQL92 for definition
  1614. * <LI> importedKeyInitiallyImmediate - see SQL92 for definition
  1615. * <LI> importedKeyNotDeferrable - see SQL92 for definition
  1616. * </UL>
  1617. * </OL>
  1618. *
  1619. * @param catalog a catalog name; "" retrieves those without a
  1620. * catalog; null means drop catalog name from the selection criteria
  1621. * @param schema a schema name; "" retrieves those
  1622. * without a schema
  1623. * @param table a table name
  1624. * @return ResultSet - each row is a primary key column description
  1625. * @exception SQLException if a database access error occurs
  1626. * @see #getExportedKeys
  1627. */
  1628. ResultSet getImportedKeys(String catalog, String schema,
  1629. String table) throws SQLException;
  1630. /**
  1631. * A possible value for the columns <code>UPDATE_RULE</code>
  1632. * and <code>DELETE_RULE</code> in the
  1633. * <code>ResultSet</code> objects returned by the methods
  1634. * <code>getImportedKeys</code>, <code>getExportedKeys</code>,
  1635. * and <code>getCrossReference</code>.
  1636. * <P>For the column <code>UPDATE_RULE</code>,
  1637. * it indicates that
  1638. * when the primary key is updated, the foreign key (imported key)
  1639. * is changed to agree with it.
  1640. * <P>For the column <code>DELETE_RULE</code>,
  1641. * it indicates that
  1642. * when the primary key is deleted, rows that imported that key
  1643. * are deleted.
  1644. */
  1645. int importedKeyCascade = 0;
  1646. /**
  1647. * A possible value for the columns <code>UPDATE_RULE</code>
  1648. * and <code>DELETE_RULE</code> in the
  1649. * <code>ResultSet</code> objects returned by the methods
  1650. * <code>getImportedKeys</code>, <code>getExportedKeys</code>,
  1651. * and <code>getCrossReference</code>.
  1652. * <P>For the column <code>UPDATE_RULE</code>, it indicates that
  1653. * a primary key may not be updated if it has been imported by
  1654. * another table as a foreign key.
  1655. * <P>For the column <code>DELETE_RULE</code>, it indicates that
  1656. * a primary key may not be deleted if it has been imported by
  1657. * another table as a foreign key.
  1658. */
  1659. int importedKeyRestrict = 1;
  1660. /**
  1661. * A possible value for the columns <code>UPDATE_RULE</code>
  1662. * and <code>DELETE_RULE</code> in the
  1663. * <code>ResultSet</code> objects returned by the methods
  1664. * <code>getImportedKeys</code>, <code>getExportedKeys</code>,
  1665. * and <code>getCrossReference</code>.
  1666. * <P>For the columns <code>UPDATE_RULE</code>
  1667. * and <code>DELETE_RULE</code>,
  1668. * it indicates that
  1669. * when the primary key is updated or deleted, the foreign key (imported key)
  1670. * is changed to <code>NULL</code>.
  1671. */
  1672. int importedKeySetNull = 2;
  1673. /**
  1674. * A possible value for the columns <code>UPDATE_RULE</code>
  1675. * and <code>DELETE_RULE</code> in the
  1676. * <code>ResultSet</code> objects returned by the methods
  1677. * <code>getImportedKeys</code>, <code>getExportedKeys</code>,
  1678. * and <code>getCrossReference</code>.
  1679. * <P>For the columns <code>UPDATE_RULE</code>
  1680. * and <code>DELETE_RULE</code>,
  1681. * it indicates that
  1682. * if the primary key has been imported, it cannot be updated or deleted.
  1683. */
  1684. int importedKeyNoAction = 3;
  1685. /**
  1686. * A possible value for the columns <code>UPDATE_RULE</code>
  1687. * and <code>DELETE_RULE</code> in the
  1688. * <code>ResultSet</code> objects returned by the methods
  1689. * <code>getImportedKeys</code>, <code>getExportedKeys</code>,
  1690. * and <code>getCrossReference</code>.
  1691. * <P>For the columns <code>UPDATE_RULE</code>
  1692. * and <code>DELETE_RULE</code>,
  1693. * it indicates that
  1694. * if the primary key is updated or deleted, the foreign key (imported key)
  1695. * is set to the default value.
  1696. */
  1697. int importedKeySetDefault = 4;
  1698. /**
  1699. * A possible value for the column <code>DEFERRABILITY</code>
  1700. * in the
  1701. * <code>ResultSet</code> objects returned by the methods
  1702. * <code>getImportedKeys</code>, <code>getExportedKeys</code>,
  1703. * and <code>getCrossReference</code>.
  1704. * <P>Indicates deferrability. See SQL-92 for a definition.
  1705. */
  1706. int importedKeyInitiallyDeferred = 5;
  1707. /**
  1708. * A possible value for the column <code>DEFERRABILITY</code>
  1709. * in the
  1710. * <code>ResultSet</code> objects returned by the methods
  1711. * <code>getImportedKeys</code>, <code>getExportedKeys</code>,
  1712. * and <code>getCrossReference</code>.
  1713. * <P>Indicates deferrability. See SQL-92 for a definition.
  1714. */
  1715. int importedKeyInitiallyImmediate = 6;
  1716. /**
  1717. * A possible value for the column <code>DEFERRABILITY</code>
  1718. * in the
  1719. * <code>ResultSet</code> objects returned by the methods
  1720. * <code>getImportedKeys</code>, <code>getExportedKeys</code>,
  1721. * and <code>getCrossReference</code>.
  1722. * <P>Indicates deferrability. See SQL-92 for a definition.
  1723. */
  1724. int importedKeyNotDeferrable = 7;
  1725. /**
  1726. * Gets a description of the foreign key columns that reference a
  1727. * table's primary key columns (the foreign keys exported by a
  1728. * table). They are ordered by FKTABLE_CAT, FKTABLE_SCHEM,
  1729. * FKTABLE_NAME, and KEY_SEQ.
  1730. *
  1731. * <P>Each foreign key column description has the following columns:
  1732. * <OL>
  1733. * <LI><B>PKTABLE_CAT</B> String => primary key table catalog (may be null)
  1734. * <LI><B>PKTABLE_SCHEM</B> String => primary key table schema (may be null)
  1735. * <LI><B>PKTABLE_NAME</B> String => primary key table name
  1736. * <LI><B>PKCOLUMN_NAME</B> String => primary key column name
  1737. * <LI><B>FKTABLE_CAT</B> String => foreign key table catalog (may be null)
  1738. * being exported (may be null)
  1739. * <LI><B>FKTABLE_SCHEM</B> String => foreign key table schema (may be null)
  1740. * being exported (may be null)
  1741. * <LI><B>FKTABLE_NAME</B> String => foreign key table name
  1742. * being exported
  1743. * <LI><B>FKCOLUMN_NAME</B> String => foreign key column name
  1744. * being exported
  1745. * <LI><B>KEY_SEQ</B> short => sequence number within foreign key
  1746. * <LI><B>UPDATE_RULE</B> short => What happens to
  1747. * foreign key when primary is updated:
  1748. * <UL>
  1749. * <LI> importedNoAction - do not allow update of primary
  1750. * key if it has been imported
  1751. * <LI> importedKeyCascade - change imported key to agree
  1752. * with primary key update
  1753. * <LI> importedKeySetNull - change imported key to NULL if
  1754. * its primary key has been updated
  1755. * <LI> importedKeySetDefault - change imported key to default values
  1756. * if its primary key has been updated
  1757. * <LI> importedKeyRestrict - same as importedKeyNoAction
  1758. * (for ODBC 2.x compatibility)
  1759. * </UL>
  1760. * <LI><B>DELETE_RULE</B> short => What happens to
  1761. * the foreign key when primary is deleted.
  1762. * <UL>
  1763. * <LI> importedKeyNoAction - do not allow delete of primary
  1764. * key if it has been imported
  1765. * <LI> importedKeyCascade - delete rows that import a deleted key
  1766. * <LI> importedKeySetNull - change imported key to NULL if
  1767. * its primary key has been deleted
  1768. * <LI> importedKeyRestrict - same as importedKeyNoAction
  1769. * (for ODBC 2.x compatibility)
  1770. * <LI> importedKeySetDefault - change imported key to default if
  1771. * its primary key has been deleted
  1772. * </UL>
  1773. * <LI><B>FK_NAME</B> String => foreign key name (may be null)
  1774. * <LI><B>PK_NAME</B> String => primary key name (may be null)
  1775. * <LI><B>DEFERRABILITY</B> short => can the evaluation of foreign key
  1776. * constraints be deferred until commit
  1777. * <UL>
  1778. * <LI> importedKeyInitiallyDeferred - see SQL92 for definition
  1779. * <LI> importedKeyInitiallyImmediate - see SQL92 for definition
  1780. * <LI> importedKeyNotDeferrable - see SQL92 for definition
  1781. * </UL>
  1782. * </OL>
  1783. *
  1784. * @param catalog a catalog name; "" retrieves those without a
  1785. * catalog; null means drop catalog name from the selection criteria
  1786. * @param schema a schema name; "" retrieves those
  1787. * without a schema
  1788. * @param table a table name
  1789. * @return ResultSet - each row is a foreign key column description
  1790. * @exception SQLException if a database access error occurs
  1791. * @see #getImportedKeys
  1792. */
  1793. ResultSet getExportedKeys(String catalog, String schema,
  1794. String table) throws SQLException;
  1795. /**
  1796. * Gets a description of the foreign key columns in the foreign key
  1797. * table that reference the primary key columns of the primary key
  1798. * table (describe how one table imports another's key.) This
  1799. * should normally return a single foreign key/primary key pair
  1800. * (most tables only import a foreign key from a table once.) They
  1801. * are ordered by FKTABLE_CAT, FKTABLE_SCHEM, FKTABLE_NAME, and
  1802. * KEY_SEQ.
  1803. *
  1804. * <P>Each foreign key column description has the following columns:
  1805. * <OL>
  1806. * <LI><B>PKTABLE_CAT</B> String => primary key table catalog (may be null)
  1807. * <LI><B>PKTABLE_SCHEM</B> String => primary key table schema (may be null)
  1808. * <LI><B>PKTABLE_NAME</B> String => primary key table name
  1809. * <LI><B>PKCOLUMN_NAME</B> String => primary key column name
  1810. * <LI><B>FKTABLE_CAT</B> String => foreign key table catalog (may be null)
  1811. * being exported (may be null)
  1812. * <LI><B>FKTABLE_SCHEM</B> String => foreign key table schema (may be null)
  1813. * being exported (may be null)
  1814. * <LI><B>FKTABLE_NAME</B> String => foreign key table name
  1815. * being exported
  1816. * <LI><B>FKCOLUMN_NAME</B> String => foreign key column name
  1817. * being exported
  1818. * <LI><B>KEY_SEQ</B> short => sequence number within foreign key
  1819. * <LI><B>UPDATE_RULE</B> short => What happens to
  1820. * foreign key when primary is updated:
  1821. * <UL>
  1822. * <LI> importedNoAction - do not allow update of primary
  1823. * key if it has been imported
  1824. * <LI> importedKeyCascade - change imported key to agree
  1825. * with primary key update
  1826. * <LI> importedKeySetNull - change imported key to NULL if
  1827. * its primary key has been updated
  1828. * <LI> importedKeySetDefault - change imported key to default values
  1829. * if its primary key has been updated
  1830. * <LI> importedKeyRestrict - same as importedKeyNoAction
  1831. * (for ODBC 2.x compatibility)
  1832. * </UL>
  1833. * <LI><B>DELETE_RULE</B> short => What happens to
  1834. * the foreign key when primary is deleted.
  1835. * <UL>
  1836. * <LI> importedKeyNoAction - do not allow delete of primary
  1837. * key if it has been imported
  1838. * <LI> importedKeyCascade - delete rows that import a deleted key
  1839. * <LI> importedKeySetNull - change imported key to NULL if
  1840. * its primary key has been deleted
  1841. * <LI> importedKeyRestrict - same as importedKeyNoAction
  1842. * (for ODBC 2.x compatibility)
  1843. * <LI> importedKeySetDefault - change imported key to default if
  1844. * its primary key has been deleted
  1845. * </UL>
  1846. * <LI><B>FK_NAME</B> String => foreign key name (may be null)
  1847. * <LI><B>PK_NAME</B> String => primary key name (may be null)
  1848. * <LI><B>DEFERRABILITY</B> short => can the evaluation of foreign key
  1849. * constraints be deferred until commit
  1850. * <UL>
  1851. * <LI> importedKeyInitiallyDeferred - see SQL92 for definition
  1852. * <LI> importedKeyInitiallyImmediate - see SQL92 for definition
  1853. * <LI> importedKeyNotDeferrable - see SQL92 for definition
  1854. * </UL>
  1855. * </OL>
  1856. *
  1857. * @param primaryCatalog a catalog name; "" retrieves those without a
  1858. * catalog; null means drop catalog name from the selection criteria
  1859. * @param primarySchema a schema name; "" retrieves those
  1860. * without a schema
  1861. * @param primaryTable the table name that exports the key
  1862. * @param foreignCatalog a catalog name; "" retrieves those without a
  1863. * catalog; null means drop catalog name from the selection criteria
  1864. * @param foreignSchema a schema name; "" retrieves those
  1865. * without a schema
  1866. * @param foreignTable the table name that imports the key
  1867. * @return ResultSet - each row is a foreign key column description
  1868. * @exception SQLException if a database access error occurs
  1869. * @see #getImportedKeys
  1870. */
  1871. ResultSet getCrossReference(
  1872. String primaryCatalog, String primarySchema, String primaryTable,
  1873. String foreignCatalog, String foreignSchema, String foreignTable
  1874. ) throws SQLException;
  1875. /**
  1876. * Gets a description of all the standard SQL types supported by
  1877. * this database. They are ordered by DATA_TYPE and then by how
  1878. * closely the data type maps to the corresponding JDBC SQL type.
  1879. *
  1880. * <P>Each type description has the following columns:
  1881. * <OL>
  1882. * <LI><B>TYPE_NAME</B> String => Type name
  1883. * <LI><B>DATA_TYPE</B> short => SQL data type from java.sql.Types
  1884. * <LI><B>PRECISION</B> int => maximum precision
  1885. * <LI><B>LITERAL_PREFIX</B> String => prefix used to quote a literal
  1886. * (may be null)
  1887. * <LI><B>LITERAL_SUFFIX</B> String => suffix used to quote a literal
  1888. (may be null)
  1889. * <LI><B>CREATE_PARAMS</B> String => parameters used in creating
  1890. * the type (may be null)
  1891. * <LI><B>NULLABLE</B> short => can you use NULL for this type?
  1892. * <UL>
  1893. * <LI> typeNoNulls - does not allow NULL values
  1894. * <LI> typeNullable - allows NULL values
  1895. * <LI> typeNullableUnknown - nullability unknown
  1896. * </UL>
  1897. * <LI><B>CASE_SENSITIVE</B> boolean=> is it case sensitive?
  1898. * <LI><B>SEARCHABLE</B> short => can you use "WHERE" based on this type:
  1899. * <UL>
  1900. * <LI> typePredNone - No support
  1901. * <LI> typePredChar - Only supported with WHERE .. LIKE
  1902. * <LI> typePredBasic - Supported except for WHERE .. LIKE
  1903. * <LI> typeSearchable - Supported for all WHERE ..
  1904. * </UL>
  1905. * <LI><B>UNSIGNED_ATTRIBUTE</B> boolean => is it unsigned?
  1906. * <LI><B>FIXED_PREC_SCALE</B> boolean => can it be a money value?
  1907. * <LI><B>AUTO_INCREMENT</B> boolean => can it be used for an
  1908. * auto-increment value?
  1909. * <LI><B>LOCAL_TYPE_NAME</B> String => localized version of type name
  1910. * (may be null)
  1911. * <LI><B>MINIMUM_SCALE</B> short => minimum scale supported
  1912. * <LI><B>MAXIMUM_SCALE</B> short => maximum scale supported
  1913. * <LI><B>SQL_DATA_TYPE</B> int => unused
  1914. * <LI><B>SQL_DATETIME_SUB</B> int => unused
  1915. * <LI><B>NUM_PREC_RADIX</B> int => usually 2 or 10
  1916. * </OL>
  1917. *
  1918. * @return ResultSet - each row is a SQL type description
  1919. * @exception SQLException if a database access error occurs
  1920. */
  1921. ResultSet getTypeInfo() throws SQLException;
  1922. /**
  1923. * A possible value for column <code>NULLABLE</code> in the
  1924. * <code>ResultSet</code> object returned by the method
  1925. * <code>getTypeInfo</code>.
  1926. * <p>Indicates that a <code>NULL</code> value is NOT allowed for this
  1927. * data type.
  1928. */
  1929. int typeNoNulls = 0;
  1930. /**
  1931. * A possible value for column <code>NULLABLE</code> in the
  1932. * <code>ResultSet</code> object returned by the method
  1933. * <code>getTypeInfo</code>.
  1934. * <p>Indicates that a <code>NULL</code> value is allowed for this
  1935. * data type.
  1936. */
  1937. int typeNullable = 1;
  1938. /**
  1939. * A possible value for column <code>NULLABLE</code> in the
  1940. * <code>ResultSet</code> object returned by the method
  1941. * <code>getTypeInfo</code>.
  1942. * <p>Indicates that it is not known whether a <code>NULL</code> value
  1943. * is allowed for this data type.
  1944. */
  1945. int typeNullableUnknown = 2;
  1946. /**
  1947. * A possible value for column <code>SEARCHABLE</code> in the
  1948. * <code>ResultSet</code> object returned by the method
  1949. * <code>getTypeInfo</code>.
  1950. * <p>Indicates that <code>WHERE</code> search clauses are not supported
  1951. * for this type.
  1952. */
  1953. int typePredNone = 0;
  1954. /**
  1955. * A possible value for column <code>SEARCHABLE</code> in the
  1956. * <code>ResultSet</code> object returned by the method
  1957. * <code>getTypeInfo</code>.
  1958. * <p>Indicates that the only <code>WHERE</code> search clause that can
  1959. * be based on this type is <code>WHERE . . .LIKE</code>.
  1960. */
  1961. int typePredChar = 1;
  1962. /**
  1963. * A possible value for column <code>SEARCHABLE</code> in the
  1964. * <code>ResultSet</code> object returned by the method
  1965. * <code>getTypeInfo</code>.
  1966. * <p>Indicates that one can base all <code>WHERE</code> search clauses
  1967. * except <code>WHERE . . .LIKE</code> on this data type.
  1968. */
  1969. int typePredBasic = 2;
  1970. /**
  1971. * A possible value for column <code>SEARCHABLE</code> in the
  1972. * <code>ResultSet</code> object returned by the method
  1973. * <code>getTypeInfo</code>.
  1974. * <p>Indicates that all <code>WHERE</code> search clauses can be
  1975. * based on this type.
  1976. */
  1977. int typeSearchable = 3;
  1978. /**
  1979. * Gets a description of a table's indices and statistics. They are
  1980. * ordered by NON_UNIQUE, TYPE, INDEX_NAME, and ORDINAL_POSITION.
  1981. *
  1982. * <P>Each index column description has the following columns:
  1983. * <OL>
  1984. * <LI><B>TABLE_CAT</B> String => table catalog (may be null)
  1985. * <LI><B>TABLE_SCHEM</B> String => table schema (may be null)
  1986. * <LI><B>TABLE_NAME</B> String => table name
  1987. * <LI><B>NON_UNIQUE</B> boolean => Can index values be non-unique?
  1988. * false when TYPE is tableIndexStatistic
  1989. * <LI><B>INDEX_QUALIFIER</B> String => index catalog (may be null);
  1990. * null when TYPE is tableIndexStatistic
  1991. * <LI><B>INDEX_NAME</B> String => index name; null when TYPE is
  1992. * tableIndexStatistic
  1993. * <LI><B>TYPE</B> short => index type:
  1994. * <UL>
  1995. * <LI> tableIndexStatistic - this identifies table statistics that are
  1996. * returned in conjuction with a table's index descriptions
  1997. * <LI> tableIndexClustered - this is a clustered index
  1998. * <LI> tableIndexHashed - this is a hashed index
  1999. * <LI> tableIndexOther - this is some other style of index
  2000. * </UL>
  2001. * <LI><B>ORDINAL_POSITION</B> short => column sequence number
  2002. * within index; zero when TYPE is tableIndexStatistic
  2003. * <LI><B>COLUMN_NAME</B> String => column name; null when TYPE is
  2004. * tableIndexStatistic
  2005. * <LI><B>ASC_OR_DESC</B> String => column sort sequence, "A" => ascending,
  2006. * "D" => descending, may be null if sort sequence is not supported;
  2007. * null when TYPE is tableIndexStatistic
  2008. * <LI><B>CARDINALITY</B> int => When TYPE is tableIndexStatistic, then
  2009. * this is the number of rows in the table; otherwise, it is the
  2010. * number of unique values in the index.
  2011. * <LI><B>PAGES</B> int => When TYPE is tableIndexStatisic then
  2012. * this is the number of pages used for the table, otherwise it
  2013. * is the number of pages used for the current index.
  2014. * <LI><B>FILTER_CONDITION</B> String => Filter condition, if any.
  2015. * (may be null)
  2016. * </OL>
  2017. *
  2018. * @param catalog a catalog name; "" retrieves those without a
  2019. * catalog; null means drop catalog name from the selection criteria
  2020. * @param schema a schema name; "" retrieves those without a schema
  2021. * @param table a table name
  2022. * @param unique when true, return only indices for unique values;
  2023. * when false, return indices regardless of whether unique or not
  2024. * @param approximate when true, result is allowed to reflect approximate
  2025. * or out of data values; when false, results are requested to be
  2026. * accurate
  2027. * @return ResultSet - each row is an index column description
  2028. * @exception SQLException if a database access error occurs
  2029. */
  2030. ResultSet getIndexInfo(String catalog, String schema, String table,
  2031. boolean unique, boolean approximate)
  2032. throws SQLException;
  2033. /**
  2034. * A possible value for column <code>TYPE</code> in the
  2035. * <code>ResultSet</code> object returned by the method
  2036. * <code>getIndexInfo</code>.
  2037. * <P>Indicates that this column contains table statistics that
  2038. * are returned in conjunction with a table's index descriptions.
  2039. */
  2040. short tableIndexStatistic = 0;
  2041. /**
  2042. * A possible value for column <code>TYPE</code> in the
  2043. * <code>ResultSet</code> object returned by the method
  2044. * <code>getIndexInfo</code>.
  2045. * <P>Indicates that this table index is a clustered index.
  2046. */
  2047. short tableIndexClustered = 1;
  2048. /**
  2049. * A possible value for column <code>TYPE</code> in the
  2050. * <code>ResultSet</code> object returned by the method
  2051. * <code>getIndexInfo</code>.
  2052. * <P>Indicates that this table index is a hashed index.
  2053. */
  2054. short tableIndexHashed = 2;
  2055. /**
  2056. * A possible value for column <code>TYPE</code> in the
  2057. * <code>ResultSet</code> object returned by the method
  2058. * <code>getIndexInfo</code>.
  2059. * <P>Indicates that this table index is not a clustered
  2060. * index, a hashed index, or table statistics;
  2061. * it is something other than these.
  2062. */
  2063. short tableIndexOther = 3;
  2064. //--------------------------JDBC 2.0-----------------------------
  2065. /**
  2066. * JDBC 2.0
  2067. *
  2068. * Does the database support the given result set type?
  2069. *
  2070. * @param type defined in <code>java.sql.ResultSet</code>
  2071. * @return <code>true</code> if so; <code>false</code> otherwise
  2072. * @exception SQLException if a database access error occurs
  2073. * @see Connection
  2074. */
  2075. boolean supportsResultSetType(int type) throws SQLException;
  2076. /**
  2077. * JDBC 2.0
  2078. *
  2079. * Does the database support the concurrency type in combination
  2080. * with the given result set type?
  2081. *
  2082. * @param type defined in <code>java.sql.ResultSet</code>
  2083. * @param concurrency type defined in <code>java.sql.ResultSet</code>
  2084. * @return <code>true</code> if so; <code>false</code> otherwise
  2085. * @exception SQLException if a database access error occurs
  2086. * @see Connection
  2087. */
  2088. boolean supportsResultSetConcurrency(int type, int concurrency)
  2089. throws SQLException;
  2090. /**
  2091. * JDBC 2.0
  2092. *
  2093. * Indicates whether a result set's own updates are visible.
  2094. *
  2095. * @param result set type, i.e. ResultSet.TYPE_XXX
  2096. * @return <code>true</code> if updates are visible for the result set type;
  2097. * <code>false</code> otherwise
  2098. * @exception SQLException if a database access error occurs
  2099. */
  2100. boolean ownUpdatesAreVisible(int type) throws SQLException;
  2101. /**
  2102. * JDBC 2.0
  2103. *
  2104. * Indicates whether a result set's own deletes are visible.
  2105. *
  2106. * @param result set type, i.e. ResultSet.TYPE_XXX
  2107. * @return <code>true</code> if deletes are visible for the result set type;
  2108. * <code>false</code> otherwise
  2109. * @exception SQLException if a database access error occurs
  2110. */
  2111. boolean ownDeletesAreVisible(int type) throws SQLException;
  2112. /**
  2113. * JDBC 2.0
  2114. *
  2115. * Indicates whether a result set's own inserts are visible.
  2116. *
  2117. * @param result set type, i.e. ResultSet.TYPE_XXX
  2118. * @return <code>true</code> if inserts are visible for the result set type;
  2119. * <code>false</code> otherwise
  2120. * @exception SQLException if a database access error occurs
  2121. */
  2122. boolean ownInsertsAreVisible(int type) throws SQLException;
  2123. /**
  2124. * JDBC 2.0
  2125. *
  2126. * Indicates whether updates made by others are visible.
  2127. *
  2128. * @param result set type, i.e. ResultSet.TYPE_XXX
  2129. * @return <code>true</code> if updates made by others
  2130. * are visible for the result set type;
  2131. * <code>false</code> otherwise
  2132. * @exception SQLException if a database access error occurs
  2133. */
  2134. boolean othersUpdatesAreVisible(int type) throws SQLException;
  2135. /**
  2136. * JDBC 2.0
  2137. *
  2138. * Indicates whether deletes made by others are visible.
  2139. *
  2140. * @param result set type, i.e. ResultSet.TYPE_XXX
  2141. * @return <code>true</code> if deletes made by others
  2142. * are visible for the result set type;
  2143. * <code>false</code> otherwise
  2144. * @exception SQLException if a database access error occurs
  2145. */
  2146. boolean othersDeletesAreVisible(int type) throws SQLException;
  2147. /**
  2148. * JDBC 2.0
  2149. *
  2150. * Indicates whether inserts made by others are visible.
  2151. *
  2152. * @param result set type, i.e. ResultSet.TYPE_XXX
  2153. * @return true if updates are visible for the result set type
  2154. * @return <code>true</code> if inserts made by others
  2155. * are visible for the result set type;
  2156. * <code>false</code> otherwise
  2157. * @exception SQLException if a database access error occurs
  2158. */
  2159. boolean othersInsertsAreVisible(int type) throws SQLException;
  2160. /**
  2161. * JDBC 2.0
  2162. *
  2163. * Indicates whether or not a visible row update can be detected by
  2164. * calling the method <code>ResultSet.rowUpdated</code>.
  2165. *
  2166. * @param result set type, i.e. ResultSet.TYPE_XXX
  2167. * @return <code>true</code> if changes are detected by the result set type;
  2168. * <code>false</code> otherwise
  2169. * @exception SQLException if a database access error occurs
  2170. */
  2171. boolean updatesAreDetected(int type) throws SQLException;
  2172. /**
  2173. * JDBC 2.0
  2174. *
  2175. * Indicates whether or not a visible row delete can be detected by
  2176. * calling ResultSet.rowDeleted(). If deletesAreDetected()
  2177. * returns false, then deleted rows are removed from the result set.
  2178. *
  2179. * @param result set type, i.e. ResultSet.TYPE_XXX
  2180. * @return true if changes are detected by the resultset type
  2181. * @exception SQLException if a database access error occurs
  2182. */
  2183. boolean deletesAreDetected(int type) throws SQLException;
  2184. /**
  2185. * JDBC 2.0
  2186. *
  2187. * Indicates whether or not a visible row insert can be detected
  2188. * by calling ResultSet.rowInserted().
  2189. *
  2190. * @param result set type, i.e. ResultSet.TYPE_XXX
  2191. * @return true if changes are detected by the resultset type
  2192. * @exception SQLException if a database access error occurs
  2193. */
  2194. boolean insertsAreDetected(int type) throws SQLException;
  2195. /**
  2196. * JDBC 2.0
  2197. *
  2198. * Indicates whether the driver supports batch updates.
  2199. * @return true if the driver supports batch updates; false otherwise
  2200. */
  2201. boolean supportsBatchUpdates() throws SQLException;
  2202. /**
  2203. * JDBC 2.0
  2204. *
  2205. * Gets a description of the user-defined types defined in a particular
  2206. * schema. Schema-specific UDTs may have type JAVA_OBJECT, STRUCT,
  2207. * or DISTINCT.
  2208. *
  2209. * <P>Only types matching the catalog, schema, type name and type
  2210. * criteria are returned. They are ordered by DATA_TYPE, TYPE_SCHEM
  2211. * and TYPE_NAME. The type name parameter may be a fully-qualified
  2212. * name. In this case, the catalog and schemaPattern parameters are
  2213. * ignored.
  2214. *
  2215. * <P>Each type description has the following columns:
  2216. * <OL>
  2217. * <LI><B>TYPE_CAT</B> String => the type's catalog (may be null)
  2218. * <LI><B>TYPE_SCHEM</B> String => type's schema (may be null)
  2219. * <LI><B>TYPE_NAME</B> String => type name
  2220. * <LI><B>CLASS_NAME</B> String => Java class name
  2221. * <LI><B>DATA_TYPE</B> String => type value defined in java.sql.Types.
  2222. * One of JAVA_OBJECT, STRUCT, or DISTINCT
  2223. * <LI><B>REMARKS</B> String => explanatory comment on the type
  2224. * </OL>
  2225. *
  2226. * <P><B>Note:</B> If the driver does not support UDTs, an empty
  2227. * result set is returned.
  2228. *
  2229. * @param catalog a catalog name; "" retrieves those without a
  2230. * catalog; null means drop catalog name from the selection criteria
  2231. * @param schemaPattern a schema name pattern; "" retrieves those
  2232. * without a schema
  2233. * @param typeNamePattern a type name pattern; may be a fully-qualified
  2234. * name
  2235. * @param types a list of user-named types to include (JAVA_OBJECT,
  2236. * STRUCT, or DISTINCT); null returns all types
  2237. * @return ResultSet - each row is a type description
  2238. * @exception SQLException if a database access error occurs
  2239. */
  2240. ResultSet getUDTs(String catalog, String schemaPattern,
  2241. String typeNamePattern, int[] types)
  2242. throws SQLException;
  2243. /**
  2244. * JDBC 2.0
  2245. * Retrieves the connection that produced this metadata object.
  2246. *
  2247. * @return the connection that produced this metadata object
  2248. */
  2249. Connection getConnection() throws SQLException;
  2250. }