Skip to content

Commit

Permalink
Update MariaDBPlatform.java
Browse files Browse the repository at this point in the history
added method buildSequenceObjectCreationWriter
  • Loading branch information
artem3332 authored and lukasj committed Aug 30, 2022
1 parent 4181361 commit 65dd611
Showing 1 changed file with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@

import org.eclipse.persistence.queries.ValueReadQuery;

import java.io.IOException;
import java.io.Writer;
import java.sql.Connection;
import java.sql.SQLException;

Expand Down Expand Up @@ -58,6 +60,20 @@ public boolean supportsSequenceObjects() {
* one of buildSelectQueryForSequenceObject methods should return non-null
* query.
*/

@Override
public Writer buildSequenceObjectCreationWriter(Writer writer, String fullSeqName, int increment, int start) throws IOException {
writer.write("CREATE SEQUENCE ");
writer.write(fullSeqName);
if(start != 1) {
writer.write(" START WITH " + start);
}
if (increment != 1) {
writer.write(" INCREMENT BY " + increment);
}
return writer;
}

@Override
public ValueReadQuery buildSelectQueryForSequenceObject(String qualifiedSeqName, Integer size) {
return new ValueReadQuery("select nextval(" + qualifiedSeqName + ")");
Expand Down

0 comments on commit 65dd611

Please sign in to comment.