Phobic

----- Original Message -----
From: Simon Slavin [mailto:slav...@bigfraud.org]
Sent: Friday, December 03, 2010 06:36 PM
To: General Discussion of SQLite Database <sqlite-users@sqlite.org>
Subject: Re: [sqlite] Degrees of separation


On 3 Dec 2010, at 11:14pm, Drake Wilson wrote:

> Another would be to
> rewrite the query to union the two directions together

You could do this with a VIEW, of course.  Have a VIEW that reflects the UNION 
of the 'know' table with its elements in the opposite order.  Then query this 
VIEW instead of the original table.

An alternative which would lead to faster code would be a TRIGGER which every 
time something was put in the 'know' table inserted another record with the 
elements reversed.  It should, of course, be an INSERT OR IGNORE, and you'd 
need a UNIQUE key on the table to prevent duplication.

Simon.
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

---------------------------------------------------------------------
This transmission (including any attachments) may contain confidential 
information, privileged material (including material protected by the 
solicitor-client or other applicable privileges), or constitute non-public 
information. Any use of this information by anyone other than the intended 
recipient is prohibited. If you have received this transmission in error, 
please immediately reply to the sender and delete this information from your 
system. Use, dissemination, distribution, or reproduction of this transmission 
by unintended recipients is not authorized and may be unlawful.
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to