I'm trying to retrieve a count of records in a table using SQLite.swift and Swift in a Cocoa macOS application. According to the README, this can be achieved using the following:
let users = Table("users")
...
let count = try…
I am new to swift and what I am trying to do is return the specified columns in my table to display in a separate viewcontroller. I have defined a function using SQLite.swift which returns them in an array, just like I want them to be. (It works…
I am struggling to see some INSERTs reflected in a SQLite database when using SQLite.swift.
I debug my iOS app with breakpoints and after the insertion I export the app container (from device) to the host hard disk. Then I inspect the SQLite…
I'm trying to define my database structure, but I can't figure out how to set the default value of a column to NULL. This is what I want it to produce:
CREATE TABLE test (
content text DEFAULT(NULL),
);
I have the following code
let content =…
My Problem:
I have my SQLite database file in the cache directory and set isExcludedFromBackup to true because i read, that doing so will prevent the iOS system from deleting it in case of full storage. But it gets deleted nonetheless. This was…
tl;dr:
How do i close a read-/ write connection to a database in Sqlite.swift?
Background story:
I am using the sqlite.swift framework to manage a .sqlite file (data.sqlite) that is copied from the application bundle (bootstrap.sqlite) on app start…
I'm experimenting with SQlite.Swift in iOS and I'm trying to randomly pick a row from a table in an SQLite database.
The table is movies and its columns are movieID, title genre and seen.
Problem:
Movies should be picked randomly but as soon as I…
I want to build a Dictionary app for iOS. I try to read data from sqlite database file with SQLite.swift here.
My code
func configureCell(){
//Todo: read sqlite file
//let path = Bundle.main.path(forResource: "taidict", ofType: "sqlite")!
…
My code is as follows:
let assetTag = Expression("asset_tag")
let query2 = mdm.select(mdm[assetTag],os, mac, lastReported)
.filter(mdm[assetTag] != "ipad" && location == facility)
.order(mdm[assetTag])
…
I recently started an iOS project and need to work with a standalone database that'll be downloaded from the internet when there are updates. This is my first iOS project, so am trying to get functionality working before designing the download…
I have the following code which retrieves list of operating systems and list of their counts. I would like to get the count values and save them to an array:
let query = mdm.select(os,os.count)
.filter(os != "")
…
I have created a Database class as so:
class Database {
static let instance = Database()
private let categories = Table("Category")
private var db: Connection?
let cat_id = Expression("id")
let cat_name =…
I have created a function for mapping json data to a sqlite store using sqlite.swift. I am receiving strange behavior though since the first time I try to run an insert I get a "No such table" error". But the inserts work perfectly after that…
In my previous question:
How to create a filter that does the SQL equivalent of WHERE ... IN for SQLite.Swift
I asked how to how to do a WHERE...IN in swift.
Now, how do I filter optional Expressions?
I have a versioned database that allows me to…