From b89f5cbbbc03df6d508e67b0d3e44fec92c23c7f Mon Sep 17 00:00:00 2001 From: Artem Pavlenko Date: Mon, 23 Jan 2012 08:40:16 +0000 Subject: [PATCH] update pdsql2sqlite to new feature_impl --- utils/pgsql2sqlite/build.py | 2 +- utils/pgsql2sqlite/pgsql2sqlite.hpp | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/utils/pgsql2sqlite/build.py b/utils/pgsql2sqlite/build.py index 32c666adb..c342fefb2 100644 --- a/utils/pgsql2sqlite/build.py +++ b/utils/pgsql2sqlite/build.py @@ -40,7 +40,7 @@ headers = ['#plugins/input/postgis'] + env['CPPPATH'] libraries = [] boost_program_options = 'boost_program_options%s' % env['BOOST_APPEND'] -libraries.extend([boost_program_options,'sqlite3','pq','mapnik']) +libraries.extend([boost_program_options,'sqlite3','pq','mapnik','icuuc']) linkflags = env['CUSTOM_LDFLAGS'] if env['SQLITE_LINKFLAGS']: diff --git a/utils/pgsql2sqlite/pgsql2sqlite.hpp b/utils/pgsql2sqlite/pgsql2sqlite.hpp index 1de81ae8c..8cd7270ca 100644 --- a/utils/pgsql2sqlite/pgsql2sqlite.hpp +++ b/utils/pgsql2sqlite/pgsql2sqlite.hpp @@ -141,9 +141,14 @@ void pgsql2sqlite(Connection conn, int geometry_oid = -1; std::string output_table_insert_sql = "insert into " + output_table_name + " values (?"; + + context_ptr ctx = boost::make_shared(); for ( unsigned pos = 0; pos < num_fields ; ++pos) { + const char* field_name = cursor->getFieldName(pos); + ctx->push(field_name); + if (pos > 0) { create_sql << ","; @@ -216,7 +221,7 @@ void pgsql2sqlite(Connection conn, sqlite::record_type output_rec; output_rec.push_back(sqlite::value_type(pkid)); bool empty_geom = true; - const char * buf = 0; + const char * buf = 0; for (unsigned pos=0 ; pos < num_fields; ++pos) { if (! cursor->isNull(pos)) @@ -275,7 +280,7 @@ void pgsql2sqlite(Connection conn, { if (oid == geometry_oid) { - mapnik::Feature feat(pkid); + mapnik::Feature feat(ctx,pkid); geometry_utils::from_wkb(feat.paths(),buf,size,wkbGeneric); if (feat.num_geometries() > 0) {