Methods Summary |
---|
public void | alterIncrement(oracle.toplink.essentials.internal.sessions.AbstractSession session, java.io.Writer schemaWriter)INTERNAL:
Execute the SQL required to alter sequence increment.
Assume that the sequence exists.
if (schemaWriter == null) {
this.alterOnDatabase(session);
} else {
this.buildAlterIncrementWriter(session, schemaWriter);
}
|
public void | alterOnDatabase(oracle.toplink.essentials.internal.sessions.AbstractSession session)INTERNAL:
Execute the SQL required to alter sequence increment.
Assume that the sequence exists.
try {
session.executeNonSelectingCall(new oracle.toplink.essentials.queryframework.SQLCall(buildAlterIncrementWriter(session, new StringWriter()).toString()));
} catch (DatabaseException exception) {
createOnDatabase(session);
}
|
public java.io.Writer | buildAlterIncrementWriter(oracle.toplink.essentials.internal.sessions.AbstractSession session, java.io.Writer writer)INTERNAL:
Return the SQL required to alter INCREMENT BY
try {
writer.write("ALTER SEQUENCE ");
writer.write(getFullName());
writer.write(" INCREMENT BY " + getIncrement());
} catch (IOException ioException) {
throw ValidationException.fileError(ioException);
}
return writer;
|
public java.io.Writer | buildCreationWriter(oracle.toplink.essentials.internal.sessions.AbstractSession session, java.io.Writer writer)INTERNAL:
Return the SQL required to create the Oracle sequence object.
try {
writer.write("CREATE SEQUENCE ");
writer.write(getFullName());
if (getIncrement() != 1) {
writer.write(" INCREMENT BY " + getIncrement());
}
// startWith value calculated using the initial value and increment.
// The first time TopLink calls select nextval, the value equal to startWith is returned.
// The first sequence value TopLink may assign is startWith - getIncrement() + 1.
int startWith = getStart() + getIncrement() - 1;
writer.write(" START WITH " + startWith);
} catch (IOException ioException) {
throw ValidationException.fileError(ioException);
}
return writer;
|
public java.io.Writer | buildDeletionWriter(oracle.toplink.essentials.internal.sessions.AbstractSession session, java.io.Writer writer)INTERNAL:
Return the SQL required to drop the Oracle sequence object.
try {
writer.write("DROP SEQUENCE ");
writer.write(getFullName());
} catch (IOException ioException) {
throw ValidationException.fileError(ioException);
}
return writer;
|
public boolean | checkIfExist(oracle.toplink.essentials.internal.sessions.AbstractSession session)INTERNAL:
Check if the sequence object already exists, in which case dont create it.
try {
session.executeSelectingCall(new oracle.toplink.essentials.queryframework.SQLCall("SELECT " + getName() + ".NEXTVAL FROM DUAL"));
} catch (DatabaseException exception) {
return false;
}
return true;
|
public int | getIncrement()The increment can be used to support pre-allocation.
return increment;
|
public int | getStart()The start used as a starting value for sequence
return start;
|
public boolean | isAlterSupported()INTERNAL:
Indicates whether alterIncrement is supported
return true;
|
public void | setIncrement(int increment)The increment can be used to support pre-allocation.
this.increment = increment;
|
public void | setStart(int start)The start used as a starting value for sequence
this.start = start;
|
public void | setStartAndIncrement(int value)The start used as a starting value for sequence
setStart(1);
setIncrement(value);
|