Skip to content

Conversation

@nielsdos
Copy link
Member

@nielsdos nielsdos commented Oct 20, 2025

The FIELD_TYPE constants are for BC. The JSON/VECTOR types are not
defined in FIELD_TYPE for libmysqlclient.
MYSQL_TYPE is available since MYSQL 5.0.0, so switch to that.

Since MYSQL_TYPEs are enums and not defines, we need version checks
instead.
JSON was added in mysql 8.0.0 in mysql/mysql-server@c24045514581
VECTOR was added in mysql 9.0.0 in mysql/mysql-server@8cd51511de7d

Replaces GH-20245.

switch (type) {
PDO_MYSQL_NATIVE_TYPE_NAME(STRING)
PDO_MYSQL_NATIVE_TYPE_NAME(VAR_STRING)
#ifdef FIELD_TYPE_TINY
Copy link
Member

Choose a reason for hiding this comment

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

Don't you need to replace these as well?

Copy link
Member Author

Choose a reason for hiding this comment

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

My bad, of course

@nielsdos
Copy link
Member Author

Ah darn it, those are part of an enum so you can't ifdef them...

The FIELD_TYPE constants are for BC. The JSON/VECTOR types are not
defined in FIELD_TYPE for libmysqlclient.
MYSQL_TYPE is available since MYSQL 5.0.0, so switch to that.

Since MYSQL_TYPEs are enums and not defines, we need version checks
instead.
JSON was added in mysql 8.0.0 in mysql/mysql-server@c24045514581
VECTOR was added in mysql 9.0.0 in mysql/mysql-server@8cd51511de7d

Replaces phpGH-20245.
PDO_MYSQL_NATIVE_TYPE_NAME(VECTOR)
#endif
#ifdef FIELD_TYPE_JSON
#if MYSQL_VERSION_ID >= 80000 || defined(PDO_USE_MYSQLND)
Copy link
Contributor

Choose a reason for hiding this comment

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

The JSON type was added in MySQL 5.7.8.

Copy link
Member Author

Choose a reason for hiding this comment

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

Huh indeed. Thanks. Looks like it got backported in mysql/mysql-server@3e14f9f in 5.7.8, adjusting again...

JSON support was backported via mysql/mysql-server@3e14f9f in 5.7.8.
Copy link
Member

@iluuu1994 iluuu1994 left a comment

Choose a reason for hiding this comment

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

Copy link
Member

@kamil-tekiela kamil-tekiela left a comment

Choose a reason for hiding this comment

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

I think this should be fine.

@nielsdos
Copy link
Member Author

Merged via c7fc819 etc

@nielsdos nielsdos closed this Oct 23, 2025
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