Swiftpack.co -  Jawtoch/firebird-lib as Swift Package
Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
Jawtoch/firebird-lib
Swift wrapper of firebird library
.package(url: "https://github.com/Jawtoch/firebird-lib.git", from: "0.2.2")

firebird-lib

Firebird Swift Wrapper. It require Clibfbclient, please see installation procedure.

Usage

Connection

To connect to database server, provide a configuration. Currently, the connection timeout is set to 10 seconds, and cannot be changed.

let configuration = FirebirdConnectionConfiguration(
	hostname: "<hostname>",
	port: "<port>",
	username: "<username>",
	password: "<password>",
	database: "<database-name>"
)

let connection = try FirebirdConnection.connect(configuration)
defer {
	try connection.close()
}

Query

Firebird provide two types of queries: simple, and default. Simple queries are for queries without output, like "UPDATE, CREATE", and default are for queries with output "SELECT".

try connection.query("SELECT * FROM employee") { row in
	// Process row here
}

Alternatively, you can retrieve rows without callback:

let rows = try connection.query("SELECT * FROM employee")

Binding data

You can bind data to your queries by passing an array of FirebirdData conforming types. Data will be bonded to the query, by replacing the placeholder ? to the provided value, in the given order.

var value: Int32 = 42
let data = withUnsafeBytes(of: &value) { Data($0) }
let firebirdData = FirebirdData(type: .long, value: data) 
let rows = try connection.query("SELECT * FROM employee WHERE emp_no = ?", [firebirdData])

GitHub

link
Stars: 0
Last commit: 4 weeks ago

Ad: Job Offers

iOS Software Engineer @ Perry Street Software
Perry Street Software is Jack’d and SCRUFF. We are two of the world’s largest gay, bi, trans and queer social dating apps on iOS and Android. Our brands reach more than 20 million members worldwide so members can connect, meet and express themselves on a platform that prioritizes privacy and security. We invest heavily into SwiftUI and using Swift Packages to modularize the codebase.

Release Notes

12 weeks ago

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API