[sqlite] With recursive question

2015-03-03 Thread Jean-Christophe Deschamps
At 04:05 01/03/2015, you wrote: >On 2/28/2015 7:22 PM, Jean-Christophe Deschamps wrote: >>Once again thank you very much Igor. I was making my life miserable >>trying to scan the "tree" from the other end. > >That, too, could be arranged. Something along these lines: > >with recursive FileDirs as

[sqlite] With recursive question

2015-03-01 Thread Jean-Christophe Deschamps
Once again thank you very much Igor. I was making my life miserable trying to scan the "tree" from the other end. At 00:37 01/03/2015, you wrote: >It's a bit unfortunate that you made the root a parent of itself. >Forces the query to make an extra check to avoid infinite recursion. `---

[sqlite] With recursive question (addendum)

2015-03-01 Thread Jean-Christophe Deschamps
Forgot to mention that I sees the issue as fundamentally distinct from the Mandelbrot example in the SQLite docs: it uses a construct -outlined in procedural statements- like: For x in xRange For y in yRange compute something like f(x, y) -- here, y is independant of x Next y Next x

[sqlite] With recursive question

2015-03-01 Thread Jean-Christophe Deschamps
Dear list, After trying a number of ways I'm at loss solving the seemingly simple problem. For a simplified example say I have a list of individual filesystem directories with FK pointing to their parent: PRAGMA foreign_keys=ON; CREATE TABLE "Dirs" ( "DirID" INTEGER NOT NULL PRIMARY KEY,

[sqlite] With recursive question

2015-02-28 Thread Igor Tandetnik
On 2/28/2015 7:22 PM, Jean-Christophe Deschamps wrote: > Once again thank you very much Igor. I was making my life miserable > trying to scan the "tree" from the other end. That, too, could be arranged. Something along these lines: with recursive FileDirs as ( select FileId, FileDirID

[sqlite] With recursive question

2015-02-28 Thread Igor Tandetnik
On 2/28/2015 6:02 PM, Jean-Christophe Deschamps wrote: > What I want to obtain is the list of all files (in random order but > that's not the point) containing: > FileID > FileName > Directory path from root using some kind of group_concat(dir, '/') with recursive DirTree as ( select DirID, ''