Class org.gjt.mm.mysql.ResultSetMetaData
java.lang.Object
|
+--org.gjt.mm.mysql.ResultSetMetaData
- public class ResultSetMetaData
- extends java.lang.Object
- implements java.sql.ResultSetMetaData
Method Summary
|
java.lang.String
|
getCatalogName(int column)
What's a column's table's catalog name?
|
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? |
java.lang.String
|
getColumnName(int column)
What's a column's name? |
java.lang.String
|
getColumnTypeName(int column)
Whats is the column's data source specific type name? |
int
|
getColumnType(int column)
What is a column's SQL Type? |
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? |
java.lang.String
|
getTableName(int column)
Whats a column's table's name? |
boolean
|
isAutoIncrement(int column)
Is the column automatically numbered (and thus read-only)
MySQL Auto-increment columns are not read only,
so to conform to the spec, this method returns false. |
boolean
|
isCaseSensitive(int column)
Does a column's case matter? |
boolean
|
isCurrency(int column)
Is the column a cash value? |
boolean
|
isDefinitelyWritable(int column)
Will a write on this column definately succeed? |
int
|
isNullable(int column)
Can you put a NULL in this column? |
boolean
|
isReadOnly(int column)
Is the column definitely not writable? |
boolean
|
isSearchable(int column)
Can the column be used in a WHERE clause? |
boolean
|
isSigned(int column)
Is the column a signed number? |
boolean
|
isWritable(int column)
Is it possible for a write on the column to succeed? |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notifyAll, notify, toString, wait, wait, wait |
getColumnCount
public int getColumnCount()
throws java.sql.SQLException
- Whats the number of columns in the ResultSet?
- Specified by:
- getColumnCount() in interface java.sql.ResultSetMetaData
- Returns:
- the number
- Throws:
- java.sql.SQLException - if a database access error occurs
isAutoIncrement
public boolean isAutoIncrement(int column)
throws java.sql.SQLException
- Is the column automatically numbered (and thus read-only)
MySQL Auto-increment columns are not read only,
so to conform to the spec, this method returns false.
- Specified by:
- isAutoIncrement(int) in interface java.sql.ResultSetMetaData
- Parameters:
column
- the first column is 1, the second is 2...- Returns:
- true if so
- Throws:
- java.sql.SQLException - if a database access error occurs
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(int) in interface java.sql.ResultSetMetaData
- Parameters:
column
- the first column is 1, the second is 2...- Returns:
- true if so
- Throws:
- java.sql.SQLException - if a database access error occurs
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(int) in interface java.sql.ResultSetMetaData
- Parameters:
column
- the first column is 1, the second is 2...- Returns:
- true if they can be used in a WHERE clause
- Throws:
- java.sql.SQLException - if a database access error occurs
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(int) in interface java.sql.ResultSetMetaData
- Parameters:
column
- the first column is 1, the second is 2...- Returns:
- true if its a cash column
- Throws:
- java.sql.SQLException - if a database access error occurs
isNullable
public int isNullable(int column)
throws java.sql.SQLException
- Can you put a NULL in this column?
- Specified by:
- isNullable(int) in interface java.sql.ResultSetMetaData
- Parameters:
column
- the first column is 1, the second is 2...- Returns:
- one of the columnNullable values
- Throws:
- java.sql.SQLException - if a database access error occurs
isSigned
public boolean isSigned(int column)
throws java.sql.SQLException
- Is the column a signed number?
- Specified by:
- isSigned(int) in interface java.sql.ResultSetMetaData
- Parameters:
column
- the first column is 1, the second is 2...- Returns:
- true if so
- Throws:
- java.sql.SQLException - if a database access error occurs
getColumnDisplaySize
public int getColumnDisplaySize(int column)
throws java.sql.SQLException
- What is the column's normal maximum width in characters?
- Specified by:
- getColumnDisplaySize(int) in interface java.sql.ResultSetMetaData
- Parameters:
column
- the first column is 1, the second is 2, etc.- Returns:
- the maximum width
- Throws:
- java.sql.SQLException - if a database access error occurs
getColumnLabel
public java.lang.String getColumnLabel(int column)
throws java.sql.SQLException
- What is the suggested column title for use in printouts and
displays?
- Specified by:
- getColumnLabel(int) in interface java.sql.ResultSetMetaData
- Parameters:
column
- the first column is 1, the second is 2, etc.- Returns:
- the column label
- Throws:
- java.sql.SQLException - if a database access error occurs
getColumnName
public java.lang.String getColumnName(int column)
throws java.sql.SQLException
- What's a column's name?
- Specified by:
- getColumnName(int) in interface java.sql.ResultSetMetaData
- Parameters:
column
- the first column is 1, the second is 2, etc.- Returns:
- the column name
- Throws:
- java.sql.SQLException - if a databvase access error occurs
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(int) in interface java.sql.ResultSetMetaData
- Parameters:
column
- the first column is 1, the second is 2...- Returns:
- the Schema
- Throws:
- java.sql.SQLException - if a database access error occurs
getPrecision
public int getPrecision(int column)
throws java.sql.SQLException
- What is a column's number of decimal digits.
- Specified by:
- getPrecision(int) in interface java.sql.ResultSetMetaData
- Parameters:
column
- the first column is 1, the second is 2...- Returns:
- the precision
- Throws:
- java.sql.SQLException - if a database access error occurs
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(int) in interface java.sql.ResultSetMetaData
- Parameters:
column
- the first column is 1, the second is 2...- Returns:
- the scale
- Throws:
- java.sql.SQLException - if a database access error occurs
getCatalogName
public java.lang.String getCatalogName(int column)
throws java.sql.SQLException
- What's a column's table's catalog name?
MySQL does not have catalogs.
- Specified by:
- getCatalogName(int) in interface java.sql.ResultSetMetaData
- Parameters:
column
- the first column is 1, the second is 2...- Returns:
- catalog name, or "" if not applicable
- Throws:
- java.sql.SQLException - if a database access error occurs
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(int) in interface java.sql.ResultSetMetaData
- Parameters:
column
- the first column is 1, the second is 2...- Returns:
- column name, or "" if not applicable
- Throws:
- java.sql.SQLException - if a database access error occurs
getColumnType
public int getColumnType(int column)
throws java.sql.SQLException
- What is a column's SQL Type? (java.sql.Type int)
- Specified by:
- getColumnType(int) in interface java.sql.ResultSetMetaData
- Parameters:
column
- the first column is 1, the second is 2, etc.- Returns:
- the java.sql.Type value
- Throws:
- java.sql.SQLException - if a database access error occurs
- See Also:
- postgresql.Field#getSQLType, java.sql.Types
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(int) in interface java.sql.ResultSetMetaData
- Parameters:
column
- the first column is 1, the second is 2, etc.- Returns:
- the type name
- Throws:
- java.sql.SQLException - if a database access error occurs
isReadOnly
public boolean isReadOnly(int column)
throws java.sql.SQLException
- Is the column definitely not writable?
- Specified by:
- isReadOnly(int) in interface java.sql.ResultSetMetaData
- Parameters:
column
- the first column is 1, the second is 2, etc.- Returns:
- true if so
- Throws:
- java.sql.SQLException - if a database access error occurs
isWritable
public boolean isWritable(int column)
throws java.sql.SQLException
- Is it possible for a write on the column to succeed?
- Specified by:
- isWritable(int) in interface java.sql.ResultSetMetaData
- Parameters:
column
- the first column is 1, the second is 2, etc.- Returns:
- true if so
- Throws:
- java.sql.SQLException - if a database access error occurs
isDefinitelyWritable
public boolean isDefinitelyWritable(int column)
throws java.sql.SQLException
- Will a write on this column definately succeed?
- Specified by:
- isDefinitelyWritable(int) in interface java.sql.ResultSetMetaData
- Parameters:
column
- the first column is 1, the second is 2, etc..- Returns:
- true if so
- Throws:
- java.sql.SQLException - if a database access error occurs