mysql_real_query causing segmentation fault for binary select
am 05.12.2009 00:06:50 von Michael PawlowskyI am trying top run these 2 SELECT queries using mysql_real_query in =
MySQL-C.
The only difference between them is changing the first hex value from 41 =
to 01.
It if is 41, the query runs fine. When I change it to 01 I get the =
following segmentation fault.
segfault at 0 ip 0000000000402be6 sp 00007fff01e5bee0 error 4 in =
apnsd[400000+7000]
SELECT `id` FROM `apns`.`tblTokens` WHERE `token_id` =3D =
0x01A161E6CEAC902311B2357792F6076A3CEA85FA9B0B071A77289FC450 D7092E LIMIT =
1
SELECT `id` FROM `apns`.`tblTokens` WHERE `token_id` =3D =
0x41A161E6CEAC902311B2357792F6076A3CEA85FA9B0B071A77289FC450 D7092E LIMIT =
1
token_id is defines as: binary(32)
I also tried it a char(32) with the same results
Any insight on why this is happening?
/* Connect to database */
if (!mysql_real_connect(conn, db_host,
db_user, db_password, db_name, 0, NULL, 0)) {
/* log an error */
syslog(LOG_ERR,"Unable to connect to DB. Error: =
%s", mysql_error(conn));
mysql_close(conn);
/* Can't connect to DB... Bailing out */
return(ERROR);
}
=09
if (mysql_real_query(conn, "SELECT `id` FROM `apns`.`tblTokens` WHERE =
`token_id` =3D =
0x01A161E6CEAC902311B2357792F6076A3CEA85FA9B0B071A77289FC450 D7092E LIMIT =
1", 129)) {
/* log an error */
syslog(LOG_ERR,"Failed to SELECT, Error: %s", =
mysql_error(conn));
syslog(LOG_ERR, "Query: %s", query);
mysql_close(conn);
/* Failed to select from DB... Bailing out */
return(ERROR);
}=20
return(0);
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=3Dgcdmg-mysql-2@m.gmane.o rg