Created
October 21, 2010 02:38
-
-
Save ebryn/637827 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/ext/tiny_tds/result.c b/ext/tiny_tds/result.c | |
index 307a2c1..24cbb23 100644 | |
--- a/ext/tiny_tds/result.c | |
+++ b/ext/tiny_tds/result.c | |
@@ -285,12 +285,23 @@ static VALUE rb_tinytds_result_each(int argc, VALUE * argv, VALUE self) { | |
if (rwrap->number_of_results == 0) { | |
rwrap->results = result; | |
} else if (rwrap->number_of_results == 1) { | |
- VALUE multi_resultsets = rb_ary_new(); | |
- rb_ary_store(multi_resultsets, 0, rwrap->results); | |
- rb_ary_store(multi_resultsets, 1, result); | |
- rwrap->results = multi_resultsets; | |
+ if (TRUE && FIX2INT(rb_funcall(rwrap->results, rb_intern("size"), 0)) == 0) { // replace true w/ flag for ignoring empty result sets | |
+ rwrap->results = result; | |
+ } else { | |
+ VALUE multi_resultsets = rb_ary_new(); | |
+ rb_ary_store(multi_resultsets, 0, rwrap->results); | |
+ rb_ary_store(multi_resultsets, 1, result); | |
+ rwrap->results = multi_resultsets; | |
+ } | |
} else { | |
- rb_ary_store(rwrap->results, rwrap->number_of_results, result); | |
+ if (TRUE) { // replace true w/ flag for ignoring empty result sets | |
+ VALUE multi_resultsets = rb_ary_new(); | |
+ rb_ary_store(multi_resultsets, 0, rwrap->results); | |
+ rb_ary_store(multi_resultsets, 1, result); | |
+ rwrap->results = multi_resultsets; | |
+ } else { | |
+ rb_ary_store(rwrap->results, rwrap->number_of_results, result); | |
+ } | |
} | |
} | |
} else { |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment