Questions tagged [sqlite.swift]
A third-party, type-safe, Swift-language layer over SQLite.
244
questions
0
votes
1
answer
72
views
Why do I get SQLite.swift error when inserting Int64 values?
As part of a migration effort, I am creating a SQLite DB for the first time.
Based on the example documentation from the site
SQLite.swift documentation
I am creating an Insert statement and then ...
0
votes
0
answers
21
views
SQLite.Swift - Syntax to do an update of many rows to increase current field value
I would like to know, if it is possible to do an update with sqlite.swift for many rows to increase a field value with it self like shown in the exampe below.
UPDATE "tabel_name" SET "...
0
votes
1
answer
56
views
Querying data from multiple tables into a custom struct in SQLite.swift
I have a database that has the tables "Orders" and "OrderDetails" and a custom struct Order that I want to query data from these tables into. I understand how to query data from a ...
-1
votes
1
answer
63
views
Establishing a Read-Write connection to a database in SQLite.swift
I'm working a project where I need to use a SQLite database to read, create , and edit different objects. I thought I had established the connection properly but, it turns out I had only established a ...
0
votes
0
answers
40
views
Why doesn't Xcode / SQLite.swift recognize my .db file as a database?
I'm using SQLite.swift to run queries on a .db file in my Xcode project, and I keep receiving "code: 26 -- file is not a database" when I try to connect to the database from the documents ...
0
votes
1
answer
59
views
How do I make XCode realize my .db file is a database? I'm incorrectly receiving the error "file is not a database (code:26)"
I'm working on a Swift project in Xcode where I access a .db file to perform SQL operations. I have successfully run queries on this file when I use the path to the database on my desktop, but when I ...
1
vote
1
answer
129
views
SQLite.swift and M1 chip and simulator
I have a project where I use SQLite.swift. Recently I got a MacBook Pro with a M1 chip. After that the project runs fine on a device but when I try to run on simulator I get this error message from ...
0
votes
2
answers
73
views
When testing a Swift/SwiftUI app on iPad, Xcode doesn't transfer SQLite database
I'm new to all this, but I've managed to finish coding my first simple Swift/SwiftUI App. It includes a SQlite DB that I've pre-populated with my data, and I manage it using SQLite.swift. The app is ...
2
votes
1
answer
270
views
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 --...
0
votes
0
answers
36
views
SQLite.swift how to use highlight() function AND get the rowid or other columns from results
I am using the highlight() function in SQLite and need to associate back to the row/file the text came from. This code below works, but cannot figure out how to get the rowid or 'pk' from the row.
///...
0
votes
0
answers
64
views
How do you make SQLite.swift available in Xcode playground?
I'd like to interactively learn SQLite.swift in the playground instead of coding it directly into my app.
I was reading this documentation which details that you can explore it interactively in ...
1
vote
1
answer
130
views
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 ...
0
votes
0
answers
16
views
Select query With Order Localized Caharacters
I use Sqlite on Android with Android Studio.
Select * From MyTable ORDER BY MyStringField COLLATE LOCALIZED
returns correct order with local characters.
On ios i use Xcode 13 and swift.sqlite
But ...
0
votes
1
answer
50
views
Where to store a SQLite DB connection with iOS?
I create a SQLite connection with SQLite.swift but I'm not sure where to store the DB connection so I can use it during the duration that a user has the app open across various views.
Is using ...
0
votes
1
answer
158
views
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....
0
votes
0
answers
84
views
Cannot create sqlite file with SQLite.swift "cannot open file at line..."
I'm attempting to create a sqlite DB file within my iOS project. I'm using the code as documented for R/W
let path = NSSearchPathForDirectoriesInDomains(
.documentDirectory, .userDomainMask, true
)...
0
votes
1
answer
106
views
SQLite.Swift - Querying an existing Db table
I am just now learning about SQLite.swift and was reading the documentation on it. I am trying to query an existing table that I already have but do not know how to do this. In the documentation it ...
1
vote
0
answers
70
views
Sqlite.swift: how I can use column aliasing(AS statment) after join for decoding?
I want to decode the result of query to my model that I used it in my remote request but after join i cant decode with codingKeys because sqlite.swift replaces the double-cotation and it can't find ...
0
votes
0
answers
103
views
SQLite.Swift error : Value of type 'Connection' has no member 'key'
XCode 12.5.1
As title, I got an error.
And I use Carthage to install SQLite.swift.
SQLite.swift version is 0.13.0
carfile here:
github "stephencelis/SQLite.swift"
import Foundation
import ...
0
votes
0
answers
86
views
How to alias selected columns in sqlite swift
I have a query with a column that should be aliased
When I try to alias the column, return nil.
this is my code :
func show() {
let cat_table = Table("cat")
let id = ...
-3
votes
1
answer
266
views
Looking for sqlite.swift example project
Are there any good sqlite.swift example projects that I can work through to learn sqlite.swift? I'm knew to swift and looking for a good wrapper for database access and would like to find a good ...
1
vote
1
answer
151
views
How to execute the SQL where In query in swift and bind the params in the statement?
Below I am sharing my existing code which I have used for executing the where IN condition but now I am stuck in how to pass the values in the request.
public func getName(list: [String], class: ...
0
votes
0
answers
114
views
Sqilte swift multiple query string to filter the sqlite
I have a question about sqlite query.
May I use one query string to query my sqlite to get my data?
Now I use three query string and it's like so complex
It only one query string will match and get ...
-3
votes
2
answers
53
views
How can I declare a variable nil until I need it? [closed]
Am just starting to use SQLite in Swift and am running into a declaration problem. I would like to wrap everything in one class that I can then call methods on.
My problem is I don't know how to ...
2
votes
2
answers
280
views
Sync SQLite database between two iPhones
I'm currently finishing up a project for IOS in Swift in which I've used an SQLite database to store data with SQLite.swift.
At the time of coding I didn't know that SQLite files are stored locally on ...
1
vote
0
answers
27
views
How to add column to Sqlite.swift
let tango_id = Expression<Int64>("tango_id")
let e_score = Expression<Double>("e_score")
let interval = Expression<Double>("interval")
let ...
0
votes
1
answer
371
views
How do I create multiple tables in Swift using SQLite database?
So I was able to do a tutorial to create one table but when I try to create another one, it doesn't show up in the DB Browser for SQLite which makes me think that it is not created.
Is there a way to ...
0
votes
1
answer
93
views
How do I Implement SQLite.swift Value Protocol
How do I make my classes comply with the Value Protocol for SQLite.swift so I can add them directly to my database. I have made all of them "Codable" but they need to conform to the Value ...
0
votes
1
answer
154
views
Converting app from SQLite.swift to GRDB.swift Second Question
I am continuing the conversion of a number of my apps from SQLite.sift to GRDB.swift.
I converted my structs to add Codable, FetchableRecord so as to have them work better with GRDB. This was ...
0
votes
1
answer
316
views
Converting app from SQLite.swift to GRDB.swift
I'm trying to convert several of my apps to use GRDB.swift. Does anybody have or know where I can find a file to get me started? I've read over most of the GRDB docs but I'm not getting it. Below is a ...
0
votes
1
answer
673
views
How do I avoid build errors when I include SQLCipher pod in Swift project?
I am using sqlite.swift
When I include this in my pod file:
pod 'SQLite.swift/SQLCipher', '~> 0.12.2'
Is SQLCipher still compatible with SQLite.swift?
Do I need additional pod statements to ...
0
votes
1
answer
432
views
Connecting SQLite 3 Database to Swift
I'm attempting to open an SQLite3 database in my SwiftUI code, to access the file path within the bundle, I'm using the following function;
let path = NSSearchPathForDirectoriesInDomains(....
2
votes
1
answer
285
views
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?
...
-2
votes
1
answer
107
views
How to make a dynamic, calculated column? (Swift, SQLite)
How i can to make a dynamic, calculated column? Which is calculated using other columns and not stored in the database.
Which can be used for data output and sorting.
Library: stephencelis/SQLite....
2
votes
1
answer
527
views
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 ...
2
votes
2
answers
578
views
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)
...
2
votes
1
answer
26
views
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?
0
votes
1
answer
38
views
How could I rollback a transaction when throwing custom errors
I have a bulk insert method that attempts to insert an array of items within a transaction. However, I have custom errors I throw based on the values being passed in. For example, strings can not be ...
-2
votes
1
answer
60
views
Can I split one iOS app into two or more, but continue sharing the same sqlite database
I have a single Health tracking app which I believe has become too complicated. Complicated both in terms of code-base as well as UI.
I would like to split it into a standalone exercise app and a ...
0
votes
1
answer
91
views
Opening and using a database from another view controller
I have created a database in one view controller and I would like to open it and access it in another view controller. I was wondering how to open up a existing database from one view controller in ...
2
votes
1
answer
153
views
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 ...
0
votes
0
answers
87
views
Is there any difference between upper or lower case commands on SQLITE?
My question is if there's any performance difference between:
SELECT * FROM mytable
vs
select * from mytable
yes, the whole question is about using reserved words in upper case for better ...
1
vote
1
answer
40
views
Conversion errors from Swift 3.0 to Swift 4.2 at SQLitt.Swift unregonized token
My current code is written with Swift 3 ,I tried to change Swift 4.2 via Xcode10.1. SQLite is crashing on changes version and working correct on old code.
I'm trying to retrieve a count of records in ...
1
vote
0
answers
50
views
No such table error in Sqlite Database swift 4.2 after change from swift 3
I'm trying to retrieve a count of records in a table using SQLite.swift and Swift in a Cocoa macOS application.
All tables can try to get data from SQLite data only two tables is showing
no such ...
1
vote
1
answer
64
views
SQLite.swift: Can't retrieve table count due unrecognized token: ":" (code: 1)
My current code is written with Swift 3 ,I tried to change Swift 4.2 via Xcode10.1.
SQLite is crashing on changes version and working correct on old code.
I'm trying to retrieve a count of records in ...
0
votes
1
answer
85
views
How to call a class only the first time i access an iOS app
I want to create database when i access the app for the first time.
As you know, Swift has an AppDelegate.swift class with @UIApplicationMain, and it means main() class.
If i want to create ...
7
votes
2
answers
3k
views
How can i resolve warning message 'BUG IN CLIENT OF libsqlite3.dylib: database integrity compromised by API violation' in Sqlite.swift?
i'm using Sqlite.swift
when i restart app in simulator, i want to remove existing database and make new database. (because of initializing database... i change the database column a lot.)
but there ...
1
vote
1
answer
1k
views
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 ...
0
votes
1
answer
232
views
Is there a SQLite for Swift method for more complex ORDER BY statements?
I have a query similar to the following that I'd like to perform on an sqlite database:
SELECT name
FROM table
WHERE name LIKE "%John%"
ORDER BY (CASE WHEN name = "John" THEN 1 WHEN name LIKE "...
0
votes
2
answers
59
views
Problems attaching two sqlite databases with https://cocoapods.org/pods/SQLite.swift
I am using stephencelis/SQLite.swift and try to attach 2 databases at runtime:
ATTACH DATABASE \'(databasePath.Local)\' AS LOCAL_USER_DB;
//
// DatabaseWrapper.swift
// ...
//
import UIKit
import ...