|
Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com |
From: Michael Pawlowsky (mikep
mikeathome.net)
Date: Fri Dec 04 2009 - 17:06:50 CST
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
I 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` = 0x01A161E6CEAC902311B2357792F6076A3CEA85FA9B0B071A77289FC450D7092E LIMIT 1
SELECT `id` FROM `apns`.`tblTokens` WHERE `token_id` = 0x41A161E6CEAC902311B2357792F6076A3CEA85FA9B0B071A77289FC450D7092E 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?
<code>
/* 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);
}
if (mysql_real_query(conn, "SELECT `id` FROM `apns`.`tblTokens` WHERE `token_id` = 0x01A161E6CEAC902311B2357792F6076A3CEA85FA9B0B071A77289FC450D7092E 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);
}
return(0);
</code>
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]