yes, you are right. I'd better to go to sleep now -:)
On Fri, Oct 16, 2009 at 2:23 AM, P Kishor wrote:
> On Fri, Oct 16, 2009 at 1:42 AM, Michael Chen
> wrote:
> > select *, (length(path) - length( replace(path, '/','' )) +1 )
>
> sqlite>
On Fri, Oct 16, 2009 at 1:42 AM, Michael Chen
wrote:
> select *, (length(path) - length( replace(path, '/','' )) +1 )
sqlite> SELECT length('/1/2/5/');
7
sqlite> SELECT replace('/1/2/5/', '/', '');
125
sqlite> SELECT length('125');
3
7 - 3 = 4
4 + 1 = 5
sqlite>
I just downloaded the source file and build it on my Mac osx 10.6, and it
seems problematic:
create table tree (
idinteger primary key,
parent_id integer references tree,
data text,
path text-- materialized path
);
-- compute depth of a node
3 matches
Mail list logo