mldvx4 has asked for the wisdom of the Perl Monks concerning the following question:
Greetings, PerlMonks,
Thanks for DBI. It works very well with SQLite3. I have a short (for now) Perl script which is accessed via CGI::Fast which will soon have a small but varying number of SQL queries for SQLite3. The queries are targeted at various FTS5 tables. The number of queries is between 1 and n where n is a "small" number, but in any case changing each time. They are executed theough prepare and execute statements. The results from each query are collected by the Perl script into its own hash with the records' unique key (recno) as the hash key. For illustration, here is the basic sample query:
SELECT old_keys.recno AS recno, 'http://example.org/' || old_keys.file, old_metadata.value AS title FROM old_keys JOIN old_metadata ON old_keys.recno = old_metadata.recno WHERE term='dc.title' AND old_metadata.recno IN ( SELECT rowid AS recno FROM old_fts5_metadata WHERE old_fts5_metadata MATCH ?);
When there is more than one query, there will be an operator XOR, AND, OR, or NOT applied between them.
My question is about the recommended approach, should I apply the operators to the various hashes after separate queries, or should I have the script build out more complex queries into a single SQL query for each search?
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Applying logical operators in either complex SQL xor hashes?
by talexb (Chancellor) on May 10, 2025 at 16:40 UTC | |
by mldvx4 (Friar) on May 11, 2025 at 15:23 UTC | |
Re: Applying logical operators in either complex SQL xor hashes?
by Marshall (Canon) on May 10, 2025 at 19:09 UTC | |
Re: Applying logical operators in either complex SQL xor hashes?
by LanX (Saint) on May 10, 2025 at 13:13 UTC |