source: subversion/sites/tile.openstreetmap.org/get_tiles_to_render.rb @ 2474

Last change on this file since 2474 was 2029, checked in by steve, 14 years ago

add hack tile stuff

  • Property svn:executable set to *
File size: 630 bytes
Line 
1#!/usr/bin/ruby
2
3require 'mysql'
4
5def get_local_connection
6  begin
7    return Mysql.real_connect('localhost', 'tile', 'tile', 'tile')
8  rescue MysqlError => e
9    mysql_error(e)
10  end
11end
12
13def call_local_sql
14  dbh = nil
15  begin
16    dbh = get_local_connection
17    sql = yield
18    res = dbh.query(sql)
19    if res.nil? then return true else return res end
20  rescue MysqlError =>ex
21    mysql_error(ex)
22  ensure
23    dbh.close unless dbh.nil?
24  end
25  nil
26end
27
28res = call_local_sql { "select x,y,z from tiles where dirty=true order by created_at asc limit 1000" }
29
30res.each_hash do |row|
31  puts "#{row['x']} #{row['y']} #{row['z']}"
32end
Note: See TracBrowser for help on using the repository browser.