Search in sources :

Example 11 with SchemaTableTree

use of org.umlg.sqlg.sql.parse.SchemaTableTree in project sqlg by pietermartin.

the class SqlgUtil method setParametersOnStatement.

public static void setParametersOnStatement(SqlgGraph sqlgGraph, LinkedList<SchemaTableTree> schemaTableTreeStack, PreparedStatement preparedStatement, int parameterIndex) throws SQLException {
    Multimap<String, Object> keyValueMap = LinkedListMultimap.create();
    for (SchemaTableTree schemaTableTree : schemaTableTreeStack) {
        for (HasContainer hasContainer : schemaTableTree.getHasContainers()) {
            if (!sqlgGraph.getSqlDialect().supportsBulkWithinOut() || !isBulkWithinAndOut(sqlgGraph, hasContainer)) {
                WhereClause whereClause = WhereClause.from(hasContainer.getPredicate());
                whereClause.putKeyValueMap(hasContainer, keyValueMap);
            }
        }
        for (AndOrHasContainer andOrHasContainer : schemaTableTree.getAndOrHasContainers()) {
            andOrHasContainer.setParameterOnStatement(keyValueMap);
        }
    }
    List<ImmutablePair<PropertyType, Object>> typeAndValues = SqlgUtil.transformToTypeAndValue(keyValueMap);
    // This is for selects
    setKeyValuesAsParameter(sqlgGraph, false, parameterIndex, preparedStatement, typeAndValues);
}
Also used : SchemaTableTree(org.umlg.sqlg.sql.parse.SchemaTableTree) ImmutablePair(org.apache.commons.lang3.tuple.ImmutablePair) HasContainer(org.apache.tinkerpop.gremlin.process.traversal.step.util.HasContainer) AndOrHasContainer(org.umlg.sqlg.sql.parse.AndOrHasContainer) WhereClause(org.umlg.sqlg.sql.parse.WhereClause) AndOrHasContainer(org.umlg.sqlg.sql.parse.AndOrHasContainer)

Aggregations

SchemaTableTree (org.umlg.sqlg.sql.parse.SchemaTableTree)11 Triple (org.apache.commons.lang3.tuple.Triple)4 SqlgSqlExecutor (org.umlg.sqlg.strategy.SqlgSqlExecutor)3 Emit (org.umlg.sqlg.strategy.Emit)2 LinkedList (java.util.LinkedList)1 ImmutablePair (org.apache.commons.lang3.tuple.ImmutablePair)1 Pair (org.apache.commons.lang3.tuple.Pair)1 HasContainer (org.apache.tinkerpop.gremlin.process.traversal.step.util.HasContainer)1 AndOrHasContainer (org.umlg.sqlg.sql.parse.AndOrHasContainer)1 WhereClause (org.umlg.sqlg.sql.parse.WhereClause)1 SchemaTable (org.umlg.sqlg.structure.SchemaTable)1 EdgeLabel (org.umlg.sqlg.structure.topology.EdgeLabel)1 Schema (org.umlg.sqlg.structure.topology.Schema)1 VertexLabel (org.umlg.sqlg.structure.topology.VertexLabel)1