Python论坛  - 讨论区

标题:[python-chinese] [OT]Sqlite 中递归查询方式?

2008年01月02日 星期三 11:25

Question wanliyou在gmail.com
星期三 一月 2 11:25:17 HKT 2008

Hi,

   现在在做一个sqlite相关的东西,需要实现类似目录下所有子目录含有的实体个数统计之类的。目录一张表,实体一张表。
   看了下sqlite的文档,似乎是没有Create Function()这么一说?倒是看见了一个
http://www.sqlite.org/lang_expr.html
叫expression的东西,但不知道是不是我要的,而且文档似乎少了些。用python递归着查倒是可以,但效率会不会很低下?用sqlite加sql语句可以搞定么?
   问得比较菜,大家帮帮看。

-- 
>: ~
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://python.cn/pipermail/python-chinese/attachments/20080102/27afd1de/attachment.html 

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2008年01月03日 星期四 22:13

Fluke fluke.l在gmail.com
星期四 一月 3 22:13:45 HKT 2008

Èç¹û²»¶ÔÊý¾Ý±íµÄÉè¼Æ½øÐÐÓÅ»¯µÄ»°£¬×öÕâ¸öÈÎÎñµÄ°ì·¨Æäʵ¾ÍÊÇд¸öµÝ¹éº¯Êý£¬Í³¼ÆÐèÒªµÄ×ÓĿ¼ÁË¡£±ê×¼µÄSQL²éѯ£¬²»¹ý³ÌÐòµÝ¹éµÄÈ¥²éѯ¡£

On 1/2/08, Question <wanliyou在gmail.com> wrote:
>
> Hi£¬
>
>    ÏÖÔÚÔÚ×öÒ»¸ösqliteÏà¹ØµÄ¶«Î÷£¬ÐèҪʵÏÖÀàËÆÄ¿Â¼ÏÂËùÓÐ×ÓĿ¼º¬ÓеÄʵÌå¸öÊýͳ¼ÆÖ®ÀàµÄ¡£Ä¿Â¼Ò»ÕÅ±í£¬ÊµÌåÒ»ÕÅ±í¡£
>    ¿´ÁËÏÂsqliteµÄÎĵµ£¬ËƺõÊÇûÓÐCreate Function£¨£©Õâôһ˵£¿µ¹ÊÇ¿´¼ûÁËÒ»¸ö
> http://www.sqlite.org/lang_expr.html½ÐexpressionµÄ¶«Î÷£¬µ«²»ÖªµÀÊDz»ÊÇÎÒÒªµÄ£¬¶øÇÒÎĵµËƺõÉÙÁËЩ¡£ÓÃpythonµÝ¹é×Ų鵹ÊÇ¿ÉÒÔ£¬µ«Ð§Âʻ᲻»áºÜµÍÏ£¿ÓÃsqlite¼ÓsqlÓï¾ä¿ÉÒԸ㶨ô£¿
>
>    ÎʵñȽϲˣ¬´ó¼Ò°ï°ï¿´¡£
>
> --
> >: ~
> _______________________________________________
> python-chinese
> Post: send python-chinese在lists.python.cn
> Subscribe: send subscribe to python-chinese-request在lists.python.cn
> Unsubscribe: send unsubscribe to  python-chinese-request在lists.python.cn
> Detail Info: http://python.cn/mailman/listinfo/python-chinese
>



-- 
Yours,
  fluke
fluke.l在gmail.com
http://algo-field.com
-------------- 下一部分 --------------
Ò»¸öHTML¸½¼þ±»ÒƳý...
URL: http://python.cn/pipermail/python-chinese/attachments/20080103/797be259/attachment.html 

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2008年01月04日 星期五 13:17

Question wanliyou在gmail.com
星期五 一月 4 13:17:04 HKT 2008

这样效率很低下啊,速度不止慢了一星半点。。。
应该可以建一个类似count的自定义函数来做吧?
关键是语法不是很清楚,是不是都差不多?

On Jan 3, 2008 10:13 PM, Fluke <fluke.l at gmail.com> wrote:

> 如果不对数据表的设计进行优化的话,做这个任务的办法其实就是写个递归函数,统计需要的子目录了。标准的SQL查询,不过程序递归的去查询。
>
> On 1/2/08, Question <wanliyou at gmail.com> wrote:
>
> > Hi,
> >
> >    现在在做一个sqlite相关的东西,需要实现类似目录下所有子目录含有的实体个数统计之类的。目录一张表,实体一张表。
> >    看了下sqlite的文档,似乎是没有Create Function()这么一说?倒是看见了一个
> > http://www.sqlite.org/lang_expr.html叫expression的东西,但不知道是不是我要的,而且文档似乎少了些。用python递归着查倒是可以,但效率会不会很低下?用sqlite加sql语句可以搞定么?
> >
> >    问得比较菜,大家帮帮看。
> >
> > --
> > >: ~
> > _______________________________________________
> > python-chinese
> > Post: send python-chinese at lists.python.cn
> > Subscribe: send subscribe to python-chinese-request at lists.python.cn
> > Unsubscribe: send unsubscribe to
> > python-chinese-request at lists.python.cn
> > Detail Info: http://python.cn/mailman/listinfo/python-chinese
> >
>
>
>
> --
> Yours,
>   fluke
> fluke.l at gmail.com
> http://algo-field.com
> _______________________________________________
> python-chinese
> Post: send python-chinese at lists.python.cn
> Subscribe: send subscribe to python-chinese-request at lists.python.cn
> Unsubscribe: send unsubscribe to  python-chinese-request at lists.python.cn
> Detail Info: http://python.cn/mailman/listinfo/python-chinese
>



-- 
>: ~
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://python.cn/pipermail/python-chinese/attachments/20080104/0e0f76fc/attachment.htm 

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

如下红色区域有误,请重新填写。

    你的回复:

    请 登录 后回复。还没有在Zeuux哲思注册吗?现在 注册 !

    Zeuux © 2025

    京ICP备05028076号