![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Is there a #define (or other methodology) I can use to detect the version of mysql++ installed |
|
(The actual incompatibility I'm running into is that 1.7.xx supplies "Result operator [] int", and 2.0 supplies "Result.at()" (if memory serves). |
|
Maybe there should also be a list of API changes between 1.7.xx and 2.0. |
#3
| |||
| |||
|
|
One question: I'd like to be able to maintain one code base that works with 1.7 and 2.0 for the next while. Is there a #define (or other methodology) I can use to detect the version of mysql++ installed and conditionally compile code for mysqlpp 1.7.XX or 2.0 as appropriate? |
#4
| |||
| |||
|
|
I think this is a reasonable request. |

|
#define MYSQLPP_LIB_VERSION 200 // version 2.0.x of the library |
#5
| |||||
| |||||
|
|
Chris Frey wrote: I think this is a reasonable request. Easy to request, easy to implement...and a PITA on each release for the maintainer, whose vote apparently isn't worth much here. ![]() |
|
I've counted them up, and this will make _seven_ places that have version numbers: ChangeLog, configure.in, mysql++.spec (2 places), lib/Makefile.am, lib/Doxyfile, and now lib/mysql++.h. Wanna bet that I never forget to update one of these before a release? |
|
#define MYSQLPP_LIB_VERSION 200 // version 2.0.x of the library If we're going to do this, let's at least use hexadecimal: #define MYSQLPP_LIB_VERSION 0x020000 1 byte per "part" of the version number. Why hex? It's a lot easier to parse: int major = (MYSQLPP_LIB_VERSION & 0xFF0000) >> 16; int minor = (MYSQLPP_LIB_VERSION & 0xFF00) >> 8; int bugfix = MYSQLPP_LIB_VERSION & 0xFF; |
|
versus the way the MySQL C API encodes it: int major = MYSQL_VERSION_ID / 10000; int minor = (MYSQL_VERSION_ID - (major * 10000)) / 100; int bugfix = MYSQL_VERSION_ID - (major * 10000) - (minor * 100); |
|
As I said, easy to implement. But that's not the problem. |
#6
| |||
| |||
|
|
I've counted them up, and this will make _seven_ places that have version numbers: ChangeLog, configure.in, mysql++.spec (2 places), lib/Makefile.am, lib/Doxyfile, and now lib/mysql++.h. Wanna bet that I never forget to update one of these before a release? Would a script help with this? |
|
I should automate this for you, since I suggested it. :-) |
#7
| |||
| |||
|
|
I should automate this for you, since I suggested it. :-) Your mission, should you choose to accept it, Mr. Frey, is to find out if the version string from configure.in is available as a variable that autoconf can substitute into Doxygen.in and mysql++.h.in files. |
#8
| |||
| |||
|
|
I haven't committed this to svn yet, since it has some file renames, etc, and might as well let people protest first. :-) |
#9
| |||
| |||
|
|
Well, it's possible. |
|
I haven't figured out an easy way to consolidate the 3 version formats into a single spot, |
![]() |
| Thread Tools | |
| Display Modes | |
| |