dbTalk Databases Forums  

Fix for VC++ insert()

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


Discuss Fix for VC++ insert() in the mailing.database.mysql-plusplus forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Mark Merendino
 
Posts: n/a

Default Fix for VC++ insert() - 04-26-2005 , 06:05 PM






------_=_NextPart_001_01C549D3.CB30019F
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

I have found a fix to the SQLQuerry::insert() problem for VC++ 7.1
=20
You need to use an explicit cast...=20
=20
(static_cast<std::stringstream&>(*this))=20
=20
So the method will look like....
=20
template <class T> SQLQuery& insert(const T &v) {

reset();

(static_cast<std::stringstream&>(*this)) << "INSERT INTO " << v.table()
<< " (" << v.field_list()

<< ") VALUES (" << v.value_list() << ")";

return *this;

}=20

Here is a link to a very good explanation of the bug and work around...
=20
http://groups-beta.google.com/group/...l/browse_threa
d/thread/9a68d84644e64f15/32829a8b52fcc42b?q=3Dstringstream+operator%3C%3=
C
+bug&rnum=3D24&hl=3Den#32829a8b52fcc42b
=20

------_=_NextPart_001_01C549D3.CB30019F--

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.