2 messages in com.mysql.lists.win32Re: Nested dialogs in input data
FromSent OnAttachments
Doru-Catalin Togea02 Aug 2002 08:23 
Paul DuBois02 Aug 2002 08:40 
Subject:Re: Nested dialogs in input data
From:Paul DuBois (pa@snake.net)
Date:08/02/2002 08:40:01 AM
List:com.mysql.lists.win32

At 17:23 +0200 8/2/02, Doru-Catalin Togea wrote:

Hi all!

I have another question:

I want to insert Bible text into a mysql database, and it sometimes contains nested dialogs, like:

Gen 3:2 And the woman said to the serpent, "We may eat the fruit of the trees of the garden; Gen 3:3 "but of the fruit of the tree which [is] in the midst of the garden, God has said, 'You shall not eat it, nor shall you touch it, lest you die.' "

I guess by now you understand my problem. However,

I want to insert each of the lines in its own row. The first line presents no problems, even though it contains a >"< character, because my sql statement would include the whole string in single quotes:

insert .... values (...., 'And the woman said to the serpent, "We may eat the fruit of the trees of the garden;');

The second line, however, contains nested dialogs where both double and single quotes are used as part of the text (that is as part of the input data), so that the first occurence of the single quote in the text will be interpreted as the end of the data, making the rest of the text superfluous parameters to my sql statement.

insert .... values (...., '"but of the fruit of the tree which [is] in the midst of the garden, God has said, 'You shall not eat it, nor shall you touch it, lest you die.' "');

What are my options?

The MySQL manual is your friend:

http://www.mysql.com/doc/S/t/String_syntax.html