dbTalk Databases Forums  

Patch for const bug in mysql_dt_base::operator std::string ()

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


Discuss Patch for const bug in mysql_dt_base::operator std::string () in the mailing.database.mysql-plusplus forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Wolfram Arnold
 
Posts: n/a

Default Patch for const bug in mysql_dt_base::operator std::string () - 05-11-2005 , 04:13 AM






Hi,

The type conversion operator to std::string in mysql_dt_base
(datetime.h) should be declared const. Otherwise it leads to
compilation bugs with SSQL's that have a field of Date type which is
also comparable, e.g. the following would fail:

sql_create_1(PriceData,
1,
0,
Date, date);

with a compilation error of something like:

g++ -c -g -I. -I/usr/include/mysql -I/usr/src/mysql++-1.7.32/lib
db-update.cpp
db-update.cpp: In function `int sql_compare_PriceData(const PriceData&,
const
PriceData&) [with mysqlpp::sql_dummy_type dummy = sql_dummy]':
db-update.cpp:108: instantiated from here
db-update.cpp:402: error: passing `const mysqlpp:ate' as `this'
argument of `
mysqlpp::mysql_dt_base:perator std::string()' discards qualifiers
db-update.cpp:402: error: passing `const mysqlpp:ate' as `this'
argument of `
mysqlpp::mysql_dt_base:perator std::string()' discards qualifiers
make: *** [db-update.o] Error 1

Cheers,

Wolfram

Patch (relative to version 1.7.35) follows:

--- datetime.h.old 2005-05-11 00:57:53.000000000 -0700
+++ datetime.h 2005-05-11 01:59:19.000000000 -0700
@@ -21,7 +21,7 @@
struct mysql_dt_base {
virtual std:stream& out_stream(std:stream&) const = 0;

- operator std::string ();
+ operator std::string () const;
};

/// \if INTERNAL
@@ -160,7 +160,7 @@
return d.out_stream(s);
}

-inline mysql_dt_base:perator std::string()
+inline mysql_dt_base:perator std::string() const
{
return stream2string<std::string>(*this);
}



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