Automattic\WooCommerce\Internal\DataStores\Orders
OrdersTableStatusUnionQuery::extract_limit
Extracts the offset and row count from the LIMIT clause, or NULL when the query is unlimited or too deeply paginated to benefit (each branch would have to fetch offset + row count rows). The offset + row count cap also rejects the "unlimited" sentinel row count.
Метод класса: OrdersTableStatusUnionQuery{}
Хуков нет.
Возвращает
int[]|null. Array of [ offset, row count ], or NULL when ineligible.
Использование
// private - только в коде основоного (родительского) класса $result = $this->extract_limit( $limits ): ?array;
- $limits(строка) (обязательный)
- The LIMIT clause, including the keyword.
Код OrdersTableStatusUnionQuery::extract_limit() OrdersTableStatusUnionQuery::extract limit WC 11.2.2
private function extract_limit( string $limits ): ?array {
if ( ! preg_match( '/^LIMIT (\d+), (\d+)$/', $limits, $limit_parts ) ) {
return null;
}
$offset = (int) $limit_parts[1];
$row_count = (int) $limit_parts[2];
if ( $row_count < 1 || ( $offset + $row_count ) > self::MAX_ROWS ) {
return null;
}
return array( $offset, $row_count );
}