Problems with getting boolean from db
Hi,
The other problem I encountered is that I cannot get boolean data from MySQL database. This is how I tried to do that, assuming that conn is a valid connection:
MYSQL_RES *res;
MYSQL_ROW row;
mysql_query(conn, "SELECT name, sex FROM customers");
res = mysql_store_result(conn);
while (row = mysql_fetch_row(res))
{
printf("%s\n", row[0]);
}
The code above works fine for me, but it prints name fields only. If I try changing printf("%s\n", row[0]) to printf("%s\n", row[1]), it doesn't print the thing I need.
Field name is varchar, sex is bool. I'd like to know how can I get data from the sex field. I use Borland C++ 6 and MySQL C API for connecting.
Thanks in advance!
Subject
Views
Written By
Posted
Problems with getting boolean from db
1351
December 17, 2010 04:02AM
365
December 17, 2010 05:35AM
400
January 09, 2011 08:22AM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.