com.caucho.jdbc
Class JdbcMetaData

java.lang.Object
  extended by com.caucho.jdbc.JdbcMetaData
Direct Known Subclasses:
GenericMetaData

public abstract class JdbcMetaData
extends java.lang.Object

Abstract way of grabbing data from the JDBC connection.


Constructor Summary
protected JdbcMetaData(javax.sql.DataSource ds)
          Create a new JDBC backing store.
 
Method Summary
static JdbcMetaData create(javax.sql.DataSource ds)
          Create based on the connection.
abstract  java.lang.String createIdentitySQL(java.lang.String sqlType)
          Returns the identity property
abstract  java.lang.String createSequenceSQL(java.lang.String name, int size)
          Returns a sequence select expression.
 java.lang.String generateBoolean(java.lang.String term)
          Returns the code to test for a boolean value for a term.
abstract  java.lang.String getBlobType()
          Returns the blob type.
protected  java.sql.Connection getConnection()
          Returns a connection, which must then be closed.
abstract  java.lang.String getCreateColumnSQL(int sqlType, int length, int precision, int scale)
          New version to Return SQL for the table with the given SQL type.
 java.lang.String getDatabaseName()
          Returns the database name.
abstract  java.lang.String getFalseLiteral()
          Returns the literal for FALSE.
abstract  java.lang.String getLongType()
          Returns the long type.
 boolean isForeignKeyViolationSQLState(java.lang.String sqlState)
          Returns true if the sql state is a "foreign key violation" error.
 boolean isLimit()
          Returns true if the metadata can handle limit
 boolean isLimitOffset()
          Returns true if the metadata can handle limit and offset
 boolean isTruncateBlobBeforeDelete()
          True if blobs must be truncated on delete.
 boolean isUniqueConstraintSQLState(java.lang.String sqlState)
          Returns true if the sql state is a "duplicate primary key" error.
 java.lang.String limit(java.lang.String sql, int firstResults, int maxResults)
          Returns a limit.
abstract  java.lang.String selectSequenceSQL(java.lang.String name)
          Returns a sequence select expression.
abstract  boolean supportsGetGeneratedKeys()
          True if the generated keys is supported
abstract  boolean supportsIdentity()
          Returns true if identity is supported.
abstract  boolean supportsPositionFunction()
          Returns true if the POSITION function is supported.
abstract  boolean supportsSequences()
          Returns true if sequences are supported.
abstract  boolean supportsUpdateTableAlias()
          Returns true if table alias name with UPDATE is supported.
abstract  boolean supportsUpdateTableList()
          Returns true if table list with UPDATE is supported: UPDATE table1 a, table2 b SET ...
 java.lang.String testSequenceSQL(java.lang.String name)
          Returns a sequence select expression.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JdbcMetaData

protected JdbcMetaData(javax.sql.DataSource ds)
Create a new JDBC backing store.

Method Detail

create

public static JdbcMetaData create(javax.sql.DataSource ds)
Create based on the connection.


getDatabaseName

public java.lang.String getDatabaseName()
Returns the database name.


getBlobType

public abstract java.lang.String getBlobType()
Returns the blob type.


isTruncateBlobBeforeDelete

public boolean isTruncateBlobBeforeDelete()
True if blobs must be truncated on delete.


supportsGetGeneratedKeys

public abstract boolean supportsGetGeneratedKeys()
True if the generated keys is supported


getFalseLiteral

public abstract java.lang.String getFalseLiteral()
Returns the literal for FALSE.


supportsPositionFunction

public abstract boolean supportsPositionFunction()
Returns true if the POSITION function is supported.


supportsUpdateTableAlias

public abstract boolean supportsUpdateTableAlias()
Returns true if table alias name with UPDATE is supported.


supportsUpdateTableList

public abstract boolean supportsUpdateTableList()
Returns true if table list with UPDATE is supported: UPDATE table1 a, table2 b SET ...


isForeignKeyViolationSQLState

public boolean isForeignKeyViolationSQLState(java.lang.String sqlState)
Returns true if the sql state is a "foreign key violation" error.


isUniqueConstraintSQLState

public boolean isUniqueConstraintSQLState(java.lang.String sqlState)
Returns true if the sql state is a "duplicate primary key" error.


getLongType

public abstract java.lang.String getLongType()
Returns the long type.


supportsIdentity

public abstract boolean supportsIdentity()
Returns true if identity is supported.


createIdentitySQL

public abstract java.lang.String createIdentitySQL(java.lang.String sqlType)
Returns the identity property


supportsSequences

public abstract boolean supportsSequences()
Returns true if sequences are supported.


createSequenceSQL

public abstract java.lang.String createSequenceSQL(java.lang.String name,
                                                   int size)
Returns a sequence select expression.


selectSequenceSQL

public abstract java.lang.String selectSequenceSQL(java.lang.String name)
Returns a sequence select expression.


testSequenceSQL

public java.lang.String testSequenceSQL(java.lang.String name)
Returns a sequence select expression.


generateBoolean

public java.lang.String generateBoolean(java.lang.String term)
Returns the code to test for a boolean value for a term.


isLimit

public boolean isLimit()
Returns true if the metadata can handle limit


isLimitOffset

public boolean isLimitOffset()
Returns true if the metadata can handle limit and offset


limit

public java.lang.String limit(java.lang.String sql,
                              int firstResults,
                              int maxResults)
Returns a limit.


getCreateColumnSQL

public abstract java.lang.String getCreateColumnSQL(int sqlType,
                                                    int length,
                                                    int precision,
                                                    int scale)
New version to Return SQL for the table with the given SQL type. Takes, length, precision and scale.


getConnection

protected java.sql.Connection getConnection()
                                     throws java.sql.SQLException
Returns a connection, which must then be closed.

Throws:
java.sql.SQLException