List:MySQL++« Previous MessageNext Message »
From:Chris Frey Date:August 27 2008 9:19am
Subject:[PATCH] Fix query overwrite bug
View as plain text  
Hi folks,

I browsed through the Wishlist and found this item that needed attention.
I've only tested this in my own test program, as I don't have Bakefile
working yet.  But I'm fairly confident this is the correct fix. :-)

Patch is in git-format-patch format, but should apply cleanly with any patch.

- Chris


From 96fc7622889e1fd252de10ef968af2b95762f673 Mon Sep 17 00:00:00 2001
From: Chris Frey <cdfrey@stripped>
Date: Wed, 27 Aug 2008 05:18:40 -0400
Subject: [PATCH] Fix query overwrite bug

After initializing the stream and setting the streambuf, the stream's
position as reported by tellp() is 0.  So seek to the end, so any further
operator<<() operations will work as expected.
---
 lib/query.cpp |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/lib/query.cpp b/lib/query.cpp
index 3824d77..5f0537a 100644
--- a/lib/query.cpp
+++ b/lib/query.cpp
@@ -47,6 +47,7 @@ copacetic_(true)
 	init(&sbuffer_);
 	if (qstr) {
 		sbuffer_.str(qstr);
+		seekp(0, std::ios::end);
 	}
 }
 
-- 
1.5.4.4

Thread
[PATCH] Fix query overwrite bugChris Frey27 Aug
  • Re: [PATCH] Fix query overwrite bugWarren Young27 Aug