Changes between Version 209 and Version 210 of WikiStart


Ignore:
Timestamp:
Feb 5, 2020, 7:35:32 PM (3 weeks ago)
Author:
jtv
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • WikiStart

    v209 v210  
    151151    do_db_work(trans);
    152152  }
    153   catch (const std::exception &e)
     153  catch (std::exception const &e)
    154154  {
    155155    std::cerr << e.what() << std::endl;
     
    173173    do_db_work(trans);
    174174  }
    175   catch (const pqxx::sql_error &e)
     175  catch (pqxx::sql_error const &e)
    176176  {
    177177    std::cerr
     
    180180    return 2;
    181181  }
    182   catch (const std::exception &e)
     182  catch (std::exception const &e)
    183183  {
    184184    std::cerr << e.what() << std::endl;
     
    205205  pqxx::work txn{c};
    206206
    207   pqxx::result r = txn.exec("SELECT name, salary FROM Employee");
     207  pqxx::result r{txn.exec("SELECT name, salary FROM Employee"};
    208208  for (auto row: r)
    209209    std::cout
     
    230230  try
    231231  {
    232     pqxx::result r = query();
     232    pqxx::result r{query()};
    233233
    234234    // Results can be accessed and iterated again.  Even after the connection
     
    242242    }
    243243  }
    244   catch (const pqxx::sql_error &e)
     244  catch (pqxx::sql_error const &e)
    245245  {
    246246    std::cerr << "SQL error: " << e.what() << std::endl;
     
    248248    return 2;
    249249  }
    250   catch (const std::exception &e)
     250  catch (std::exception const &e)
    251251  {
    252252    std::cerr << "Error: " << e.what() << std::endl;