@Test public void testInsert() throws Exception { cluster.cache(DEFAULT_CACHE_NAME).clear(); final String key = "key"; final Map<String, String> input = new HashMap<>(); input.put("field0", "value1"); input.put("field1", "value2"); final Status status = client.insert(TABLE_NAME, key, StringByteIterator.getByteIteratorMap(input)); assertThat(status, is(Status.OK)); assertThat(cluster.cache(DEFAULT_CACHE_NAME).size(), is(1)); }
@Override public Status insert(String table, String key, Map<String, ByteIterator> values) { try { InsertData insertData = new InsertData(key, values); StringBuilder sb = new StringBuilder("INSERT INTO ").append(table).append(" (") .append(insertData.getInsertFields()).append(") VALUES (") .append(insertData.getInsertParams()).append(')'); SqlFieldsQuery qry = new SqlFieldsQuery(sb.toString()); qry.setArgs(insertData.getArgs()); cache.query(qry).getAll(); return Status.OK; } catch (Exception e) { log.error(String.format("Error in processing insert to table: %s", table), e); return Status.ERROR; } }
IgniteSqlClient extends IgniteAbstractClient { @Override public Status insert(String table, String key, Map<String, ByteIterator> values) { try { InsertData insertData = new InsertData(key, values); StringBuilder sb = new StringBuilder("INSERT INTO ").append(table).append(" (") .append(insertData.getInsertFields()).append(") VALUES (") .append(insertData.getInsertParams()).append(')'); SqlFieldsQuery qry = new SqlFieldsQuery(sb.toString()); qry.setArgs(insertData.getArgs()); cache.query(qry).getAll(); return Status.OK; } catch (Exception e) { log.error(String.format("Error in processing insert to table: %s", table), e); return Status.ERROR; } } }
IgniteSqlClient extends IgniteAbstractClient { @Override public Status insert(String table, String key, Map<String, ByteIterator> values) { try { InsertData insertData = new InsertData(key, values); StringBuilder sb = new StringBuilder("INSERT INTO ").append(table).append(" (") .append(insertData.getInsertFields()).append(") VALUES (") .append(insertData.getInsertParams()).append(')'); SqlFieldsQuery qry = new SqlFieldsQuery(sb.toString()); qry.setArgs(insertData.getArgs()); cache.query(qry).getAll(); return Status.OK; } catch (Exception e) { log.error(String.format("Error in processing insert to table: %s", table), e); return Status.ERROR; } }  }
IgniteSqlClient extends IgniteAbstractClient { @Override public Status insert(String table, String key, Map<String, ByteIterator> values) { try { InsertData insertData = new InsertData(key, values); StringBuilder sb = new StringBuilder("INSERT INTO ").append(table).append(" (") .append(insertData.getInsertFields()).append(") VALUES (") .append(insertData.getInsertParams()).append(')'); SqlFieldsQuery qry = new SqlFieldsQuery(sb.toString()); qry.setArgs(insertData.getArgs()); cache.query(qry).getAll(); return Status.OK; } catch (Exception e) { log.error(String.format("Error in processing insert to table: %s", table), e); return Status.ERROR; } }  @Override Status read(String table, String key, Set<String> fields,
                     Map<String, ByteIterator> result); @Override Status update(String table, String key,
                       Map<String, ByteIterator> values); @Override Status insert(String table, String key, Map<String, ByteIterator> values); @Override Status delete(String table, String key); }
IgniteSqlClient extends IgniteAbstractClient { @Override public Status insert(String table, String key, Map<String, ByteIterator> values) { try { InsertData insertData = new InsertData(key, values); StringBuilder sb = new StringBuilder("INSERT INTO ").append(table).append(" (") .append(insertData.getInsertFields()).append(") VALUES (") .append(insertData.getInsertParams()).append(')'); SqlFieldsQuery qry = new SqlFieldsQuery(sb.toString()); qry.setArgs(insertData.getArgs()); cache.query(qry).getAll(); return Status.OK; } catch (Exception e) { log.error(String.format("Error in processing insert to table: %s", table), e); return Status.ERROR; } }  @Override Status read(String table, String key, Set<String> fields,
                     Map<String, ByteIterator> result); @Override Status update(String table, String key,
                       Map<String, ByteIterator> values); @Override Status insert(String table, String key, Map<String, ByteIterator> values); @Override Status delete(String table, String key);  }