MetaToCustomTableMigrator::generate_insert_sql_for_batch()privateWC 1.0

Generate SQL for data insertion.

Метод класса: MetaToCustomTableMigrator{}

Хуков нет.


Строку. Generated queries for insertion for this batch, would be of the form: INSERT IGNORE INTO $table_name ($columns) values ($value for row 1) ($value for row 2) ...


// private - только в коде основоного (родительского) класса
$result = $this->generate_insert_sql_for_batch( $batch ): string;
$batch(массив) (обязательный)
Data to generate queries for. Will be 'data' array returned by $this->fetch_data_for_migration_for_ids() method.

Код MetaToCustomTableMigrator::generate_insert_sql_for_batch() WC 7.5.1

private function generate_insert_sql_for_batch( array $batch ): string {
	$table = $this->schema_config['destination']['table_name'];

	list( $value_sql, $column_sql ) = $this->generate_column_clauses( array_merge( $this->core_column_mapping, $this->meta_column_mapping ), $batch );

	return "INSERT IGNORE INTO $table (`$column_sql`) VALUES $value_sql;"; // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared, -- $insert_query is hardcoded, $value_sql is already escaped.