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
You have an issue here - the `std::string` returned by `pgsql_store_nodes` will, because it is anonymous, fall out of scope at the end of the statement and so the pointer stored in `paramValues[1]` will likely point to garbage. You either need to store the `std::string` in a local variable until the `paramValues` pointers have been used, or (hackily) use static local storage in `pgsql_store_nodes` as it was before.