Skip to content

Commit

Permalink
Protect the 'foo'.'table' type of field names which doesn't seem to
Browse files Browse the repository at this point in the history
work.
  • Loading branch information
Gray Watson committed Jul 28, 2016
1 parent 354dfa1 commit d23d098
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/main/java/com/j256/ormlite/db/SqliteAndroidDatabaseType.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,15 @@ protected void appendDateType(StringBuilder sb, FieldType fieldType, int fieldWi
appendStringType(sb, fieldType, fieldWidth);
}

@Override
public void appendEscapedEntityName(StringBuilder sb, String name) {
/*
* Android Sqlite doesn't seem to be able to handle the 'foo'.'bar' form of the column name which is for
* database.table I think so we just default to be single quoted like before.
*/
sb.append('`').append(name).append('`');
}

@Override
protected void appendBooleanType(StringBuilder sb, FieldType fieldType, int fieldWidth) {
// we have to convert booleans to numbers
Expand All @@ -64,7 +73,7 @@ public DataPersister getDataPersister(DataPersister defaultPersister, FieldType
}
// we are only overriding certain types
switch (defaultPersister.getSqlType()) {
case DATE :
case DATE:
/*
* We need to map the dates into their string equivalents because of mapping issues with Sqlite's
* default date string formats.
Expand All @@ -76,7 +85,7 @@ public DataPersister getDataPersister(DataPersister defaultPersister, FieldType
} else {
return DateStringType.getSingleton();
}
default :
default:
return super.getDataPersister(defaultPersister, fieldType);
}
}
Expand Down

0 comments on commit d23d098

Please sign in to comment.