Automattic\WooCommerce\Database\Migrations
MetaToCustomTableMigrator::generate_insert_sql_for_batch()
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() MetaToCustomTableMigrator::generate insert sql for batch WC 9.3.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 INTO $table (`$column_sql`) VALUES $value_sql;"; // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared, -- $insert_query is hardcoded, $value_sql is already escaped. }