Buffon
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?
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?
ASKER
and what if I want to distinguish between empty and null?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
if (!strlen(row[1])) {
// it is empty or null
}