Link to home
Start Free TrialLog in
Avatar of Buffon
BuffonFlag for Israel

asked on

mysql null

this is my code:

                MYSQL *conn;
      MYSQL_RES *res;
      MYSQL_ROW  row;
      
      query = query1 + me->id;

      conn = mysql_init(NULL);
      mysql_real_connect(conn, "", "", "", "", 0, NULL, 0);
      mysql_query(conn, query.c_str());
      res = mysql_store_result(conn);
      
      while(row = mysql_fetch_row(res))
      {
            user.id = row[0];
            user.name = "";
            user.session = "";
            user.socket = -1;
            user.sequence = row[1];
            me->q.push_back(user);
      }

I want to check if row[1] is a mysql null, how do I do that?
Avatar of Jaime Olivares
Jaime Olivares
Flag of Peru image

just have to check if empty:

if (!strlen(row[1])) {
   // it is empty or null
}
Avatar of Buffon

ASKER

and what if I want to distinguish between empty and null?
ASKER CERTIFIED SOLUTION
Avatar of Jaime Olivares
Jaime Olivares
Flag of Peru image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial