Skip to content

perron2/swift-sqlite

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 

Repository files navigation

SQLite Database

A lightweight Swift wrapper around the C SQLite library.

Example

do {
    let db = try Database(name: "your.db")
    defer { db.close() }
    db.foreignKeysEnabled = true

    let stmt = try db.prepare("select name, age from persons where age > :age")
    stmt.bind("age", 40)

    let rows = stmt.query()
    while try rows.next() {
        print(rows.string("name"))
        print(rows.int("age"))
    }
} catch {
    print(error)
}

Installation

Add the files to your project and make sure you have a bridging header file that includes the standard SQLite header file:

#ifndef Bridging_Header_h
#define Bridging_Header_h

#include <sqlite3.h>

#endif /* Bridging_Header_h */

Add the SQLite framework to your project:

  1. Open the General settings tab of your target.
  2. Under Linked Frameworks and Libraries click the add button.
  3. Select libsqlite3.0.tbd

About

A lightweight Swift wrapper around the SQLite library

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages