Skip to content

ext/pdo_firebird: Added Pdo\Firebird::ATTR_API_VERSION #14916

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

Closed

Conversation

SakiTakamachi
Copy link
Member

@SakiTakamachi SakiTakamachi commented Jul 11, 2024

This return FB_API_VER.

Related #14897

The functions that are built change depending on the value of FB_API_VER described in ibase.h, but the only way for users to know this value is to actually look at ibase.h, so add an attribute value to make it possible to obtain it.

@sim1984
Copy link
Contributor

sim1984 commented Jul 11, 2024

Maybe it's worth adding this information to phpinfo as well?

PHP_MINFO_FUNCTION(pdo_firebird) /* {{{ */
{
	char version[64];
	isc_get_client_version(version);

	php_info_print_table_start();
	php_info_print_table_row(2, "PDO Driver for Firebird", "enabled");
	php_info_print_table_row(2, "Client Library Version", version);
        php_info_print_table_row(2, "Firebird API version", FB_API_VER);
	php_info_print_table_end();
}
/* }}} */

@Girgias
Copy link
Member

Girgias commented Jul 11, 2024

Yes, this should also be added to phpinfo

@SakiTakamachi
Copy link
Member Author

Okay, I'll add it later

@SakiTakamachi
Copy link
Member Author

done

@@ -60,6 +60,7 @@ PHP_MINIT_FUNCTION(pdo_firebird) /* {{{ */
REGISTER_PDO_CLASS_CONST_LONG("FB_ATTR_DATE_FORMAT", (zend_long) PDO_FB_ATTR_DATE_FORMAT);
REGISTER_PDO_CLASS_CONST_LONG("FB_ATTR_TIME_FORMAT", (zend_long) PDO_FB_ATTR_TIME_FORMAT);
REGISTER_PDO_CLASS_CONST_LONG("FB_ATTR_TIMESTAMP_FORMAT", (zend_long) PDO_FB_ATTR_TIMESTAMP_FORMAT);
REGISTER_PDO_CLASS_CONST_LONG("FB_ATTR_API_VERSION", (zend_long) PDO_FB_ATTR_API_VERSION);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, is this related to the server, or the driver?

As it might make more sense to expose it via PDO::ATTR_SERVER_INFO

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This only related to the header file ibase.h at build time.

The server side is completely irrelevant.

The client side is somewhat involved, but due to factors such as updates, the header file version at the time of build and the client version do not always match.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, then this is fine.

Copy link
Member

@cmb69 cmb69 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall, this looks sensible to me, but I wonder about the PDO driver specific subclasses; shouldn't PDO::FB_ATTR_API_VERSION be rather something like PdoFirebird::ATTR_API_VERSION?

@SakiTakamachi
Copy link
Member Author

@cmb69
Indeed, makes sense.

Firstly I forgot to add this to the stub.

And other constants that are new in 8.4 (such as transaction isolation levels) should probably be been the same way. However, other constants will be addressed in a follow-up PR.

I'll fix this, thx!

@SakiTakamachi
Copy link
Member Author

FYI:

PdoFirebird class has become Pdo\Firebird. The same for other drivers :)

@SakiTakamachi
Copy link
Member Author

done!

@SakiTakamachi
Copy link
Member Author

SakiTakamachi commented Jul 16, 2024

I realized while changing this that the stub's extends PDO should probably be extends \PDO.
I'll fix it in a follow-up PR. PRs will be opened one by one, as the Stub hash will conflict and cause trouble.

Copy link
Member

@cmb69 cmb69 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! Looks good to me.

@SakiTakamachi SakiTakamachi changed the title ext/pdo_firebird: Added FB_ATTR_API_VERSION ext/pdo_firebird: Added Pdo\Firebird::ATTR_API_VERSION Jul 17, 2024
@SakiTakamachi SakiTakamachi deleted the pdo_fb_add_attr_api_version branch July 17, 2024 11:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants