Automattic\WooCommerce\Blueprint\Steps

RunSql::from_table_rowpublic staticWC 1.0

Build a RunSql step for a database row, using the portable table-prefix placeholder in place of the live database prefix.

Pass the unprefixed table name (e.g. 'woocommerce_shipping_zones'). The placeholder is prepended for you, so exported SQL stays portable across sites with different table prefixes. On import, ImportRunSql resolves the placeholder back to the importing site's prefix.

Method of the class: RunSql{}

No Hooks.

Returns

self.

Usage

$result = RunSql::from_table_row( $row, $table, $type ): self;
$row(array) (required)
Row data keyed by column name.
$table(string) (required)
Unprefixed table name.
$type(string)
One of insert, insert ignore, replace into.
Default: 'replace into'

RunSql::from_table_row() code WC 11.0.1

public static function from_table_row( array $row, string $table, string $type = 'replace into' ): self {
	return new self( (string) Util::array_to_insert_sql( $row, self::TABLE_PREFIX_PLACEHOLDER . $table, $type ) );
}