-
Notifications
You must be signed in to change notification settings - Fork 803
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
Add stubs for SQL Anywhere sasql extension #382
Conversation
sasql/sasql.php
Outdated
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool, updated!
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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