Skip to content

Commit

Permalink
Block signals for mysql_real_query.
Browse files Browse the repository at this point in the history
  • Loading branch information
bos committed Jun 3, 2011
1 parent 71aaa21 commit c2a5062
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Database/MySQL/Base/C.hsc
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ foreign import ccall safe mysql_get_ssl_cipher
foreign import ccall unsafe mysql_stat
:: Ptr MYSQL -> IO CString

foreign import ccall unsafe mysql_real_query
foreign import ccall unsafe "mysql_signals.h _hs_mysql_real_query" mysql_real_query
:: Ptr MYSQL -> CString -> CULong -> IO CInt

foreign import ccall safe mysql_insert_id
Expand Down
10 changes: 10 additions & 0 deletions cbits/mysql_signals.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,16 @@ int STDCALL _hs_mysql_ping(MYSQL *mysql)
return ret;
}

int STDCALL _hs_mysql_real_query(MYSQL *mysql, const char *q,
unsigned long length)
{
int ret;
block_rts_signals();
ret = mysql_real_query(mysql, q, length);
unblock_rts_signals();
return ret;
}

const char *STDCALL _hs_mysql_stat(MYSQL *mysql)
{
const char *ret;
Expand Down
2 changes: 2 additions & 0 deletions include/mysql_signals.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ MYSQL *STDCALL _hs_mysql_real_connect(MYSQL *mysql, const char *host,
unsigned long clientflag);
void STDCALL _hs_mysql_close(MYSQL *sock);
int STDCALL _hs_mysql_ping(MYSQL *mysql);
int STDCALL _hs_mysql_real_query(MYSQL *mysql, const char *q,
unsigned long length);
const char *STDCALL _hs_mysql_stat(MYSQL *mysql);
my_bool STDCALL _hs_mysql_autocommit(MYSQL * mysql, my_bool auto_mode);
my_bool STDCALL _hs_mysql_change_user(MYSQL *mysql, const char *user,
Expand Down

0 comments on commit c2a5062

Please sign in to comment.