Search in sources :

Example 1 with AllTypes

use of org.apache.ignite.internal.processors.cache.IgniteCacheUpdateSqlQuerySelfTest.AllTypes in project ignite by apache.

the class IgniteCacheInsertSqlQuerySelfTest method testNestedFieldsHandling.

/**
 */
public void testNestedFieldsHandling() {
    IgniteCache<Integer, AllTypes> p = ignite(0).cache("I2AT");
    p.query(new SqlFieldsQuery("insert into AllTypes(_key, innerTypeCol, arrListCol, _val, innerStrCol) values (1, ?, ?, ?, 'sss')").setArgs(new AllTypes.InnerType(50L), new ArrayList<>(Arrays.asList(3L, 2L, 1L)), new AllTypes(1L)));
    AllTypes res = p.get(1);
    AllTypes.InnerType resInner = new AllTypes.InnerType(50L);
    resInner.innerStrCol = "sss";
    resInner.arrListCol = new ArrayList<>(Arrays.asList(3L, 2L, 1L));
    assertEquals(resInner, res.innerTypeCol);
}
Also used : ArrayList(java.util.ArrayList) AllTypes(org.apache.ignite.internal.processors.cache.IgniteCacheUpdateSqlQuerySelfTest.AllTypes) SqlFieldsQuery(org.apache.ignite.cache.query.SqlFieldsQuery)

Example 2 with AllTypes

use of org.apache.ignite.internal.processors.cache.IgniteCacheUpdateSqlQuerySelfTest.AllTypes in project ignite by apache.

the class IgniteCacheMergeSqlQuerySelfTest method testNestedFieldsHandling.

/**
 */
public void testNestedFieldsHandling() {
    IgniteCache<Integer, AllTypes> p = ignite(0).cache("I2AT");
    p.query(new SqlFieldsQuery("merge into AllTypes(_key, innerTypeCol, arrListCol, _val, innerStrCol) " + "values (1, ?, ?, ?, 'sss')").setArgs(new AllTypes.InnerType(50L), new ArrayList<>(Arrays.asList(3L, 2L, 1L)), new AllTypes(1L)));
    AllTypes res = p.get(1);
    AllTypes.InnerType resInner = new AllTypes.InnerType(50L);
    resInner.innerStrCol = "sss";
    resInner.arrListCol = new ArrayList<>(Arrays.asList(3L, 2L, 1L));
    assertEquals(resInner, res.innerTypeCol);
}
Also used : ArrayList(java.util.ArrayList) AllTypes(org.apache.ignite.internal.processors.cache.IgniteCacheUpdateSqlQuerySelfTest.AllTypes) SqlFieldsQuery(org.apache.ignite.cache.query.SqlFieldsQuery)

Aggregations

ArrayList (java.util.ArrayList)2 SqlFieldsQuery (org.apache.ignite.cache.query.SqlFieldsQuery)2 AllTypes (org.apache.ignite.internal.processors.cache.IgniteCacheUpdateSqlQuerySelfTest.AllTypes)2