|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.triactive.jdo.store.sql.SqlIdentifier
An SQL identifier.
Field Summary | |
protected DatabaseAdapter |
dba
The database adapter for the relevant database. |
protected java.lang.String |
fullName
The full identifier value before any truncation. |
protected java.lang.String |
name
The identifier value, possibly truncated. |
Method Summary | |
int |
compareTo(java.lang.Object obj)
Compares this object with the specified object for order. |
boolean |
equals(java.lang.Object obj)
Tests this object for equality with another object. |
int |
hashCode()
Returns a hash code value for this object. |
SqlIdentifier |
intern()
Returns a canonical representation for the identifier object. |
boolean |
isKeyword()
Tests whether this identifier is also a SQL keyword in the relevant database. |
static java.lang.String |
javaToSql(java.lang.String javaName)
Converts the given Java name to its equivalent, full-length SQL identifier value. |
java.lang.String |
toString()
Returns the string representation of this SQL identifier. |
java.lang.String |
undelimited()
Returns the undelimited string representation of this identifier. |
java.lang.String |
untruncated()
Returns the untruncated, undelimited string representation of this identifier. |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
protected final DatabaseAdapter dba
protected final java.lang.String fullName
protected final java.lang.String name
Method Detail |
public final boolean isKeyword()
toString()
.
true
if this identifier is a SQL keyword in its
database, false
otherwise.public SqlIdentifier intern()
This method behaves much like String.intern()
.
A pool of SQL identifiers, initially empty, is maintained privately.
When the intern method is invoked, if the pool already contains an object
equal to this SqlIdentifier
object as determined by the
equals(Object)
method, then the identifier from the pool is
returned.
Otherwise, this SqlIdentifier
object is added to the pool
and a reference to this SqlIdentifier
object is returned.
It follows that for any two identifiers i1
and
i2
, i1.intern() == i2.intern()
is
true
if and only if i1.equals(i2)
is
true
.
public final int hashCode()
public final boolean equals(java.lang.Object obj)
obj
- the object to compare with
true
if the objects are equal,
false
otherwise.public final int compareTo(java.lang.Object obj)
undelimited
string representation
.
compareTo
in interface java.lang.Comparable
obj
- the Object to be compared.
public final java.lang.String toString()
public java.lang.String undelimited()
public java.lang.String untruncated()
public static java.lang.String javaToSql(java.lang.String javaName)
Conversion consists of breaking the string into words, converting each word to upper-case, and separating each one with an underscore "_". Words are identified by a leading upper-case character. Invalid SQL identifier characters are replaced with a 2 or 4 character string representing their Unicode value in hex. Finally, any leading or trailing underscores are removed.
Java Name | SQL Identifier |
---|---|
abc | ABC |
DiskDrive | DISK_DRIVE |
DiskDrive.numHeads | DISK_DRIVE_NUM_HEADS |
JSPPage | JSPPAGE |
König | KF6NIG |
_foo | FOO |
javaName
- the Java identifier
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |