GithubHelp home page GithubHelp logo

graywang / ddsqlitekit Goto Github PK

View Code? Open in Web Editor NEW

This project forked from openboy2012/ddsqlitekit

0.0 2.0 0.0 398 KB

An ORM kit of object persistence use SQLite

Home Page: http://dwz.cn/IRSV4

License: MIT License

Objective-C 99.67% Ruby 0.33%

ddsqlitekit's Introduction

DDSQLiteKit

An ORM kit of object persistence use SQLite

##SQLitePersistentObject

SQLitePersistentObject is an ORM Kit Write by Jeff LaMarche, it's excellent.

Any class that subclasses this class can have their properties automatically persisted into a sqlite database. There are some limits - currently certain property types aren't supported like void *, char *, structs and unions. Anything that doesn't work correctly with Key Value Coding will not work with this. Ordinary scalars (ints, floats, etc) will be converted to NSNumber, as will BOOL.

SQLite is very good about converting types, so you can search on a number field passing in a number in a string, and can search on a string field by passing in a number. The only limitation we place on the search methods is that we don't allow searching on blobs, which is simply for performance reasons.

but now, Jeff not work on this library. so I will work on this library. in original this library is non-safe-thread in multithread opearations , I just make it thread-safe in multithread use some new methods

##Installation

Version Platform
SQLitePersisentObject is available through CocoaPods, to install it simply add the following line to your Podfile:

pod "SQLitePersistentObject"

Alternatively, you can just drag the files from SQLitePersistentObject / SQLitePersistentObject into your own project.

Usage

create an object inherit SQLitePersistentObject

header file:
#import "SQLitePersistentObject.h"

@interface Device : SQLitePersistentObject

@property (nonatomic, copy) NSString *name;
@property (nonatomic, copy) NSString *model;
@property (nonatomic, strong) NSNumber *price;

@end


implementation file:
#import "Device.h"

@implementation Device

@end

Methods

#pragma mark - DeJohn Dong Added Methods
/**
 *  Asynchronous add/update an object to db.
 */
- (void)save;

/**
 *  Asynchronous delete an object from db.
 */
- (void)asynDeleteObject;

/**
 *  Asynchronous delete an object and the cascade objects from db.
 */
- (void)asynDeleteObjectCascade:(BOOL)cascade;

/**
 *  Asynchronous Query the object list with criteria from db.
 *
 *  @param criteria criteria string
 *  @param result   result list
 */
+ (void)queryByCriteria:(NSString *)criteria result:(DBQueryResult)result;

/**
 *  Asynchronous Query the first object with criteria from db
 *
 *  @param criteria criteria string
 *  @param result   result object
 */
+ (void)queryFirstItemByCriteria:(NSString *)criteria result:(DBQueryResult)result;

/**
 *  Asynchronous Query all the objects from db
 *
 *  @param result result list
 */
+ (void)queryResult:(DBQueryResult)result;

Requirements

  • Xcode 6
  • iOS 5.1.1 or Mac OSX 10.8

Author

Jeff LaMarche [email protected] / DeJohn Dong, [email protected]

License

SQLitePersistentObject is available under the MIT license. See the LICENSE file for more info.

ddsqlitekit's People

Contributors

openboy2012 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.