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))
   = row[0];
   = "";
            user.session = "";
            user.socket = -1;
            user.sequence = row[1];

I want to check if row[1] is a mysql null, how do I do that?
LVL 11
Who is Participating?
Jaime OlivaresConnect With a Mentor Software ArchitectCommented:
According with MySql documentation:
null values are returned as null pointers, so this will be different to my first code:

if (row[1]==NULL) {
   // it is null
Jaime OlivaresSoftware ArchitectCommented:
just have to check if empty:

if (!strlen(row[1])) {
   // it is empty or null
BuffonAuthor Commented:
and what if I want to distinguish between empty and null?
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.