Skip to content

Commit

Permalink
Merge pull request #6 from etemplar/autoincrementpk
Browse files Browse the repository at this point in the history
Autoincrement field addition.
  • Loading branch information
jrvansuita authored Jun 7, 2017
2 parents 984c849 + 3373da8 commit 7f84ccd
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
11 changes: 11 additions & 0 deletions sqliteparser/src/main/java/com/vansuita/sqliteparser/Create.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,17 @@ public Create pk(String fieldName) {
return this;
}

/**
* Sets the primary key autoincrement field name.
*
* @param fieldName The name of the field
* @return the same instance of {@link Create} class.
*/
public Create pkai(String fieldName) {
fields.put(fieldName, AUTOINCREMENT);
return this;
}

/**
* Sets a String field name.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ public String build() {
protected static final String CREATE_TABLE = "CREATE TABLE %s (%s)";
protected static final String INTEGER = "INTEGER";
protected static final String PK = INTEGER + " PRIMARY KEY";
protected static final String AUTOINCREMENT = PK + " AUTOINCREMENT";
protected static final String TEXT = "TEXT";
protected static final String FLOAT = "FLOAT";

Expand Down

0 comments on commit 7f84ccd

Please sign in to comment.