天天看点

iOS 下的 sqlite ModalObject

iPhone iPad iOS sqlite FMDatabase ModalObject 地址: https://github.com/angelipin/ModalObject QQ: 541412674 Sample:

//
//  huangli.h
//  Almanac
//
//  Created by wang yepin on 12-11-16.
//  Copyright (c) 2012年 wang yepin. All rights reserved.
//

#import <UIKit/UIKit.h>
#import <ModalObject/Modal/Modal.h>

@interface huangli : Modal
Property_Declear(NSInteger, date, queryDate, nonatomic, assign);

@property (nonatomic, strong) NSString  *y;
@property (nonatomic, strong) NSString  *j;
@property (nonatomic, strong) NSString  *c;
@property (nonatomic, strong) NSString  *s;
@property (nonatomic, strong) NSString  *ch;
@property (nonatomic, strong) NSString  *zc;
@property (nonatomic, strong) NSString  *ts;
@property (nonatomic, strong) NSString  *js;
@end
           
//
//  huangli.m
//  Almanac
//
//  Created by wang yepin on 12-11-16.
//  Copyright (c) 2012年 wang yepin. All rights reserved.
//

#import "huangli.h"

@implementation huangli
Property_Implement(date, queryDate);

- (void)dealloc {
    [_y release];
    [_j release];
    [_c release];
    [_s release];
    [_ch release];
    [_zc release];
    [_ts release];
    [_js release];
    
    [super dealloc];
}
@end
           

Sample:

NSArray  *documents = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
    NSString *documentDirectory = [documents objectAtIndex:0];
    NSString *commonDbName = @"common.sqlite";
    NSString *commonDbPath = [documentDirectory stringByAppendingPathComponent:commonDbName];

    [self copyDatabase:[NSArray arrayWithObjects:commonDbName, nil] toDirectory:documentDirectory];
    
    [huangli registeDatabase:commonDbPath];
    huangli *hl = [huangli queryDate:[NSNumber numberWithInt:20121117]];