While the code is stable and unit tested, the API has not yet been finalized, and may see incompatible changes prior to the 1.0 release.
Plausible Database provides an Objective-C veneer over the underlying SQL database. Classes are automatically bound to statement parameters, and converted to and from the underlying SQL datatypes.
PLSqliteDatabase *db = [[PLSqliteDatabase alloc] initWithPath: @"/path/to/database"]; if (![db open]) NSLog(@"Could not open database");
if (![db executeUpdate: @"CREATE TABLE example (id INTEGER)"])
NSLog(@"Table creation failed");
if (![db executeUpdate: @"INSERT INTO example (id) VALUES (?)", [NSNumber numberWithInteger: 42]])
NSLog(@"Data insert failed");
NSObject<PLResultSet> *results = [db executeQuery: @"SELECT id FROM example WHERE id = ?", [NSNumber numberWithInteger: 42]];
while ([results next]) {
NSLog(@"Value of column id is %d", [results intForColumn: @"id"]);
}
// Failure to close the result set will not leak memory, but may // retain database resources until the instance is deallocated. [results close];
1.5.5