Hi Jenei, On Wednesday, 2011-08-31 12:59:06 +0200, Jenei Gábor wrote:
Hello Eike, I made the changes you said, and I resolved the no linefeed issue also, I hope it is ok now, and can be pushed, actually for me worked fine with all types of comments. Also I tried to follow the principals you said. So, push it if you think there is no need to correct something.
You're on the right track :-) First, I have a question because I'm by no means an SQL expert:
+::rtl::OUString delComment(const ::rtl::OUString& sQuery){ [...] + for(size_t i=0;i<nQueryLen;i++){ + if(sCopy[i]=='\"' && !bIsText2 && !bComment) bIsText1=!bIsText1; + if(sCopy[i]=='\'' && !bIsText1 && !bComment) bIsText2=!bIsText2; + if(sCopy[i]=='\n' && bComment) bComment=false; + if(!bIsText1 && !bIsText2 && (i+1)<nQueryLen && sCopy[i]=='-' && sCopy[i+1]=='-') bComment=true; + if(!bIsText1 && !bIsText2 && (i+1)<nQueryLen && sCopy[i]=='/' && sCopy[i+1]=='/') bComment=true; + if(!bComment) sTemp.append(&sCopy[i],1);
This and the similar loop in getComment() treats also // as comment leader, I thought only -- is used for "comment until end of line"? A short web search didn't come up with anything different. Second, I erred earlier when I talked about the struct with nPos, I overlooked that doSaveAsDoc() reconstructs the query string with sTranslatedStmt = m_xComposer->getComposedQuery(); so actually the resulting sTranslatedStmt may be different from the original m_sStatement and the positions may not match and your previous approach with searching for LFs would be needed instead. Sorry for confusion. Just tell me about the // leader and I'll fix things up for you. Eike -- PGP/OpenPGP/GnuPG encrypted mail preferred in all private communication. Key ID: 0x293C05FD - 997A 4C60 CE41 0149 0DB3 9E96 2F1A D073 293C 05FD
Attachment:
signature.asc
Description: Digital signature