8 messages in com.mysql.lists.plusplusRe: bug in Store() in mysql++ for Bor...
FromSent OnAttachments
Michael Masson26 Jun 2004 14:49 
Michael Masson26 Jun 2004 14:53 
bayufa29 Jun 2004 02:01 
Mark Scholtens29 Jun 2004 03:11 
sinisa29 Jun 2004 05:34 
sinisa29 Jun 2004 05:45 
bayufa29 Jun 2004 19:54 
sinisa30 Jun 2004 05:18 
Subject:Re: bug in Store() in mysql++ for Borland
From:bayufa (bay@bdg.centrin.net.id)
Date:06/29/2004 07:54:55 PM
List:com.mysql.lists.plusplus

Thanks

Yes , i already know that bug is exist . But im not sure ! Do i have to patch the bug manually or it already done using new version . My version is 1.7.9 !

my initial code snapshot is like this :

void ResUse::copy(const ResUse& other) { if (!other.mysql_res) { mysql_res=0; _types=0; _names=0; return; } if (initialized) purge(); throw_exceptions = other.throw_exceptions; mysql_res = other.mysql_res; _fields = other._fields; if (other._names) _names = new FieldNames(*other._names); else _names = NULL; if (other._types) _types = new FieldTypes(*other._types); else _types = NULL; mysql = other.mysql; initialized = true; }

1 . Could someone show me the patched code ?? because i'm affraid i will miss something !

Result res;

void sql(const char* q) { // dlog << "[ DB ] Query sent: " << q << endl; try { Query query = con->query();

// Use of dynamically allocated and manually cleaned Result // will eliminate memory leak

// if(res) delete res; // res=new Result(); // *res=query.store(q);

// MEMORY LEAK res=query.store(q);

2 . Above code is interesting . I just meet the code like that ! Is above code is recommended ??

3. Is mysql++ library is thread safe ?? because im using it very much in some thread .. what should i aware ?

1.7.9 does not have memory leaks.

the only one found so far, is the following one:

--- result_orig.cc 2002-11-14 03:19:28.000000000 +0100 +++ result.cc 2002-11-14 03:20:16.000000000 +0100 @@ -20,11 +20,11 @@ }

void ResUse::copy(const ResUse& other) { + if (initialized) + purge(); if (!other.mysql_res) { mysql_res=0; _types=0; _names=0; return; } - if (initialized) - purge(); throw_exceptions = other.throw_exceptions; mysql_res = other.mysql_res; _fields = other._fields;