-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Support SQLite3 @name notation #3636
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Besides the common `:param` notation to designate named parameters in prepared statements, SQLite3 also supports `@param` and `$param`. While the latter is mostly to support the Tcl programming language, and would be confusing for PHP's sqlite3 binding due to the similarity with string interpolation, the former is common under .NET and raises no such issue. Therefore we add support for it. This patch has been developed in cooperation with @bohwaz.
If there are no objections, I'll merge this on the next weekend. |
I don't object, but I also don't really see the point here. It seems weird to introduce a sqlite-specific syntax, while we already have one that is universally supported (through pdo if nothing else). |
Well, the syntax is supported by SQLite anyway. It is, however, not possible to bind to a parameter in @param notation. This appears to be unnecessarily confusing, particularly for people with a .NET background. |
My point was that this syntax is allowed by SQLite (and so you expect it to work), but the PHP implementation broke it, trying to add "smart" behaviour (in prefixing a parameter name with a double colon when it doesn't have one). So this patch is just a bugfix actually :) |
Fair enough, please feel free to go ahead. As an unrelated point, the following zend_string_init can be replaced by a zend_string_copy. Duplicating the string does not appear to be necessary here. |
Good catch, thanks! Fixed via b7b3a65. |
Comment on behalf of cmb at php.net: Applied as 86c6b3b. |
Cf. <php/php-src#3636>. git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@345971 c90b9560-bf6c-de11-be94-00142212c4b1
Cf. <php/php-src#3636>. git-svn-id: http://svn.php.net/repository/phpdoc/en@345971 c90b9560-bf6c-de11-be94-00142212c4b1
Cf. <php/php-src#3636>. git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@345971 c90b9560-bf6c-de11-be94-00142212c4b1
Cf. <php/php-src#3636>. git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@345971 c90b9560-bf6c-de11-be94-00142212c4b1
Besides the common
:param
notation to designate named parameters inprepared statements, SQLite3 also supports
@param
and$param
.While the latter is mostly to support the Tcl programming language, and
would be confusing for PHP's sqlite3 binding due to the similarity with
string interpolation, the former is common under .NET and raises no
such issue. Therefore we add support for it.
This patch has been developed in cooperation with @bohwaz.