Add stubs for SQL Anywhere sasql extension#382
Add stubs for SQL Anywhere sasql extension#382Majkl578 wants to merge 1 commit intoJetBrains:masterfrom
Conversation
| const SASQL_INPUT_OUTPUT = 0; | ||
| const SASQL_NUM = 0; | ||
| const SASQL_STORE_RESULT = 0; | ||
| const SASQL_USE_RESULT = 0; |
There was a problem hiding this comment.
I believe we need to extract the actual values from the extension distribution binaries. Otherwise, it may lead to errors like "duplicate array keys" when constants are used as array keys.
There was a problem hiding this comment.
Yes, I don't have access to any SA installation/extension though. :/ So at least better than udefined constants ATM.
There was a problem hiding this comment.
Let me see if I can extract them during the day. This is where I currently am:
↪ ldd php-5.6.0_sqlanywhere.so
statically linked
↪ php -dextension=$PWD/php-5.6.0_sqlanywhere.so
Warning: PHP Startup: The SQLAnywhere client libraries could not be loaded. Please ensure that libdbcapi.so can be found in your LD_LIBRARY_PATH environment variable. in Unknown on line 0
Going to try the Windows DLL later.
UPD: Same thing:
php -dextension=ext/php-5.6.0_sqlanywhere_nts.dll
Warning: PHP Startup: The SQLAnywhere client libraries could not be loaded. Please ensure that dbcapi.dll can be found in your PATH environment variable. in Unknown on line 0
There was a problem hiding this comment.
From the extension source:
REGISTER_LONG_CONSTANT("SASQL_D_INPUT", 1, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("SASQL_D_OUTPUT", 2, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("SASQL_D_INPUT_OUTPUT", 3, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("SASQL_USE_RESULT", 0, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("SASQL_STORE_RESULT", 1, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("SASQL_NUM", 1, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("SASQL_ASSOC", 2, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("SASQL_BOTH", 3, CONST_CS | CONST_PERSISTENT);
sasql/sasql.php
Outdated
| * | ||
| * @param resource $stmt A statement resource that was executed by sasql_stmt_execute. | ||
| * @param mixed ...$vars References to PHP variables that will be bound to result set columns returned by the | ||
| sasql_stmt_fetch. |
There was a problem hiding this comment.
A * is missing in the beginning.
|
Thank you for contribution! sasql is not a standard extension and not PECL extension, it would be better to create a separate plugin with these stubs. Here is an example: https://github.com/artspb/phpstorm-library-plugin |
|
Hmm I think I am not going to do that unfortunately, I am not interested in maintaining a plugin for an extension I don't use. It's just that Doctrine uses it and PhpStorm is unable to recognize it's functions (plus PHPStan which we use together with stubs as a polyfill). |
|
@andrey-sokolov Should probably noted that stubs already include multiple non-PECL/non-standard proprietary extensions:
So your decision doesn't seem to be objective. |
|
These were there years before opening public contribution and will remain for backward compatibility reasons. Popularity matters the most now. Do you have some usage statistic for this extension? |
http://dcx.sap.com/index.html#sa160/en/dbprogramming/php-api.html
http://dcx.sap.com/sa160/en/pdf/dbprogramming16.pdf
cc @morozov