• Stars
    star
    383
  • Rank 111,995 (Top 3 %)
  • Language
    Objective-C
  • License
    Other
  • Created over 16 years ago
  • Updated almost 10 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

An Objective-C database abstraction framework.

DatabaseKit ReadMe

About:

DatabaseKit is an unbelievably straight-forward to use database framework for Objective-C.

Features:

  • Supports SQLite, but is built to make it easy to add support for additional SQL databases, just subclass DBConnection.
  • Query composition done purely in Objective-C.
  • If you use a connection pool or queue(Done transparently by default) then query objects are thread safe.
  • If you provide a model class, then results from it's corresponding table will automatically be returned as instances of that class.
  • Supports creating and migrating tables for model classes at runtime.
  • Almost no code required.

Examples

Connecting:

// Open a SQLite database
DB *db = [DB withURL:[NSURL URLWithString:@"sqlite://myDb.sqlite"]];
if(err)
    NSLog(@"Couldn't open database: %@.", [err localizedDescription]);

Querying:

// Get the names of every person in our database
DBTable *people = db[@"people"];
DBSelectQuery *names = [people select:@"name"];

for(NSDictionary *row in [names limit:100]) {
    NSLog(@"Name: %@", row[@"name"]);
}

// Delete really old people
[[[people delete] where:@"bornOn < %@", [NSDate distantPast]] execute];

// Change the name of everyone called John
[[[people update:@{ @"name": @"Percie" }] where:@"name = %@", @"John"] execute];

// You can create a class to represent results from a table like so:
// (Our project's class prefix is `NICE`)
@interface NICEPerson : DBModel
@property(readwrite, retain) NSString *name, *address;
- (void)introduceYourself;
@end

@implementation NICEPerson
- (void)introduceYourself
{
    NSLog(@"Hi! I'm %@.", self.name);
}
@end

// And now if you perform a query
NicePerson *someone = [[people select] firstObject];
[someone introduceYourself];

More Repositories

1

xnomad

A tiling window manager for OS X, written in tranquil.
C
483
star
2

Tranquil

A language built on top of the Objective-C runtime, and ABI compatible with Objective-C.
Objective-C++
323
star
3

HTTPKit

A minimal, high-performance Objective-C library to write self-sufficient web applications. Built on top of Mongoose.
Objective-C
210
star
4

TLC

The Tiny Lua Cocoa Bridge
Lua
136
star
5

CoreFoundation-Lite-Linux

CFLite fixed to build correctly on linux (Tested on debian with clang 3.0)
C
38
star
6

Menufela

A little SIMBL hack that enables you to toggle the menubar on/off.
Objective-C
34
star
7

Tranquil-Live

A Lua LiveCoding environment for Mac
Objective-C
16
star
8

CodeRunner-templates

My CodeRunner templates (See readme for list)
Shell
15
star
9

GLMath

Simple math toolkit for use in computer graphics
C
14
star
10

Blackshades

Blackshades fixed to make it build on osx (Blackshades was created by Wolfire games - http://www.wolfire.com)
C++
13
star
11

yaccviso

Yacc grammar visualizer –– This repo is no longer maintained, please use Kaplan's official repo instead.
C
10
star
12

sekwenser

A step sequencer for use with the Korg PadKONTROL
Objective-C
10
star
13

Dynamo

A little OpenGL powered 2d engine written in C (That is very much in progress)
C
8
star
14

Beets

A little iPhone utility that listens to music through the mic and displays its BPM
Objective-C
7
star
15

FABatching

A single header library for adding allocation batching&pooling to Objective-C classes.
C
3
star
16

ShaderToy

A little app that runs fragment shaders in a ShaderToy.com like environment locally
Objective-C
3
star
17

FConvenience

Nice to have macros, for writing less cluttered code
Objective-C
3
star
18

Foundation-Lite

A subset of Foundation for Linux [Not maintained]
Objective-C
3
star
19

CoreFoundation-Lite-OS-X

CoreFoundation fixed to build on retail OS X (See readme for build instructions)
C
2
star
20

Dynamo-Android-Sample

A simple Android sample for Dynamo
C
2
star
21

objc-autoinit

Automatic init methods for Objective-C
C
2
star
22

Dynamo-iOS-Sample

A simple iOS sample for Dynamo
Objective-C
1
star
23

qdnes

Quick&Dirty NES, a toy project I'm using to learn how to write emulators (Not even close to working, and may never)
C++
1
star
24

marklit

A little tool for writing literate C code using markdown
Ruby
1
star
25

FLazyObjects

Classes for lazily allocating objects.
Objective-C
1
star
26

Scroll-availability-indicators

A little hack that adds a shadow on the edges of scroll views if there is content out of view (in Lion)
Objective-C
1
star