Commit Graph

335 Commits

Author SHA1 Message Date
Brian Lopez
a6b5e9c28c add connect_flags to default options and add REMEMBER_OPTIONS to that list. fix NUM2INT to be NUM2ULONG as it should be for flags 2010-10-14 08:12:52 -07:00
Brian Lopez
7169649857 free the client after close if we can 2010-10-13 15:25:37 -07:00
Brian Lopez
225ddadaf7 forgot to remove this 2010-10-13 15:18:12 -07:00
Brian Lopez
0d1e9916bf get rid of double-pointer casting 2010-10-13 15:17:35 -07:00
Brian Lopez
a17ba07c75 a couple of minor updates to connection management with some specs 2010-10-06 10:33:52 -07:00
Brian Lopez
f9d30e8f85 check for error from mysql_affected_rows call 2010-10-05 23:36:37 -07:00
Brian Lopez
40f0cd012c change connection check symantecs 2010-10-05 23:36:05 -07:00
Anton Mironov
687487d5a5 Detach before executing callbacks.
This allows to make queries in callbacks.
2010-09-28 13:47:19 +08:00
Brian Lopez
2ae908c512 make sure we don't hit a race condition if this EM spec is taking longer to run than normal 2010-09-27 13:25:10 -07:00
Brian Lopez
4383885634 was in a hurry earlier 2010-09-27 13:24:37 -07:00
Brian Lopez
307b92b966 whoops, lost this line in a previous patch 2010-09-27 11:17:47 -07:00
Luis Lavena
685538ce52 Dry windows configuration options 2010-09-26 17:25:23 -03:00
Luis Lavena
553c9a77c3 Inject 1.8/1.9 pure-ruby entry point during xcompile
The original problem of .so files not included in the final
gemspec is because rake-compiler put files in lib_dir/X.Y/extension
while the pure-ruby entry point was looking for lib_dir/XY/extension
2010-09-26 17:14:52 -03:00
Luis Lavena
95db3c74df Use MySQL 5.1.51 now from available mirror 2010-09-26 17:09:25 -03:00
Brian Lopez
ba41a5a24e final rake task changes for fat binary support on windows 2010-09-18 23:50:05 -07:00
Aaron Patterson
84dc998a3b adding a task for fat binary shim 2010-09-18 13:36:39 -07:00
Brian Lopez
50775163ed prepare for 0.2.4 release 2010-09-17 10:19:16 -07:00
Brian Lopez
26650c8c05 Version bump to 0.2.4 2010-09-17 10:13:10 -07:00
Brian Lopez
dc9164d016 re-fix some compiler warnings 2010-09-14 22:27:18 -07:00
Brian Lopez
e7924df06a make sure we only attempt to close/free the MYSQL pointer once 2010-09-14 22:27:07 -07:00
Brian Lopez
5cadce3417 fix bug in rb_mysql_client_free 2010-09-14 20:51:21 -07:00
Joe Damato
05c942a668 Fix macros and associated semicolons 2010-09-14 19:14:07 -07:00
Joe Damato
7b8d6359c2 Fix data corruption bug 2010-09-14 18:01:14 -07:00
Kouhei Yanagita
0f0bd5a001 set IndexDefinition#length 2010-09-15 00:38:39 +08:00
Brian Lopez
b1b66cc389 enable cross-compilation 2010-09-09 07:35:31 -07:00
Brian Lopez
64be4019ad work around an rbx bug (it's going to be fixed in rbx soon anyhow) 2010-09-07 15:43:22 -07:00
Brian Lopez
530b082905 Revert "remove cached values for better rbx compatibility (this may come back in the near future)"
This reverts commit d12c5e2e27.
2010-09-07 15:38:08 -07:00
Brian Lopez
d12c5e2e27 remove cached values for better rbx compatibility (this may come back in the near future) 2010-09-04 11:52:10 -07:00
Brian Lopez
c110d0d263 rbx doesn't have rb_obj_dup yet 2010-09-04 11:52:09 -07:00
Brian Lopez
9b401ba9b9 take advantage of DO API in benchmark 2010-09-04 11:52:09 -07:00
Brian Lopez
98fbeb6f64 add aliases for Mysql compatibility 2010-09-01 11:42:16 -07:00
Brian Lopez
ae6c33a13f add cache_rows option to enable/disable internal row caching for results 2010-08-27 12:08:48 -07:00
Brian Lopez
10222fb455 appease the rdoc.info godz 2010-08-24 20:59:17 -07:00
Brian Lopez
3b2e7602a0 formatting fix so I collapse in TM 2010-08-24 09:27:29 -07:00
Eric Wong
1100288eba avoid stack overflow when escaping large strings
Attempting to escape large, untrusted strings cause stack
overflows (easier under Ruby 1.9 using pthreads) leading to
SystemStackError on small overflows and segmentation faults on
large overflows.  Instead of allocating on the stack, we'll
allocate a string buffer from the heap.

This has the unfortunate effect of reducing escape performance
for common cases, but in my experience SQL escaping isn't much
of a bottleneck.

For reference, Ruby 1.9.2-p0 with pthreads gets a stack size of
512K and the default process stack size is 8MB on both x86 and
x86_64 Linux.
2010-08-24 05:24:35 +00:00
Luis Lavena
4f9625f877 Wrap fcntl to exclude Windows.
Naive implementation, get it compiled but crashes.
2010-08-23 11:59:11 -07:00
Luis Lavena
b3ec7b57de Bumped MySQL version 5.1.50 for Windows
And also cleanup compiled extension when 'rake clean'
2010-08-23 11:59:02 -07:00
Brian Lopez
17cabf5559 update files for 0.2.3 release 2010-08-20 20:24:00 -07:00
Brian Lopez
15da806495 Version bump to 0.2.3 2010-08-20 20:23:38 -07:00
Brian Lopez
dd5f563554 make sure we respect application_timezone for DateTime values as well 2010-08-20 15:13:08 -07:00
Brian Lopez
e56c79894c fix compiler warning 2010-08-20 12:08:29 -07:00
Brian Lopez
a19888e939 Make sure we switch over to the DateTime class for DATETIME/TIMESTAMP columns that are out of the supported range for 32bit platforms 2010-08-20 12:07:27 -07:00
Aaron Patterson
c5f2eb7f3f adding FOUND_ROWS to the client flags 2010-08-20 10:14:49 -07:00
Aaron Patterson
ce77899848 connection flags can be passed to the constructor 2010-08-20 09:56:36 -07:00
Aaron Patterson
864cf0f291 exposing client flags 2010-08-20 09:36:15 -07:00
Brian Lopez
4935931431 update files for 0.2.2 release 2010-08-19 16:03:43 -07:00
Brian Lopez
554837a932 Version bump to 0.2.2 2010-08-19 16:03:29 -07:00
Eric Wong
8e81dcb053 retry connect if interrupted by signals
The MySQL client libraries normally retry system calls when
interrupted by signals.  The lone exception I've found is in the
(infrequent) connection setup where it'll propagate the
connect(2) syscall error all the way back up to the caller.
Fortunately inspection of the MySQL client library reveals it
properly preserves the global "errno" variable even with
debugging enabled.

Note that the net.last_errno member does NOT correspond to the
system "errno".
2010-08-19 15:55:32 -07:00
Eric Wong
8bfbfa2708 fix signal handling when waiting on queries
This reverts the single-threaded select() optimization from
commits 9a63a587c0 and
0190457dbd.

Under Ruby 1.9, the reverted optimization caused signal handlers
to be delayed until the socket became readable.

Under Ruby 1.8, matters are worse as receiving a signal during
select() causes Errno::EINTR to be raised.

There is now a (somewhat fragile) spec for testing signal
handling during a "SELECT sleep(2)" query.

Furthermore, the performance difference I measured on
benchmark/thread_alone.rb was negligible (over 1000 iterations)
between the two:

Ruby 1.8.7-p249
  Rehearsal ----------------------------------------------------
  select             0.040000   0.020000   0.060000 (  0.119448)
  rb_thread_select   0.050000   0.020000   0.070000 (  0.132091)
  ------------------------------------------- total: 0.130000sec

                         user     system      total        real
  select             0.030000   0.030000   0.060000 (  0.116471)
  rb_thread_select   0.050000   0.020000   0.070000 (  0.119874)

Ruby 1.9.2-p0
  Rehearsal ----------------------------------------------------
  select             0.050000   0.030000   0.080000 (  0.134208)
  rb_thread_select   0.080000   0.000000   0.080000 (  0.141316)
  ------------------------------------------- total: 0.160000sec

                         user     system      total        real
  select             0.050000   0.020000   0.070000 (  0.123325)
  rb_thread_select   0.060000   0.010000   0.070000 (  0.124075)

Benchmarks were performed on an _empty_ mysql2_test table to
maximize the relative time for the select(2)-related code path
(vs reading data).  The test was run on Debian Lenny, x86_64 and
a stock 2.6.35.2 Linux kernel.  Hardware was a Core2 Duo @
1.6GHz with the performance CPU governor while on AC power
to eliminate CPU speed fluctuations during the test.
2010-08-18 20:13:13 -07:00
Brian Lopez
d990f68320 slight refactor of how initial commands were being sent 2010-08-18 12:50:03 -07:00