Re: [sqlite] SQL parsing logic for triggers

2016-10-09 Thread gwenn
On Sun, Oct 9, 2016 at 12:14 PM, Richard Hipp  wrote:
> On 10/9/16, gwenn  wrote:
>> Hello,
>> I am just looking for information (I am not asking for any change):
>> It is for (auto) completion hints.
>>
>> 1) it seems not possible to insert default values in trigger command:
>>
>> // INSERT
>> trigger_cmd(A) ::= insert_cmd(R) INTO trnm(X) idlist_opt(F) select(S).
>>
>> versus
>>
>> // The INSERT command
>> /
>> //
>> cmd ::= with(W) insert_cmd(R) INTO fullname(X) idlist_opt(F) select(S).
>> cmd ::= with(W) insert_cmd(R) INTO fullname(X) idlist_opt(F) DEFAULT VALUES.
>>
>> Is it a choice or an oversight ?
>
> Deliberate.  Adding DEFAULT VALUES to triggers is just more code to be
> tested and maintained for something that adds no new capability and
> that nobody ever uses.
>
>>
>> Is it to make possible to create temporary trigger by using the
>> following syntax:
>> CREATE TABLE test (data);
>> CREATE TRIGGER temp.trig UPDATE ON main.test BEGIN ...; END;
>> instead of:
>> CREATE TEMP TRIGGER trig UPDATE ON main.test BEGIN ...; END;
>>
>
> Did you try it?  What happened?

Yes I tried and it works as expected (the two statements seem equivalent).
But the reverse does not:
CREATE TEMP TABLE test (data);
CREATE TRIGGER main.trig UPDATE ON temp.test BEGIN ...; END;
Is (temp.[trigger name], [^temp].[table name])  the only working case
when the provided database names are different ?

And I have another question related to hexadecimals.
It seems that they are not properly tokenized in select statements (at
least in the result columns part).
Invalid hexadecimals are not rejected but splitted into the valid part
and an elided 'as' part.
For example:
SELECT 0x1g;
is interpreted as
SELECT 0x1 g;

Invalid hexadecimals are properly rejected where there is no elided
'as' possible.
For example,
INSERT INTO test VALUES (0x1g);

Is it intentional ?

Many thanks.

> --
> 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
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] SQL parsing logic for triggers

2016-10-09 Thread Richard Hipp
On 10/9/16, gwenn  wrote:
> Hello,
> I am just looking for information (I am not asking for any change):
> It is for (auto) completion hints.
>
> 1) it seems not possible to insert default values in trigger command:
>
> // INSERT
> trigger_cmd(A) ::= insert_cmd(R) INTO trnm(X) idlist_opt(F) select(S).
>
> versus
>
> // The INSERT command
> /
> //
> cmd ::= with(W) insert_cmd(R) INTO fullname(X) idlist_opt(F) select(S).
> cmd ::= with(W) insert_cmd(R) INTO fullname(X) idlist_opt(F) DEFAULT VALUES.
>
> Is it a choice or an oversight ?

Deliberate.  Adding DEFAULT VALUES to triggers is just more code to be
tested and maintained for something that adds no new capability and
that nobody ever uses.

>
> Is it to make possible to create temporary trigger by using the
> following syntax:
> CREATE TABLE test (data);
> CREATE TRIGGER temp.trig UPDATE ON main.test BEGIN ...; END;
> instead of:
> CREATE TEMP TRIGGER trig UPDATE ON main.test BEGIN ...; END;
>

Did you try it?  What happened?
-- 
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] SQL parsing logic for triggers

2016-10-09 Thread gwenn
Sorry,
I've just found the answer to the first question here:
http://www.sqlite.org/lang_insert.html
Regards.

On Sun, Oct 9, 2016 at 10:34 AM, gwenn  wrote:
> Hello,
> I am just looking for information (I am not asking for any change):
> It is for (auto) completion hints.
>
> 1) it seems not possible to insert default values in trigger command:
>
> // INSERT
> trigger_cmd(A) ::= insert_cmd(R) INTO trnm(X) idlist_opt(F) select(S).
>
> versus
>
> // The INSERT command 
> /
> //
> cmd ::= with(W) insert_cmd(R) INTO fullname(X) idlist_opt(F) select(S).
> cmd ::= with(W) insert_cmd(R) INTO fullname(X) idlist_opt(F) DEFAULT VALUES.
>
> Is it a choice or an oversight ?
>
> 2) It seems possible to use different database names when creating a trigger:
>
> trigger_decl(A) ::= temp(T) TRIGGER ifnotexists(NOERR) nm(B) dbnm(Z)
> trigger_time(C) trigger_event(D)
> ON fullname(E) foreach_clause when_clause(G). {
>
> Is it to make possible to create temporary trigger by using the
> following syntax:
> CREATE TABLE test (data);
> CREATE TRIGGER temp.trig UPDATE ON main.test BEGIN ...; END;
> instead of:
> CREATE TEMP TRIGGER trig UPDATE ON main.test BEGIN ...; END;
>
> Or there are other use cases supported ?
>
> Thanks.
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] SQL parsing logic for triggers

2016-10-09 Thread gwenn
Hello,
I am just looking for information (I am not asking for any change):
It is for (auto) completion hints.

1) it seems not possible to insert default values in trigger command:

// INSERT
trigger_cmd(A) ::= insert_cmd(R) INTO trnm(X) idlist_opt(F) select(S).

versus

// The INSERT command /
//
cmd ::= with(W) insert_cmd(R) INTO fullname(X) idlist_opt(F) select(S).
cmd ::= with(W) insert_cmd(R) INTO fullname(X) idlist_opt(F) DEFAULT VALUES.

Is it a choice or an oversight ?

2) It seems possible to use different database names when creating a trigger:

trigger_decl(A) ::= temp(T) TRIGGER ifnotexists(NOERR) nm(B) dbnm(Z)
trigger_time(C) trigger_event(D)
ON fullname(E) foreach_clause when_clause(G). {

Is it to make possible to create temporary trigger by using the
following syntax:
CREATE TABLE test (data);
CREATE TRIGGER temp.trig UPDATE ON main.test BEGIN ...; END;
instead of:
CREATE TEMP TRIGGER trig UPDATE ON main.test BEGIN ...; END;

Or there are other use cases supported ?

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