Advertisement
Guest User

Untitled

a guest
Jun 19th, 2017
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. MYSQL *dbconn = 0;
  2. MYSQL_RES *res;
  3. MYSQL_ROW row;
  4. dbconn = mysql_init(NULL);
  5. while (!mysql_real_connect(dbconn, mysql_server,mysql_user, mysql_password, mysql_database, 0, NULL, 0)) {
  6. cout << "\nSQL Serveriin ei saada yhteytta: " << mysql_error(dbconn);
  7. usleep(200);
  8. }
  9. MYSQL_RES mysql_find(string cmd, string database) {
  10. if (mysql_query(dbconn, cmd.c_str())) { cout << "\nERROR2: " << mysql_error(dbconn); }
  11. res = mysql_use_result(dbconn);
  12. mysql_free_result(res);
  13. return *res;
  14. }
  15. MYSQL_RES *result;
  16. *result = mysql_find(sqlcmd,"mydb");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement