I think you might be right there, but for my practical purpose I need the
result to be invalid.
I just wonder if a Halt at row 2 and no further rows produced is good way
to determine this.

RBS

On Wed, Aug 1, 2018 at 3:39 PM, Hick Gunter <h...@scigames.at> wrote:

> Judging from the following output, I would say it is data producing, but
> returns no rows for no table or a table that has no indexes. Just because a
> given select statement returns no matching rows does not make it invalid
>
> asql> create temp table test (i integer, t text);
> asql> create index test_i on test(i);
> asql> pragma index_list(test);
> seq   name           uniq
> ----  -------------  ----
> 0     test_i         0
> asql> explain pragma index_list(test);
> addr  opcode         p1    p2    p3    p4             p5  comment
> ----  -------------  ----  ----  ----  -------------  --  -------------
> 0     Integer        0     1     0                    00  NULL
> 1     String8        0     2     0     test_i         00  NULL
> 2     Integer        0     3     0                    00  NULL
> 3     ResultRow      1     3     0                    00  NULL
> 4     Halt           0     0     0                    00  NULL
>
> -----Ursprüngliche Nachricht-----
> Von: sqlite-users [mailto:sqlite-users-boun...@mailinglists.sqlite.org]
> Im Auftrag von David Raymond
> Gesendet: Mittwoch, 01. August 2018 16:31
> An: SQLite mailing list <sqlite-users@mailinglists.sqlite.org>
> Betreff: [EXTERNAL] Re: [sqlite] Is pragma index_list without supplied
> table name valid SQL?
>
> Don't forget this point about pragmas:
>
> https://www.sqlite.org/pragma.html
> "No error messages are generated if an unknown pragma is issued. Unknown
> pragmas are simply ignored. This means if there is a typo in a pragma
> statement the library does not inform the user of the fact."
>
> That way if there's a typo, or if you try a new pragma in an old version
> then it won't complain, it just won't do anything.
>
> -----Original Message-----
> From: sqlite-users [mailto:sqlite-users-boun...@mailinglists.sqlite.org]
> On Behalf Of Bart Smissaert
> Sent: Wednesday, August 01, 2018 10:13 AM
> To: General Discussion of SQLite Database
> Subject: [sqlite] Is pragma index_list without supplied table name valid
> SQL?
>
> Using SQLite 3.22.0
>
> In my app I have code to determine if a given SQL string is
> data-producing, non-data producing or invalid. It uses these 3 SQLite
> functions:
>
> sqlite3_prepare_v3
> sqlite3_stmt_readonly
> sqlite3_column_count
>
> Have been using this code for a few years and sofar never failed, but now
> come across:
> pragma index_list
> so, without a supplied table name.
> This gives me data-producing and I think it should give me invalid.
>
> Firstly is this SQL indeed invalid?
>
> Secondly, if it is I need to add some code to pick this up and was
> thinking about using explain for that. Explain pragma index_list gives me:
>
> addr opcode p1 p2 p3 p4 p5 comment
> ---------------------------------------------------
> 0 Init 0 1 0  00 Start at 1
> 1 Halt 0 0 0  00
>
> And that to me looks it is indeed an invalid SQL as it gives a Halt
> already in the second row and produces no further rows.
>
> Am I right here and would this be a good way to pick up invalid SQL?
>
>
> RBS
> _______________________________________________
> 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
>
>
> ___________________________________________
>  Gunter Hick | Software Engineer | Scientific Games International GmbH |
> Klitschgasse 2-4, A-1130 Vienna | FN 157284 a, HG Wien, DVR: 0430013 | (O)
> +43 1 80100 - 0
>
> May be privileged. May be confidential. Please delete if not the addressee.
> _______________________________________________
> 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

Reply via email to