Hello all! Im am programming on С++ for mysql. I've got a problem with mysql_fetch_row() function. When I want to make a query foe MySQL server I do this:
mysql_real_query()
    then
mysql_store_result()
   and then
mysql_fetch_row()

All was well, but today my program has fallen with an error in mysql_fetch_row(). mysql_real_query() mysql_store_result() work properly, but mysql_fetch_row returns NULL. I just don't know what to do. I've watched all my code near this function and mde query from another client and it is well. This is my code:
   MYSQL_RES *res;
   MYSQL_ROW row;

   std::stringstream ost;
ost <<"SELECT Uid,Login,Password,Server,Ips,Logged_in,Locked,Deleted,Multilogin FROM user_auth WHERE Login = '"<<login<<"';";
   string query(ost.str());
if( mysql_real_query( mysql, query.c_str(), query.length() ) != 0)
   {
syslog(LOG_ERR,"Tbilling Error. Mysql_real_query() call: %s", mysql_error( mysql ));
       return -1;
   }

   if( (res = mysql_store_result(mysql) ) == NULL)
   {
syslog(LOG_ERR,"Tbilling Error. Mysql_store_result() call: %s", mysql_error( mysql ));
       return -1;
   }
   syslog(LOG_ERR,"Number of rows is %d",mysql_num_rows(res));
   if( ( row = mysql_fetch_row(res)) == NULL)
   {
syslog(LOG_ERR,"Tbilling Error. Mysql_fetch_row() call:%s", mysql_errno( mysql ));
       return -1;
   }

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to