Questions tagged [sqlite.swift]

A third-party, type-safe, Swift-language layer over SQLite.

A third-party, type-safe, Swift-language layer over SQLite.

Related tags:

,

References:

252 questions
3
votes
3 answers

How to declare database connection variable globally in Swift

I need to initialize a variable to connect to an SQLite database in Swift. I am using the SQLite.swift library and need to connect to the database with this line: let db = try Connection("path/to/db.sqlite3") However, this line by itself will not…
Chandler Freeman
  • 899
  • 1
  • 10
  • 25
3
votes
1 answer

sqlite.swift with Carthage

I'm using sqlite.swift in my Swift project. Until now I'm using Cocoapods to install/update the library. Is it possible to install sqlite.swift with Carthage insted of using Cocoapods?
Alex Bibiano
  • 633
  • 1
  • 6
  • 19
3
votes
1 answer

NSDate Compare in tests

I'm writing some tests to see if a person object is correctly saved into a local database (SQLite, using strings for the dates). in my tests I have : let testPerson = Person(firstName:"John", lastName:"Doe") After saving to the database I test if…
Glenn
  • 2,808
  • 2
  • 24
  • 30
3
votes
1 answer

SQLite Insert is not working properly in swift

I am trying to insert data from array into my table. If the insert is done I think, its suppose to print it in the console, but it is not. So I tried db.trace(println) and it shows me SELECT * FROM "formatedData1" My createDatabase function: …
Dereck
  • 95
  • 3
  • 12
2
votes
1 answer

How do I resolve "Cannot find connection in scope" error (SQLite)?

I'm trying to use sqlite.swift in a small app I'm developing, but I'm new to Swift and SQLite. I used CocoaPods to install sqlite.swift. I used these commands: sudo gem install cocoapods pod setup --verbose I then navigated to the directory for my…
randombits
  • 21
  • 3
2
votes
1 answer

Creating a global SQLite DB Connection with Singleton pattern in Swift

I detect whether a connection exists on a Singleton instance and if it doesn't it will open up a new connection on app start up. However, ideally I'd like for the open function to fire when the Singleton is first created without having to explicitly…
Paul
  • 1,101
  • 1
  • 11
  • 20
2
votes
1 answer

Where to initialize sqlite database for a user with SwiftUI?

I have this function that initializes a database (basically copied from the documentation of SQLite.swift). func createDB() { let paths = FileManager.default.urls(for: FileManager.SearchPathDirectory.documentDirectory, in:…
Paul
  • 1,101
  • 1
  • 11
  • 20
2
votes
1 answer

Like does not work with Russian symbols? (Swift, SQLite)

I use like with lowercaseString and Russian symbols but LOWER doesn't convert them to lowercase in the query. I tried to create my own function but it didn't work for me. How to solve this problem? Having studied the documentation of SQLite, I…
Wolfak
  • 97
  • 1
  • 2
  • 9
2
votes
1 answer

Why does Xcode12 give me SQLite Compiler Error?

After upgrading to Xcode 12 / iOS 14 my project is no longer compiling/importing the SQLite3 library because it is previously defined in the iOS 14 usr/include. Is this something that I can fix in my build settings? Can I remove it from the…
Chris
  • 52
  • 8
2
votes
2 answers

Does SQLite.swift has the ability to detect & notify table data change?

I was wondering, does SQLite.swift have the capability, to detect & notify table data change? (Similar to what is offered by NSFetchedResultsController, to detect & notify entity data change) For GRDB.swift, it offers the capability to observe…
Cheok Yan Cheng
  • 47,586
  • 132
  • 466
  • 875
2
votes
1 answer

Change existing table with SQLite.swift?

What is the best way to change an existing table with SQLite (add new columns) without losing the table data?
vitaliy-zh
  • 185
  • 9
2
votes
1 answer

How to chain conditions in with SQLite.swift type safe API?

I am using SQLite.swift and I would like to represent a SQL statement with multiple dynamic filter conditions in the type safe API. I have found similar questions, but none of them provided any insights on how this might be possible. So far I would…
frankenapps
  • 5,800
  • 6
  • 28
  • 69
2
votes
1 answer

Xcode Missing required module 'SQLiteObjc' with Sqlite.swift

I am using SQLite.swift to connect to a database but am getting "Missing required module 'SQLiteObjc'" on the import of SQLite. I believe I have connected it properly. Here is another screenshot I took. It seems to be reading the SQLiteObjc module…
Rob Paterson
  • 101
  • 1
  • 8
2
votes
0 answers

Swift: Insert UIImage as blob into SQLite database

I am using SQLite.swift and I want to insert an UIImage in a column of type 'blob'. My table: "CREATE TABLE IF NOT EXISTS " + TABLE_USER + "(" + COLUMN_ID + " INTEGER PRIMARY KEY, " + …
Raspberry
  • 139
  • 1
  • 11
2
votes
1 answer

'SQLite.swift/SQLCipher' error: ambiguous use of 'SQLITE_DETERMINISTIC'

I'm using SQLite.swift and SQLCipher via cocoapods. I get the error ambiguous use of 'SQLITE_DETERMINISTIC' in the SQLite.swift file: Connection.swift fails at line 590. Snippet is show below. var flags = SQLITE_UTF8 #if !os(Linux) …
1 2
3
16 17