Author: wyoung
Date: Thu Jan  3 08:38:49 2008
New Revision: 2068

URL: http://svn.gna.org/viewcvs/mysqlpp?rev=2068&view=rev
Log:
Disabled SSQLS if built under VC++ 2003.  #including custom.h produces
an error, and building examples/custom*.cpp produces a stub program that
does nothing but complain that you need to use a compatibile compiler.

Modified:
    trunk/README.vc
    trunk/Wishlist
    trunk/doc/userman/userman.dbx
    trunk/examples/custom1.cpp
    trunk/examples/custom2.cpp
    trunk/examples/custom3.cpp
    trunk/examples/custom4.cpp
    trunk/examples/custom5.cpp
    trunk/examples/stock.h
    trunk/lib/custom.pl

Modified: trunk/README.vc
URL: 
http://svn.gna.org/viewcvs/mysqlpp/trunk/README.vc?rev=2068&r1=2067&r2=2068&view=diff
==============================================================================
--- trunk/README.vc (original)
+++ trunk/README.vc Thu Jan  3 08:38:49 2008
@@ -1,19 +1,52 @@
+Visual C++ Version Compatibility
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+    MySQL++ is fully-functional with Visual C++ 2005 and 2008.
+
+    MySQL++ also works with VS 2003, with the exception of the SSQLS
+    feature.  There was partial support for SSQLS in the MySQL++
+    v2 series, but a feature we added in MySQL++ v3.0 crashes the
+    compiler, so we had to remove support for it entirely.  You don't
+    need to change anything to use MySQL++ v3 with Visual C++ 2003.
+    The SSQLS parts of the library and the examples simply disable
+    themselves when built with Visual C++ 2003.
+
+    Older versions of Visual C++ are basically hopeless when it comes
+    to having sufficient support for Standard C++ to build MySQL++.
+    There is an ancient hacked version of MySQL++ on the official
+    MySQL++ web site that works with Visual C++ 6 and up, but my
+    advice if you're on so old a compiler is that you're better off
+    programming straight to the C API, if only because you can still
+    get support for it.
+
+    The .sln and .vcproj files shipped with MySQL++ are for Visual
+    Studio 2003.  If you have that version installed as well as a newer
+    version, double-clicking the .sln file will open the solution in
+    Visual Studio 2003.  (This is because .sln files aren't associated
+    with Visual Studio directly, they're associated with a helper
+    tool that examines the file's contents to decide which version of
+    Visual Studio to launch.)  To migrate the solution files to the
+    newer version, open the .sln file from within the desired version
+    of Visual Studio.  After saving out the migrated solution files,
+    double-clicking the .sln file will open it in the newer version.
+
+
 Prerequisites
 ~~~~~~~~~~~~~
-    We currently have full support only for Visual Studio 2005.  It may
-    work with the "Orca" beta of the next version of Visual Studio,
-    but it hasn't been tested.  With a little work you can make it
-    work on Visual Studio 2003 as well; see below.  Older versions
-    are basically hopeless when it comes to having sufficient support
-    for Standard C++ to build MySQL++.
-
-    You also need to have the MySQL server installed, even if you
-    will be using a MySQL server on another machine.  This is because
-    in addition to installing the server itself, it also installs
-    the client-side development files that MySQL++ needs in order to
-    communicate with a MySQL server.  The MySQL server installer hasn't
-    always installed the development files by default, so you might
-    need to do some kind of custom install so you can enable them.
+    You need to have the MySQL server installed on your development
+    system, even if you will be using a MySQL server on another server.
+    This is because in addition to installing the server itself,
+    it also installs the client-side development files that MySQL++
+    needs in order to communicate with a MySQL server.
+
+    Historically, the MySQL server installer has sometimes installed
+    the development files by default, and sometimes not.  If you get
+    an error about mysql-version.h or mysql.h when building MySQL++,
+    you might need to go back and reinstall the server and select a
+    custom install to enable installation of the development files.
+
+    If you're getting these header file errors and are certain the
+    development files are indeed installed, read on in the following
+    section.
 
 
 Building the Library and Example Programs
@@ -171,22 +204,6 @@
     same directory as this README file.
 
 
-Making It Work With Visual Studio 2003
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-    MySQL++'s SSQLS feature depends on a feature of newer C++
-    compilers called variadic macro argument lists, which Visual
-    C++ 2003 doesn't support.  You can disable the use of this C++
-    feature at the expense of not being able to use a given SSQLS
-    macro in more than one module within your program.  If you can
-    live with that and you have a Perl interpreter on your system,
-    go into the lib subdirectory of the MySQL++ distribution and say:
-
-        perl custom.pl -v
-
-    This will regenerate custom.h and custom-macros.h without the
-    multi-module support so it will work with Visual C++ 2003.
-
-
 If You Run Into Problems...
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~
     Especially if you have linking problems, make sure your project

Modified: trunk/Wishlist
URL: 
http://svn.gna.org/viewcvs/mysqlpp/trunk/Wishlist?rev=2068&r1=2067&r2=2068&view=diff
==============================================================================
--- trunk/Wishlist (original)
+++ trunk/Wishlist Thu Jan  3 08:38:49 2008
@@ -14,9 +14,6 @@
       possibility of building without thread support.  Then work
       it into userman's threads chapter, which already has a stub
       for this.
-
-    o Disable SSQLS if < VC++ 2005, remove custom.pl -v, and remove
-      discussion of it from userman.
 
 
 v3.1 Tentative Plan

Modified: trunk/doc/userman/userman.dbx
URL: 
http://svn.gna.org/viewcvs/mysqlpp/trunk/doc/userman/userman.dbx?rev=2068&r1=2067&r2=2068&view=diff
==============================================================================
--- trunk/doc/userman/userman.dbx (original)
+++ trunk/doc/userman/userman.dbx Thu Jan  3 08:38:49 2008
@@ -2051,15 +2051,6 @@
 // File my_ssqls.cpp, which owns the SSQLS:
 #define EXPAND_MY_SSQLS_STATICS
 #include "my_ssqls.h"</programlisting>
-
-    <para>Note that due to a compiler limitation, you can't use the
-    <varname>MYSQLPP_SSQLS_NO_STATICS</varname> feature with Visual
-    C++ 2003. As instructed in <filename>README.vc</filename>, you
-    have to disable this feature in order to get the SSQLS header
-    files to compile. Having done that, the SSQLS feature works
-    fine as long as you can live with using each structure type in
-    a single module. Visual C++ 2005 and newer don't suffer from
-    this limitation.</para>
   </sect2>
 
 
@@ -2317,6 +2308,56 @@
 
     <programlisting><xi:include href="cgi_jpeg.txt" parse="text"
     xmlns:xi="http://www.w3.org/2001/XInclude"/></programlisting>
+  </sect2>
+
+
+  <sect2 id="ssqls-vc2003">
+    <title>SSQLS and Visual C++ 2003</title>
+
+    <para>SSQLS works on all platforms supported by MySQL++ except
+    for Visual C++ 2003. (Because the rest of MySQL++ works just fine
+    with Visual C++ 2003, we haven't removed this platform from the
+    supported list entirely.)</para>
+
+    <para>If you do need SSQLS and are currently on Visual C++ 2003,
+    you have these options:</para>
+
+    <orderedlist>
+      <listitem><para>The simplest option is to upgrade to a newer
+      version of Visual C++. The compiler limitations that break
+      SSQLS are all fixed in Visual C++ 2005 and newer. <ulink
+      url="http://www.microsoft.com/express/vc/";>Visual
+      C++ Express</ulink> is free and is apparently
+      here to stay; coupled with the free <ulink
+      url="http://wxwidgets.org/";>wxWidgets</ulink> library, it lacks
+      little compared to Visual C++ Professional.  A bonus of using
+      wxWidgets is that it's cross-platform and better-supported
+      than MFC.</para></listitem>
+
+      <listitem><para>If you can't upgrade your compiler, you may
+      be able to downgrade to MySQL++ v2.<emphasis>x</emphasis>.
+      The SSQLS feature in these older versions worked with
+      Visual C++ 2003, but didn't let you use a given SSQLS in
+      more than one module in a program. If you can live with that
+      limitation and have a Perl interpreter on your system, you
+      can re-generate <filename>lib/custom-macros.h</filename> to
+      remove the multiple-module SSQLS support. To do this, you run
+      the command <command>perl custom.pl -v</command> from within
+      MySQL++'s <filename>lib</filename> subdirectory before you
+      build and install the library.</para></listitem>
+
+      <listitem><para>There's <ulink
+      url="http://svn.gna.org/viewcvs/*checkout*/mysqlpp/trunk/Wishlist";>a
+      plan</ulink> to replace the current SSQLS mechanism with an
+      entirely new code base. Although this is being done primary
+      to get new features that are too difficult to add within the
+      current design, it also means we'll have the chance to test
+      step-by-step along the way that we don't reintroduce code that
+      Visual C++ 2003 doesn't support. This may happen without you
+      doing anything, but if there's someone on the team who cares
+      about this, that will naturally increase the chances that it
+      does happen.</para></listitem>
+    </orderedlist>
   </sect2>
 </sect1>
 

Modified: trunk/examples/custom1.cpp
URL: 
http://svn.gna.org/viewcvs/mysqlpp/trunk/examples/custom1.cpp?rev=2068&r1=2067&r2=2068&view=diff
==============================================================================
--- trunk/examples/custom1.cpp (original)
+++ trunk/examples/custom1.cpp Thu Jan  3 08:38:49 2008
@@ -38,6 +38,7 @@
 int
 main(int argc, char *argv[])
 {
+#if defined(MYSQLPP_SSQLS_COMPATIBLE)
        // Get database access parameters from command line
     const char* db = 0, *server = 0, *user = 0, *pass = "";
        if (!parse_command_line(argc, argv, &db, &server, &user, &pass)) {
@@ -80,6 +81,11 @@
                cerr << "Error: " << er.what() << endl;
                return -1;
        }
+#else
+       // MySQL++ works under Visual C++ 2003 with only one excpetion,
+       // SSQLS, so we have to stub out the examples to avoid build errors.
+       cout << argv[0] << " requires Visual C++ 2005 or newer." << endl;
+#endif
 
        return 0;
 }

Modified: trunk/examples/custom2.cpp
URL: 
http://svn.gna.org/viewcvs/mysqlpp/trunk/examples/custom2.cpp?rev=2068&r1=2067&r2=2068&view=diff
==============================================================================
--- trunk/examples/custom2.cpp (original)
+++ trunk/examples/custom2.cpp Thu Jan  3 08:38:49 2008
@@ -36,6 +36,7 @@
 int
 main(int argc, char *argv[])
 {
+#if defined(MYSQLPP_SSQLS_COMPATIBLE)
        // Get database access parameters from command line
     const char* db = 0, *server = 0, *user = 0, *pass = "";
        if (!parse_command_line(argc, argv, &db, &server, &user, &pass)) {
@@ -83,6 +84,11 @@
                cerr << "Error: " << er.what() << endl;
                return -1;
        }
+#else
+       // MySQL++ works under Visual C++ 2003 with only one excpetion,
+       // SSQLS, so we have to stub out the examples to avoid build errors.
+       cout << argv[0] << " requires Visual C++ 2005 or newer." << endl;
+#endif
 
        return 0;
 }

Modified: trunk/examples/custom3.cpp
URL: 
http://svn.gna.org/viewcvs/mysqlpp/trunk/examples/custom3.cpp?rev=2068&r1=2067&r2=2068&view=diff
==============================================================================
--- trunk/examples/custom3.cpp (original)
+++ trunk/examples/custom3.cpp Thu Jan  3 08:38:49 2008
@@ -36,6 +36,7 @@
 int
 main(int argc, char *argv[])
 {
+#if defined(MYSQLPP_SSQLS_COMPATIBLE)
        // Get database access parameters from command line
     const char* db = 0, *server = 0, *user = 0, *pass = "";
        if (!parse_command_line(argc, argv, &db, &server, &user, &pass)) {
@@ -103,6 +104,11 @@
                cerr << "Error: " << er.what() << endl;
                return -1;
        }
+#else
+       // MySQL++ works under Visual C++ 2003 with only one excpetion,
+       // SSQLS, so we have to stub out the examples to avoid build errors.
+       cout << argv[0] << " requires Visual C++ 2005 or newer." << endl;
+#endif
 
        return 0;
 }

Modified: trunk/examples/custom4.cpp
URL: 
http://svn.gna.org/viewcvs/mysqlpp/trunk/examples/custom4.cpp?rev=2068&r1=2067&r2=2068&view=diff
==============================================================================
--- trunk/examples/custom4.cpp (original)
+++ trunk/examples/custom4.cpp Thu Jan  3 08:38:49 2008
@@ -38,6 +38,7 @@
 int
 main(int argc, char *argv[])
 {
+#if defined(MYSQLPP_SSQLS_COMPATIBLE)
        // Get database access parameters from command line
     const char* db = 0, *server = 0, *user = 0, *pass = "";
        if (!parse_command_line(argc, argv, &db, &server, &user, &pass)) {
@@ -95,6 +96,11 @@
                cerr << "Error: " << er.what() << endl;
                return -1;
        }
+#else
+       // MySQL++ works under Visual C++ 2003 with only one excpetion,
+       // SSQLS, so we have to stub out the examples to avoid build errors.
+       cout << argv[0] << " requires Visual C++ 2005 or newer." << endl;
+#endif
 
        return 0;
 }

Modified: trunk/examples/custom5.cpp
URL: 
http://svn.gna.org/viewcvs/mysqlpp/trunk/examples/custom5.cpp?rev=2068&r1=2067&r2=2068&view=diff
==============================================================================
--- trunk/examples/custom5.cpp (original)
+++ trunk/examples/custom5.cpp Thu Jan  3 08:38:49 2008
@@ -38,6 +38,7 @@
 int
 main(int argc, char *argv[])
 {
+#if defined(MYSQLPP_SSQLS_COMPATIBLE)
        // Get database access parameters from command line
     const char* db = 0, *server = 0, *user = 0, *pass = "";
        if (!parse_command_line(argc, argv, &db, &server, &user, &pass)) {
@@ -80,6 +81,11 @@
                cerr << "Error: " << er.what() << endl;
                return -1;
        }
+#else
+       // MySQL++ works under Visual C++ 2003 with only one excpetion,
+       // SSQLS, so we have to stub out the examples to avoid build errors.
+       cout << argv[0] << " requires Visual C++ 2005 or newer." << endl;
+#endif
 
        return 0;
 }

Modified: trunk/examples/stock.h
URL: 
http://svn.gna.org/viewcvs/mysqlpp/trunk/examples/stock.h?rev=2068&r1=2067&r2=2068&view=diff
==============================================================================
--- trunk/examples/stock.h (original)
+++ trunk/examples/stock.h Thu Jan  3 08:38:49 2008
@@ -25,6 +25,9 @@
 ***********************************************************************/
 
 #include <mysql++.h>
+
+#if defined(MYSQLPP_SSQLS_COMPATIBLE)
+
 #include <custom.h>
 
 // The following is calling a very complex macro which will create
@@ -45,3 +48,5 @@
        mysqlpp::sql_date, sdate,
        mysqlpp::Null<mysqlpp::sql_mediumtext>, description)
 
+#endif
+

Modified: trunk/lib/custom.pl
URL: 
http://svn.gna.org/viewcvs/mysqlpp/trunk/lib/custom.pl?rev=2068&r1=2067&r2=2068&view=diff
==============================================================================
--- trunk/lib/custom.pl (original)
+++ trunk/lib/custom.pl Thu Jan  3 08:38:49 2008
@@ -47,10 +47,6 @@
 # No user-serviceable parts below.
 
 use strict;
-use Getopt::Std;
-
-our ($opt_v);
-getopts('v') or die "usage: custom.pl [-v]\n";
 
 open (OUT0, ">custom.h");
 open (OUT, ">custom-macros.h");
@@ -62,11 +58,15 @@
 // not modify this file directly. Change the script instead.
 // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 
-#ifndef MYSQLPP_CUSTOM_H
+#if !defined(MYSQLPP_CUSTOM_H)
 #define MYSQLPP_CUSTOM_H
 
 #include "noexceptions.h"
 #include "sql_types.h"
+
+#if !defined(MYSQLPP_SSQLS_COMPATIBLE)
+#      error Your compiler is not compatible with the SSQLS feature!
+#endif
 
 #include <string>
 
@@ -85,26 +85,14 @@
 namespace mysqlpp {
 
 enum sql_dummy_type { sql_dummy };
----
-
-my ($suppress_statics_start, $suppress_statics_end) = ('', '');
-unless ($opt_v) {
-       print OUT0 << "---";
-
-#if defined(_MSC_VER) && (_MSC_VER < 1400)
-#      error Please run the MySQL++ script lib/custom.pl with the -v 
compatibility flag.
+
+#ifdef MYSQLPP_SSQLS_NO_STATICS
+#      define MYSQLPP_SSQLS_CONDITIONAL_STATICS(...)
+#else
+#      define MYSQLPP_SSQLS_CONDITIONAL_STATICS(...) __VA_ARGS__
 #endif
 
-#ifdef MYSQLPP_SSQLS_NO_STATICS
-#      define MYSQLPP_SSQLS_EXPAND(...)
-#else
-#      define MYSQLPP_SSQLS_EXPAND(...) __VA_ARGS__
-#endif
-
----
-       $suppress_statics_start = 'MYSQLPP_SSQLS_EXPAND(';
-       $suppress_statics_end = ')';
-}
+---
 
 my @types = ("Date", "DateTime", "Time", "String", "std::string");
 foreach my $type (@types) {
@@ -165,7 +153,7 @@
 
 } // end namespace mysqlpp
 
-#endif
+#endif // !defined(MYSQLPP_CUSTOM_H)
 
 ---
 
@@ -705,12 +693,12 @@
     NAME##_cus_equal_list<Manip> equal_list(mysqlpp::cchar *d, mysqlpp::cchar 
*c, Manip m, 
                                                mysqlpp::sql_cmp_type sc) const;
   }; 
-  $suppress_statics_start
-  const char *NAME::names[] = { 
-$names 
-  }; 
-  const char *NAME::_table = #NAME ;
-  $suppress_statics_end
+  MYSQLPP_SSQLS_CONDITIONAL_STATICS(
+         const char *NAME::names[] = { 
+                $names
+         }; 
+         const char *NAME::_table = #NAME ;
+  )
 
   template <class Manip>
   NAME##_cus_value_list<Manip>::NAME##_cus_value_list


_______________________________________________
Mysqlpp-commits mailing list
[email protected]
https://mail.gna.org/listinfo/mysqlpp-commits

Reply via email to