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

Quick Search    Search Deep

postgresql.jdbc1
Class ResultSetMetaData  view ResultSetMetaData download ResultSetMetaData.java

java.lang.Object
  extended bypostgresql.jdbc1.ResultSetMetaData
All Implemented Interfaces:
java.sql.ResultSetMetaData

public class ResultSetMetaData
extends java.lang.Object
implements java.sql.ResultSetMetaData

A ResultSetMetaData object can be used to find out about the types and properties of the columns in a ResultSet


Field Summary
(package private)  postgresql.Field[] fields
           
(package private)  java.util.Vector rows
           
 
Fields inherited from interface java.sql.ResultSetMetaData
columnNoNulls, columnNullable, columnNullableUnknown
 
Constructor Summary
ResultSetMetaData(java.util.Vector rows, postgresql.Field[] fields)
          Initialise for a result with a tuple set and a field descriptor set
 
Method Summary
 java.lang.String getCatalogName(int column)
          What's a column's table's catalog name? As with getSchemaName(), we can say that if getTableName() returns n/a, then we can too - otherwise, we need to work on it.
 int getColumnCount()
          Whats the number of columns in the ResultSet?
 int getColumnDisplaySize(int column)
          What is the column's normal maximum width in characters?
 java.lang.String getColumnLabel(int column)
          What is the suggested column title for use in printouts and displays? We suggest the ColumnName!
 java.lang.String getColumnName(int column)
          What's a column's name?
 int getColumnType(int column)
          What is a column's SQL Type? (java.sql.Type int)
 java.lang.String getColumnTypeName(int column)
          Whats is the column's data source specific type name?
private  postgresql.Field getField(int columnIndex)
          For several routines in this package, we need to convert a columnIndex into a Field[] descriptor.
 int getPrecision(int column)
          What is a column's number of decimal digits.
 int getScale(int column)
          What is a column's number of digits to the right of the decimal point?
 java.lang.String getSchemaName(int column)
          What is a column's table's schema? This relies on us knowing the table name....which I don't know how to do as yet.
 java.lang.String getTableName(int column)
          Whats a column's table's name? How do I find this out? Both getSchemaName() and getCatalogName() rely on knowing the table Name, so we need this before we can work on them.
 boolean isAutoIncrement(int column)
          Is the column automatically numbered (and thus read-only) I believe that PostgreSQL does not support this feature.
 boolean isCaseSensitive(int column)
          Does a column's case matter? ASSUMPTION: Any field that is not obviously case insensitive is assumed to be case sensitive
 boolean isCurrency(int column)
          Is the column a cash value? 6.1 introduced the cash/money type, which haven't been incorporated as of 970414, so I just check the type name for both 'cash' and 'money'
 boolean isDefinitelyWritable(int column)
          Will a write on this column definately succeed? Hmmm...this is a bad one, since the two preceding functions have not been really defined.
 int isNullable(int column)
          Can you put a NULL in this column? I think this is always true in 6.1's case.
 boolean isReadOnly(int column)
          Is the column definitely not writable? In reality, we would have to check the GRANT/REVOKE stuff for this to be effective, and I haven't really looked into that yet, so this will get re-visited.
 boolean isSearchable(int column)
          Can the column be used in a WHERE clause? Basically for this, I split the functions into two types: recognised types (which are always useable), and OTHER types (which may or may not be useable).
 boolean isSigned(int column)
          Is the column a signed number? In PostgreSQL, all numbers are signed, so this is trivial.
 boolean isWritable(int column)
          Is it possible for a write on the column to succeed? Again, we would in reality have to check the GRANT/REVOKE stuff, which I haven't worked with as yet.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.sql.ResultSetMetaData
getColumnClassName
 

Field Detail

rows

java.util.Vector rows

fields

postgresql.Field[] fields
Constructor Detail

ResultSetMetaData

public ResultSetMetaData(java.util.Vector rows,
                         postgresql.Field[] fields)
Initialise for a result with a tuple set and a field descriptor set

Method Detail

getColumnCount

public int getColumnCount()
                   throws java.sql.SQLException
Whats the number of columns in the ResultSet?

Specified by:
getColumnCount in interface java.sql.ResultSetMetaData

isAutoIncrement

public boolean isAutoIncrement(int column)
                        throws java.sql.SQLException
Is the column automatically numbered (and thus read-only) I believe that PostgreSQL does not support this feature.

Specified by:
isAutoIncrement in interface java.sql.ResultSetMetaData

isCaseSensitive

public boolean isCaseSensitive(int column)
                        throws java.sql.SQLException
Does a column's case matter? ASSUMPTION: Any field that is not obviously case insensitive is assumed to be case sensitive

Specified by:
isCaseSensitive in interface java.sql.ResultSetMetaData

isSearchable

public boolean isSearchable(int column)
                     throws java.sql.SQLException
Can the column be used in a WHERE clause? Basically for this, I split the functions into two types: recognised types (which are always useable), and OTHER types (which may or may not be useable). The OTHER types, for now, I will assume they are useable. We should really query the catalog to see if they are useable.

Specified by:
isSearchable in interface java.sql.ResultSetMetaData

isCurrency

public boolean isCurrency(int column)
                   throws java.sql.SQLException
Is the column a cash value? 6.1 introduced the cash/money type, which haven't been incorporated as of 970414, so I just check the type name for both 'cash' and 'money'

Specified by:
isCurrency in interface java.sql.ResultSetMetaData

isNullable

public int isNullable(int column)
               throws java.sql.SQLException
Can you put a NULL in this column? I think this is always true in 6.1's case. It would only be false if the field had been defined NOT NULL (system catalogs could be queried?)

Specified by:
isNullable in interface java.sql.ResultSetMetaData

isSigned

public boolean isSigned(int column)
                 throws java.sql.SQLException
Is the column a signed number? In PostgreSQL, all numbers are signed, so this is trivial. However, strings are not signed (duh!)

Specified by:
isSigned in interface java.sql.ResultSetMetaData

getColumnDisplaySize

public int getColumnDisplaySize(int column)
                         throws java.sql.SQLException
What is the column's normal maximum width in characters?

Specified by:
getColumnDisplaySize in interface java.sql.ResultSetMetaData

getColumnLabel

public java.lang.String getColumnLabel(int column)
                                throws java.sql.SQLException
What is the suggested column title for use in printouts and displays? We suggest the ColumnName!

Specified by:
getColumnLabel in interface java.sql.ResultSetMetaData

getColumnName

public java.lang.String getColumnName(int column)
                               throws java.sql.SQLException
What's a column's name?

Specified by:
getColumnName in interface java.sql.ResultSetMetaData

getSchemaName

public java.lang.String getSchemaName(int column)
                               throws java.sql.SQLException
What is a column's table's schema? This relies on us knowing the table name....which I don't know how to do as yet. The JDBC specification allows us to return "" if this is not applicable.

Specified by:
getSchemaName in interface java.sql.ResultSetMetaData

getPrecision

public int getPrecision(int column)
                 throws java.sql.SQLException
What is a column's number of decimal digits.

Specified by:
getPrecision in interface java.sql.ResultSetMetaData

getScale

public int getScale(int column)
             throws java.sql.SQLException
What is a column's number of digits to the right of the decimal point?

Specified by:
getScale in interface java.sql.ResultSetMetaData

getTableName

public java.lang.String getTableName(int column)
                              throws java.sql.SQLException
Whats a column's table's name? How do I find this out? Both getSchemaName() and getCatalogName() rely on knowing the table Name, so we need this before we can work on them.

Specified by:
getTableName in interface java.sql.ResultSetMetaData

getCatalogName

public java.lang.String getCatalogName(int column)
                                throws java.sql.SQLException
What's a column's table's catalog name? As with getSchemaName(), we can say that if getTableName() returns n/a, then we can too - otherwise, we need to work on it.

Specified by:
getCatalogName in interface java.sql.ResultSetMetaData

getColumnType

public int getColumnType(int column)
                  throws java.sql.SQLException
What is a column's SQL Type? (java.sql.Type int)

Specified by:
getColumnType in interface java.sql.ResultSetMetaData

getColumnTypeName

public java.lang.String getColumnTypeName(int column)
                                   throws java.sql.SQLException
Whats is the column's data source specific type name?

Specified by:
getColumnTypeName in interface java.sql.ResultSetMetaData

isReadOnly

public boolean isReadOnly(int column)
                   throws java.sql.SQLException
Is the column definitely not writable? In reality, we would have to check the GRANT/REVOKE stuff for this to be effective, and I haven't really looked into that yet, so this will get re-visited.

Specified by:
isReadOnly in interface java.sql.ResultSetMetaData

isWritable

public boolean isWritable(int column)
                   throws java.sql.SQLException
Is it possible for a write on the column to succeed? Again, we would in reality have to check the GRANT/REVOKE stuff, which I haven't worked with as yet. However, if it isn't ReadOnly, then it is obviously writable.

Specified by:
isWritable in interface java.sql.ResultSetMetaData

isDefinitelyWritable

public boolean isDefinitelyWritable(int column)
                             throws java.sql.SQLException
Will a write on this column definately succeed? Hmmm...this is a bad one, since the two preceding functions have not been really defined. I cannot tell is the short answer. I thus return isWritable() just to give us an idea.

Specified by:
isDefinitelyWritable in interface java.sql.ResultSetMetaData

getField

private postgresql.Field getField(int columnIndex)
                           throws java.sql.SQLException
For several routines in this package, we need to convert a columnIndex into a Field[] descriptor. Rather than do the same code several times, here it is.