I'm afraid I still get // % db eval "insert into t1 values('\\\\')" % //
Quoting Hell it still is... -Shamil D. "Lawrence Chitty" <[EMAIL PROTECTED] To: [EMAIL PROTECTED] lworld.com> cc: Subject: Re: [sqlite] How to handle slashes (\) in text columns 07/20/2004 05:30 PM ----- Original Message ----- From: <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, July 20, 2004 10:02 PM Subject: [sqlite] How to handle slashes (\) in text columns > I'm using the TCL binding of SQLITE and was trying to figure out how to > enter various characters into a text column. To enter a slash, all I > normally would do is to append another slash to it. However, this only > works fine if the slash is not the last character in the field. Consider > the following: > > % db eval "insert into t1 values('\')" > % <-- no character > > % db eval "insert into t1 values('\\')" > % \\ <-- slash did not escape!! > > % db eval "insert into t1 values('\\TEST')" > % \TEST <-- returns as expected > > % db eval "insert into t1 values('TEST\\')" > % TEST\\ <-- slash did not escape!! > > % db eval "insert into t1 values('\\TEST\\')" > % \\TEST\\ <-- now not even the first slash was escaped!! > > In short, what I'm asking is how can I insert text with one slash at the > end? I'm rather rusty on Tcl, but I think that this is what tcl'ers refer to as quoting hell. The short answer is that you need 4 slashes, e.g. db eval "insert into t1 values('\\\\')" The reason goes something like this - the first pass of the quoted stuff expands variables and does the slash escaping which leaves us with 2 slashes. The eval then causes the slash escaping to happen again. There may be better ways to handle this ?. I did a quick search but didn't come up with any conclusive. You could ask this question on comp.lang.tcl and see if they have a cleaner suggestion if no-one else here replies. Lawrence --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.721 / Virus Database: 477 - Release Date: 16/07/04 The information transmitted is intended only for the person(s)or entity to which it is addressed and may contain confidential and/or legally privileged material. Delivery of this message to any person other than the intended recipient(s) is not intended in any way to waive privilege or confidentiality. Any review, retransmission, dissemination or other use of , or taking of any action in reliance upon, this information by entities other than the intended recipient is prohibited. If you receive this in error, please contact the sender and delete the material from any computer. For Translation: http://www.baxter.com/email_disclaimer