use of org.springframework.data.relational.core.sql.SqlIdentifier in project spring-data-jdbc by spring-projects.
the class SqlContext method getTable.
Table getTable(PersistentPropertyPathExtension path) {
SqlIdentifier tableAlias = path.getTableAlias();
Table table = Table.create(path.getTableName());
return tableAlias == null ? table : table.as(tableAlias);
}
use of org.springframework.data.relational.core.sql.SqlIdentifier in project spring-data-jdbc by spring-projects.
the class SqlIdentifierParameterSource method addAll.
void addAll(SqlIdentifierParameterSource others) {
for (SqlIdentifier identifier : others.getIdentifiers()) {
String name = identifier.getReference(identifierProcessing);
addValue(identifier, others.getValue(name), others.getSqlType(name));
}
}
use of org.springframework.data.relational.core.sql.SqlIdentifier in project spring-data-jdbc by spring-projects.
the class JdbcRepositoryEmbeddedWithCollectionIntegrationTests method countRowsInTable.
private int countRowsInTable(String name, long idValue) {
SqlIdentifier id = SqlIdentifier.quoted("ID");
String whereClause = id.toSql(dialect.getIdentifierProcessing()) + " = " + idValue;
return JdbcTestUtils.countRowsInTableWhere((JdbcTemplate) template.getJdbcOperations(), name, whereClause);
}
use of org.springframework.data.relational.core.sql.SqlIdentifier in project spring-data-jdbc by spring-projects.
the class IdentifierUnitTests method identifierPartsCanBeAccessedByString.
// DATAJDBC-542
@Test
public void identifierPartsCanBeAccessedByString() {
Map<SqlIdentifier, Object> idParts = new HashMap<>();
idParts.put(unquoted("aName"), "one");
idParts.put(quoted("Other"), "two");
Identifier id = Identifier.from(idParts);
Map<SqlIdentifier, Object> map = id.toMap();
assertSoftly(softly -> {
softly.assertThat(map.get("aName")).describedAs("aName").isEqualTo("one");
softly.assertThat(map.get("Other")).describedAs("Other").isEqualTo("two");
softly.assertThat(map.get("other")).describedAs("other").isNull();
softly.assertThat(map.get("OTHER")).describedAs("OTHER").isNull();
});
}
use of org.springframework.data.relational.core.sql.SqlIdentifier in project spring-data-jdbc by spring-projects.
the class DerivedSqlIdentifierUnitTests method equality.
// DATAJDBC-386
@Test
public void equality() {
SqlIdentifier basis = new DerivedSqlIdentifier("simple", false);
SqlIdentifier equal = new DerivedSqlIdentifier("simple", false);
SqlIdentifier quoted = new DerivedSqlIdentifier("simple", true);
SqlIdentifier notSimple = SqlIdentifier.from(new DerivedSqlIdentifier("simple", false), new DerivedSqlIdentifier("not", false));
assertSoftly(softly -> {
softly.assertThat(basis).isEqualTo(equal);
softly.assertThat(equal).isEqualTo(basis);
softly.assertThat(basis).isNotEqualTo(quoted);
softly.assertThat(basis).isNotEqualTo(notSimple);
});
}
Aggregations