Re: [sqlite] Adding data with periods

2008-12-15 Thread Eric Bohlman
Mohd Radzi Ibrahim wrote:
> It seems to works either way.
> 
> I'm just wondering is there any hidden reason that single quote is 
> preferred? Portability?
> Or is double-qoute has some kind of special meaning that we should use it 
> for that special purpose?

If what's enclosed in the double quotes winds up being a column name or 
other identifier, SQLite will treat it as an identifier rather than a 
literal. This can cause all sorts of unpleasant surprises, particularly 
of the "this was working fine until I made this cosmetic change..." sort.
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Adding data with periods

2008-12-15 Thread Chris Wedgwood
On Sun, Dec 14, 2008 at 11:04:56PM -0600, aditya siram wrote:

> sqlite> create table test_table ("Contents" varchar);
> sqlite> insert into test_table "hello . world";
> SQL error: near ""hello . world"": syntax error

insert into test_table values("hello . world");
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Adding data with periods

2008-12-15 Thread Eugene Wee
Additionally, double quotes do have a "special meaning" in that they are
used to delimit identifiers.

Regards,
Eugene

On Mon, Dec 15, 2008 at 3:15 PM, John Stanton  wrote:

> Single quotes are SQL, as chosen by he designers.  It is good practice
> to stick to the standard rather than rely on extensions which vary from
> implementatiopn tio implementation.
>
> Mohd Radzi Ibrahim wrote:
> > It seems to works either way.
> >
> > I'm just wondering is there any hidden reason that single quote is
> > preferred? Portability?
> > Or is double-qoute has some kind of special meaning that we should use it
> > for that special purpose?
> >
> >
> > -radzi-
>
>
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Adding data with periods

2008-12-14 Thread John Stanton
Single quotes are SQL, as chosen by he designers.  It is good practice 
to stick to the standard rather than rely on extensions which vary from 
implementatiopn tio implementation.

Mohd Radzi Ibrahim wrote:
> It seems to works either way.
>
> I'm just wondering is there any hidden reason that single quote is 
> preferred? Portability?
> Or is double-qoute has some kind of special meaning that we should use it 
> for that special purpose?
>
>
> -radzi-
>
>
> - Original Message - 
> From: "P Kishor" 
> To: "General Discussion of SQLite Database" 
> Sent: Monday, December 15, 2008 1:32 PM
> Subject: Re: [sqlite] Adding data with periods
>
>
>   
>> On 12/14/08, aditya siram  wrote:
>> 
>>> Thanks a lot. The issue has been fixed with:
>>>  INSERT INTO TEST_TABLE(CONTENTS) VALUES ("Hello. World!");
>>>
>>>   
>> Use single quotes to delimit text, not double quotes.
>> ___
>> 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] Adding data with periods

2008-12-14 Thread Mohd Radzi Ibrahim
It seems to works either way.

I'm just wondering is there any hidden reason that single quote is 
preferred? Portability?
Or is double-qoute has some kind of special meaning that we should use it 
for that special purpose?


-radzi-


- Original Message - 
From: "P Kishor" 
To: "General Discussion of SQLite Database" 
Sent: Monday, December 15, 2008 1:32 PM
Subject: Re: [sqlite] Adding data with periods


> On 12/14/08, aditya siram  wrote:
>> Thanks a lot. The issue has been fixed with:
>>  INSERT INTO TEST_TABLE(CONTENTS) VALUES ("Hello. World!");
>>
>
>
> Use single quotes to delimit text, not double quotes.
> ___
> 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] Adding data with periods

2008-12-14 Thread P Kishor
On 12/14/08, aditya siram  wrote:
> Thanks a lot. The issue has been fixed with:
>  INSERT INTO TEST_TABLE(CONTENTS) VALUES ("Hello. World!");
>


Use single quotes to delimit text, not double quotes.
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Adding data with periods

2008-12-14 Thread aditya siram
Thanks a lot. The issue has been fixed with:
INSERT INTO TEST_TABLE(CONTENTS) VALUES ("Hello. World!");

I was thrown by the error message that seemed to be complaining about the
periods when I was actually missing the VALUES(...) clause.

Appreciate the quick response ...
deech

On Sun, Dec 14, 2008 at 11:21 PM, John Stanton  wrote:

> Note that literal delimiters in SQL are single quotes, e.g. 'This is an
> SQL literal'.
>
> It is good practice with Sqlite to use bound variables.  You avoid
> possible SQL injection attacks and limit sensitivity to data content.
>
> aditya siram wrote:
> > Hi all,
> > I'm having trouble adding data with period characters in it. I tries to
> > escape the period with a `'` but that didn' t seem to work. Here is an
> > example interaction:
> >
> > sqlite> create table test_table ("Contents" varchar);
> > sqlite> insert into test_table "hello . world";
> > SQL error: near ""hello . world"": syntax error
> > sqlite> insert into test_table "hello '. world";
> > SQL error: near ""hello '. world"": syntax error
> >
> > Thanks ...
> > deech
> > ___
> > 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] Adding data with periods

2008-12-14 Thread John Stanton
Note that literal delimiters in SQL are single quotes, e.g. 'This is an 
SQL literal'.

It is good practice with Sqlite to use bound variables.  You avoid 
possible SQL injection attacks and limit sensitivity to data content.

aditya siram wrote:
> Hi all,
> I'm having trouble adding data with period characters in it. I tries to
> escape the period with a `'` but that didn' t seem to work. Here is an
> example interaction:
>
> sqlite> create table test_table ("Contents" varchar);
> sqlite> insert into test_table "hello . world";
> SQL error: near ""hello . world"": syntax error
> sqlite> insert into test_table "hello '. world";
> SQL error: near ""hello '. world"": syntax error
>
> Thanks ...
> deech
> ___
> 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] Adding data with periods

2008-12-14 Thread Mohd Radzi Ibrahim
The syntax is wrong.

INSERT INTO TEST_TABLE(CONTENTS) VALUES ("Hello. World!");

is the correct one.

-radzi-
- Original Message - 
From: "aditya siram" 
To: 
Sent: Monday, December 15, 2008 1:04 PM
Subject: [sqlite] Adding data with periods


> Hi all,
> I'm having trouble adding data with period characters in it. I tries to
> escape the period with a `'` but that didn' t seem to work. Here is an
> example interaction:
> 
> sqlite> create table test_table ("Contents" varchar);
> sqlite> insert into test_table "hello . world";
> SQL error: near ""hello . world"": syntax error
> sqlite> insert into test_table "hello '. world";
> SQL error: near ""hello '. world"": syntax error
> 
> Thanks ...
> deech
> ___
> 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] Adding data with periods

2008-12-14 Thread P Kishor
On 12/14/08, aditya siram  wrote:
> Hi all,
>  I'm having trouble adding data with period characters in it. I tries to
>  escape the period with a `'` but that didn' t seem to work. Here is an
>  example interaction:
>
>  sqlite> create table test_table ("Contents" varchar);
>  sqlite> insert into test_table "hello . world";
>  SQL error: near ""hello . world"": syntax error
>  sqlite> insert into test_table "hello '. world";
>  SQL error: near ""hello '. world"": syntax error
>


many errors in the above. The correct syntax would be

sqlite> INSERT INTO test_table VALUES ('hello . world');

note the keyword VALUES, and the text string delimited with single
quotes, not double quotes.
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Adding data with periods

2008-12-14 Thread kirrthana
Hi,

Sqlite takes the period as a special character. Wherever you get a period '
make it as ''. This will make it as a normal character and will work fine.
Hope the solution solves your problem.

Regards,
Kirrthana

-Original Message-
From: sqlite-users-boun...@sqlite.org
[mailto:sqlite-users-boun...@sqlite.org]on Behalf Of aditya siram
Sent: Monday, December 15, 2008 10:35 AM
To: sqlite-users@sqlite.org
Subject: [sqlite] Adding data with periods


Hi all,
I'm having trouble adding data with period characters in it. I tries to
escape the period with a `'` but that didn' t seem to work. Here is an
example interaction:

sqlite> create table test_table ("Contents" varchar);
sqlite> insert into test_table "hello . world";
SQL error: near ""hello . world"": syntax error
sqlite> insert into test_table "hello '. world";
SQL error: near ""hello '. world"": syntax error

Thanks ...
deech
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


The information contained in this electronic message and any attachments to 
this message are intended for the exclusive use of the addressee(s) and may 
contain proprietary, confidential or privileged information. If you are not the 
intended recipient, you should not disseminate, distribute or copy this e-mail. 
Please notify the sender immediately and destroy all copies of this message and 
any attachments contained in it.
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] Adding data with periods

2008-12-14 Thread aditya siram
Hi all,
I'm having trouble adding data with period characters in it. I tries to
escape the period with a `'` but that didn' t seem to work. Here is an
example interaction:

sqlite> create table test_table ("Contents" varchar);
sqlite> insert into test_table "hello . world";
SQL error: near ""hello . world"": syntax error
sqlite> insert into test_table "hello '. world";
SQL error: near ""hello '. world"": syntax error

Thanks ...
deech
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users