On Tue, 19 Apr 2011 14:18:05 -0600 Dave White <dwh...@companioncorp.com> wrote:
> For example, this works: > SELECT T01_fts.docid FROM T01_fts JOIN T01 ON T01_fts.docid = T01.rowid > WHERE T01.hasPic = 0 AND T01_fts.words MATCH 'SBNTKN*' > > These do not: > SELECT T01_fts.docid FROM T01_fts JOIN T01 ON T01_fts.docid = T01.rowid > WHERE T01.hasPic = 0 OR T01_fts.words MATCH 'SBNTKN*' > SELECT T01_fts.docid FROM T01_fts JOIN T01 ON T01_fts.docid = T01.rowid > WHERE T01.hasPic = 0 AND (T01_fts.words MATCH 'SBNTKN*' OR T01_fts.words > MATCH 'CTLTKN*' ) I think it is GLOB '*' what you look for (or LIKE '%' for case-insensitive match): SELECT T01_fts.docid FROM T01_fts JOIN T01 ON T01_fts.docid = T01.rowid WHERE T01.hasPic = 0 OR T01_fts.words GLOB 'SBNTKN*'; SELECT T01_fts.docid FROM T01_fts JOIN T01 ON T01_fts.docid = T01.rowid WHERE T01.hasPic = 0 AND (T01_fts.words GLOB 'SBNTKN*' OR T01_fts.words GLOB 'CTLTKN*'); > And an entirely separate question: Is there currently a way, or will there > soon be a way to clone prepared statements? I'd do it like this: sqlite3_stmt *stmt2 = NULL; sqlite3_prepare_v2(sqlite3_db_handle(stmt1), sqlite3_sql(stmt1), -1, &stmt2, NULL); Check what the respective functions do here: http://www.sqlite.org/c3ref/funclist.html Basically: - the first argument function returns the database of the first statement (you may pass a different open database handle directly, in order to "clone" the first statement over it); - the second argument function returns the sql text of the first statement; - the third argument is the size of the text to parse, negative to get it up to the first NULL - normally the end; - the fourth is a pointer to your new unallocated statement; I think copying the bindings is possible using sqlite3_bind_parameter_* and something else I can't figure out right now. -- Mihai Militaru <mihai.milit...@xmpp.ro> _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users