Advertisement
Guest User

Untitled

a guest
Jun 20th, 2017
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.79 KB | None | 0 0
  1. void Job::run()
  2. {
  3.     while (true)
  4.     {
  5.         try
  6.         {
  7.             boost::mutex::scoped_lock lock(Job::io_mutex);
  8.             string sqlConnectionString = "hostaddr="+server+" port="+port+
  9.                                          " dbname="+dbname+" user="+user+
  10.                                          " password="+password;
  11.             session sql(postgresql, sqlConnectionString);
  12.             string result;
  13.             sql << sqlQuery, into(result);
  14.             cout << interval << endl;
  15.             cout << boost::this_thread::get_id() << endl;
  16.             sql.close();
  17.         }
  18.         catch (std::exception const &e )
  19.         {
  20.             cerr << "Error: " << e.what() << '\n';
  21.         }
  22.         boost::this_thread::sleep(boost::posix_time::milliseconds(interval));
  23.     }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement