Changes between Version 182 and Version 183 of WikiStart


Ignore:
Timestamp:
Sep 9, 2017, 9:06:39 AM (2 weeks ago)
Author:
jtv
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • WikiStart

    v182 v183  
    163163=== Complete example ===
    164164
    165 Here's a more complete example, in C++11, showing iteration and direct field access.  Download it, or view it in colour, [attachment:complete-example.cxx here].
    166 
    167 {{{
    168 #!cpp
     165Here's a more complete example, in C++11, showing iteration and direct field access.
     166
     167{{{
    169168#include <iostream>
    170169#include <pqxx/pqxx>
     
    211210      for (auto field: row) std::cout << field.c_str() << " ";
    212211      std::cout << std::endl;
    213   }
    214   catch (const std::exception &e)
    215   {
    216     std::cerr << "Error: " << e.what() << std::endl;
    217     return 1;
     212    }
    218213  }
    219214  catch (const pqxx::sql_error &e)
     
    222217    std::cerr << "Query was: " << e.query() << std::endl;
    223218    return 2;
     219  }
     220  catch (const std::exception &e)
     221  {
     222    std::cerr << "Error: " << e.what() << std::endl;
     223    return 1;
    224224  }
    225225}