Re: [sqlite] Why "UTF-8" and not 'UTF-8' ?

2019-09-23 Thread Darren Duncan

On 2019-09-23 1:22 p.m., Simon Slavin wrote:

Can I get an answer to my 'Subject' header ?

Is the parameter to the PRAGMA a string parameter ?  If so, can the 
documentation be changed to use apostrophes as delimiters ?  Using double 
quotes in the documentation seems really weird.

If, on the other hand, the PRAMGA is actually looking for double-quotes after 
the equals sign, is this for a reason ?


I agree.  All documentation should show the more standard/correct single quotes 
for strings when that works, and only show double quotes when those are 
required.  This would help avoid a lot of confusion. -- Darren Duncan

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


Re: [sqlite] Why "UTF-8" and not 'UTF-8' ?

2019-09-23 Thread Keith Medcalf

On Monday, 23 September, 2019 14:09, Richard Hipp :

>In any event, you are correct that the behavior can now be disabled
>and should be for new applications.  But we need to leave it turned on
>by default for legacy.

Nevertheless, the point is that even if you purportedly turn the behaviour off, 
it is not turned off:

That is, if you compile with DQS set to 0, the statement

pragma encoding = "UTF-8"

is still accepted without error.

SQLite version 3.30.0 2019-09-23 19:37:40
Enter ".help" for usage hints.
Connected to a transient in-memory database.
Use ".open FILENAME" to reopen on a persistent database.
sqlite> pragma encoding="UTF-8";
sqlite> .dbconfig
   enable_fkey on
enable_trigger on
   enable_view on
fts3_tokenizer off
load_extension on
  no_ckpt_on_close off
   enable_qpsg off
   trigger_eqp off
reset_database off
 defensive off
   writable_schema off
legacy_alter_table off
   dqs_dml off
   dqs_ddl off

If fact the dqs_ddl setting seems not to do anything at all.  dqs_dml seems to 
work however.

sqlite> create table x (x default "DFLT");
sqlite> insert into x default values;
sqlite> select * from x;
DFLT
sqlite> insert into x values ("DFLT");
Error: no such column: DFLT
sqlite>

Now, if you created a legacy database with dqs_ddl turned on and opened it in a 
version of SQLite3 that has dqs_ddl turned off, should parsing a currently 
malformed schema produce an error?  However, the create with incorrect quotes 
should be an error if at the time it is made dqs_ddl is turned off.

sqlite> create view v as select "TEST";
sqlite> select * from v;
Error: no such column: TEST
sqlite>

Should this not toss an error when the ddl creating the view is parsed?  Hard 
to say because a view is merely a stored statement and I don't think it is 
parsed (as in prepared) at create view time, however it does definitely throw 
an error when executed (prepared), in accordance with the dqs_dml setting.

Does the dqs_ddl setting need to be passed to something else, like the parser 
generator?





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


Re: [sqlite] Why "UTF-8" and not 'UTF-8' ?

2019-09-23 Thread Simon Slavin
On 23 Sep 2019, at 9:09pm, Richard Hipp  wrote:

> In any event, you are correct that the behavior can now be disabled
> and should be for new applications.

Can I get an answer to my 'Subject' header ?

Is the parameter to the PRAGMA a string parameter ?  If so, can the 
documentation be changed to use apostrophes as delimiters ?  Using double 
quotes in the documentation seems really weird.

If, on the other hand, the PRAMGA is actually looking for double-quotes after 
the equals sign, is this for a reason ?
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Why "UTF-8" and not 'UTF-8' ?

2019-09-23 Thread Richard Hipp
On 9/23/19, Keith Medcalf  wrote:
>
> due to a
> longstanding bug in SQLite3 you can use identifier quotes around strings

I don't think "bug" is quite the right word here, as the behavior was
deliberate.  The use of double-quotes for strings was put in in a
(perhaps misguided) attempt to be more compatible with MySQL 3.x,
which was the predominant SQL engine when SQLite was first being
designed.  Maybe "mis-feature" would be a better word.

In any event, you are correct that the behavior can now be disabled
and should be for new applications.  But we need to leave it turned on
by default for legacy.


-- 
D. Richard Hipp
d...@sqlite.org
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Why "UTF-8" and not 'UTF-8' ?

2019-09-23 Thread Keith Medcalf

It should be 

pragma encoding = 'UTF-8';

UTF-8 is a character string, not an identifier.  And yes, due to a longstanding 
bug in SQLite3 you can use identifier quotes around strings -- if the 
identifier quotes do not resolve to an identifier they fallback to a string.  

You can now "turn this bug off" but the turning off does not seem to affect 
usage in most DDL, which will still carry on accepting double-quoted strings in 
most places.

>-Original Message-
>From: sqlite-users  On
>Behalf Of Simon Slavin
>Sent: Monday, 23 September, 2019 11:28
>To: SQLite mailing list 
>Subject: [sqlite] Why "UTF-8" and not 'UTF-8' ?
>
>The documentation for PRAGMA includes this command:
>
>PRAGMA encoding = "UTF-8";
>
>Why is it "UTF-8" and not 'UTF-8' ?  Why is it double quotes rather than
>a normally-delimited string ?  Should either of these work ?
>
>PRAGMA encoding = UTF-8;PRAGMA encoding = 'UTF-8'
>___
>sqlite-users mailing list
>sqlite-users@mailinglists.sqlite.org
>http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users



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


Re: [sqlite] Why "UTF-8" and not 'UTF-8' ?

2019-09-23 Thread J. King
On September 23, 2019 1:27:54 p.m. EDT, Simon Slavin  
wrote:
>The documentation for PRAGMA includes this command:
>
>PRAGMA encoding = "UTF-8"; 
>
>Why is it "UTF-8" and not 'UTF-8' ?  Why is it double quotes rather
>than a normally-delimited string ?  Should either of these work ?
>
>PRAGMA encoding = UTF-8;PRAGMA encoding = 'UTF-8'
>___
>sqlite-users mailing list
>sqlite-users@mailinglists.sqlite.org
>http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

It's worth noting, too, that barring changed  compile-time settings, the 
default encoding is UTF-8 to begin with. 
-- 
J. King
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] Why "UTF-8" and not 'UTF-8' ?

2019-09-23 Thread Simon Slavin
The documentation for PRAGMA includes this command:

PRAGMA encoding = "UTF-8"; 

Why is it "UTF-8" and not 'UTF-8' ?  Why is it double quotes rather than a 
normally-delimited string ?  Should either of these work ?

PRAGMA encoding = UTF-8;PRAGMA encoding = 'UTF-8'
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users