Re: [sqlite] How to Use an Apostrophe in a Text Field?
>True. I will get rid of the habit of using double quotes for string >literals. >Thanks for information. But most of the databases support this non >standard >behavior. Yeah ... until things break under your feet due to a new version not sticking to the "non-standard" behavior anymore or parser unable to raise ambiguity in the way you expect in unexpected corner case. I hate it when such simple details get an opportunity to cause premium havoc. ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] How to Use an Apostrophe in a Text Field?
Hi, True. I will get rid of the habit of using double quotes for string literals. Thanks for information. But most of the databases support this non standard behavior. Thanks Venkat VENKAT From: Jean-Christophe Deschamps To: General Discussion of SQLite Database Sent: Thu, April 21, 2011 4:03:49 PM Subject: Re: [sqlite] How to Use an Apostrophe in a Text Field? > The apostrophes are escaped by apostrophes. Correct. http://www.sqlite.org/faq.html#q14 > One more way you can do. > >insert into () values ("*Goin' Down > >> the Road Feelin' Bad*"); > >It is double quotes before and after *. Similarly double quotes will >be escaped by one more double quote Don't do that: it can reveal a pitfall. It's not SQL even if SQLite does its best to interpret it without issuing an error. Double quotes should be reserved to enclose database, table and column names, not string literals. SQLite also accepts square brackets as well: "My Table" is the same as [My Table]. Only use single quotes (apostrophes) for string literals. A statement like: delete from "my table" where column = "column"; is prone to disapoint you! http://www.sqlite.org/faq.html#q24 ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] How to Use an Apostrophe in a Text Field?
> The apostrophes are escaped by apostrophes. Correct. http://www.sqlite.org/faq.html#q14 > One more way you can do. > >insert into () values ("*Goin' Down > >> the Road Feelin' Bad*"); > >It is double quotes before and after *. Similarly double quotes will >be escaped by one more double quote Don't do that: it can reveal a pitfall. It's not SQL even if SQLite does its best to interpret it without issuing an error. Double quotes should be reserved to enclose database, table and column names, not string literals. SQLite also accepts square brackets as well: "My Table" is the same as [My Table]. Only use single quotes (apostrophes) for string literals. A statement like: delete from "my table" where column = "column"; is prone to disapoint you! http://www.sqlite.org/faq.html#q24 ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] How to Use an Apostrophe in a Text Field?
Sorry if my reply didn't make it through the first time, but doubling up on the apostrophes worked just fine. My thanks to those of you who suggested it. On Thu, Apr 21, 2011 at 4:27 AM, venkat easwar wrote: > > > The apostrophes are escaped by apostrophes. One more way you can do. > > insert into () values ("*Goin' Down > >> the Road Feelin' Bad*"); > > It is double quotes before and after *. Similarly double quotes will be > escaped > by one more double quote > VENKAT > > > > > > From: Jim Morris > To: General Discussion of SQLite Database > Sent: Mon, April 18, 2011 8:25:54 PM > Subject: Re: [sqlite] How to Use an Apostrophe in a Text Field? > > Did you try doubling the apostrophes? > > *Goin'' Down the Road Feelin'' Bad* > > > On 4/17/2011 6:16 PM, Simon Slavin wrote: > > On 17 Apr 2011, at 11:54pm, Alan Holbrook wrote: > > > >> I'm using SQLite with VBE2008. I've defined a table with a number of > text > >> fields in it. If the information I want to write to the database > contains > >> an embedded apostrophe, the program throws an error. That is, if I set > >> textfield1 to *Going Down the Road Feeling Bad*, the data gets written > >> correctly and the program continues. But if I set textfield1 to *Goin' > Down > >> the Road Feelin' Bad*, I get an error. > >> > >> Is there a way I can use an apostrophe in the data to be written? > > Your library might do it for you. If you're writing directly to the > SQLite > >library then I believe you can double the apostrophe: > > > > Goin'' Down the Road Feelin'' Bad > > > > so it might be worth trying that. > > > > Simon. > > ___ > > sqlite-users mailing list > > sqlite-users@sqlite.org > > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > > > ___ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > ___ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] How to Use an Apostrophe in a Text Field?
The apostrophes are escaped by apostrophes. One more way you can do. insert into () values ("*Goin' Down >> the Road Feelin' Bad*"); It is double quotes before and after *. Similarly double quotes will be escaped by one more double quote VENKAT From: Jim Morris To: General Discussion of SQLite Database Sent: Mon, April 18, 2011 8:25:54 PM Subject: Re: [sqlite] How to Use an Apostrophe in a Text Field? Did you try doubling the apostrophes? *Goin'' Down the Road Feelin'' Bad* On 4/17/2011 6:16 PM, Simon Slavin wrote: > On 17 Apr 2011, at 11:54pm, Alan Holbrook wrote: > >> I'm using SQLite with VBE2008. I've defined a table with a number of text >> fields in it. If the information I want to write to the database contains >> an embedded apostrophe, the program throws an error. That is, if I set >> textfield1 to *Going Down the Road Feeling Bad*, the data gets written >> correctly and the program continues. But if I set textfield1 to *Goin' Down >> the Road Feelin' Bad*, I get an error. >> >> Is there a way I can use an apostrophe in the data to be written? > Your library might do it for you. If you're writing directly to the SQLite >library then I believe you can double the apostrophe: > > Goin'' Down the Road Feelin'' Bad > > so it might be worth trying that. > > Simon. > ___ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] How to Use an Apostrophe in a Text Field?
Thanks to all for all the suggestions. Doubling up the apostrophe worked. On Mon, Apr 18, 2011 at 10:55 AM, Jim Morris wrote: > Did you try doubling the apostrophes? > > *Goin'' Down the Road Feelin'' Bad* > > > On 4/17/2011 6:16 PM, Simon Slavin wrote: > > On 17 Apr 2011, at 11:54pm, Alan Holbrook wrote: > > > >> I'm using SQLite with VBE2008. I've defined a table with a number of > text > >> fields in it. If the information I want to write to the database > contains > >> an embedded apostrophe, the program throws an error. That is, if I set > >> textfield1 to *Going Down the Road Feeling Bad*, the data gets written > >> correctly and the program continues. But if I set textfield1 to *Goin' > Down > >> the Road Feelin' Bad*, I get an error. > >> > >> Is there a way I can use an apostrophe in the data to be written? > > Your library might do it for you. If you're writing directly to the > SQLite library then I believe you can double the apostrophe: > > > > Goin'' Down the Road Feelin'' Bad > > > > so it might be worth trying that. > > > > Simon. > > ___ > > sqlite-users mailing list > > sqlite-users@sqlite.org > > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > > > ___ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] How to Use an Apostrophe in a Text Field?
Did you try doubling the apostrophes? *Goin'' Down the Road Feelin'' Bad* On 4/17/2011 6:16 PM, Simon Slavin wrote: > On 17 Apr 2011, at 11:54pm, Alan Holbrook wrote: > >> I'm using SQLite with VBE2008. I've defined a table with a number of text >> fields in it. If the information I want to write to the database contains >> an embedded apostrophe, the program throws an error. That is, if I set >> textfield1 to *Going Down the Road Feeling Bad*, the data gets written >> correctly and the program continues. But if I set textfield1 to *Goin' Down >> the Road Feelin' Bad*, I get an error. >> >> Is there a way I can use an apostrophe in the data to be written? > Your library might do it for you. If you're writing directly to the SQLite > library then I believe you can double the apostrophe: > > Goin'' Down the Road Feelin'' Bad > > so it might be worth trying that. > > Simon. > ___ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] How to Use an Apostrophe in a Text Field?
On 17 Apr 2011, at 11:54pm, Alan Holbrook wrote: > I'm using SQLite with VBE2008. I've defined a table with a number of text > fields in it. If the information I want to write to the database contains > an embedded apostrophe, the program throws an error. That is, if I set > textfield1 to *Going Down the Road Feeling Bad*, the data gets written > correctly and the program continues. But if I set textfield1 to *Goin' Down > the Road Feelin' Bad*, I get an error. > > Is there a way I can use an apostrophe in the data to be written? Your library might do it for you. If you're writing directly to the SQLite library then I believe you can double the apostrophe: Goin'' Down the Road Feelin'' Bad so it might be worth trying that. Simon. ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] How to Use an Apostrophe in a Text Field?
On Sun, Apr 17, 2011 at 3:54 PM, Alan Holbrook wrote: > I'm using SQLite with VBE2008. I've defined a table with a number of text > fields in it. If the information I want to write to the database contains > an embedded apostrophe, the program throws an error. That is, if I set > textfield1 to *Going Down the Road Feeling Bad*, the data gets written > correctly and the program continues. But if I set textfield1 to *Goin' Down > the Road Feelin' Bad*, I get an error. > > Is there a way I can use an apostrophe in the data to be written? I'm guessing you're making a statement like INSERT INTO foo VALUES('Goin' Down the Road Feelin' Bad'), which obviously won't work. You should instead use prepared statements, which do not have this problem. An alternative is to escape your input, but that is still error-prone and slower. -- Cory Nelson http://int64.org ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] How to Use an Apostrophe in a Text Field?
On Apr 17, 2011, at 5:54 PM, Alan Holbrook wrote: > I'm using SQLite with VBE2008. I've defined a table with a number of text > fields in it. If the information I want to write to the database contains > an embedded apostrophe, the program throws an error. That is, if I set > textfield1 to *Going Down the Road Feeling Bad*, the data gets written > correctly and the program continues. But if I set textfield1 to *Goin' Down > the Road Feelin' Bad*, I get an error. > > Is there a way I can use an apostrophe in the data to be written? Escape the apostrophe using the conventions of your VBE2008, or better yet, use bind values. > ___ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
[sqlite] How to Use an Apostrophe in a Text Field?
I'm using SQLite with VBE2008. I've defined a table with a number of text fields in it. If the information I want to write to the database contains an embedded apostrophe, the program throws an error. That is, if I set textfield1 to *Going Down the Road Feeling Bad*, the data gets written correctly and the program continues. But if I set textfield1 to *Goin' Down the Road Feelin' Bad*, I get an error. Is there a way I can use an apostrophe in the data to be written? ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users