Skip to content

Commit d888595

Browse files
committed
Docs: Add information about version macros
1 parent 9cc4d02 commit d888595

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

doc/usage.txt

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,39 @@ where the exact set of headers represented by `<mysql/cppconn/*.h>` pattern
6868
depends on the APIs used in the code.
6969

7070

71+
Public headers define `MYSQL_CONCPP_VERSION_NUMBER` macro that represents
72+
the Connector/C++ version number in XYYZZZZ format. For example for
73+
Connector/C++ 9.2.0 the macro will have the value 9020000.
74+
75+
Connector/C++ applications that use X DevAPI, X DevAPI for C, or the JDBC API
76+
can use the `MYSQL_CONCPP_VERSION_NUMBER` macro to add conditional tests that
77+
determine the inclusion or exclusion of API features based on which
78+
Connector/C++ version introduced them.
79+
80+
@note
81+
The version macros were introduced in connector version 8.0.30 and can not
82+
be used to test for earlier versions in which the macro is not defined and thus
83+
it is treated as 0 in conditional checks. That can produce unexpected
84+
results, for example:
85+
~~~~
86+
#if MYSQL_CONCPP_VERSION_NUMBER > 8000028
87+
// this does not compile with the 8.0.29 connector!
88+
#endif
89+
90+
#if MYSQL_CONCPP_VERSION_NUMBER < 8000028
91+
// this compiles with the 8.0.29 connector!
92+
#endif
93+
~~~~
94+
95+
Apart from `MYSQL_CONCPP_VERSION_NUMBER` there are also macros with individual
96+
components of the version number: `MYSQL_CONCPP_VERSION_MAJOR`,
97+
`MYSQL_CONCPP_VERSION_MINOR` and `MYSQL_CONCPP_VERSION_MICRO`.
98+
99+
@note
100+
The Connector/C++ product version represented by these macros is unrelated
101+
to API or ABI versions, which are handled separately.
102+
103+
71104
### Linking with Connector/C++ dynamically
72105

73106
Connector targets defined by `mysql-concpp` module refer to shared connector

0 commit comments

Comments
 (0)