HYDatabaseManager 0.0.3

HYDatabaseManager 0.0.3

TestsTested
LangLanguage Obj-CObjective C
License MIT
ReleasedLast Release May 2017

Maintained by Yan.


Downloads

Total6
Week0
Month6

Installs

Apps1
powered by Segment

GitHub

Stars0
Watchers1
Forks0
Issues0
Contributors1
Pull Requests0

Code

Files2
LOCLines of Code 114


  • By
  • Yan

Avoid multi thread makes the sqlite sleep.

Install

pod 'HYDatabaseManager'

pod install

Usage

NSString *sql = @"CREATE TABLE IF NOT EXISTS data ('id' INTEGER PRIMARY KEY AUTOINCREMENT  NOT NULL  UNIQUE, 'start' DATETIME, 'end' DATETIME);";
    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
        NSMutableArray *array = [NSMutableArray array];
        [array addObject:sql];
        for (int i = 0; i < 10000; i++) {
            [array addObject:@"INSERT into data (start, end) VALUES (1, 2)"];
        }
        [HYDatabaseManager executeSqls:[array copy] finished:^(BOOL result) {
            NSLog(@"finished");
        }];
        [HYDatabaseManager selectSql:@"SELECT * FROM data" keys:@[@"start"] finished:^(NSArray *results) {
            NSLog(@"end");
        }];
    });