From: Frederic Cervenansky Date: Tue, 9 Feb 2010 16:20:34 +0000 (+0000) Subject: Big correction in Database query X-Git-Tag: CREATOOLS.2-0-3~56 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?p=creaImageIO.git;a=commitdiff_plain;h=13b605c6de821a35a519dd8aee048d1386443f51 Big correction in Database query --- diff --git a/src2/creaImageIOSQLiteTreeHandler.cpp b/src2/creaImageIOSQLiteTreeHandler.cpp index e9724c4..627db08 100644 --- a/src2/creaImageIOSQLiteTreeHandler.cpp +++ b/src2/creaImageIOSQLiteTreeHandler.cpp @@ -502,7 +502,7 @@ namespace creaImageIO } } - + // Create the attributes table for Root (i.e. Tree) LevelDescriptor::AttributeDescriptorListType::const_iterator a; for (a = GetTree().GetAttributeDescriptorList(0).begin(); @@ -533,22 +533,21 @@ namespace creaImageIO //======================================================================== /// - std::string& SQLformat(std::string& str) + void SQLformat(std::string i_str, std::string &o_str) { - // quote must be doubled - boost::algorithm::replace_all(str,"'","''"); - // Found strange strings which contained NULL char INSIDE string - int i,size=str.size(); - for (i=0;iGetAttributeMap().begin(); i != n->GetAttributeMap().end(); @@ -570,7 +570,8 @@ namespace creaImageIO } atts += "'" + i->first + "'"; - values += "'" + SQLformat(i->second) + "'"; + SQLformat(i->second, out); + values += "'" + out + "'"; atts += ","; values += ","; GimmickMessage(4,"'"<first<<"' = '"<second<<"'"<