Re: [sqlite] trimming with tab and other special characters
On Tue, Nov 29, 2016 at 4:19 PM, Igor Tandetnikwrote: That's the exact opposite of your interpretation. For backslash escapes, > you need to rely on "facilities of your programming language". If you > cannot, and must use raw SQL queries, there are still ways to represent > arbitrary characters, but backslash escapes is not one of them. > Yes, my fault. ___ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] trimming with tab and other special characters
On 11/29/2016 4:00 AM, Max Vlasov wrote: I wonder why OP and other authors of the discussion https://www.mail-archive.com/sqlite-users@mailinglists.sqlite.org/msg49355.html was so sure about backslash escaping support, even Igor Tandetnik :) I said, and I quote: """ If you do it in your program, just put those characters in the query string or bound parameter string, using facilities of your programming language. E.g. in C that would be something like "trim(vEmail, ' \t\n')". If you do it manually from, say, command line interface, you can do this: update mytable set mycolumn=trim(mycolumn, cast(X'20090A' as text)); """ That's the exact opposite of your interpretation. For backslash escapes, you need to rely on "facilities of your programming language". If you cannot, and must use raw SQL queries, there are still ways to represent arbitrary characters, but backslash escapes is not one of them. -- Igor Tandetnik ___ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] trimming with tab and other special characters
On 2016/11/29 11:00 AM, Max Vlasov wrote: Reasonable enough, I wonder why OP and other authors of the discussion https://www.mail-archive.com/sqlite-users@mailinglists.sqlite.org/msg49355.html was so sure about backslash escaping support, even Igor Tandetnik :) None of them were sure about backslash support or claimed it. I think you misread. If you read that more carefully, you will see that Igor was explaining how to do it in the "C" code before passing to SQLite API - that's very much different to claiming the actual "SQL" interpreter will understand backslash escaping. ___ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] trimming with tab and other special characters
Reasonable enough, I wonder why OP and other authors of the discussion https://www.mail-archive.com/sqlite-users@mailinglists.sqlite.org/msg49355.html was so sure about backslash escaping support, even Igor Tandetnik :) On Tue, Nov 29, 2016 at 11:39 AM, Clemens Ladischwrote: > Max Vlasov wrote: > > trim(col, char(9)) > > works, while > > trim(col,'\t') > > does not. > > SELECT trim('ttthello\tt\\\', '\t'); > hello > > Works as designed. > > SQL does not use backslash escaping. > Use char(9) or an actual tab character (' '). > > > Regards, > Clemens > ___ > sqlite-users mailing list > sqlite-users@mailinglists.sqlite.org > http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users > ___ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] trimming with tab and other special characters
Max Vlasov wrote: > trim(col, char(9)) > works, while > trim(col,'\t') > does not. SELECT trim('ttthello\tt\\\', '\t'); hello Works as designed. SQL does not use backslash escaping. Use char(9) or an actual tab character (' '). Regards, Clemens ___ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
[sqlite] trimming with tab and other special characters
Hi, the search in the mailing list about the trim function reveals possible escaping support for the second parameter of the function, but in my case (sqlite 3.15.1) trim(col, char(9)) works, while trim(col,'\t') does not. Can someone clarify on that? Thanks Max ___ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users