简介iOS开发中应用SQLite的模糊查询和常用函数

2020-01-14 17:44:55王冬梅
易采站长站为您分析iOS开发中应用SQLite的模糊查询和常用函数,SQLite是一个可作嵌入式的数据库非常适合小型应用使用,需要的朋友可以参考下  

SQLite模糊查询
一、示例

说明:本文简单示例了SQLite的模糊查询

1.新建一个继承自NSObject的模型

简介iOS开发中应用SQLite的模糊查询和常用函数

该类中的代码:

复制代码
//
//  YYPerson.h
//  03-模糊查询
//
//  Created by apple on 14-7-27.
//  Copyright (c) 2014年 wendingding. All rights reserved.
//

 

#import <Foundation/Foundation.h>

@interface YYPerson : NSObject
@property (nonatomic, assign) int ID;
@property (nonatomic, copy) NSString *name;
@property (nonatomic, assign) int age;

@end


2.新建一个工具类,用来管理模型

 

简介iOS开发中应用SQLite的模糊查询和常用函数

工具类中的代码设计如下:

YYPersonTool.h文件

复制代码
//
//  YYPersonTool.h
//  03-模糊查询
//
//  Created by apple on 14-7-27.
//  Copyright (c) 2014年 wendingding. All rights reserved.
//

 

#import <Foundation/Foundation.h>

@class YYPerson;
@interface YYPersonTool : NSObject
/**
 *  保存一个联系人
 */
+ (void)save:( YYPerson*)person;

/**
 *  查询所有的联系人