PDA

View Full Version : SQLITE - escape sequences does not work


dmla
12-03-2004, 01:18 PM
SQLITE - escape sequences does not work.
I have database (made from example in sqlite plugin). I saved there string like "\t123123123\n\t567567567".
Then from example:

sRule = tRules.Data[nItemRowNumber]["Rule"];
Input.SetText("Input_Info_Display", sRule);

And on the screen I can see:

\t123123123\n\t567567567

Why escape sequences does not work?

Brett
12-03-2004, 01:49 PM
Because the string from the database doesn't contain the ASCII value for a tab, it contains the charecter values of "\" and "t". Therefore the script interpreter also sees it that way.

dmla
12-04-2004, 12:53 PM
So, can you help me to solve the problem??
Anyway thx for answer.

Worm
12-04-2004, 01:13 PM
function Reformat(sSourceString)
sSourceString = String.Replace(sSourceString, "\\t", "\t", false);
sSourceString = String.Replace(sSourceString, "\\n", "\n", false);
sSourceString = String.Replace(sSourceString, "\\r", "\r", false);
return sSourceString;
end


sRule = tRules.Data[nItemRowNumber]["Rule"];
sRule = Reformat(sRule);
Input.SetText("Input_Info_Display", sRule);

dmla
12-15-2004, 10:50 AM
Worm - Big Thanx to you.
I will try to do it, but "You, Worm - are my friend".

Thnx again :)

sferguson
12-15-2004, 02:18 PM
Worm!

On behalf of the AMS community, please accept this little note of thanks for sharing all the insights re: SQLite stuff, particularly the tips on using escape sequences and variables with queries, et. al. Personally, I'm knee deep in my first real AMS SQLite project, and your posts on these issues have made all the difference.

So, please accept this "100 pound Virtual Fruitcake" as a small token of our collective gratitude.

http://fruitcake.fergusonsystems.com/fruitcake.jpg

Like the Hallmark Card Company always says... "It's the thought that counts". :p While it may not fill your belly, hopefully it will bring a smile to your face.

Worm
12-15-2004, 02:23 PM
mmmmmmmmmmmmmmmmm, FruitCake!

Thank you for the kind words. I appreciate them. (and the FruitCake, can't forget the fruitcake?).

And yes, I'm smiling :)

TJ_Tigger
12-15-2004, 05:45 PM
That is the best type of fruitcake . . . virtual.