Skip navigation links

Oracle Fusion Middleware Java API Reference for Oracle TopLink
11g Release 1 (11.1.1)

E28847-01


org.eclipse.persistence.platform.database.oracle.publisher.sqlrefl
Class SqlName

java.lang.Object
  extended by org.eclipse.persistence.platform.database.oracle.publisher.sqlrefl.Name
      extended by org.eclipse.persistence.platform.database.oracle.publisher.sqlrefl.SqlName

Direct Known Subclasses:
DefaultArgsHolderName, PlsqlRecordName, PlsqlTableName

public class SqlName
extends Name

A SqlName encapsulates the name of a database entity, that is, anything declared directly within a schema. A SqlName identifies the schema in which the entity is declared, and the name of the entity within the schema. Schema and entity names are converted to a canonical form so that they may be compared accurately. Quotes are stripped, and names that are not quoted are shifted to upper case. This class implements 'equals' and 'hash', so that SqlNames may be stored in Hashtables. This class is currently used only for type names. An attribute of a type is not considered to be a SqlName, because it is nested within the type, not directly within the schema. A SqlName instance can describe a PL/SQL type. Both the PL/SQL type name and the corresponding SQL name are captured in the SqlName instance. The two names are accessed via getTypeName(), and getTargetTypeName().


Field Summary
(package private) static int m_case
           
protected  int m_column
           
protected  boolean m_contextFromIntype
           
protected  java.lang.String m_convertInto
           
protected  java.lang.String m_convertIntoQualified
           
protected  java.lang.String m_convertOutOf
           
protected  java.lang.String m_convertOutOfQualified
           
(package private) static java.lang.String m_defaultSchema
           
protected  boolean m_fromDB
           
protected  java.lang.Boolean m_hasConversion
           
protected  boolean m_isReused
           
protected  boolean m_isRowType
           
protected  int m_line
           
protected static int m_pl2SQLCounter
           
protected  boolean m_predefined
           
protected  boolean m_printAsIs
           
protected  boolean m_quoted
           
private static int m_rowtypeDistinguisher
           
protected  java.lang.String m_sourceName
          The original database type for the type represented. - If (m_sourceName==m_name), this type does not need conversion and can be published into Java classes directly. - If (m_sourceName!
protected static int m_sql2PLCounter
           
(package private) static int m_targetLang
           
private static java.lang.String PUBLIC
           
static java.lang.String ROWTYPE
           
static java.lang.String ROWTYPE_PL
           
static java.lang.String ROWTYPE_SQL
           

 

Fields inherited from class org.eclipse.persistence.platform.database.oracle.publisher.sqlrefl.Name
m_annotation, m_context, m_name, NO_CONTEXT

 

Constructor Summary
(package private) SqlName(java.lang.String plsql, java.lang.String sql)
           
  SqlName(java.lang.String schema, java.lang.String type, boolean fromDB, boolean printAsIs, boolean predefined, java.lang.String convertInto, java.lang.String convertOutOf, java.lang.String conversionTarget, SqlReflector reflector)
           
protected SqlName(java.lang.String schema, java.lang.String type, boolean fromDB, int line, int col, boolean printAsIs, boolean predefined, java.lang.String convertInto, java.lang.String convertOutOf, java.lang.String conversionTarget, SqlReflector reflector)
           
  SqlName(java.lang.String schema, java.lang.String type, boolean fromDB, int line, int col, SqlReflector reflector)
          Initializes a SqlName with the schema and name of a declared entity.
  SqlName(java.lang.String schema, java.lang.String type, boolean fromDB, int line, int col, java.lang.String packageName, SqlType parentType, SqlReflector reflector)
          Create a SqlName instance for a PL/SQL type, which requires extra identifying information, such the names for the package and method that mentions this PL/SQL type.
  SqlName(java.lang.String schema, java.lang.String type, boolean fromDB, SqlReflector reflector)
           

 

Method Summary
static boolean containsLowerChar(java.lang.String s)
           
static java.lang.String dbifyName(java.lang.String s, java.sql.Connection conn)
           
static java.lang.String dbifyName(java.lang.String s, SqlReflector reflector)
           
static java.lang.String determineSqlName(java.lang.String packageName, java.lang.String[] sourceName, TypeClass parentType, boolean[] isRowType, SqlReflector reflector)
          Determine the SQL type name for a PL/SQL type.
 boolean equals(java.lang.Object obj)
          Returns true if and only if two Names are equal.
static int getCase()
           
 int getColumn()
          Returns the column number where the sqlname was found by the parser.
 java.lang.String getDeclClass()
          Returns the declaration class name of an SqlName.
 java.lang.String getDeclClass(java.lang.String currPackage)
           
 java.lang.String getDeclItf()
          Returns the declaration interface name of a SqlName.
 java.lang.String getDeclItf(java.lang.String currPackage)
          Returns the declaration interface name of a SqlName.
 java.lang.String getDeclItfPackage()
          Returns the Java declaration interface of an SqlName.
 java.lang.String getDeclPackage()
          Returns the declaration package name of an SqlName.
 boolean getFromDB()
          Returns the boolean whether SqlName is from the DB.
 java.lang.String getFullTargetTypeName(int schemaName)
           
 java.lang.String getFullTypeName(int schemaName)
           
private  java.lang.String getFullTypeName(java.lang.String typeName, int schemaName)
           
 java.lang.String getIntoConversion()
          Returns the PL/SQL function to be used for converting a SQL type into this PL/SQL type.
 java.lang.String getIntoConversionQualified()
           
 LangName getLangName()
          Returns the LangName of this SqlName.
 int getLine()
          Returns the line number where the sqlname was found by the parser.
 java.lang.String getOutOfConversion()
          Returns the PL/SQL function to be used for converting this PL/SQL into a SQL type.
 java.lang.String getOutOfConversionQualified()
           
 java.lang.String getQuotedSimpleName()
           
 java.lang.String getSchemaName()
          Returns the schema name of the declared entity.
static int getTargetLang()
           
 java.lang.String getTargetTypeName()
          Return the SQL type name.
 java.lang.String getTypeName()
          Returns the name of the original database type.
 java.lang.String getUseClass()
           
 java.lang.String getUseClass(boolean full)
           
 java.lang.String getUseClass(java.lang.String currPackage)
          Returns the use class name of a SqlName.
 java.lang.String getUseItf()
          Returns the use interface name of a SqlName.
 java.lang.String getUseItf(java.lang.String currPackage)
          Returns the use interface name of a SqlName.
 java.lang.String getUseItfPackage()
          Returns the Java use interface
 java.lang.String getUsePackage()
          Returns the Java use package name of an SqlName.
 boolean hasConversion()
           
 boolean hasDeclItf()
           
 int hashCode()
          Returns a hash code for the Name.
 boolean hasUseClass()
          return ture, if this type has user subclass
 boolean hasUseItf()
          If both decl interface and use interface are defined, we use the latter
static void initStaticVariables()
           
static java.lang.String interfaceIfPossible(SqlName sqlName, boolean itfIfPossible)
           
static boolean isAlpha(char ch)
           
 boolean isPredefined()
           
 boolean isQuoted()
          Returns the boolean whether SqlName was quoted or not
static boolean isQuoted(java.lang.String str)
          Returns the boolean whether SqlName was quoted or not
 boolean isReused()
           
 boolean isRowType()
           
static boolean langIsC()
           
static boolean langIsCpp()
           
static boolean langIsOtt()
           
private static java.lang.String massageSchema(java.lang.String schema, boolean fromDB, boolean predefined, SqlReflector reflector)
           
static void setCase(int caseOption)
          Set the default style of case conversion used to generate the Java equivalent of an unknown SQL name.
static void setDefaultSchema(java.lang.String defaultSchema)
          Initialize the SqlName class with the default schema name, used when a SqlName is created without an explciit schema name
 LangName setLangName(java.lang.String packageName, java.lang.String useName, java.lang.String useItf, java.lang.String generatedName, java.lang.String generatedItf, java.lang.String hfile, SqlType firstParent, java.lang.String cppfile, boolean userNameGiven)
          Sets the LangName associated with this SqlName.
static void setTargetLang(int targetLang)
           
static java.lang.String sqlIdToJavaId(java.lang.String s, boolean wordBoundary)
           
static java.lang.String sqlIdToJavaId(java.lang.String s, boolean wordBoundary, boolean avoidJavaPrimitives)
           
private  java.lang.String stripPublic(java.lang.String name)
           
 java.lang.String toQuotedString(boolean omitSchemaName)
          Returns the name of the declared entity as a quoted string.
 java.lang.String toString()
          Returns the complete name of the declared entity.
private  java.lang.String toString(boolean omitSchemaName)
           

 

Methods inherited from class org.eclipse.persistence.platform.database.oracle.publisher.sqlrefl.Name
getAnnotation, getContextName, getSimpleName, renameJavaMethodPrefix, setAnnotation

 

Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait

 

Field Detail

ROWTYPE

public static final java.lang.String ROWTYPE
See Also:
Constant Field Values

ROWTYPE_PL

public static final java.lang.String ROWTYPE_PL
See Also:
Constant Field Values

ROWTYPE_SQL

public static final java.lang.String ROWTYPE_SQL
See Also:
Constant Field Values

m_rowtypeDistinguisher

private static int m_rowtypeDistinguisher

PUBLIC

private static final java.lang.String PUBLIC
See Also:
Constant Field Values

m_defaultSchema

static java.lang.String m_defaultSchema

m_case

static int m_case

m_targetLang

static int m_targetLang

m_sql2PLCounter

protected static int m_sql2PLCounter

m_pl2SQLCounter

protected static int m_pl2SQLCounter

m_fromDB

protected boolean m_fromDB

m_contextFromIntype

protected boolean m_contextFromIntype

m_line

protected int m_line

m_column

protected int m_column

m_quoted

protected boolean m_quoted

m_printAsIs

protected boolean m_printAsIs

m_sourceName

protected java.lang.String m_sourceName
The original database type for the type represented. - If (m_sourceName==m_name), this type does not need conversion and can be published into Java classes directly. - If (m_sourceName!=m_name), this type is typically a PL/SQL type, which needs to be converted into and out of a SQL type in the published code. In this case, m_name represents that SQL type

m_isRowType

protected boolean m_isRowType

m_isReused

protected boolean m_isReused

m_predefined

protected boolean m_predefined

m_hasConversion

protected java.lang.Boolean m_hasConversion

m_convertOutOf

protected java.lang.String m_convertOutOf

m_convertInto

protected java.lang.String m_convertInto

m_convertOutOfQualified

protected java.lang.String m_convertOutOfQualified

m_convertIntoQualified

protected java.lang.String m_convertIntoQualified

Constructor Detail

SqlName

public SqlName(java.lang.String schema,
               java.lang.String type,
               boolean fromDB,
               int line,
               int col,
               SqlReflector reflector)
Initializes a SqlName with the schema and name of a declared entity. If "schema" is null, the default schema will be used.
Parameters:
schema - the schema in which the entity is declared
type - the declared name of the entity in the schema

SqlName

public SqlName(java.lang.String schema,
               java.lang.String type,
               boolean fromDB,
               SqlReflector reflector)

SqlName

SqlName(java.lang.String plsql,
        java.lang.String sql)

SqlName

public SqlName(java.lang.String schema,
               java.lang.String type,
               boolean fromDB,
               boolean printAsIs,
               boolean predefined,
               java.lang.String convertInto,
               java.lang.String convertOutOf,
               java.lang.String conversionTarget,
               SqlReflector reflector)

SqlName

protected SqlName(java.lang.String schema,
                  java.lang.String type,
                  boolean fromDB,
                  int line,
                  int col,
                  boolean printAsIs,
                  boolean predefined,
                  java.lang.String convertInto,
                  java.lang.String convertOutOf,
                  java.lang.String conversionTarget,
                  SqlReflector reflector)

SqlName

public SqlName(java.lang.String schema,
               java.lang.String type,
               boolean fromDB,
               int line,
               int col,
               java.lang.String packageName,
               SqlType parentType,
               SqlReflector reflector)
Create a SqlName instance for a PL/SQL type, which requires extra identifying information, such the names for the package and method that mentions this PL/SQL type.
Parameters:
schema -
type -
parentType - The PL/SQL package type that references to the SqlType for which the SqlName is created for

Method Detail

interfaceIfPossible

public static java.lang.String interfaceIfPossible(SqlName sqlName,
                                                   boolean itfIfPossible)

determineSqlName

public static java.lang.String determineSqlName(java.lang.String packageName,
                                                java.lang.String[] sourceName,
                                                TypeClass parentType,
                                                boolean[] isRowType,
                                                SqlReflector reflector)
Determine the SQL type name for a PL/SQL type. Generate a name in the form of <prefix>_<name>. The <prefix> term is determined as follows in precedency - java user interface name of the associated PL/SQL package - java base interface name of the associated PL/SQL package - the associated PL/SQL package name Generated names are subject to length and conflict check. If length excceeds PL/SQL identifier limit, the name will be chopped. If conflicts occurs, the name will be pos-fixed with numeric values,

initStaticVariables

public static void initStaticVariables()

getSchemaName

public java.lang.String getSchemaName()
Returns the schema name of the declared entity.

getTypeName

public java.lang.String getTypeName()
Returns the name of the original database type. For a PL/SQL type, returns the name of the declared PL/SQL type within the schema. not uppercased The name is prefixed by the package name and ".", except for CURSOR%ROWTYPE

getTargetTypeName

public java.lang.String getTargetTypeName()
Return the SQL type name. If this SqlName instance represents a PL/SQL type, or a type requring conversions into and out of a SQL type, the method returns the SQL type name. Otherwise, this method returns the same name as getTypeName().

getFullTargetTypeName

public java.lang.String getFullTargetTypeName(int schemaName)

getUseClass

public java.lang.String getUseClass(java.lang.String currPackage)
Returns the use class name of a SqlName. This includes the package name if the Java class is not in the current package. If the Java name has not been created yet, it is constructed using the CASE and PACKAGE options. * @param SqlName the SQL name of the type
Overrides:
getUseClass in class Name
Parameters:
currPackage - the package from which the class is referenced
Returns:
the name of an SQL type.

getUseClass

public java.lang.String getUseClass()
Overrides:
getUseClass in class Name

getUseClass

public java.lang.String getUseClass(boolean full)
Overrides:
getUseClass in class Name

getUsePackage

public java.lang.String getUsePackage()
Returns the Java use package name of an SqlName.
Overrides:
getUsePackage in class Name

hasUseClass

public boolean hasUseClass()
return ture, if this type has user subclass
Specified by:
hasUseClass in class Name

getUseItf

public java.lang.String getUseItf()
Returns the use interface name of a SqlName.
Overrides:
getUseItf in class Name

getUseItf

public java.lang.String getUseItf(java.lang.String currPackage)
Returns the use interface name of a SqlName.

getUseItfPackage

public java.lang.String getUseItfPackage()
Returns the Java use interface
Overrides:
getUseItfPackage in class Name

hasUseItf

public boolean hasUseItf()
If both decl interface and use interface are defined, we use the latter
Overrides:
hasUseItf in class Name

hasDeclItf

public boolean hasDeclItf()
Overrides:
hasDeclItf in class Name

getFromDB

public boolean getFromDB()
Returns the boolean whether SqlName is from the DB.

getLine

public int getLine()
Returns the line number where the sqlname was found by the parser.

getColumn

public int getColumn()
Returns the column number where the sqlname was found by the parser.

isQuoted

public boolean isQuoted()
Returns the boolean whether SqlName was quoted or not

isQuoted

public static boolean isQuoted(java.lang.String str)
Returns the boolean whether SqlName was quoted or not

getDeclClass

public java.lang.String getDeclClass()
Returns the declaration class name of an SqlName. The declaration class name is the name of the class that JPub generates. It is different from the use class name, the name of the class name generated when the class is used, rather than declared, if the use class is user-written. The user tells JPub that this is the case by putting the clause "GENERATE <decl name> AS <use name>" in the input file. * @return the decl class name of a type.
Overrides:
getDeclClass in class Name

getDeclPackage

public java.lang.String getDeclPackage()
Returns the declaration package name of an SqlName. The declaration package name is the name of the package that JPub generates. It is different from the use package name, the name of the package name generated when the package is used, rather than declared, if the use package is user-written. The user tells JPub that this is the case by putting the clause "GENERATE <decl name> AS <use name> in the input file. * @return the decl package name of a type.
Overrides:
getDeclPackage in class Name

getDeclClass

public java.lang.String getDeclClass(java.lang.String currPackage)

getDeclItf

public java.lang.String getDeclItf()
Returns the declaration interface name of a SqlName.
Overrides:
getDeclItf in class Name

getDeclItf

public java.lang.String getDeclItf(java.lang.String currPackage)
Returns the declaration interface name of a SqlName.

getDeclItfPackage

public java.lang.String getDeclItfPackage()
Returns the Java declaration interface of an SqlName.
Overrides:
getDeclItfPackage in class Name

getLangName

public LangName getLangName()
Returns the LangName of this SqlName.

setLangName

public LangName setLangName(java.lang.String packageName,
                            java.lang.String useName,
                            java.lang.String useItf,
                            java.lang.String generatedName,
                            java.lang.String generatedItf,
                            java.lang.String hfile,
                            SqlType firstParent,
                            java.lang.String cppfile,
                            boolean userNameGiven)
Sets the LangName associated with this SqlName. Create a new C or Java name, and associate it with this SqlName.

toString

public java.lang.String toString()
Returns the complete name of the declared entity. The returned name includes the schema name and the name of the entity within the schema.
Specified by:
toString in class Name

toQuotedString

public java.lang.String toQuotedString(boolean omitSchemaName)
Returns the name of the declared entity as a quoted string. If a non-null schema name was supplied when this SqlName was constructed, the omitSchemaName flag is ignored, and the returned name includes the schema name. If a null schema name was supplied when this SqlName was declared, the returned name includes the schema name only if omitSchemaName == false. * @param omitSchemaName suggestion not to include the schema name
Returns:
the name of the declared entity as a quoted string

toString

private java.lang.String toString(boolean omitSchemaName)

getQuotedSimpleName

public java.lang.String getQuotedSimpleName()

setDefaultSchema

public static void setDefaultSchema(java.lang.String defaultSchema)
Initialize the SqlName class with the default schema name, used when a SqlName is created without an explciit schema name. * @param defaultSchema the name of the default schema

setCase

public static void setCase(int caseOption)
Set the default style of case conversion used to generate the Java equivalent of an unknown SQL name. A name is unknown if its Java name was not specified via addType() or addAttribute().

getCase

public static int getCase()

setTargetLang

public static void setTargetLang(int targetLang)

getTargetLang

public static int getTargetLang()

langIsOtt

public static boolean langIsOtt()

langIsC

public static boolean langIsC()

langIsCpp

public static boolean langIsCpp()

containsLowerChar

public static boolean containsLowerChar(java.lang.String s)

sqlIdToJavaId

public static java.lang.String sqlIdToJavaId(java.lang.String s,
                                             boolean wordBoundary)

sqlIdToJavaId

public static java.lang.String sqlIdToJavaId(java.lang.String s,
                                             boolean wordBoundary,
                                             boolean avoidJavaPrimitives)

isAlpha

public static boolean isAlpha(char ch)

massageSchema

private static java.lang.String massageSchema(java.lang.String schema,
                                              boolean fromDB,
                                              boolean predefined,
                                              SqlReflector reflector)

equals

public boolean equals(java.lang.Object obj)
Returns true if and only if two Names are equal.
Overrides:
equals in class Name

hashCode

public int hashCode()
Returns a hash code for the Name. Implemented so that Names may be put in Hashtables.
Overrides:
hashCode in class Name

isRowType

public boolean isRowType()

isPredefined

public boolean isPredefined()

hasConversion

public boolean hasConversion()

getOutOfConversion

public java.lang.String getOutOfConversion()
Returns the PL/SQL function to be used for converting this PL/SQL into a SQL type.

Returns null if this is not a PL/SQL type or if it does not have user-defined conversions.


getIntoConversion

public java.lang.String getIntoConversion()
Returns the PL/SQL function to be used for converting a SQL type into this PL/SQL type.

Returns null if this is not a PL/SQL type or if it does not have user-defined conversions.


getOutOfConversionQualified

public java.lang.String getOutOfConversionQualified()

getIntoConversionQualified

public java.lang.String getIntoConversionQualified()

getFullTypeName

public java.lang.String getFullTypeName(int schemaName)

getFullTypeName

private java.lang.String getFullTypeName(java.lang.String typeName,
                                         int schemaName)

isReused

public boolean isReused()

dbifyName

public static java.lang.String dbifyName(java.lang.String s,
                                         SqlReflector reflector)

dbifyName

public static java.lang.String dbifyName(java.lang.String s,
                                         java.sql.Connection conn)

stripPublic

private java.lang.String stripPublic(java.lang.String name)

Skip navigation links

Copyright © 1998, 2012, Oracle. All Rights Reserved.