/SQLClient

Native Microsoft SQL Server client for iOS

Primary LanguageCMIT LicenseMIT

SQLClient

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.

  1. Open a Terminal window. Update RubyGems by entering: sudo gem update --system. Enter your password when prompted.
  2. Install CocoaPods by entering sudo gem install cocoapods.
  3. Create a file at the root of your Xcode project folder called Podfile.
  4. Enter the following text: pod 'SQLClient', '~> 0.1.3'
  5. In Terminal navigate to this folder and enter pod install.
  6. You will see a new SQLClient.xcworkspace file. Open this file in Xcode to work with this project from now on.

###Manual

  1. Drag and drop the contents of the SQLClient/SQLClient/SQLClient folder into your Xcode project.
  2. Select Copy items into destination group's folder (if needed).
  3. Go to Project > Build Phases > Link Binary With Libraries.
  4. Click + and add libiconv.dylib.

##Documentation

SQLClient Class Reference

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