Creates {@link PutResult} of insert.

@param insertedId     id of new row.
@param affectedTables tables that were affected.
@param affectedTags   notification tags that were affected.
@return new {@link PutResult} instance.
555178
@NonNull
    public static PutResult newInsertResult(
            long insertedId,
            @NonNull Set<String> affectedTables,
            @Nullable String... affectedTags
    ) {
        return newInsertResult(insertedId, affectedTables, nonNullSet(affectedTags));
    }
437785
public static Builder newBuilder(TableId table, Iterable<RowToInsert> rows) {
    return newBuilder(table).setRows(rows);
  }
118851
private static String generateCrudReplicatedInsert(Table table) {
        StringBuilder sb = new StringBuilder();
        sb.append("INSERT INTO " + table.getTypeName() + " VALUES ");

        generateCrudColumnList(table, sb);
        sb.append(";");

        return sb.toString();
    }
175629
void insertResult(PersistentStore store, Result ins) {

        RowSetNavigator nav = ins.initialiseNavigator();

        while (nav.hasNext()) {
            Object[] data = nav.getNext();
            Object[] newData =
                (Object[]) ArrayUtil.resizeArrayIfDifferent(data,
                    getColumnCount());

            insertData(store, newData);
        }
    }
1235743
public void put(TableKelp table, 
                StreamSource ss, 
                PutType putType,
                Result<Boolean> result)
  {
    if (ss == null) {
      result.ok(false);
      return;
    }

    try (InputStream is = ss.getInputStream()) {
      if (is.available() < 1) {
        System.err.println("BAD_STREAM: " + is + " " + ss + " " + System.identityHashCode(ss) + " " + table); 
        throw new IOException(L.l("unexpected empty stream {0} for {1} [{2}]",
                                  is, table, AmpSystem.currentManager()));
      }
      
      table.put(is, putType, result);
    } catch (Throwable e) {
      e.printStackTrace();
      result.fail(e);
    }
  }
215162
@Override
  public void put(byte []tableKey, 
                  StreamSource rowSource,
                  Result<Boolean> result)
  {
    putImpl(tableKey, rowSource, PutType.PUT, result);
  }
32591
private void putBinds() throws BindException
  {
    createStageIfNeeded();

    String putStatement = getPutStmt(bindDir.toString(), stagePath);

    for (int i = 0; i < PUT_RETRY_COUNT; i++)
    {
      try
      {
        SFStatement statement = new SFStatement(session);
        SFBaseResultSet putResult = statement.execute(putStatement, null, null);
        putResult.next();

        // metadata is 0-based, result set is 1-based
        int column = putResult.getMetaData().getColumnIndex(
            SnowflakeFileTransferAgent.UploadColumns.status.name()) + 1;
        String status = putResult.getString(column);

        if (SnowflakeFileTransferAgent.ResultStatus.UPLOADED.name().equals(status))
        {
          return; // success!
        }
        logger.debug("PUT statement failed. The response had status %s.", status);
      }
      catch (SFException | SQLException ex)
      {
        logger.debug("Exception encountered during PUT operation. ", ex);
      }
    }

    // if we haven't returned (on success), throw exception
    throw new BindException("Failed to PUT files to stage.", BindException.Type.UPLOAD);
  }
1057667
private static PreparedStatement createStatementForInsert(final Connection connection,
                                                             final Introspected introspected,
                                                             final FieldColumnInfo[] fcInfos) throws SQLException
   {
      final String sql = createStatementCache.computeIfAbsent(introspected, key -> {
         final String tableName = introspected.getTableName();
         final StringBuilder sqlSB = new StringBuilder("INSERT INTO ").append(tableName).append('(');
         final StringBuilder sqlValues = new StringBuilder(") VALUES (");

         for (final FieldColumnInfo fcInfo : fcInfos) {
            sqlSB.append(fcInfo.getDelimitedColumnName()).append(',');
            sqlValues.append("?,");
         }

         sqlValues.deleteCharAt(sqlValues.length() - 1);
         sqlSB.deleteCharAt(sqlSB.length() - 1).append(sqlValues).append(')');

         return sqlSB.toString();
      });

      if (introspected.hasGeneratedId()) {
         return connection.prepareStatement(sql, introspected.getIdColumnNames());
      }
      else {
         return connection.prepareStatement(sql);
      }
   }
509898
@NonNull
    public static <T> PutResults<T> newInstance(@NonNull Map<T, PutResult> putResults) {
        return new PutResults<T>(putResults);
    }
1332488
public <T extends AbstractJaxb> boolean insertAfterId(String id, T insObject)
            throws TagTypeUnmatchException {
        return InsertByIdUtil.insertAfterId(id, insObject, this);
    }
1217495
@Override
  public <N,V> MutationResult insert(final K key, final String cf, final HColumn<N,V> c) {
    addInsertion(key, cf, c);
    return execute();
  }
345962
public static long insert(Connection connection, String table,
			ContentValues values) {
		try {
			return insertOrThrow(connection, table, values);
		} catch (Exception e) {
			log.log(Level.WARNING, "Error inserting into table: " + table
					+ ", Values: " + values, e);
			return -1;
		}
	}
222320
public static Builder newBuilder(TableId table, RowToInsert... rows) {
    return newBuilder(table, ImmutableList.copyOf(rows));
  }
1052400
@SuppressWarnings("unchecked")
	@Override
	public <E> int batchInsert(final Class<E> entityType, final Stream<E> entities,
			final InsertsCondition<? super E> condition) {
		@SuppressWarnings("rawtypes")
		EntityHandler handler = this.getEntityHandler();
		if (!handler.getEntityType().isAssignableFrom(entityType)) {
			throw new IllegalArgumentException("Entity type not supported");
		}

		try {
			TableMetadata metadata = handler.getMetadata(this.transactionManager, entityType);
			SqlContext context = handler.createBatchInsertContext(this, metadata, entityType);
			context.setSqlKind(SqlKind.BATCH_INSERT);

			// IDアノテーションが付与されたカラム情報を取得する
			MappingColumn[] idColumns = MappingUtils.getIdMappingColumns(entityType);

			setGeneratedKeyColumns(context, idColumns, metadata);

			int count = 0;
			List<E> entityList = new ArrayList<>();
			for (Iterator<E> iterator = entities.iterator(); iterator.hasNext();) {
				E entity = iterator.next();

				if (!entityType.isInstance(entity)) {
					throw new IllegalArgumentException("Entity types do not match");
				}

				entityList.add(entity);

				handler.setInsertParams(context, entity);
				context.addBatch();

				if (condition.test(context, context.batchCount(), entity)) {
					count += Arrays.stream(doBatchInsert(context, handler, entityList, idColumns)).sum();
					entityList.clear();
				}
			}
			return count + (context.batchCount() != 0
					? Arrays.stream(doBatchInsert(context, handler, entityList, idColumns)).sum()
					: 0);
		} catch (SQLException e) {
			throw new EntitySqlRuntimeException(SqlKind.BATCH_INSERT, e);
		}
	}
335127
@Override
    protected void create(List<TableInfo> tableInfos)
    {
        StatementResult result = null;
        String statement = null;

        for (TableInfo tableInfo : tableInfos)
        {
            try
            {
                result = tableAPI.executeSync("DROP TABLE IF EXISTS " + tableInfo.getTableName());
                if (!result.isSuccessful())
                {
                    throw new SchemaGenerationException("Unable to DROP TABLE " + tableInfo.getTableName());
                }
                statement = buildCreateDDLQuery(tableInfo);
                result = tableAPI.executeSync(statement);
                if (!result.isSuccessful())
                {
                    throw new SchemaGenerationException("Unable to CREATE TABLE " + tableInfo.getTableName());
                }
                createIndexOnTable(tableInfo);
            }
            catch (IllegalArgumentException e)
            {
                logger.error("Invalid Statement. Caused By: ", e);
                throw new SchemaGenerationException(e, "Invalid Statement. Caused By: ");
            }
            catch (FaultException e)
            {
                logger.error("Statement couldn't be executed. Caused By: ", e);
                throw new SchemaGenerationException(e, "Statement couldn't be executed. Caused By: ");
            }
        }
    }
1276206
public static InsertAllRequest of(String datasetId, String tableId, Iterable<RowToInsert> rows) {
    return newBuilder(datasetId, tableId, rows).build();
  }
1003424
public <T extends AbstractJaxb> boolean insertBeforeId(String id,
            T insObject) throws TagTypeUnmatchException {
        return InsertByIdUtil.insertBeforeId(id, insObject, this);
    }