I'm using SQLite.swift library in my iOS app for database needs. I'm using more than one database with different names. I'm doing it fine no problems. At one point I need to delete the .sqlite3 file i.e., the whole database file when it's no longer…
I'm unable to use the SQLite framework in my project. As I'm getting the errors shown in the image. Can anyone help me out to resolve this error.
Note: The project is in Swift 3.0 and I have used Cocoapod to install the SQLite library
How to remove in print or data Optional() ? (swift3, xcode 8.2.1)
let statement = try connection.prepare("SELECT * FROM persons")
for data in statement
{
print(data)
}
// result print :
[Optional(1), Optional("John"),…
How do you get at a row of type SQLite.Row using the row number?
This is order to populate a picker using the results Array.
Thanks
var allCountries:Array?
let countries = Table("Country")
let id = Expression("rowid")
let name =…
I'm using this code to start a transaction in my actual bd:
let stmt = try db.prepare("BEGIN TRANSACTION;")
try stmt.run()
But after i close the transaction and want to check the db, i can't open it because it's encrypted, and i need a key, but i…
I am not able to set foreign key using stephencelis SQLite.swift.
t.foreignKey(user_id, references:"user_mstr",user_id)
I have two tables user_master and user_details. How to set user_id as a foreign key in user_detail table. I am getting below…
I am trying to save data into an sqlite database with the below function.
func insertSpecieDetail(_ specieId: Int)
{
//
// Create a temporary SpecieDetailModel for storing our values from the query.
//
let specieDetail:…
I'm trying to debug some sqlite.swift statements that aren't delivering the results I expect.
The documentation shows examples of SQL in comments.
for user in try db.prepare(users.select(id, email)) {
print("id: \(user[id]), email:…
When I am trying to fetch all the data in the SQLite Database in swift using singleton, I get an error in sharedInstance and zero results are fetched.
Here is my code:
DatabaseManager.swift
import SQLite
class DatabaseManager {
let…
I'm running Xcode 8.0 build version 8S174q and Apple Swift version 3.0 (swiftlang-800.0.34.6 clang-800.0.33).
Pauls-Mac-mini:~ paul$ xcrun xcodebuild -version
Xcode 8.0
Build version 8S174q
Pauls-Mac-mini:~ paul$ xcrun swift -version
Apple Swift…
In my iOS app, I have a SQLite database with an items table that has many rows. I'm avoiding loading all of the items into memory and instead only loading the ones being currently shown in the UITableView.
I'm using SQLite.swift which can throw when…
I'm migrating my iOS application to Xcode8 and Swift 3. I updated the dependencies version, everythings looks fine except for the SQLite.swift.
In my project on the line "import SQLite" I've this error:
"Module compiled with Swift 2.3 cannot be…
I have a SQLite database that I want to populate with some initial data.
Using SQLite.swift, this method seems to be working:
do {
let _ = try db.run( userDictionary.create(ifNotExists: false) {t in
t.column(wordId, primaryKey: true)
…
I would like to filter results for the same column with multiple values
example in sql:
SELECT * FROM myTable WHERE status = 1 AND current_condition = ("New", "Working")
this will return all rows from myTable where the status is 1 and the…
I want to delete a row with the given value (contactID), which is also the primary key, in SQLite.Swift:
let delRowCo = ContactTable.filter(ContactID == contactID)
try db.run(delRowCo.delete())
The given contactID surely exists, but it doesn't…