use of org.sql.generation.api.grammar.builders.modification.ColumnSourceByValuesBuilder in project qi4j-sdk by Qi4j.
the class PostgreSQLIndexing method createInsertStatementWithAutoGeneratedIDForEntitiesTable.
@Override
protected InsertStatement createInsertStatementWithAutoGeneratedIDForEntitiesTable(String schemaName, String tableName, SQLVendor vendor) {
ModificationFactory m = vendor.getModificationFactory();
LiteralFactory l = vendor.getLiteralFactory();
TableReferenceFactory t = vendor.getTableReferenceFactory();
ColumnsFactory c = vendor.getColumnsFactory();
ColumnSourceByValuesBuilder columnBuilder = m.columnSourceByValues();
columnBuilder.addValues(ValueSource.Default.INSTANCE);
for (Integer x = 1; x < AMOUNT_OF_COLUMNS_IN_ENTITY_TABLE; ++x) {
columnBuilder.addValues(l.param());
}
return ((PgSQLInsertStatementBuilder) m.insert()).setReturningClause(vendor.getQueryFactory().columnsBuilder().addUnnamedColumns(c.colName(DBNames.ENTITY_TABLE_PK_COLUMN_NAME)).createExpression()).setTableName(t.tableName(schemaName, tableName)).setColumnSource(columnBuilder.createExpression()).createExpression();
}
use of org.sql.generation.api.grammar.builders.modification.ColumnSourceByValuesBuilder in project qi4j-sdk by Qi4j.
the class AbstractSQLIndexing method createInsertStatement.
protected InsertStatement createInsertStatement(String schemaName, String tableName, Integer amountOfColumns, SQLVendor vendor) {
ModificationFactory m = vendor.getModificationFactory();
LiteralFactory l = vendor.getLiteralFactory();
TableReferenceFactory t = vendor.getTableReferenceFactory();
ColumnSourceByValuesBuilder columnBuilder = m.columnSourceByValues();
for (Integer x = 0; x < amountOfColumns; ++x) {
columnBuilder.addValues(l.param());
}
return m.insert().setTableName(t.tableName(schemaName, tableName)).setColumnSource(columnBuilder.createExpression()).createExpression();
}
use of org.sql.generation.api.grammar.builders.modification.ColumnSourceByValuesBuilder in project qi4j-sdk by Qi4j.
the class AbstractSQLIndexing method createPropertyInsert.
protected InsertStatement createPropertyInsert(QNameInfo qNameInfo, SQLVendor vendor) {
String tableName = qNameInfo.getTableName();
ModificationFactory m = vendor.getModificationFactory();
TableReferenceFactory t = vendor.getTableReferenceFactory();
LiteralFactory l = vendor.getLiteralFactory();
ColumnSourceByValuesBuilder columnBuilder = m.columnSourceByValues().addValues(l.param(), l.param(), l.param());
if (qNameInfo.getCollectionDepth() > 0) {
columnBuilder.addValues(l.func("text2ltree", l.param()));
}
columnBuilder.addValues(l.param());
return m.insert().setTableName(t.tableName(this._state.schemaName().get(), tableName)).setColumnSource(columnBuilder.createExpression()).createExpression();
}
Aggregations