On 5/8/08, Teg <[EMAIL PROTECTED]> wrote:
> Hello P,
>
>  If you use parameterized inserts doesn't this whole issue just go
>  away? I used to have to mess with escaping strings and so forth. Now
>  that I compile and bind the strings to the statements, I don't have to
>  mess with it any more.

You are correct. My experience is with Perl DBI, and using bind vars,
all that escaping/quoting mess is not my job but DBI's job.

I am not sure if the OP has the luxury of using bind vars and what
technology he is using. I am just responding to the X problem instead
of to the XY problem [1].

[1] http://www.perlmonks.org/index.pl?node_id=542341



>
>  C
>
>
>  Thursday, May 8, 2008, 9:11:40 AM, you wrote:
>
>
>  PK> On 5/8/08, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>  >> I am converting text data from another database into SQLite. Some text
>  >>  data has embedded apostrophes like this:
>  >>
>  >>     This was George's big day
>  >>
>  >>  Other data has embedded double quotes like this:
>  >>
>  >>     The box is 3" wide
>  >>
>  >>  I am generating INSERT INTO statements for thousands of records to be 
> used
>  >>  in a Windows script to move the data into SQLite. I am needing to use
>  >>  different statement (with different delmiters) for each of the above
>  >>  2 scenarios:
>  >>
>  >>  INSERT INTO tbl VALUES("This was George's big day");
>  >>  INSERT INTO tbl VALUES('The box is 3" wide');
>
>
> PK> INSERT INTO tbl VALUES ('This was George''s big day');
>  PK> INSERT INTO tbl VALUES ('The box is 3" wide');
>
>  PK> The text delimiter in SQL is '
>  PK> You escape a ' with another '
>
>
>
>  >>
>  >>  Double-quotes wrap the apostrophe in #1, apostrophes wrap the 
> double-quote
>  >>  in #2. But this means I need to parse the data content for every field in
>  >>  order to generate the INSERTs. Is there a single set of delimiters that
>  >>  would handle both scenarios without having to parse the data first?
>  >>
>  >>  Chris
>  >>
>  >>  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>  >>  Christopher F. Martin
>  >>  School of Medicine
>  >>  Center for Digestive Diseases & Nutrition
>  >>  CB# 7555, 4104 Bioinformatics Bldg.
>  >>  University of North Carolina at Chapel Hill
>  >>  Chapel Hill, North Carolina 27599-7555
>  >>  Phone: 919.966.9340       Fax: 919.966.7592
>  >>  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>  >>
>  >>
>
> PK> _______________________________________________
>  PK> sqlite-users mailing list
>  PK> sqlite-users@sqlite.org
>  PK> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
>
>
>
>  --
>  Best regards,
>   Teg                            mailto:[EMAIL PROTECTED]
>
>
>  _______________________________________________
>  sqlite-users mailing list
>  sqlite-users@sqlite.org
>  http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>


-- 
Puneet Kishor http://punkish.eidesis.org/
Nelson Institute for Environmental Studies http://www.nelson.wisc.edu/
Open Source Geospatial Foundation (OSGeo) http://www.osgeo.org/
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to