aboutsummaryrefslogtreecommitdiffstats
path: root/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.h
diff options
context:
space:
mode:
Diffstat (limited to 'Frameworks/MCPKit/MCPFoundationKit/MCPConnection.h')
-rw-r--r--Frameworks/MCPKit/MCPFoundationKit/MCPConnection.h70
1 files changed, 43 insertions, 27 deletions
diff --git a/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.h b/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.h
index c6d81bd6..89739e23 100644
--- a/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.h
+++ b/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.h
@@ -27,47 +27,62 @@
// More info at <http://code.google.com/p/sequel-pro/>
#import <Foundation/Foundation.h>
+#import <pthread.h>
#import "MCPConstants.h"
-
#import "mysql.h"
-#include <pthread.h>
-
-enum
-{
- MCP_NO_STREAMING = 0,
- MCP_FAST_STREAMING = 1,
- MCP_LOWMEM_STREAMING = 2
-};
-typedef NSUInteger mcp_query_streaming_types;
-@class MCPResult, MCPStreamingResult;
@protocol MCPConnectionProxy;
-/**
- * NSStringDataUsingLossyEncoding(aStr, enc, lossy) := [aStr dataUsingEncoding:enc allowLossyConversion:lossy]
- */
-static inline NSData* NSStringDataUsingLossyEncoding(NSString* self, NSInteger encoding, NSInteger lossy)
-{
- typedef NSData* (*SPStringDataUsingLossyEncodingMethodPtr)(NSString*, SEL, NSInteger, NSInteger);
- static SPStringDataUsingLossyEncodingMethodPtr SPNSStringDataUsingLossyEncoding;
- if (!SPNSStringDataUsingLossyEncoding) SPNSStringDataUsingLossyEncoding = (SPStringDataUsingLossyEncodingMethodPtr)[self methodForSelector:@selector(dataUsingEncoding:allowLossyConversion:)];
- NSData* to_return = SPNSStringDataUsingLossyEncoding(self, @selector(dataUsingEncoding:allowLossyConversion:), encoding, lossy);
- return to_return;
-}
+@class MCPResult, MCPStreamingResult;
-// Connection delegate interface
@interface NSObject (MCPConnectionDelegate)
+/**
+ *
+ */
- (void)willQueryString:(NSString *)query connection:(id)connection;
+
+/**
+ *
+ */
- (void)queryGaveError:(NSString *)error connection:(id)connection;
+
+/**
+ *
+ */
- (BOOL)connectionEncodingViaLatin1:(id)connection;
+
+/**
+ *
+ */
- (NSString *)keychainPasswordForConnection:(id)connection;
+
+/**
+ *
+ */
- (NSString *)onReconnectShouldSelectDatabase:(id)connection;
+
+/**
+ *
+ */
- (NSString *)onReconnectShouldUseEncoding:(id)connection;
+
+/**
+ *
+ */
- (void)noConnectionAvailable:(id)connection;
+
+/**
+ *
+ */
- (MCPConnectionCheck)connectionLost:(id)connection;
-- (NSString*)connectionID;
+
+/**
+ *
+ */
+- (NSString *)connectionID;
+
@end
@interface MCPConnection : NSObject
@@ -77,9 +92,10 @@ static inline NSData* NSStringDataUsingLossyEncoding(NSString* self, NSInteger e
NSStringEncoding mEncoding; /* The encoding used by MySQL server, to ISO-1 default. */
NSTimeZone *mTimeZone; /* The time zone of the session. */
NSUInteger mConnectionFlags; /* The flags to be used for the connection to the database. */
- id delegate; /* Connection delegate */
- NSLock *queryLock; /* Anything that performs a mysql_net_read is not thread-safe: mysql queries, pings */
+ id delegate; /* Connection delegate */
+
+ NSLock *queryLock; /* Anything that performs a mysql_net_read is not thread-safe: mysql queries, pings */
BOOL useKeepAlive;
BOOL isDisconnecting;
@@ -212,7 +228,7 @@ void performThreadedKeepAlive(void *ptr);
- (MCPResult *)queryString:(NSString *)query;
- (MCPStreamingResult *)streamingQueryString:(NSString *)query;
- (MCPStreamingResult *)streamingQueryString:(NSString *)query useLowMemoryBlockingStreaming:(BOOL)fullStream;
-- (id)queryString:(NSString *) query usingEncoding:(NSStringEncoding) encoding streamingResult:(NSInteger) streamResult;
+- (id)queryString:(NSString *)query usingEncoding:(NSStringEncoding)encoding streamingResult:(NSInteger)streamResult;
- (my_ulonglong)affectedRows;
- (my_ulonglong)insertId;
- (void)cancelCurrentQuery;