Hello.
Not a terribly long-term user, only since around April 2004. First time
poster.
We are currently using MySQL++ 1.7.9 on a Solaris 2.8 system with gcc
2.95. Yeah, it's old.
We're working to upgrade to gcc 3.3.2, and I also decided to try out
MySQL++ 1.7.17.
I found that I needed to apply these patches to both handle STL-related
issues as well as our
non-standard installation location for MySQL itself.
1. configure and configure.in needed quotes around the value assigned to
MYSQL_lib_check
and MYSQL_inc_check, or else the specification of --with-mysql would
cause this to be
executed:
MYSQL_lib_check=$with_mysql/lib/mysql $with_mysql/lib
sh will interpret this to mean "for the execution of
$with_mysql/lib, assign $with_mysql/lib/mysql to MYSQL_lib_check".
This will show up in the execution of configure as a complaint about
the $with_mysql/lib directory not being executable.
2. Replaced inclusion of <strstream> with <sstream>.
[Deprecated]
3. Replaced subclassing of std::strstream with std::stringstream.
[Deprecated]
4. Replaced use of ostrstream with ostringstream.
[Deprecated]
5. Replaced call to pcount() with "rdbuf()->str().size()".
[pcount() isn't to be found within the stringstream classes]
6. Removed call to ostrstream::freeze().
[Same fate as pcount]
I don't know whether these changes will cause problems on other systems.
David
Index: configure
===================================================================
RCS file: /csa/cvs/extern/mysql++-1.7.17/configure,v
retrieving revision 1.1
diff -u -r1.1 configure
--- configure 1 Oct 2004 15:23:16 -0000 1.1
+++ configure 1 Oct 2004 15:50:11 -0000
@@ -19185,8 +19185,8 @@
# Check whether --with-mysql or --without-mysql was given.
if test "${with_mysql+set}" = set; then
withval="$with_mysql"
- MYSQL_lib_check=$with_mysql/lib/mysql $with_mysql/lib
-MYSQL_inc_check=$with_mysql/include/mysql
+ MYSQL_lib_check="$with_mysql/lib/mysql $with_mysql/lib"
+MYSQL_inc_check="$with_mysql/include/mysql"
else
MYSQL_lib_check="/usr/local/mysql/lib/mysql /usr/local/lib/mysql
/opt/mysql/lib/mysql /usr/lib/mysql /usr/local/mysql/lib /usr/local/lib
/opt/mysql/lib /usr/lib"
MYSQL_inc_check="/usr/local/mysql/include/mysql
/usr/local/include/mysql /opt/mysql/include/mysql /usr/include/mysql"
Index: configure.in
===================================================================
RCS file: /csa/cvs/extern/mysql++-1.7.17/configure.in,v
retrieving revision 1.1
diff -u -r1.1 configure.in
--- configure.in 1 Oct 2004 15:23:17 -0000 1.1
+++ configure.in 1 Oct 2004 15:27:19 -0000
@@ -25,8 +25,8 @@
#
AC_ARG_WITH(mysql,
[ --with-mysql=<path> root directory path of MySQL
installation],
- [MYSQL_lib_check=$with_mysql/lib/mysql $with_mysql/lib
-MYSQL_inc_check=$with_mysql/include/mysql],
+ [MYSQL_lib_check="$with_mysql/lib/mysql $with_mysql/lib"
+MYSQL_inc_check="$with_mysql/include/mysql"],
[MYSQL_lib_check="/usr/local/mysql/lib/mysql /usr/local/lib/mysql
/opt/mysql/lib/mysql /usr/lib/mysql /usr/local/mysql/lib /usr/local/lib
/opt/mysql/lib /usr/lib"
MYSQL_inc_check="/usr/local/mysql/include/mysql
/usr/local/include/mysql /opt/mysql/include/mysql /usr/include/mysql"])
Index: examples/load_file.cc
===================================================================
RCS file: /csa/cvs/extern/mysql++-1.7.17/examples/load_file.cc,v
retrieving revision 1.1
diff -u -r1.1 load_file.cc
--- examples/load_file.cc 1 Oct 2004 15:23:27 -0000 1.1
+++ examples/load_file.cc 1 Oct 2004 15:50:11 -0000
@@ -22,7 +22,7 @@
Connection con(use_exceptions);
try {
con.real_connect
(MY_DATABASE,MY_HOST,MY_USER,MY_PASSWORD,3306,(int)0,60,NULL);
- Query query = con.query(); ostrstream strbuf;
+ Query query = con.query(); ostringstream strbuf;
ifstream In (argv[1],ios::in | ios::binary); struct stat
for_len;
if ((In.rdbuf())->is_open()) {
if (stat (argv[1],&for_len) == -1) return -1;
Index: examples/updel_x_.cc
===================================================================
RCS file: /csa/cvs/extern/mysql++-1.7.17/examples/updel_x_.cc,v
retrieving revision 1.1
diff -u -r1.1 updel_x_.cc
--- examples/updel_x_.cc 1 Oct 2004 15:23:29 -0000 1.1
+++ examples/updel_x_.cc 1 Oct 2004 15:50:11 -0000
@@ -14,7 +14,7 @@
int main (void) {
Connection con(use_exceptions);
try {
- ostrstream strbuf; unsigned int i=0;
+ ostringstream strbuf; unsigned int i=0;
con.real_connect
(MY_DATABASE,MY_HOST,MY_USER,MY_PASSWORD,3306,(int)0,60,NULL);
Query query = con.query(); query << MY_QUERY;
ResUse res = query.use(); Row row;
Index: sqlplusint/datetime1.hh
===================================================================
RCS file: /csa/cvs/extern/mysql++-1.7.17/sqlplusint/datetime1.hh,v
retrieving revision 1.1
diff -u -r1.1 datetime1.hh
--- sqlplusint/datetime1.hh 1 Oct 2004 15:23:32 -0000 1.1
+++ sqlplusint/datetime1.hh 1 Oct 2004 15:27:19 -0000
@@ -2,7 +2,7 @@
#define __datetime1_hh__
#include <string>
-#include <strstream>
+#include <sstream>
#include <iostream>
#include "defs.hh"
Index: sqlplusint/sql_query.cc
===================================================================
RCS file: /csa/cvs/extern/mysql++-1.7.17/sqlplusint/sql_query.cc,v
retrieving revision 1.1
diff -u -r1.1 sql_query.cc
--- sqlplusint/sql_query.cc 1 Oct 2004 15:23:37 -0000 1.1
+++ sqlplusint/sql_query.cc 1 Oct 2004 15:27:19 -0000
@@ -32,7 +32,7 @@
char * SQLQuery::preview_char() {
*this << std::ends;
- uint length = pcount();
+ uint length = rdbuf()->str().size();
char *s = new char[length + 1];
get(s, length, '\0');
seekg (0,std::ios::beg);
@@ -92,7 +92,7 @@
SQLQuery *const_this = const_cast<SQLQuery *>(this);
if (!parsed.empty()) const_this->proc(const_cast<SQLQueryParms&>(p));
*const_this << std::ends;
- uint length = const_this->pcount() + 1;
+ uint length = const_this->rdbuf()->str().size() + 1;
char* s = new char[length];
const_this->get(s, length, '\0');
const_this->seekg (0,std::ios::beg);
Index: sqlplusint/sql_query1.hh
===================================================================
RCS file: /csa/cvs/extern/mysql++-1.7.17/sqlplusint/sql_query1.hh,v
retrieving revision 1.1
diff -u -r1.1 sql_query1.hh
--- sqlplusint/sql_query1.hh 1 Oct 2004 15:23:37 -0000 1.1
+++ sqlplusint/sql_query1.hh 1 Oct 2004 15:27:19 -0000
@@ -1,7 +1,7 @@
#ifndef __sql_query_1_hh
#define __sql_query_1_hh
-#include <strstream>
+#include <sstream>
#include <vector>
#include <map>
#include "define_short.hh"
@@ -98,9 +98,9 @@
// wish to also be able to execute the queries without having to send
// them to the *Connection* object.
//
-// This class is subclassed from *strstream*. This means that you can
+// This class is subclassed from *stringstream*. This means that you
can
// write to it like a stream to avoid having to piece parts together
-// by creating you own *strstream* or by using *sprintf*. Although you
+// by creating you own *stringstream* or by using *sprintf*. Although
you
// can read from query because it is a stream this is _not_
// recommended. I can not guarantee the predictability of the class if
// you do and will offer no help if you run into problems when you do
@@ -109,7 +109,7 @@
// your query before you try to use any of the *SQLQuery* specific
// methods except for *error()* and *success()*.
-class SQLQuery : public std::strstream {
+class SQLQuery : public std::stringstream {
friend class SQLQueryParms;
private:
char* preview_char();
Index: sqlplusint/stream2string3.hh
===================================================================
RCS file: /csa/cvs/extern/mysql++-1.7.17/sqlplusint/stream2string3.hh,v
retrieving revision 1.1
diff -u -r1.1 stream2string3.hh
--- sqlplusint/stream2string3.hh 1 Oct 2004 15:23:38 -0000
1.1
+++ sqlplusint/stream2string3.hh 1 Oct 2004 15:27:19 -0000
@@ -1,15 +1,14 @@
#ifndef __stream2string3_hh__
#define __stream2string3_hh__
-#include <strstream>
+#include <sstream>
template<class Strng, class T>
Strng stream2string(const T &object) {
- std::ostrstream str;
+ std::ostringstream str;
object.out_stream(str);
str << std::ends;
Strng s = str.str();
- str.freeze(0);
return s;
}