aboutsummaryrefslogtreecommitdiffstats
path: root/Frameworks/SPMySQLFramework/SPMySQLEmptyResult.m
diff options
context:
space:
mode:
authorrowanbeentje <rowan@beent.je>2013-03-11 23:03:28 +0000
committerrowanbeentje <rowan@beent.je>2013-03-11 23:03:28 +0000
commitf4967d21057a1363cacc9607b5ace0149a45ca11 (patch)
tree987e9786303429596420858cec43702f5957790b /Frameworks/SPMySQLFramework/SPMySQLEmptyResult.m
parente88ea3b18a1e9bd1f1e5bef51d982992ce211933 (diff)
downloadsequelpro-f4967d21057a1363cacc9607b5ace0149a45ca11.tar.gz
sequelpro-f4967d21057a1363cacc9607b5ace0149a45ca11.tar.bz2
sequelpro-f4967d21057a1363cacc9607b5ace0149a45ca11.zip
- Add a new SPMySQLEmptyResult class to SPMySQLFrameowkr, returning it instead of nil if a query produces no result set. This allows per-result-set properties to be preserved, fixing issues where information like query execution time was lost - addressing Issue #1577
Diffstat (limited to 'Frameworks/SPMySQLFramework/SPMySQLEmptyResult.m')
-rw-r--r--Frameworks/SPMySQLFramework/SPMySQLEmptyResult.m115
1 files changed, 115 insertions, 0 deletions
diff --git a/Frameworks/SPMySQLFramework/SPMySQLEmptyResult.m b/Frameworks/SPMySQLFramework/SPMySQLEmptyResult.m
new file mode 100644
index 00000000..f8f7e268
--- /dev/null
+++ b/Frameworks/SPMySQLFramework/SPMySQLEmptyResult.m
@@ -0,0 +1,115 @@
+//
+// $$
+//
+// SPMySQLEmptyResult.m
+// SPMySQLFramework
+//
+// Created by Rowan Beentje (rowan.beent.je) on March 11, 2013
+// Copyright (c) 2013 Rowan Beentje. All rights reserved.
+//
+// Permission is hereby granted, free of charge, to any person
+// obtaining a copy of this software and associated documentation
+// files (the "Software"), to deal in the Software without
+// restriction, including without limitation the rights to use,
+// copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the
+// Software is furnished to do so, subject to the following
+// conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+// OTHER DEALINGS IN THE SOFTWARE.
+//
+// More info at <http://code.google.com/p/sequel-pro/>
+
+#import "SPMySQLEmptyResult.h"
+
+@implementation SPMySQLEmptyResult
+
+#pragma mark -
+#pragma mark Setup and teardown
+
+/**
+ * Override the standard SPMySQLResult interface
+ */
+- (id)initWithMySQLResult:(void *)theResult stringEncoding:(NSStringEncoding)theStringEncoding
+{
+ return [super init];
+}
+
+- (void)dealloc
+{
+ [super dealloc];
+}
+
+#pragma mark -
+#pragma mark Overrides
+
+- (NSUInteger)numberOfFields
+{
+ return 0;
+}
+
+- (unsigned long long)numberOfRows
+{
+ return 0;
+}
+
+- (NSArray *)fieldNames
+{
+ return nil;
+}
+
+- (void)seekToRow:(unsigned long long)targetRow
+{
+}
+
+- (id)getRow
+{
+ return nil;
+}
+
+- (NSArray *)getRowAsArray
+{
+ return nil;
+}
+
+- (NSDictionary *)getRowAsDictionary
+{
+ return nil;
+}
+
+- (id)getRowAsType:(SPMySQLResultRowType)theType
+{
+ return nil;
+}
+
+- (NSUInteger)countByEnumeratingWithState:(NSFastEnumerationState *)state objects:(id *)stackbuf count:(NSUInteger)len
+{
+ return 0;
+}
+
+- (NSArray *)fieldDefinitions
+{
+ return nil;
+}
+
+- (id)_stringWithBytes:(const void *)bytes length:(NSUInteger)length
+{
+ return nil;
+}
+
+- (id)_getObjectFromBytes:(char *)bytes ofLength:(NSUInteger)length fieldType:(unsigned int)fieldType fieldDefinitionIndex:(NSUInteger)fieldIndex
+{
+ return nil;
+}
+
+@end