Skip to content

Conversation

@invisal
Copy link
Collaborator

@invisal invisal commented Nov 21, 2024

Add the support for positional placeholder and named placeholder. You can now use

connection.raw("SELECT * FROM tbl WHERE id = ?", [1]);

Or

connection.raw("SELECT * FROM tbl WHERE id = :id", { id: 1 });

Test Case

  √ Positional placeholder (6 ms)
  √ Positional placeholder inside the string should be ignored
  √ Named placeholder to number placeholder
  √ Named placeholder to number placeholder with string (1 ms) 
  √ Named placeholder with missing value should throw an error (11 ms)
  √ Number of positional placeholder should match with the number of values (1 ms)      
  √ Mixing named and positional placeholder should throw error (1 ms)
  √ Convert positional placeholder to numbered placeholder (1 ms) 

Connection Test Case

  √ Support named parameters
  √ Support positional placeholder

@invisal invisal requested a review from Brayden November 21, 2024 13:46
@Brayden Brayden merged commit 2d40411 into main Nov 21, 2024
11 checks passed
@Brayden Brayden deleted the invisal/support-raw-placeholders branch November 21, 2024 15:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants