Automattic\WooCommerce\Database\Migrations
MetaToCustomTableMigrator::generate_insert_sql_for_batch()
Generate SQL for data insertion.
Method of the class: MetaToCustomTableMigrator{}
No Hooks.
Return
String
. 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) ...
Usage
// private - for code of main (parent) class only $result = $this->generate_insert_sql_for_batch( $batch ): string;
- $batch(array) (required)
- 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 code WC 9.7.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. }