Skip to content
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

Closed
wants to merge 1 commit into from

Conversation

sasql/sasql.php Outdated
const SASQL_INPUT_OUTPUT = 0;
const SASQL_NUM = 0;
const SASQL_STORE_RESULT = 0;
const SASQL_USE_RESULT = 0;
Copy link
Contributor

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.

Copy link
Contributor Author

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.

Copy link
Contributor

@morozov morozov Jun 27, 2018

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

Copy link
Contributor

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);

Copy link
Contributor Author

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.
Copy link
Contributor

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.

@andrey-sokolov
Copy link
Collaborator

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

@Majkl578
Copy link
Contributor Author

Majkl578 commented Jul 4, 2018

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).

@Majkl578
Copy link
Contributor Author

Majkl578 commented Jul 6, 2018

@andrey-sokolov Should probably noted that stubs already include multiple non-PECL/non-standard proprietary extensions:

  • suhosin
  • sybase (precedesor of SASQL)
  • newrelic
  • mapscript
  • ZendCache
  • ZendDebugger
  • ZendUtils

So your decision doesn't seem to be objective.

@neuro159
Copy link
Collaborator

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?

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.

4 participants