Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Source code: postgresql/jdbc2/DatabaseMetaData.java


1   package postgresql.jdbc2;
2   
3   // IMPORTANT NOTE: This file implements the JDBC 2 version of the driver.
4   // If you make any modifications to this file, you must make sure that the
5   // changes are also made (if relevent) to the related JDBC 1 class in the
6   // postgresql.jdbc1 package.
7   
8   import java.sql.*;
9   import java.util.*;
10  import postgresql.Field;
11  
12  /**
13   * This class provides information about the database as a whole.
14   *
15   * <p>Many of the methods here return lists of information in ResultSets.  You
16   * can use the normal ResultSet methods such as getString and getInt to 
17   * retrieve the data from these ResultSets.  If a given form of metadata is
18   * not available, these methods should throw a SQLException.
19   *
20   * <p>Some of these methods take arguments that are String patterns.  These
21   * arguments all have names such as fooPattern.  Within a pattern String,
22   * "%" means match any substring of 0 or more characters, and "_" means
23   * match any one character.  Only metadata entries matching the search
24   * pattern are returned.  if a search pattern argument is set to a null
25   * ref, it means that argument's criteria should be dropped from the
26   * search.
27   *
28   * <p>A SQLException will be throws if a driver does not support a meta
29   * data method.  In the case of methods that return a ResultSet, either
30   * a ResultSet (which may be empty) is returned or a SQLException is
31   * thrown.
32   *
33   * @see java.sql.DatabaseMetaData
34   */
35  public class DatabaseMetaData implements java.sql.DatabaseMetaData 
36  {
37    Connection connection;    // The connection association
38    
39    // These define various OID's. Hopefully they will stay constant.
40    static final int iVarcharOid = 1043;  // OID for varchar
41    static final int iBoolOid = 16;  // OID for bool
42    static final int iInt2Oid = 21;  // OID for int2
43    static final int iInt4Oid = 23;  // OID for int4
44    static final int VARHDRSZ =  4;  // length for int4
45    
46    // This is a default value for remarks
47    private static final byte defaultRemarks[]="no remarks".getBytes();
48    
49    public DatabaseMetaData(Connection conn)
50    {
51      this.connection = conn;
52    }
53    
54    /**
55     * Can all the procedures returned by getProcedures be called
56     * by the current user?
57     *
58     * @return true if so
59     * @exception SQLException if a database access error occurs
60     */
61    public boolean allProceduresAreCallable() throws SQLException
62    {
63      return true;    // For now...
64    }
65    
66    /**
67     * Can all the tables returned by getTable be SELECTed by
68     * the current user?
69     *
70     * @return true if so
71     * @exception SQLException if a database access error occurs
72     */
73    public boolean allTablesAreSelectable() throws SQLException
74    {
75      return true;    // For now...
76    }
77    
78    /**
79     * What is the URL for this database?
80     *
81     * @return the url or null if it cannott be generated
82     * @exception SQLException if a database access error occurs
83     */
84    public String getURL() throws SQLException
85    {
86      return connection.getURL();
87    }
88    
89    /**
90     * What is our user name as known to the database?
91     *
92     * @return our database user name
93     * @exception SQLException if a database access error occurs
94     */
95    public String getUserName() throws SQLException
96    {
97      return connection.getUserName();
98    }
99    
100   /**
101    * Is the database in read-only mode?
102    *
103    * @return true if so
104    * @exception SQLException if a database access error occurs
105    */
106   public boolean isReadOnly() throws SQLException
107   {
108     return connection.isReadOnly();
109   }
110   
111   /**
112    * Are NULL values sorted high?
113    *
114    * @return true if so
115    * @exception SQLException if a database access error occurs
116    */
117   public boolean nullsAreSortedHigh() throws SQLException
118   {
119     return false;
120   }
121   
122   /**
123    * Are NULL values sorted low?
124    *
125    * @return true if so
126    * @exception SQLException if a database access error occurs
127    */
128   public boolean nullsAreSortedLow() throws SQLException
129   {
130     return false;
131   }
132   
133   /**
134    * Are NULL values sorted at the start regardless of sort order?
135    *
136    * @return true if so
137    * @exception SQLException if a database access error occurs
138    */
139   public boolean nullsAreSortedAtStart() throws SQLException
140   {
141     return false;
142   }
143   
144   /**
145    * Are NULL values sorted at the end regardless of sort order?
146    *
147    * @return true if so
148    * @exception SQLException if a database access error occurs
149    */
150   public boolean nullsAreSortedAtEnd() throws SQLException
151   {
152     return true;
153   }
154   
155   /**
156    * What is the name of this database product - we hope that it is
157    * PostgreSQL, so we return that explicitly.
158    *
159    * @return the database product name
160    * @exception SQLException if a database access error occurs
161    */
162   public String getDatabaseProductName() throws SQLException
163   {
164     return new String("PostgreSQL");
165   }
166   
167   /**
168    * What is the version of this database product.
169    *
170    * <p>Note that PostgreSQL 6.3 has a system catalog called pg_version - 
171    * however, select * from pg_version on any database retrieves
172    * no rows.
173    *
174    * <p>For now, we will return the version 6.3 (in the hope that we change
175    * this driver as often as we change the database)
176    *
177    * @return the database version
178    * @exception SQLException if a database access error occurs
179    */
180   public String getDatabaseProductVersion() throws SQLException
181   {
182     return ("6.5.2");
183   }
184   
185   /**
186    * What is the name of this JDBC driver?  If we don't know this
187    * we are doing something wrong!
188    *
189    * @return the JDBC driver name
190    * @exception SQLException why?
191    */
192   public String getDriverName() throws SQLException
193   {
194     return new String("PostgreSQL Native Driver");
195   }
196   
197   /**
198    * What is the version string of this JDBC driver?  Again, this is
199    * static.
200    *
201    * @return the JDBC driver name.
202    * @exception SQLException why?
203    */
204   public String getDriverVersion() throws SQLException
205   {
206     return new String(Integer.toString(connection.this_driver.getMajorVersion())+"."+Integer.toString(connection.this_driver.getMinorVersion()));
207   }
208   
209   /**
210    * What is this JDBC driver's major version number?
211    *
212    * @return the JDBC driver major version
213    */
214   public int getDriverMajorVersion()
215   {
216     return connection.this_driver.getMajorVersion();
217   }
218   
219   /**
220    * What is this JDBC driver's minor version number?
221    *
222    * @return the JDBC driver minor version
223    */
224   public int getDriverMinorVersion()
225   {
226     return connection.this_driver.getMinorVersion();
227   }
228   
229   /**
230    * Does the database store tables in a local file?  No - it
231    * stores them in a file on the server.
232    * 
233    * @return true if so
234    * @exception SQLException if a database access error occurs
235    */
236   public boolean usesLocalFiles() throws SQLException
237   {
238     return false;
239   }
240   
241   /**
242    * Does the database use a file for each table?  Well, not really,
243    * since it doesnt use local files. 
244    *
245    * @return true if so
246    * @exception SQLException if a database access error occurs
247    */
248   public boolean usesLocalFilePerTable() throws SQLException
249   {
250     return false;
251   }
252   
253   /**
254    * Does the database treat mixed case unquoted SQL identifiers
255    * as case sensitive and as a result store them in mixed case?
256    * A JDBC-Compliant driver will always return false.
257    *
258    * <p>Predicament - what do they mean by "SQL identifiers" - if it
259    * means the names of the tables and columns, then the answers
260    * given below are correct - otherwise I don't know.
261    *
262    * @return true if so
263    * @exception SQLException if a database access error occurs
264    */
265   public boolean supportsMixedCaseIdentifiers() throws SQLException
266   {
267     return false;
268   }
269   
270   /**
271    * Does the database treat mixed case unquoted SQL identifiers as
272    * case insensitive and store them in upper case?
273    *
274    * @return true if so
275    */
276   public boolean storesUpperCaseIdentifiers() throws SQLException
277   {
278     return false;
279   }
280   
281   /**
282    * Does the database treat mixed case unquoted SQL identifiers as
283    * case insensitive and store them in lower case?
284    *
285    * @return true if so
286    */
287   public boolean storesLowerCaseIdentifiers() throws SQLException
288   {
289     return true;
290   }
291   
292   /**
293    * Does the database treat mixed case unquoted SQL identifiers as
294    * case insensitive and store them in mixed case?
295    *
296    * @return true if so
297    */
298   public boolean storesMixedCaseIdentifiers() throws SQLException
299   {
300     return false;
301   }
302   
303   /**
304    * Does the database treat mixed case quoted SQL identifiers as
305    * case sensitive and as a result store them in mixed case?  A
306    * JDBC compliant driver will always return true. 
307    *
308    * <p>Predicament - what do they mean by "SQL identifiers" - if it
309    * means the names of the tables and columns, then the answers
310    * given below are correct - otherwise I don't know.
311    *
312    * @return true if so
313    * @exception SQLException if a database access error occurs
314    */
315   public boolean supportsMixedCaseQuotedIdentifiers() throws SQLException
316   {
317     return true;
318   }
319   
320   /**
321    * Does the database treat mixed case quoted SQL identifiers as
322    * case insensitive and store them in upper case?
323    *
324    * @return true if so
325    */
326   public boolean storesUpperCaseQuotedIdentifiers() throws SQLException
327   {
328     return false;
329   }
330   
331   /**
332    * Does the database treat mixed case quoted SQL identifiers as case
333    * insensitive and store them in lower case?
334    *
335    * @return true if so
336    */
337   public boolean storesLowerCaseQuotedIdentifiers() throws SQLException
338   {
339     return false;
340   }
341   
342   /**
343    * Does the database treat mixed case quoted SQL identifiers as case
344    * insensitive and store them in mixed case?
345    *
346    * @return true if so
347    */
348   public boolean storesMixedCaseQuotedIdentifiers() throws SQLException
349   {
350     return false;
351   }
352   
353   /**
354    * What is the string used to quote SQL identifiers?  This returns
355    * a space if identifier quoting isn't supported.  A JDBC Compliant
356    * driver will always use a double quote character.
357    *
358    * <p>If an SQL identifier is a table name, column name, etc. then
359    * we do not support it.
360    *
361    * @return the quoting string
362    * @exception SQLException if a database access error occurs
363    */
364   public String getIdentifierQuoteString() throws SQLException
365   {
366     return null;
367   }
368   
369   /**
370    * Get a comma separated list of all a database's SQL keywords that
371    * are NOT also SQL92 keywords.
372    *
373    * <p>Within PostgreSQL, the keywords are found in
374    *   src/backend/parser/keywords.c
375    *
376    * <p>For SQL Keywords, I took the list provided at
377    *   <a href="http://web.dementia.org/~shadow/sql/sql3bnf.sep93.txt">
378    * http://web.dementia.org/~shadow/sql/sql3bnf.sep93.txt</a>
379    * which is for SQL3, not SQL-92, but it is close enough for
380    * this purpose.
381    *
382    * @return a comma separated list of keywords we use
383    * @exception SQLException if a database access error occurs
384    */
385   public String getSQLKeywords() throws SQLException
386   {
387     return new String("abort,acl,add,aggregate,append,archive,arch_store,backward,binary,change,cluster,copy,database,delimiters,do,extend,explain,forward,heavy,index,inherits,isnull,light,listen,load,merge,nothing,notify,notnull,oids,purge,rename,replace,retrieve,returns,rule,recipe,setof,stdin,stdout,store,vacuum,verbose,version");
388   }
389   
390   public String getNumericFunctions() throws SQLException
391   {
392     // XXX-Not Implemented
393     return "";
394   }
395   
396   public String getStringFunctions() throws SQLException
397   {
398     // XXX-Not Implemented
399     return "";
400   }
401   
402   public String getSystemFunctions() throws SQLException
403   {
404     // XXX-Not Implemented
405     return "";
406   }
407   
408   public String getTimeDateFunctions() throws SQLException
409   {
410     // XXX-Not Implemented
411     return "";
412   }
413   
414   /**
415    * This is the string that can be used to escape '_' and '%' in
416    * a search string pattern style catalog search parameters
417    *
418    * @return the string used to escape wildcard characters
419    * @exception SQLException if a database access error occurs
420    */
421   public String getSearchStringEscape() throws SQLException
422   {
423     return new String("\\");
424   }
425   
426   /**
427    * Get all the "extra" characters that can bew used in unquoted
428    * identifier names (those beyond a-zA-Z0-9 and _)
429    *
430    * <p>From the file src/backend/parser/scan.l, an identifier is
431    * {letter}{letter_or_digit} which makes it just those listed
432    * above.
433    *
434    * @return a string containing the extra characters
435    * @exception SQLException if a database access error occurs
436    */
437   public String getExtraNameCharacters() throws SQLException
438   {
439     return new String("");
440   }
441   
442   /**
443    * Is "ALTER TABLE" with an add column supported?
444    * Yes for PostgreSQL 6.1
445    *
446    * @return true if so
447    * @exception SQLException if a database access error occurs
448    */
449   public boolean supportsAlterTableWithAddColumn() throws SQLException
450   {
451     return true;
452   }
453   
454   /**
455    * Is "ALTER TABLE" with a drop column supported?
456    * Yes for PostgreSQL 6.1
457    *
458    * @return true if so
459    * @exception SQLException if a database access error occurs
460    */
461   public boolean supportsAlterTableWithDropColumn() throws SQLException
462   {
463     return true;
464   }
465   
466   /**
467    * Is column aliasing supported?
468    *
469    * <p>If so, the SQL AS clause can be used to provide names for
470    * computed columns or to provide alias names for columns as
471    * required.  A JDBC Compliant driver always returns true.
472    *
473    * <p>e.g.
474    *
475    * <br><pre>
476    * select count(C) as C_COUNT from T group by C;
477    *
478    * </pre><br>
479    * should return a column named as C_COUNT instead of count(C)
480    *
481    * @return true if so
482    * @exception SQLException if a database access error occurs
483    */
484   public boolean supportsColumnAliasing() throws SQLException
485   {
486     return true;
487   }
488   
489   /**
490    * Are concatenations between NULL and non-NULL values NULL?  A
491    * JDBC Compliant driver always returns true
492    *
493    * @return true if so
494    * @exception SQLException if a database access error occurs
495    */
496   public boolean nullPlusNonNullIsNull() throws SQLException
497   {
498     return true;
499   }
500   
501   public boolean supportsConvert() throws SQLException
502   {
503     // XXX-Not Implemented
504     return false;
505   }
506   
507   public boolean supportsConvert(int fromType, int toType) throws SQLException
508   {
509     // XXX-Not Implemented
510     return false;
511   }
512   
513   public boolean supportsTableCorrelationNames() throws SQLException
514   {
515     // XXX-Not Implemented
516     return false;
517   }
518   
519   public boolean supportsDifferentTableCorrelationNames() throws SQLException
520   {
521     // XXX-Not Implemented
522     return false;
523   }
524   
525   /**
526    * Are expressions in "ORCER BY" lists supported?
527    * 
528    * <br>e.g. select * from t order by a + b;
529    *
530    * @return true if so
531    * @exception SQLException if a database access error occurs
532    */
533   public boolean supportsExpressionsInOrderBy() throws SQLException
534   {
535     return true;
536   }
537   
538   /**
539    * Can an "ORDER BY" clause use columns not in the SELECT?
540    * I checked it, and you can't.
541    *
542    * @return true if so
543    * @exception SQLException if a database access error occurs
544    */
545   public boolean supportsOrderByUnrelated() throws SQLException
546   {
547     return false;
548   }
549   
550   /**
551    * Is some form of "GROUP BY" clause supported?
552    * I checked it, and yes it is.
553    *
554    * @return true if so
555    * @exception SQLException if a database access error occurs
556    */
557   public boolean supportsGroupBy() throws SQLException
558   {
559     return true;
560   }
561   
562   /**
563    * Can a "GROUP BY" clause use columns not in the SELECT?
564    * I checked it - it seems to allow it
565    *
566    * @return true if so
567    * @exception SQLException if a database access error occurs
568    */
569   public boolean supportsGroupByUnrelated() throws SQLException
570   {
571     return true;
572   }
573   
574   /**
575    * Can a "GROUP BY" clause add columns not in the SELECT provided
576    * it specifies all the columns in the SELECT?  Does anyone actually
577    * understand what they mean here?
578    *
579    * @return true if so
580    * @exception SQLException if a database access error occurs
581    */
582   public boolean supportsGroupByBeyondSelect() throws SQLException
583   {
584     return true;    // For now...
585   }
586   
587   /**
588    * Is the escape character in "LIKE" clauses supported?  A
589    * JDBC compliant driver always returns true.
590    *
591    * @return true if so
592    * @exception SQLException if a database access error occurs
593    */
594   public boolean supportsLikeEscapeClause() throws SQLException
595   {
596     return true;
597   }
598   
599   /**
600    * Are multiple ResultSets from a single execute supported?
601    * Well, I implemented it, but I dont think this is possible from
602    * the back ends point of view.
603    * 
604    * @return true if so
605    * @exception SQLException if a database access error occurs
606    */
607   public boolean supportsMultipleResultSets() throws SQLException
608   {
609     return false;
610   }
611   
612   /**
613    * Can we have multiple transactions open at once (on different
614    * connections?)
615    * I guess we can have, since Im relying on it.
616    *
617    * @return true if so
618    * @exception SQLException if a database access error occurs
619    */
620   public boolean supportsMultipleTransactions() throws SQLException
621   {
622     return true;
623   }
624   
625   /**
626    * Can columns be defined as non-nullable.  A JDBC Compliant driver
627    * always returns true.
628    *
629    * <p>This changed from false to true in v6.2 of the driver, as this
630    * support was added to the backend.
631    *
632    * @return true if so
633    * @exception SQLException if a database access error occurs
634    */
635   public boolean supportsNonNullableColumns() throws SQLException
636   {
637     return true;
638   }
639   
640   /**
641    * Does this driver support the minimum ODBC SQL grammar.  This
642    * grammar is defined at:
643    *
644    * <p><a href="http://www.microsoft.com/msdn/sdk/platforms/doc/odbc/src/intropr.htm">http://www.microsoft.com/msdn/sdk/platforms/doc/odbc/src/intropr.htm</a>
645    *
646    * <p>In Appendix C.  From this description, we seem to support the
647    * ODBC minimal (Level 0) grammar.
648    *
649    * @return true if so
650    * @exception SQLException if a database access error occurs
651    */
652   public boolean supportsMinimumSQLGrammar() throws SQLException
653   {
654     return true;
655   }
656   
657   /**
658    * Does this driver support the Core ODBC SQL grammar.  We need
659    * SQL-92 conformance for this.
660    *
661    * @return true if so
662    * @exception SQLException if a database access error occurs
663    */
664   public boolean supportsCoreSQLGrammar() throws SQLException
665   {
666     return false;
667   }
668   
669   /**
670    * Does this driver support the Extended (Level 2) ODBC SQL
671    * grammar.  We don't conform to the Core (Level 1), so we can't
672    * conform to the Extended SQL Grammar.
673    *
674    * @return true if so
675    * @exception SQLException if a database access error occurs
676    */
677   public boolean supportsExtendedSQLGrammar() throws SQLException
678   {
679     return false;
680   }
681   
682   /**
683    * Does this driver support the ANSI-92 entry level SQL grammar?
684    * All JDBC Compliant drivers must return true.  I think we have
685    * to support outer joins for this to be true.
686    *
687    * @return true if so
688    * @exception SQLException if a database access error occurs
689    */
690   public boolean supportsANSI92EntryLevelSQL() throws SQLException
691   {
692     return false;
693   }
694   
695   /**
696    * Does this driver support the ANSI-92 intermediate level SQL
697    * grammar?  Anyone who does not support Entry level cannot support
698    * Intermediate level.
699    *
700    * @return true if so
701    * @exception SQLException if a database access error occurs
702    */
703   public boolean supportsANSI92IntermediateSQL() throws SQLException
704   {
705     return false;
706   }
707   
708   /**
709    * Does this driver support the ANSI-92 full SQL grammar?
710    *
711    * @return true if so
712    * @exception SQLException if a database access error occurs
713    */
714   public boolean supportsANSI92FullSQL() throws SQLException
715   {
716     return false;
717   }
718   
719   /**
720    * Is the SQL Integrity Enhancement Facility supported?
721    * I haven't seen this mentioned anywhere, so I guess not
722    * 
723    * @return true if so
724    * @exception SQLException if a database access error occurs
725    */
726   public boolean supportsIntegrityEnhancementFacility() throws SQLException
727   {
728     return false;
729   }
730   
731   /**
732    * Is some form of outer join supported?  From my knowledge, nope.
733    *
734    * @return true if so
735    * @exception SQLException if a database access error occurs
736    */
737   public boolean supportsOuterJoins() throws SQLException
738   {
739     return false;
740   }
741   
742   /**
743    * Are full nexted outer joins supported?  Well, we dont support any
744    * form of outer join, so this is no as well
745    *
746    * @return true if so
747    * @exception SQLException if a database access error occurs
748    */
749   public boolean supportsFullOuterJoins() throws SQLException
750   {
751     return false;
752   }
753   
754   /**
755    * Is there limited support for outer joins?  (This will be true if
756    * supportFullOuterJoins is true)
757    *
758    * @return true if so
759    * @exception SQLException if a database access error occurs
760    */
761   public boolean supportsLimitedOuterJoins() throws SQLException
762   {
763     return false;
764   }
765   
766   /**
767    * What is the database vendor's preferred term for "schema" - well,
768    * we do not provide support for schemas, so lets just use that
769    * term.
770    *
771    * @return the vendor term
772    * @exception SQLException if a database access error occurs
773    */
774   public String getSchemaTerm() throws SQLException
775   {
776     return new String("Schema");
777   }
778   
779   /**
780    * What is the database vendor's preferred term for "procedure" - 
781    * I kind of like "Procedure" myself.
782    *
783    * @return the vendor term
784    * @exception SQLException if a database access error occurs
785    */
786   public String getProcedureTerm() throws SQLException
787   {
788     return new String("Procedure");
789   }
790   
791   /**
792    * What is the database vendor's preferred term for "catalog"? -
793    * we dont have a preferred term, so just use Catalog
794    *
795    * @return the vendor term
796    * @exception SQLException if a database access error occurs
797    */
798   public String getCatalogTerm() throws SQLException
799   {
800     return new String("Catalog");
801   }
802   
803   /**
804    * Does a catalog appear at the start of a qualified table name?
805    * (Otherwise it appears at the end).
806    *
807    * @return true if so
808    * @exception SQLException if a database access error occurs
809    */
810   public boolean isCatalogAtStart() throws SQLException
811   {
812     return false;
813   }
814   
815   /**
816    * What is the Catalog separator.  Hmmm....well, I kind of like
817    * a period (so we get catalog.table definitions). - I don't think
818    * PostgreSQL supports catalogs anyhow, so it makes no difference.
819    *
820    * @return the catalog separator string
821    * @exception SQLException if a database access error occurs
822    */
823   public String getCatalogSeparator() throws SQLException
824   {
825     // PM Sep 29 97 - changed from "." as we don't support catalogs.
826     return new String("");
827   }
828   
829   /**
830    * Can a schema name be used in a data manipulation statement?  Nope.
831    *
832    * @return true if so
833    * @exception SQLException if a database access error occurs
834    */
835   public boolean supportsSchemasInDataManipulation() throws SQLException
836   {
837     return false;
838   }
839   
840   /**
841    * Can a schema name be used in a procedure call statement?  Nope.
842    *
843    * @return true if so
844    * @exception SQLException if a database access error occurs
845    */
846   public boolean supportsSchemasInProcedureCalls() throws SQLException
847   {
848     return false;
849   }
850   
851   /**
852    * Can a schema be used in a table definition statement?  Nope.
853    *
854    * @return true if so
855    * @exception SQLException if a database access error occurs
856    */
857   public boolean supportsSchemasInTableDefinitions() throws SQLException
858   {
859     return false;
860   }
861   
862   /**
863    * Can a schema name be used in an index definition statement?
864    *
865    * @return true if so
866    * @exception SQLException if a database access error occurs
867    */
868   public boolean supportsSchemasInIndexDefinitions() throws SQLException
869   {
870     return false;
871   }
872   
873   /**
874    * Can a schema name be used in a privilege definition statement?
875    *
876    * @return true if so
877    * @exception SQLException if a database access error occurs
878    */
879   public boolean supportsSchemasInPrivilegeDefinitions() throws SQLException
880   {
881     return false;
882   }
883   
884   /**
885    * Can a catalog name be used in a data manipulation statement?
886    *
887    * @return true if so
888    * @exception SQLException if a database access error occurs
889    */
890   public boolean supportsCatalogsInDataManipulation() throws SQLException
891   {
892     return false;
893   }
894   
895   /**
896    * Can a catalog name be used in a procedure call statement?
897    *
898    * @return true if so
899    * @exception SQLException if a database access error occurs
900    */
901   public boolean supportsCatalogsInProcedureCalls() throws SQLException
902   {
903     return false;
904   }
905   
906   /**
907    * Can a catalog name be used in a table definition statement?
908    *
909    * @return true if so
910    * @exception SQLException if a database access error occurs
911    */
912   public boolean supportsCatalogsInTableDefinitions() throws SQLException
913   {
914     return false;
915   }
916   
917   /**
918    * Can a catalog name be used in an index definition?
919    *
920    * @return true if so
921    * @exception SQLException if a database access error occurs
922    */
923   public boolean supportsCatalogsInIndexDefinitions() throws SQLException
924   {
925     return false;
926   }
927   
928   /**
929    * Can a catalog name be used in a privilege definition statement?
930    *
931    * @return true if so
932    * @exception SQLException if a database access error occurs
933    */
934   public boolean supportsCatalogsInPrivilegeDefinitions() throws SQLException
935   {
936     return false;
937   }
938   
939   /**
940    * We support cursors for gets only it seems.  I dont see a method
941    * to get a positioned delete.
942    *
943    * @return true if so
944    * @exception SQLException if a database access error occurs
945    */
946   public boolean supportsPositionedDelete() throws SQLException
947   {
948     return false;      // For now...
949   }
950   
951   /**
952    * Is positioned UPDATE supported?
953    * 
954    * @return true if so
955    * @exception SQLException if a database access error occurs
956    */
957   public boolean supportsPositionedUpdate() throws SQLException
958   {
959     return false;      // For now...
960   }
961   
962   public boolean supportsSelectForUpdate() throws SQLException
963   {
964     // XXX-Not Implemented
965     return false;
966   }
967   
968   public boolean supportsStoredProcedures() throws SQLException
969   {
970     // XXX-Not Implemented
971     return false;
972   }
973   
974   public boolean supportsSubqueriesInComparisons() throws SQLException
975   {
976     // XXX-Not Implemented
977     return false;
978   }
979   
980   public boolean supportsSubqueriesInExists() throws SQLException
981   {
982     // XXX-Not Implemented
983     return false;
984   }
985   
986   public boolean supportsSubqueriesInIns() throws SQLException
987   {
988     // XXX-Not Implemented
989     return false;
990   }
991   
992   public boolean supportsSubqueriesInQuantifieds() throws SQLException
993   {
994     // XXX-Not Implemented
995     return false;
996   }
997   
998   public boolean supportsCorrelatedSubqueries() throws SQLException
999   {
1000    // XXX-Not Implemented
1001    return false;
1002  }
1003  
1004  /**
1005   * Is SQL UNION supported?  Nope.
1006   *
1007   * @return true if so
1008   * @exception SQLException if a database access error occurs
1009   */
1010  public boolean supportsUnion() throws SQLException
1011  {
1012    return false;
1013  }
1014  
1015  /**
1016   * Is SQL UNION ALL supported?  Nope.
1017   *
1018   * @return true if so
1019   * @exception SQLException if a database access error occurs
1020   */
1021  public boolean supportsUnionAll() throws SQLException
1022  {
1023    return false;
1024  }
1025  
1026  /**
1027   * In PostgreSQL, Cursors are only open within transactions.
1028   *
1029   * @return true if so
1030   * @exception SQLException if a database access error occurs
1031   */
1032  public boolean supportsOpenCursorsAcrossCommit() throws SQLException
1033  {
1034    return false;
1035  }
1036  
1037  /**
1038   * Do we support open cursors across multiple transactions?
1039   *
1040   * @return true if so
1041   * @exception SQLException if a database access error occurs
1042   */
1043  public boolean supportsOpenCursorsAcrossRollback() throws SQLException
1044  {
1045    return false;
1046  }
1047  
1048  /**
1049   * Can statements remain open across commits?  They may, but
1050   * this driver cannot guarentee that.  In further reflection.
1051   * we are talking a Statement object jere, so the answer is
1052   * yes, since the Statement is only a vehicle to ExecSQL()
1053   *
1054   * @return true if they always remain open; false otherwise
1055   * @exception SQLException if a database access error occurs
1056   */
1057  public boolean supportsOpenStatementsAcrossCommit() throws SQLException
1058  {
1059    return true;
1060  }
1061  
1062  /**
1063   * Can statements remain open across rollbacks?  They may, but
1064   * this driver cannot guarentee that.  In further contemplation,
1065   * we are talking a Statement object here, so the answer is yes,
1066   * since the Statement is only a vehicle to ExecSQL() in Connection
1067   *
1068   * @return true if they always remain open; false otherwise
1069   * @exception SQLException if a database access error occurs
1070   */
1071  public boolean supportsOpenStatementsAcrossRollback() throws SQLException
1072  {
1073    return true;
1074  }
1075  
1076  /**
1077   * How many hex characters can you have in an inline binary literal
1078   *
1079   * @return the max literal length
1080   * @exception SQLException if a database access error occurs
1081   */
1082  public int getMaxBinaryLiteralLength() throws SQLException
1083  {
1084    return 0;        // For now...
1085  }
1086  
1087  /**
1088   * What is the maximum length for a character literal
1089   * I suppose it is 8190 (8192 - 2 for the quotes)
1090   *
1091   * @return the max literal length
1092   * @exception SQLException if a database access error occurs
1093   */
1094  public int getMaxCharLiteralLength() throws SQLException
1095  {
1096    return 8190;
1097  }
1098  
1099  /**
1100   * Whats the limit on column name length.  The description of
1101   * pg_class would say '32' (length of pg_class.relname) - we
1102   * should probably do a query for this....but....
1103   *
1104   * @return the maximum column name length
1105   * @exception SQLException if a database access error occurs
1106   */
1107  public int getMaxColumnNameLength() throws SQLException
1108  {
1109    return 32;
1110  }
1111  
1112  /**
1113   * What is the maximum number of columns in a "GROUP BY" clause?
1114   *
1115   * @return the max number of columns
1116   * @exception SQLException if a database access error occurs  
1117   */
1118  public int getMaxColumnsInGroupBy() throws SQLException
1119  {
1120    return getMaxColumnsInTable();
1121  }
1122  
1123  /**
1124   * What's the maximum number of columns allowed in an index?
1125   * 6.0 only allowed one column, but 6.1 introduced multi-column
1126   * indices, so, theoretically, its all of them.
1127   *
1128   * @return max number of columns
1129   * @exception SQLException if a database access error occurs
1130   */
1131  public int getMaxColumnsInIndex() throws SQLException
1132  {
1133    return getMaxColumnsInTable();
1134  }
1135  
1136  /**
1137   * What's the maximum number of columns in an "ORDER BY clause?
1138   * Theoretically, all of them!
1139   *
1140   * @return the max columns
1141   * @exception SQLException if a database access error occurs
1142   */
1143  public int getMaxColumnsInOrderBy() throws SQLException
1144  {
1145    return getMaxColumnsInTable();
1146  }
1147  
1148  /**
1149   * What is the maximum number of columns in a "SELECT" list?
1150   * Theoretically, all of them!
1151   *
1152   * @return the max columns
1153   * @exception SQLException if a database access error occurs
1154   */
1155  public int getMaxColumnsInSelect() throws SQLException
1156  {
1157    return getMaxColumnsInTable();
1158  }
1159  
1160  /**
1161   * What is the maximum number of columns in a table? From the
1162   * create_table(l) manual page...
1163   *
1164   * <p>"The new class is created as a heap with no initial data.  A
1165   * class can have no more than 1600 attributes (realistically,
1166   * this is limited by the fact that tuple sizes must be less than
1167   * 8192 bytes)..."
1168   *
1169   * @return the max columns
1170   * @exception SQLException if a database access error occurs
1171   */
1172  public int getMaxColumnsInTable() throws SQLException
1173  {
1174    return 1600;
1175  }
1176  
1177  /**
1178   * How many active connection can we have at a time to this
1179   * database?  Well, since it depends on postmaster, which just
1180   * does a listen() followed by an accept() and fork(), its
1181   * basically very high.  Unless the system runs out of processes,
1182   * it can be 65535 (the number of aux. ports on a TCP/IP system).
1183   * I will return 8192 since that is what even the largest system
1184   * can realistically handle,
1185   *
1186   * @return the maximum number of connections
1187   * @exception SQLException if a database access error occurs
1188   */
1189  public int getMaxConnections() throws SQLException
1190  {
1191    return 8192;
1192  }
1193  
1194  /**
1195   * What is the maximum cursor name length (the same as all
1196   * the other F***** identifiers!)
1197   *
1198   * @return max cursor name length in bytes
1199   * @exception SQLException if a database access error occurs
1200   */
1201  public int getMaxCursorNameLength() throws SQLException
1202  {
1203    return 32;
1204  }
1205  
1206  /**
1207   * What is the maximum length of an index (in bytes)?  Now, does
1208   * the spec. mean name of an index (in which case its 32, the 
1209   * same as a table) or does it mean length of an index element
1210   * (in which case its 8192, the size of a row) or does it mean
1211   * the number of rows it can access (in which case it 2^32 - 
1212   * a 4 byte OID number)?  I think its the length of an index
1213   * element, personally, so Im setting it to 8192.
1214   *
1215   * @return max index length in bytes
1216   * @exception SQLException if a database access error occurs
1217   */
1218  public int getMaxIndexLength() throws SQLException
1219  {
1220    return 8192;
1221  }
1222  
1223  public int getMaxSchemaNameLength() throws SQLException
1224  {
1225    // XXX-Not Implemented
1226    return 0;
1227  }
1228  
1229  /**
1230   * What is the maximum length of a procedure name?
1231   * (length of pg_proc.proname used) - again, I really
1232   * should do a query here to get it.
1233   *
1234   * @return the max name length in bytes
1235   * @exception SQLException if a database access error occurs
1236   */
1237  public int getMaxProcedureNameLength() throws SQLException
1238  {
1239    return 32;
1240  }
1241  
1242  public int getMaxCatalogNameLength() throws SQLException
1243  {
1244    // XXX-Not Implemented
1245    return 0;
1246  }
1247  
1248  /**
1249   * What is the maximum length of a single row?  (not including
1250   * blobs).  8192 is defined in PostgreSQL.
1251   *
1252   * @return max row size in bytes
1253   * @exception SQLException if a database access error occurs
1254   */
1255  public int getMaxRowSize() throws SQLException
1256  {
1257    return 8192;
1258  }
1259  
1260  /**
1261   * Did getMaxRowSize() include LONGVARCHAR and LONGVARBINARY
1262   * blobs?  We don't handle blobs yet
1263   *
1264   * @return true if so
1265   * @exception SQLException if a database access error occurs
1266   */
1267  public boolean doesMaxRowSizeIncludeBlobs() throws SQLException
1268  {
1269    return false;
1270  }
1271  
1272  /**
1273   * What is the maximum length of a SQL statement?
1274   *
1275   * @return max length in bytes
1276   * @exception SQLException if a database access error occurs
1277   */
1278  public int getMaxStatementLength() throws SQLException
1279  {
1280    return 8192;
1281  }
1282  
1283  /**
1284   * How many active statements can we have open at one time to
1285   * this database?  Basically, since each Statement downloads
1286   * the results as the query is executed, we can have many.  However,
1287   * we can only really have one statement per connection going
1288   * at once (since they are executed serially) - so we return
1289   * one.
1290   *
1291   * @return the maximum
1292   * @exception SQLException if a database access error occurs
1293   */
1294  public int getMaxStatements() throws SQLException
1295  {
1296    return 1;
1297  }
1298  
1299  /**
1300   * What is the maximum length of a table name?  This was found
1301   * from pg_class.relname length
1302   *
1303   * @return max name length in bytes
1304   * @exception SQLException if a database access error occurs
1305   */
1306  public int getMaxTableNameLength() throws SQLException
1307  {
1308    return 32;
1309  }
1310  
1311  /**
1312   * What is the maximum number of tables that can be specified
1313   * in a SELECT?  Theoretically, this is the same number as the
1314   * number of tables allowable.  In practice tho, it is much smaller
1315   * since the number of tables is limited by the statement, we
1316   * return 1024 here - this is just a number I came up with (being
1317   * the number of tables roughly of three characters each that you
1318   * can fit inside a 8192 character buffer with comma separators).
1319   *
1320   * @return the maximum
1321   * @exception SQLException if a database access error occurs
1322   */
1323  public int getMaxTablesInSelect() throws SQLException
1324  {
1325    return 1024;
1326  }
1327  
1328  /**
1329   * What is the maximum length of a user name?  Well, we generally
1330   * use UNIX like user names in PostgreSQL, so I think this would
1331   * be 8.  However, showing the schema for pg_user shows a length
1332   * for username of 32.
1333   *
1334   * @return the max name length in bytes
1335   * @exception SQLException if a database access error occurs
1336   */
1337  public int getMaxUserNameLength() throws SQLException
1338  {
1339    return 32;
1340  }
1341  
1342  
1343  /**
1344   * What is the database's default transaction isolation level?  We
1345   * do not support this, so all transactions are SERIALIZABLE.
1346   *
1347   * @return the default isolation level
1348   * @exception SQLException if a database access error occurs
1349   * @see Connection
1350   */
1351  public int getDefaultTransactionIsolation() throws SQLException
1352  {
1353      return Connection.TRANSACTION_READ_COMMITTED;
1354  }
1355  
1356  /**
1357   * Are transactions supported?  If not, commit and rollback are noops
1358   * and the isolation level is TRANSACTION_NONE.  We do support
1359   * transactions.  
1360   *
1361   * @return true if transactions are supported
1362   * @exception SQLException if a database access error occurs
1363   */
1364  public boolean supportsTransactions() throws SQLException
1365  {
1366    return true;
1367  }
1368  
1369  /**
1370   * Does the database support the given transaction isolation level?
1371   * We only support TRANSACTION_SERIALIZABLE and TRANSACTION_READ_COMMITTED
1372   * 
1373   * @param level the values are defined in java.sql.Connection
1374   * @return true if so
1375   * @exception SQLException if a database access error occurs
1376   * @see Connection
1377   */
1378  public boolean supportsTransactionIsolationLevel(int level) throws SQLException
1379  {
1380    if (level == Connection.TRANSACTION_SERIALIZABLE ||
1381        level == Connection.TRANSACTION_READ_COMMITTED)
1382      return true;
1383    else
1384      return false;
1385  }
1386  
1387  /**
1388   * Are both data definition and data manipulation transactions 
1389   * supported?  I checked it, and could not do a CREATE TABLE
1390   * within a transaction, so I am assuming that we don't
1391   *
1392   * @return true if so
1393   * @exception SQLException if a database access error occurs
1394   */
1395  public boolean supportsDataDefinitionAndDataManipulationTransactions() throws SQLException
1396  {
1397    return false;
1398  }
1399  
1400  /**
1401   * Are only data manipulation statements withing a transaction
1402   * supported?
1403   *
1404   * @return true if so
1405   * @exception SQLException if a database access error occurs
1406   */
1407  public boolean supportsDataManipulationTransactionsOnly() throws SQLException
1408  {
1409    return true;
1410  }
1411  
1412  /**
1413   * Does a data definition statement within a transaction force
1414   * the transaction to commit?  I think this means something like:
1415   *
1416   * <p><pre>
1417   * CREATE TABLE T (A INT);
1418   * INSERT INTO T (A) VALUES (2);
1419   * BEGIN;
1420   * UPDATE T SET A = A + 1;
1421   * CREATE TABLE X (A INT);
1422   * SELECT A FROM T INTO X;
1423   * COMMIT;
1424   * </pre><p>
1425   *
1426   * does the CREATE TABLE call cause a commit?  The answer is no.  
1427   *
1428   * @return true if so
1429   * @exception SQLException if a database access error occurs
1430   */
1431  public boolean dataDefinitionCausesTransactionCommit() throws SQLException
1432  {
1433    return false;
1434  }
1435  
1436  /**
1437   * Is a data definition statement within a transaction ignored?
1438   * It seems to be (from experiment in previous method)
1439   *
1440   * @return true if so
1441   * @exception SQLException if a database access error occurs
1442   */
1443  public boolean dataDefinitionIgnoredInTransactions() throws SQLException
1444  {
1445    return true;
1446  }
1447  
1448  /**
1449   * Get a description of stored procedures available in a catalog
1450   * 
1451   * <p>Only procedure descriptions matching the schema and procedure
1452   * name criteria are returned.  They are ordered by PROCEDURE_SCHEM
1453   * and PROCEDURE_NAME
1454   *
1455   * <p>Each procedure description has the following columns:
1456   * <ol>
1457   * <li><b>PROCEDURE_CAT</b> String => procedure catalog (may be null)
1458   * <li><b>PROCEDURE_SCHEM</b> String => procedure schema (may be null)
1459   * <li><b>PROCEDURE_NAME</b> String => procedure name
1460   * <li><b>Field 4</b> reserved (make it null)
1461   * <li><b>Field 5</b> reserved (make it null)
1462   * <li><b>Field 6</b> reserved (make it null)
1463   * <li><b>REMARKS</b> String => explanatory comment on the procedure
1464   * <li><b>PROCEDURE_TYPE</b> short => kind of procedure
1465   *  <ul>
1466   *    <li> procedureResultUnknown - May return a result
1467   *   <li> procedureNoResult - Does not return a result
1468   *  <li> procedureReturnsResult - Returns a result
1469   *    </ul>
1470   * </ol>
1471   *
1472   * @param catalog - a catalog name; "" retrieves those without a
1473   *  catalog; null means drop catalog name from criteria
1474   * @param schemaParrern - a schema name pattern; "" retrieves those
1475   *  without a schema - we ignore this parameter
1476   * @param procedureNamePattern - a procedure name pattern
1477   * @return ResultSet - each row is a procedure description
1478   * @exception SQLException if a database access error occurs
1479   */
1480  public java.sql.ResultSet getProcedures(String catalog, String schemaPattern, String procedureNamePattern) throws SQLException
1481  {
1482    // the field descriptors for the new ResultSet
1483    Field f[] = new Field[8];
1484    java.sql.ResultSet r;  // ResultSet for the SQL query that we need to do
1485    Vector v = new Vector();    // The new ResultSet tuple stuff
1486    
1487    byte remarks[] = defaultRemarks;
1488    
1489    f[0] = new Field(connection, "PROCEDURE_CAT",   iVarcharOid, 32);
1490    f[1] = new Field(connection, "PROCEDURE_SCHEM", iVarcharOid, 32);
1491    f[2] = new Field(connection, "PROCEDURE_NAME",  iVarcharOid, 32);
1492    f[3] = f[4] = f[5] = null;  // reserved, must be null for now
1493    f[6] = new Field(connection, "REMARKS",     iVarcharOid, 8192);
1494    f[7] = new Field(connection, "PROCEDURE_TYPE", iInt2Oid,  2);
1495    
1496    // If the pattern is null, then set it to the default
1497    if(procedureNamePattern==null)
1498      procedureNamePattern="%";
1499    
1500    r = connection.ExecSQL("select proname, proretset from pg_proc where proname like '"+procedureNamePattern.toLowerCase()+"' order by proname");
1501    
1502    while (r.next())
1503      {
1504  byte[][] tuple = new byte[8][0];
1505  
1506  tuple[0] = null;      // Catalog name
1507  tuple[1] = null;      // Schema name
1508  tuple[2] = r.getBytes(1);    // Procedure name
1509  tuple[3] = tuple[4] = tuple[5] = null;  // Reserved
1510  tuple[6] = remarks;      // Remarks
1511  
1512  if (r.getBoolean(2))
1513    tuple[7] = Integer.toString(java.sql.DatabaseMetaData.procedureReturnsResult).getBytes();
1514  else
1515    tuple[7] = Integer.toString(java.sql.DatabaseMetaData.procedureNoResult).getBytes();
1516  
1517  v.addElement(tuple);
1518      }
1519    return new ResultSet(connection, f, v, "OK", 1);
1520  }
1521  
1522  /**
1523   * Get a description of a catalog's stored procedure parameters
1524   * and result columns.
1525   *
1526   * <p>Only descriptions matching the schema, procedure and parameter
1527   * name criteria are returned. They are ordered by PROCEDURE_SCHEM
1528   * and PROCEDURE_NAME. Within this, the return value, if any, is
1529   * first. Next are the parameter descriptions in call order. The
1530   * column descriptions follow in column number order.
1531   *
1532   * <p>Each row in the ResultSet is a parameter description or column 
1533   * description with the following fields:
1534   * <ol>
1535   * <li><b>PROCEDURE_CAT</b> String => procedure catalog (may be null)
1536   * <li><b>PROCEDURE_SCHE</b>M String => procedure schema (may be null)
1537   * <li><b>PROCEDURE_NAME</b> String => procedure name
1538   * <li><b>COLUMN_NAME</b> String => column/parameter name
1539   * <li><b>COLUMN_TYPE</b> Short => kind of column/parameter:
1540   * <ul><li>procedureColumnUnknown - nobody knows
1541   * <li>procedureColumnIn - IN parameter
1542   * <li>procedureColumnInOut - INOUT parameter
1543   * <li>procedureColumnOut - OUT parameter
1544   * <li>procedureColumnReturn - procedure return value
1545   * <li>procedureColumnResult - result column in ResultSet
1546   * </ul>
1547   * <li><b>DATA_TYPE</b> short => SQL type from java.sql.Types
1548   * <li><b>TYPE_NAME</b> String => SQL type name
1549   * <li><b>PRECISION</b> int => precision
1550   * <li><b>LENGTH</b> int => length in bytes of data
1551   * <li><b>SCALE</b> short => scale
1552   * <li><b>RADIX</b> short => radix
1553   * <li><b>NULLABLE</b> short => can it contain NULL?
1554   * <ul><li>procedureNoNulls - does not allow NULL values
1555   * <li>procedureNullable - allows NULL values
1556   * <li>procedureNullableUnknown - nullability unknown
1557   * <li><b>REMARKS</b> String => comment describing parameter/column
1558   * </ol>
1559   * @param catalog This is ignored in postgresql, advise this is set to null
1560   * @param schemaPattern This is ignored in postgresql, advise this is set to null
1561   * @param procedureNamePattern a procedure name pattern
1562   * @param columnNamePattern a column name pattern
1563   * @return each row is a stored procedure parameter or column description
1564   * @exception SQLException if a database-access error occurs
1565   * @see #getSearchStringEscape
1566   */
1567  // Implementation note: This is required for Borland's JBuilder to work
1568  public java.sql.ResultSet getProcedureColumns(String catalog, String schemaPattern, String procedureNamePattern, String columnNamePattern) throws SQLException
1569  {
1570    if(procedureNamePattern==null)
1571      procedureNamePattern="%";
1572    
1573    if(columnNamePattern==null)
1574      columnNamePattern="%";
1575    
1576    // for now, this returns an empty result set.
1577    Field f[] = new Field[13];
1578    ResultSet r;  // ResultSet for the SQL query that we need to do
1579    Vector v = new Vector();    // The new ResultSet tuple stuff
1580    
1581    f[0] = new Field(connection, new String("PROCEDURE_CAT"), iVarcharOid, 32);
1582    f[1] = new Field(connection, new String("PROCEDURE_SCHEM"), iVarcharOid, 32);
1583    f[2] = new Field(connection, new String("PROCEDURE_NAME"), iVarcharOid, 32);
1584    f[3] = new Field(connection, new String("COLUMN_NAME"), iVarcharOid, 32);
1585    f[4] = new Field(connection, new String("COLUMN_TYPE"), iInt2Oid, 2);
1586    f[5] = new Field(connection, new String("DATA_TYPE"), iInt2Oid, 2);
1587    f[6] = new Field(connection, new String("TYPE_NAME"), iVarcharOid, 32);
1588    f[7] = new Field(connection, new String("PRECISION"), iInt4Oid, 4);
1589    f[8] = new Field(connection, new String("LENGTH"), iInt4Oid, 4);
1590    f[9] = new Field(connection, new String("SCALE"), iInt2Oid, 2);
1591    f[10] = new Field(connection, new String("RADIX"), iInt2Oid, 2);
1592    f[11] = new Field(connection, new String("NULLABLE"), iInt2Oid, 2);
1593    f[12] = new Field(connection, new String("REMARKS"), iVarcharOid, 32);
1594    
1595    // add query loop here
1596    
1597    return new ResultSet(connection, f, v, "OK", 1);
1598  }
1599  
1600  /**
1601   * Get a description of tables available in a catalog.              
1602   *
1603   * <p>Only table descriptions matching the catalog, schema, table
1604   * name and type criteria are returned. They are ordered by
1605   * TABLE_TYPE, TABLE_SCHEM and TABLE_NAME.                      
1606   * 
1607   * <p>Each table description has the following columns:     
1608   *
1609   * <ol>
1610   * <li><b>TABLE_CAT</b> String => table catalog (may be null)      
1611   * <li><b>TABLE_SCHEM</b> String => table schema (may be null)         
1612   * <li><b>TABLE_NAME</b> String => table name
1613   * <li><b>TABLE_TYPE</b> String => table type. Typical types are "TABLE",
1614   * "VIEW", "SYSTEM TABLE", "GLOBAL TEMPORARY", "LOCAL
1615   * TEMPORARY", "ALIAS", "SYNONYM".                             
1616   * <li><b>REMARKS</b> String => explanatory comment on the table
1617   * </ol>
1618   *
1619   * <p>The valid values for the types parameter are:
1620   * "TABLE", "INDEX", "LARGE OBJECT", "SEQUENCE", "SYSTEM TABLE" and
1621   * "SYSTEM INDEX"
1622   *
1623   * @param catalog a catalog name; For postgresql, this is ignored, and
1624   * should be set to null
1625   * @param schemaPattern a schema name pattern; For postgresql, this is ignored, and
1626   * should be set to null
1627   * @param tableNamePattern a table name pattern. For all tables this should be "%"
1628   * @param types a list of table types to include; null returns
1629   * all types
1630   * @return each row is a table description      
1631   * @exception SQLException if a database-access error occurs.
1632   */
1633  public java.sql.ResultSet getTables(String catalog, String schemaPattern, String tableNamePattern, String types[]) throws SQLException
1634  {
1635    // Handle default value for types
1636    if(types==null)
1637      types = defaultTableTypes;
1638    
1639    if(tableNamePattern==null)
1640      tableNamePattern="%";
1641    
1642    // the field descriptors for the new ResultSet
1643    Field f[] = new Field[5];
1644    java.sql.ResultSet r;  // ResultSet for the SQL query that we need to do
1645    Vector v = new Vector();    // The new ResultSet tuple stuff
1646    
1647    f[0] = new Field(connection, new String("TABLE_CAT"), iVarcharOid, 32);
1648    f[1] = new Field(connection, new String("TABLE_SCHEM"), iVarcharOid, 32);
1649    f[2] = new Field(connection, new String("TABLE_NAME"), iVarcharOid, 32);
1650    f[3] = n