Am sure this is fairly obvious, to me it would make more sense if the second double question mark in the example was a single one.
From their docs:
Alternatively, you can use ?? characters as placeholders for identifiers you would like to have escaped like this:
var userId = 1;
var columns = ['username', 'email'];
var query = connection.query('SELECT ?? FROM ?? WHERE id = ?', [columns, 'users', userId], function(err, results) {
// ...
});
console.log(query.sql); // SELECT `username`, `email` FROM `users` WHERE id = 1
To keep such question marks in a SQL statement from being interpreted as positional parameters, use two question marks (??) as an escape sequence. You can also use this escape sequence in a Statement, but that is not required. Specifically only in a Statement a single (?) can be used as an operator.
The question mark represents a parameter that will later be replaced. Using parameterized queries is more secure than embedding the parameters right into the query. SQL Server calls this parameterize queries, and Oracle calls it bind variables.
In PHP 7, the double question mark(??) operator known as Null Coalescing Operator. It returns its first operand if it exists and is not NULL; otherwise, it returns its second operand. It evaluates from left to right.
The double question mark is also used in cases when we want to highlight something while asking. Example: “Is that your cupboard or a pile of garbage??” “Didn't you hear me when I said let's go??” and “Who steals a pen??”
??
is used for table and column names, it escapes them with backticks. ?
is for ordinary values.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With