Native Microsoft SQL Server client for iOS. An Objective-C wrapper around the open-source FreeTDS library.
##Sample Usage
#import "SQLClient.h"
SQLClient* client = [SQLClient sharedInstance];
client.delegate = self;
[client connect:@"server:port" username:@"user" password:@"pass" database:@"db" completion:^(BOOL success) {
if (success)
{
[client execute:@"SELECT * FROM Users" completion:^(NSArray* results) {
for (NSArray* table in results)
for (NSDictionary* row in table)
for (NSString* column in row)
NSLog(@"%@=%@", column, row[column]);
[client disconnect];
}];
}
}];
//Required
- (void)error:(NSString*)error code:(int)code severity:(int)severity
{
NSLog(@"Error #%d: %@ (Severity %d)", code, error, severity);
}
##Demo Project Open the Xcode project inside the SQLClient folder.
##Installation
###CocoaPods
CocoaPods is the preferred way to install this library.
- Open a Terminal window. Update RubyGems by entering:
sudo gem update --system. Enter your password when prompted. - Install Cocoapods by entering
sudo gem install cocoapods. - Create a file at the root of your Xcode project folder called Podfile.
- Enter the following text:
pod 'SQLClient', '~> 0.1.3' - In Terminal navigate to this folder and enter
pod install. - You will see a new SQLClient.xcworkspace file. Open this file in XCode to work with this project from now on.
###Manual
- Drag and drop the contents of the SQLClient/SQLClient/SQLClient folder into your Xcode project.
- Select Copy items into destination group's folder (if needed).
- Go to Project > Build Phases > Link Binary With Libraries.
- Click + and add libiconv.dylib.
##Documentation
SQLClient: A Native Microsoft SQL Server Library for iOS
##Credits
FreeTDS: http://www.freetds.org
FreeTDS-iOS: https://github.com/patchhf/FreeTDS-iOS
FreeTDS example code in C: http://freetds.schemamania.org/userguide/samplecode.htm