SHARE
TWEET

Untitled

a guest Jun 19th, 2017 52 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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");
RAW Paste Data
Top