.]
[INCREMENT BY ]
[START WITH ]
[MAXVALUE | NOMAXVALUE]
[MINVALUE | NOMINVALUE]
[CYCLE | NOCYCLE]
[CACHE | NOCACHE]
[ORDER|NOORDER]
*/
StringBuffer query = new StringBuffer(createSequenceQuery(sequenceName));
if(prop != null)
{
Boolean b;
Long value;
value = SequenceManagerHelper.getSeqIncrementBy(prop);
if(value != null)
{
query.append(" INCREMENT BY ").append(value.longValue());
}
value = SequenceManagerHelper.getSeqStart(prop);
if(value != null)
{
query.append(" START WITH ").append(value.longValue());
}
value = SequenceManagerHelper.getSeqMaxValue(prop);
if(value != null)
{
query.append(" MAXVALUE ").append(value.longValue());
}
value = SequenceManagerHelper.getSeqMinValue(prop);
if(value != null)
{
query.append(" MINVALUE ").append(value.longValue());
}
b = SequenceManagerHelper.getSeqCycleValue(prop);
if(b != null)
{
if(b.booleanValue()) query.append(" CYCLE");
else query.append(" NOCYCLE");
}
value = SequenceManagerHelper.getSeqCacheValue(prop);
if(value != null)
{
query.append(" CACHE ").append(value.longValue());
}
b = SequenceManagerHelper.getSeqOrderValue(prop);
if(b != null)
{
if(b.booleanValue()) query.append(" ORDER");
else query.append(" NOORDER");
}
}
return query.toString();
}
public String nextSequenceQuery(String sequenceName)
{
return "select " + sequenceName + ".nextval from dual";
}
public String dropSequenceQuery(String sequenceName)
{
return "drop sequence " + sequenceName;
}
/* (non-Javadoc)
* @see org.apache.ojb.broker.platforms.Platform#addPagingSql(java.lang.StringBuffer)
*/
public void addPagingSql(StringBuffer anSqlString)
]]>
null if Oracle update batching is used,
* since it is impossible to dissolve total row count into distinct
* statement counts. If JDBC update batching is used, an int array is
* returned containing number of updated rows for each batched statement.
* @throws PlatformException upon JDBC failure
*/
public int[] executeBatch(PreparedStatement stmt) throws PlatformException
{
// Check for Oracle batching support
final Method methodSendBatch = (Method) m_batchStatementsInProgress.remove(stmt);
final boolean statementBatchingSupported = methodSendBatch != null;
int[] retval = null;
if (statementBatchingSupported)
{
try
{
// sendBatch() returns total row count as an Integer
methodSendBatch.invoke(stmt, null);
}
catch (Exception e)
{
throw new PlatformException(e.getLocalizedMessage(), e);
}
}
else
{
retval = super.executeBatch(stmt);
}
return retval;
}
/** @see Platform#setObjectForStatement */
public void setObjectForStatement(PreparedStatement ps, int index, Object value, int sqlType) throws SQLException
{
]]>
");
result.append(eol);
// Write all arguments only if we're not including all fields.
if (!this.getIncludeAllFields())
{
Iterator args = this.getArguments().iterator();
while (args.hasNext())
{
result.append(((ArgumentDescriptor) args.next()).toXML());
}
}
// Closing tag
result.append(" ");
result.append(tags.getClosingTagById(UPDATE_PROCEDURE));
]]>
* The argument will be added only if this procedure is not configured
* to {@link #getIncludeAllFields() include all arguments}.
*/
public final void addArgument(ArgumentDescriptor argument)
{
if (!this.getIncludeAllFields())
{
super.addArgument(argument);
}
}
/*
* @see XmlCapable#toXML()
*/
public String toXML()
{
RepositoryTags tags = RepositoryTags.getInstance();
String eol = System.getProperty("line.separator");
// The result
StringBuffer result = new StringBuffer(1024);
result.append(eol);
result.append(" ");
// Opening tag and attributes
result.append(" ");
result.append(tags.getOpeningTagNonClosingById(UPDATE_PROCEDURE));
]]>