首页 > 数据库技术 > 详细

fmdb

时间:2015-10-23 10:20:05      阅读:223      评论:0      收藏:0      [点我收藏+]
#if SQLITE_VERSION_NUMBER >= 3007017

- (uint32_t)applicationID {
    
    uint32_t r = 0;
    
    FMResultSet *rs = [self executeQuery:@"pragma application_id"];
    
    if ([rs next]) {
        r = (uint32_t)[rs longLongIntForColumnIndex:0];
    }
    
    [rs close];
    
    return r;
}

- (void)setApplicationID:(uint32_t)appID {
    NSString *query = [NSString stringWithFormat:@"pragma application_id=%d", appID];
    FMResultSet *rs = [self executeQuery:query];
    [rs next];
    [rs close];
}


#if TARGET_OS_MAC && !TARGET_OS_IPHONE
- (NSString*)applicationIDString {
    NSString *s = NSFileTypeForHFSTypeCode([self applicationID]);
    
    assert([s length] == 6);
    
    s = [s substringWithRange:NSMakeRange(1, 4)];
    
    
    return s;
    
}

- (void)setApplicationIDString:(NSString*)s {
    
    if ([s length] != 4) {
        NSLog(@"setApplicationIDString: string passed is not exactly 4 chars long. (was %ld)", [s length]);
    }
    
    [self setApplicationID:NSHFSTypeCodeFromFileType([NSString stringWithFormat:@"‘%@‘", s])];
}


#endif

#endif

 

fmdb

原文:http://www.cnblogs.com/javastart/p/4903418.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!