dbTalk Databases Forums  

mysqlpp 2.0beta

mailing.database.mysql-plusplus mailing.database.mysql-plusplus


Discuss mysqlpp 2.0beta in the mailing.database.mysql-plusplus forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
J Robinson
 
Posts: n/a

Default mysqlpp 2.0beta - 07-18-2005 , 11:20 AM






Hello Everyone:

I've been playing with porting my C++ app to use
mysql++ 2.0 instead of mysql++ 1.7. Looks good
overall. Nice work, Warren and everyone!

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?

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

Also (I know, I said one question): Maybe there should
also be a list of API changes between 1.7.xx and 2.0.

Thanks, jrobinson

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

--
MySQL++ Mailing List
For list archives: http://lists.mysql.com/plusplus
To unsubscribe: http://lists.mysql.com/plusplus?unsu...ie.nctu.edu.tw


Reply With Quote
  #2  
Old   
Warren Young
 
Posts: n/a

Default Re: mysqlpp 2.0beta - 07-18-2005 , 12:57 PM






J Robinson wrote:

Quote:
Is there a #define (or other methodology) I can use to
detect the version of mysql++ installed
In v1.7.x, there were three places where I had to change numbers for
each release. Due to the soname change in v2.0, there are now four
places. I'm not eager to add yet another. (And no, there's no
straightforward way to automate changing them all from a single location.)

Quote:
(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).
This is changing (again, hopefully never again) in beta2, due out on
store shelves very soon. As long as you never use row[0], you can
continue using numbers. If you must index the first field, you can use
this godawful construct:

row[(Row::size_type)0];

<hurk>...<spew>....

Personally, I'd encourage you to use SSQLS and give row indexing a miss
altogether.

Quote:
Maybe there should
also be a list of API changes between 1.7.xx and 2.0.
If it was a snake, it'd have bit you:

http://tangentsoft.net/mysql++/doc/u...breakages.html

This was mentioned in the release announcement, which you should also read:

http://lists.mysql.com/plusplus/4591

--
MySQL++ Mailing List
For list archives: http://lists.mysql.com/plusplus
To unsubscribe: http://lists.mysql.com/plusplus?unsu...ie.nctu.edu.tw



Reply With Quote
  #3  
Old   
Chris Frey
 
Posts: n/a

Default Re: mysqlpp 2.0beta - 07-21-2005 , 05:50 AM



On Mon, Jul 18, 2005 at 09:19:53AM -0700, J Robinson wrote:
Quote:
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?
I think this is a reasonable request. Any objections to adding this
to mysql++.h:

#define MYSQLPP_LIB_VERSION 200 // version 2.0.x of the library

This would be incremented like this:

#define MYSQLPP_LIB_VERSION 201 // version 2.1.x of the library

etc. and would allow:

#if MYSQLPP_LIB_VERSION >= 200
blah
#else
....
#endif

For those that need it.

- Chris


--
MySQL++ Mailing List
For list archives: http://lists.mysql.com/plusplus
To unsubscribe: http://lists.mysql.com/plusplus?unsu...ie.nctu.edu.tw



Reply With Quote
  #4  
Old   
Warren Young
 
Posts: n/a

Default Re: mysqlpp 2.0beta - 07-21-2005 , 07:48 PM



Chris Frey wrote:

Quote:
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?

Quote:
#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);

Base 10 is a pain for binary computers.

Also, it's easy to make a macro to make comparisons easier:

#define MYSQLPP_VERSION(major, minor, bugfix) \
((major) << 16) | ((minor) << 8) | (bugfix)

#if MYSQLPP_LIB_VERSION >= MYSQLPP_VERSION(2, 0, 0)
...


As I said, easy to implement. But that's not the problem.

--
MySQL++ Mailing List
For list archives: http://lists.mysql.com/plusplus
To unsubscribe: http://lists.mysql.com/plusplus?unsu...ie.nctu.edu.tw



Reply With Quote
  #5  
Old   
Chris Frey
 
Posts: n/a

Default Re: mysqlpp 2.0beta - 07-21-2005 , 09:51 PM



On Thu, Jul 21, 2005 at 06:48:07PM -0600, Warren Young wrote:
Quote:
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.
Your vote definitely counts, since you're doing the work.


Quote:
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? Perhaps convert some of these files to
filename.in so configure handles it, based on a single file in the root
directory?


Quote:
#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;
MUCH better! Thanks.


Quote:
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);
ieeeeeeeeeeee


Quote:
As I said, easy to implement. But that's not the problem.
I should automate this for you, since I suggested it. :-)

- Chris


--
MySQL++ Mailing List
For list archives: http://lists.mysql.com/plusplus
To unsubscribe: http://lists.mysql.com/plusplus?unsu...ie.nctu.edu.tw



Reply With Quote
  #6  
Old   
Warren Young
 
Posts: n/a

Default Re: mysqlpp 2.0beta - 07-21-2005 , 10:09 PM



Chris Frey wrote:
Quote:
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?
Of those six files, only mysql++.h and _maybe_ the Doxyfile are amenable
to automatic generation.

Quote:
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.

Another way you could do it is to use the #define in config.h, which the
configure script generates. But that means writing a C program (or a
really ugly script) to do the substitution. Much better to leverage
autoconf if we can.

This email will self-destruct in 7 seconds.

--
MySQL++ Mailing List
For list archives: http://lists.mysql.com/plusplus
To unsubscribe: http://lists.mysql.com/plusplus?unsu...ie.nctu.edu.tw



Reply With Quote
  #7  
Old   
Chris Frey
 
Posts: n/a

Default Re: mysqlpp 2.0beta - 07-30-2005 , 04:51 AM



On Thu, Jul 21, 2005 at 09:09:00PM -0600, Warren Young wrote:
Quote:
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.
Well, it's possible. I haven't figured out an easy way to consolidate the
3 version formats into a single spot, but at least all version numbers are
in one file: configure.in. And they are in 3 lines close to each other,
so pretty easy to update, and hard to miss.

The only version numbers that have to be updated manually besides configure.in
are in the history files: Changelog, and the history log stuff in mysql++.spec.
The version at the top of mysql++.spec is handled automatically.

I haven't committed this to svn yet, since it has some file renames, etc,
and might as well let people protest first. :-)

Here's the patch.
- Chris


Index: configure.in
================================================== =================
--- configure.in (revision 994)
+++ configure.in (working copy)
@@ -15,8 +15,15 @@


dnl Standard autotools stuff
-AC_INIT(lib/mysql++.h)
-AM_INIT_AUTOMAKE(mysql++, 2.0.0) # Bump in mysql++.spec & lib/Makefile.am, too!
+dnl Version bumping: don't forget:
+dnl Changelog
+dnl History in mysql++.spec
+dnl
+AC_INIT(mysql++, 2.0.0, plusplus (AT) lists (DOT) mysql.com)
+AC_SUBST(PACKAGE_LIB_VERSION, [2:0:0])
+AC_SUBST(PACKAGE_HEADER_VERSION, [0x020000])
+
+AM_INIT_AUTOMAKE
AM_CONFIG_HEADER(config.h)
AC_PROG_MAKE_SET
AC_DISABLE_STATIC
@@ -85,6 +92,6 @@
#
# Done with checks!
#
-AC_OUTPUT(Makefile lib/Makefile examples/Makefile)
+AC_OUTPUT([Makefile mysql++.spec lib/mysql++.h lib/Makefile lib/Doxyfile examples/Makefile])

./makemake.sh simple gcc
Index: mysql++.spec.in
================================================== =================
--- mysql++.spec.in (revision 994)
+++ mysql++.spec.in (working copy)
@@ -1,6 +1,6 @@
Summary: C++ wrapper for the MySQL C API
-Name: mysql++
-Version: 2.0.0
+Name: @PACKAGE_NAME@
+Version: @PACKAGE_VERSION@
Release: beta2
Copyright: LGPL
Group: Development/Databases
Index: lib/mysql++.h.in
================================================== =================
--- lib/mysql++.h.in (revision 994)
+++ lib/mysql++.h.in (working copy)
@@ -40,6 +40,8 @@
#if !defined(MYSQLPP_MYSQLPP_H)
#define MYSQLPP_MYSQLPP_H

+#define MYSQLPP_LIB_VERSION @PACKAGE_HEADER_VERSION@
+
// This #include order gives the fewest redundancies in the #include
// dependency chain.
#include "connection.h"
Index: lib/Doxyfile.in
================================================== =================
--- lib/Doxyfile.in (revision 994)
+++ lib/Doxyfile.in (working copy)
@@ -23,7 +23,7 @@
# This could be handy for archiving the generated documentation or
# if some version control system is used.

-PROJECT_NUMBER = 2.0
+PROJECT_NUMBER = @PACKAGE_VERSION@

# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
# base path where the generated documentation will be put.
Index: lib/Makefile.am
================================================== =================
--- lib/Makefile.am (revision 994)
+++ lib/Makefile.am (working copy)
@@ -26,7 +26,7 @@
# interfaces supported. Bump the last only if explicit backwards-
# compatibility is added -- like two different versions of a single
# function. 'age' must be less than the current interface version.
-libmysqlpp_la_LDFLAGS=-version-info 2:0:0
+libmysqlpp_la_LDFLAGS=-version-info @PACKAGE_LIB_VERSION@

libmysqlpp_la_SOURCES = \
coldata.cpp connection.cpp datetime.cpp fields.cpp field_names.cpp \


--
MySQL++ Mailing List
For list archives: http://lists.mysql.com/plusplus
To unsubscribe: http://lists.mysql.com/plusplus?unsu...ie.nctu.edu.tw



Reply With Quote
  #8  
Old   
Chris Frey
 
Posts: n/a

Default Re: mysqlpp 2.0beta - 07-30-2005 , 04:55 AM



On Sat, Jul 30, 2005 at 05:50:35AM -0400, Chris Frey wrote:
Quote:
I haven't committed this to svn yet, since it has some file renames, etc,
and might as well let people protest first. :-)
I changed my mind and committed anyway, since it's easier to work with
than patch files. This is svn, and pretty easy to revert, so please do
if there are problems.

- Chris


--
MySQL++ Mailing List
For list archives: http://lists.mysql.com/plusplus
To unsubscribe: http://lists.mysql.com/plusplus?unsu...ie.nctu.edu.tw



Reply With Quote
  #9  
Old   
Warren Young
 
Posts: n/a

Default Re: mysqlpp 2.0beta - 08-01-2005 , 08:05 AM



Chris Frey wrote:
Quote:
Well, it's possible.
The single biggest thing you did in this is find "PACKAGE_VERSION", and
set up the *.in files. Everything flows from that, so despite the
weaknesses of this patch, it would have been worthwhile as-is. Thanks
for that, and for going further.

Quote:
I haven't figured out an easy way to consolidate the
3 version formats into a single spot,
It's possible to generate the MYSQLPP_LIB_VERSION macro in
lib/mysql++.h. I've checked in a change which does this, which also
lets you use the macro I wrote in a message earlier in this thread,
which lets you say:

#if MYSQLPP_LIB_VERSION >= MYSQLPP_VERSION(2, 0, 0)
...

Of the remaining two version numbers in configure.in, it's not possible
to generate one from the other without some nontrivial arithmetic. If
you're curious, try playing around with the libtool version number; try
to generate libmysqlpp.so.1.9.0, for instance. (I'm willing to spoil
you, but you might enjoy the puzzle, so I'll keep mum for the moment.)
Artithmetic can be done in Bourne shell, but...ech.

I'm glad you moved the libtool version number from lib/Makefile.am to
configure.in. That isn't strictly necessary, but it does help me to see
more of the numbers in once place.

--
MySQL++ Mailing List
For list archives: http://lists.mysql.com/plusplus
To unsubscribe: http://lists.mysql.com/plusplus?unsu...ie.nctu.edu.tw



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.