Skip to content

Instantly share code, notes, and snippets.

View methodmissing's full-sized avatar

Lourens Naudé methodmissing

View GitHub Profile
require File.dirname(__FILE__) + '/test_helper'
m = Mysql.real_connect('localhost','root')
class << m
def safe_query( query )
begin
send_query( query )
rescue => e
diff --git a/ext/mysql.c b/ext/mysql.c
index b804723..b6a3227 100644
--- a/ext/mysql.c
+++ b/ext/mysql.c
@@ -61,6 +61,7 @@ struct mysql {
char connection;
char query_with_result;
char blocking;
+ int async_in_progress;
};
diff --git a/ext/mysql.c b/ext/mysql.c
index b804723..472f0eb 100644
--- a/ext/mysql.c
+++ b/ext/mysql.c
@@ -61,6 +61,7 @@ struct mysql {
char connection;
char query_with_result;
char blocking;
+ char query_sent;
};
diff --git a/ext/mysql.c b/ext/mysql.c
index b804723..372edf4 100644
--- a/ext/mysql.c
+++ b/ext/mysql.c
@@ -61,6 +61,7 @@ struct mysql {
char connection;
char query_with_result;
char blocking;
+ char query_sent;
};
require File.dirname(__FILE__) + '/test_helper'
c = Mysql.real_connect('localhost','root')
c.send_query('select sleep(1)')
c.send_query('select sleep(1)')
diff --git a/ext/mysql.c b/ext/mysql.c
index b804723..d957978 100644
--- a/ext/mysql.c
+++ b/ext/mysql.c
@@ -798,13 +798,16 @@ static VALUE send_query(VALUE obj, VALUE sql)
{
MYSQL* m = GetHandler(obj);
+ free_old_query(m);
+
module ActiveSupport
class BufferedLogger
def <<( message )
info( message )
end
end
end
# modified <RAILS_ROOT/script/console overloading the irb executeable ( assumes script/irb )
#!/usr/bin/env ruby
ARGV << "--irb=#{File.dirname(__FILE__)}/irb"
require File.dirname(__FILE__) + '/../config/boot'
require 'commands/console'
#<RAILS_ROOT>/script/irb or elsewhere
#!/usr/bin/env ruby
macbook-pros-computer:Ruby lourens$ sudo dtrace -n 'syscall:::entry/execname == "ruby"/{ @[execname, probefunc] = count() }'
dtrace: description 'syscall:::entry' matched 427 probes
^C
ruby execve 1
ruby exit 1
ruby fork 1
ruby getdtablesize 1
ruby kill 1
ruby mkdir 1
/* <MYSQL_ROOT>/vio/vio.c */
/* Copyright (C) 2000 MySQL AB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of