Rewrite pgsql_store_nodes in more standard C++

This eliminates a bunch of memory allocations, gotos, etc

Currently doesn't pass regression test, but does pass unit tests

@zerebubuth, any thoughts why? It seems to be a problem in ``--append``. test log messages are

```
****************************************
Running initial import for Extra tags hstore match onlyFFFF..F
======================================================================
FAIL: runTest (__main__.BasicSlimTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "tests/regression-test.py", line 440, in runTest
    self.updateGeneric(self.parameters, diff_import_file)
  File "tests/regression-test.py", line 389, in updateGeneric
    self.assertEqual (proc.returncode, 0, "Execution of osm2pgsql --slim --append with options: '%s' failed:\n%s\n%s\n" % (str(parameters), outp, outerr))
AssertionError: Execution of osm2pgsql --slim --append with options: '[]' failed:

osm2pgsql SVN version 0.85.0 (64bit id space)

Using built-in tag processing pipeline
Using projection SRS 900913 (Spherical Mercator)
Setting up table: planet_osm_point
NOTICE:  table "planet_osm_point_tmp" does not exist, skipping
Setting up table: planet_osm_line
NOTICE:  table "planet_osm_line_tmp" does not exist, skipping
Setting up table: planet_osm_polygon
NOTICE:  table "planet_osm_polygon_tmp" does not exist, skipping
Setting up table: planet_osm_roads
NOTICE:  table "planet_osm_roads_tmp" does not exist, skipping
Allocating memory for dense node cache
Allocating dense node cache in one big chunk
Allocating memory for sparse node cache
Sharing dense sparse
Node-cache: cache=100MB, maxblocks=12800*8192, allocation method=11
Mid: pgsql, scale=100 cache=100
Setting up table: planet_osm_nodes
Setting up table: planet_osm_ways
Setting up table: planet_osm_rels

Reading in file: tests/000466354.osc.gz
node cache: stored: 854(100.00%), storage efficiency: 40.78% (dense blocks: 1, sparse nodes: 535), hit rate: 28.07%
Osm2pgsql failed due to ERROR: insert_way failed: ERROR:  array value must start with "{" or dimension information
(7)
Arguments were: 33459033, <80>y<EF>^A, {"place","island","natural","coastline","name","Bryher","boundary","administrative","admin_level","5"},
```

This does imply that we've got lacking test coverage
If the aim here is to reduce allocations then this doesn't work. The previous implementation had a (potentially dangerous and non-thread-safe) static local buffer and pretty much the only advantage of this would be to massively reduce the number of allocations.

Similar benefits can be had by allocating the `std::stringstream` and storing it in a `boost::thread_specific_ptr` once, and re-using that. It will buffer in the same way as the previous C-based implementation. However, `std::stringstream::str()` returns by value, and therefore always allocates, so uglier tactics would be required if you want to reduce the number of allocations to the level of the previous C-based implementation.