use of org.springframework.data.relational.core.sql.SqlIdentifier in project spring-data-jdbc by spring-projects.
the class SqlIdentifierUnitTests method quotedSimpleObjectIdentifier.
// DATAJDBC-386
@Test
public void quotedSimpleObjectIdentifier() {
SqlIdentifier identifier = quoted("someName");
assertThat(identifier.toSql(BRACKETS_LOWER_CASE)).isEqualTo("[someName]");
assertThat(identifier.getReference(BRACKETS_LOWER_CASE)).isEqualTo("someName");
}
use of org.springframework.data.relational.core.sql.SqlIdentifier in project spring-data-jdbc by spring-projects.
the class RelationalPersistentEntityImplUnitTests method testRelationalPersistentEntitySchemaNameChoice.
// GH-1099
@Test
void testRelationalPersistentEntitySchemaNameChoice() {
mappingContext = new RelationalMappingContext(NamingStrategyWithSchema.INSTANCE);
RelationalPersistentEntity<?> persistentEntity = mappingContext.getPersistentEntity(EntityWithSchemaAndName.class);
SqlIdentifier tableName = persistentEntity.getTableName();
assertThat(tableName).isEqualTo(SqlIdentifier.from(SqlIdentifier.quoted("DART_VADER"), quoted("I_AM_THE_SENATE")));
}
use of org.springframework.data.relational.core.sql.SqlIdentifier in project spring-data-jdbc by spring-projects.
the class RelationalPersistentEntityImplUnitTests method specifiedSchemaGetsCombinedWithNameFromNamingStrategy.
// GH-1099
@Test
void specifiedSchemaGetsCombinedWithNameFromNamingStrategy() {
RelationalPersistentEntity<?> persistentEntity = mappingContext.getPersistentEntity(EntityWithSchema.class);
SqlIdentifier tableName = persistentEntity.getTableName();
assertThat(tableName).isEqualTo(SqlIdentifier.from(quoted("ANAKYN_SKYWALKER"), quoted("ENTITY_WITH_SCHEMA")));
}
use of org.springframework.data.relational.core.sql.SqlIdentifier in project spring-data-jdbc by spring-projects.
the class DerivedSqlIdentifierUnitTests method unquotedSimpleObjectIdentifierWithAdjustableLetterCasing.
// DATAJDBC-386
@Test
public void unquotedSimpleObjectIdentifierWithAdjustableLetterCasing() {
SqlIdentifier identifier = new DerivedSqlIdentifier("someName", false);
String sql = identifier.toSql(BRACKETS_LOWER_CASE);
assertThat(sql).isEqualTo("somename");
assertThat(identifier.getReference(BRACKETS_LOWER_CASE)).isEqualTo("someName");
}
use of org.springframework.data.relational.core.sql.SqlIdentifier in project spring-data-jdbc by spring-projects.
the class DerivedSqlIdentifierUnitTests method quotedMultipartObjectIdentifierWithAdjustableLetterCase.
// DATAJDBC-386
@Test
public void quotedMultipartObjectIdentifierWithAdjustableLetterCase() {
SqlIdentifier identifier = SqlIdentifier.from(new DerivedSqlIdentifier("some", true), new DerivedSqlIdentifier("name", true));
String sql = identifier.toSql(IdentifierProcessing.ANSI);
assertThat(sql).isEqualTo("\"SOME\".\"NAME\"");
}
Aggregations