[OSM-dev] Temporary tables for the map query?

Tom Hughes tom at compton.nu
Mon May 26 23:59:08 BST 2008


In message <1211833829.19623.58.camel at localhost.localdomain>
          Jon Burgess <jburgess777 at googlemail.com> wrote:

> On Mon, 2008-05-26 at 17:37 +0100, Tom Hughes wrote:
> > I'm not sure how well that works when accessed directly from C code
> > but I think it can be persuaded to behave sensibly. I know that the
> > ruby code always reads all the results into memory but that is a ruby
> > issue I think.
> 
> The C api can do things one row at a time quite easily.
> Ruby can be persuaded to do the same thing too.
> 
>   "If you want to suppress automatic result set
>   generation by query, set your database handle's
>   query_with_result variable to false:
> 
>    dbh.query_with_result = false
> 
> ?[ from ?http://www.kitebird.com/articles/ruby-mysql.html#TOC_11 ]

The only problem with that is that you can't then use any normal
ruby idioms like iterators to process the results because doing
so will cause it to suck all the rows into memory.

Instead you have to loop manually as shown in the example on that
page.

> I've no idea whether you can convince rails to work with this.

No, because it will use iterators to access the result set, which
will either not work or will suck everything into memory.

Tom

-- 
Tom Hughes (tom at compton.nu)
http://www.compton.nu/




More information about the dev mailing list