Subject | Open to suggestions: building a tree |
---|---|
Author | Brandon Smith |
Post date | 2003-08-23T03:00:38Z |
I'm using FB 1.0.2.908 and here's what I want to do:
Table dir_tree has three fields, Dir_ID (integer, pk), Parent
(integer, fk to Dir_ID), and This_Dir, varchar(250).
For the insert proc, I want to bring in a string like
"d:\top\next\xyz\abc\here is a dir"
I want this to end up being 6 records in this table, "d", "top",
"next", "xyz", "abc" and "here is a dir" with the parent field
pointing to the parent, except for "d" which would have a null parent.
Standard linked list kind of thing.
Where I'm stuck is taking apart the incoming string and stashing it
somehow in FB's procedure language so I can go through it and act on
each part. I found that page that shows SQL version of pos, and I
could easily do a Delphi thing to do pos and break it up. What I'm
looking for is some sort or cursor or array. I can't seem to find
anything that fits the bill. Any suggestions?
Thanks,
Brandon
Table dir_tree has three fields, Dir_ID (integer, pk), Parent
(integer, fk to Dir_ID), and This_Dir, varchar(250).
For the insert proc, I want to bring in a string like
"d:\top\next\xyz\abc\here is a dir"
I want this to end up being 6 records in this table, "d", "top",
"next", "xyz", "abc" and "here is a dir" with the parent field
pointing to the parent, except for "d" which would have a null parent.
Standard linked list kind of thing.
Where I'm stuck is taking apart the incoming string and stashing it
somehow in FB's procedure language so I can go through it and act on
each part. I found that page that shows SQL version of pos, and I
could easily do a Delphi thing to do pos and break it up. What I'm
looking for is some sort or cursor or array. I can't seem to find
anything that fits the bill. Any suggestions?
Thanks,
Brandon