Skip to content

Commit cbaa6e0

Browse files
committed
Add support for locking clause syntax (FOR UPDATE and similar)
1 parent b13c28f commit cbaa6e0

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

tests/WP_SQLite_Driver_Tests.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6868,6 +6868,7 @@ public function testUpdateWithJoinComplexQuery(): void {
68686868
WHERE claim_id = 0 AND scheduled_date_gmt <= '2025-09-03 12:23:55' AND status = 'pending'
68696869
ORDER BY priority ASC, attempts ASC, scheduled_date_gmt ASC, action_id ASC
68706870
LIMIT 25
6871+
FOR UPDATE
68716872
) t2 ON t1.action_id = t2.action_id
68726873
SET claim_id = 37, last_attempt_gmt = '2025-09-03 12:23:55', last_attempt_local = '2025-09-03 12:23:55'"
68736874
);

wp-includes/sqlite-ast/class-wp-sqlite-driver.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2841,6 +2841,10 @@ private function translate( $node ): ?string {
28412841
case 'indexHint':
28422842
case 'indexHintList':
28432843
return null;
2844+
case 'lockingClause':
2845+
// SQLite doesn't support locking clauses (SELECT ... FOR UPDATE).
2846+
// They are not needed in SQLite due to the database file locking.
2847+
return null;
28442848
default:
28452849
return $this->translate_sequence( $node->get_children() );
28462850
}

0 commit comments

Comments
 (0)