On Sun, May 18, 2014 at 10:46 PM, James K. Lowden <jklow...@schemamania.org>wrote:
> On Sun, 18 May 2014 19:15:18 +0200 > RSmith <rsm...@rsweb.co.za> wrote: > > > > As Igor says, http://sqlite.org/c3ref/prepare.html would be > > > appropriate. However, a database connection is required for this. > > > > But of course.... What kind of syntactical correctness can you hope > > to check without a connection? > > You could hope for the kind of syntactical correctness that conforms to > the rules of the syntax. No schema infomation is required for that. > > select A from T where W = 'foo'; > > is valid syntax. It might not execute correctly, expecially if there's > no table T with columns A and W, but that's not a syntax issue. > This is indeed what I was thinking of. A function that would mark the above statement as 'valid', but mark select from T where W='foo'; select name from from where 1; as as 'invalid'. I don't know if such a function would actually be useful, but I thought I remembered that it already existed, and so I thought I would use it as a basis for another function I wanted to write, which would compare 2 SQL statements for equivalence, even if they don't memcmp() equal. The more I think of it, though, I think that the solution is as simple as converting all letters to lower(/upper) case and converting all whitespace to a single space each, except for within matching [ ], " ", ' ' or ` `. After that, I can do a memcmp(). -- ˙uʍop-ǝpısdn sı ɹoʇıuoɯ ɹnoʎ 'sıɥʇ pɐǝɹ uɐɔ noʎ ɟı _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users