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
1
vote
0 answers

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 table tablename (code:1) My query for create table…
Chen Yin
  • 23
  • 5
1
vote
1 answer

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 a table using SQLite.swift and Swift in a Cocoa…
Chen Yin
  • 23
  • 5
1
vote
1 answer

How to sort an SQLite Table in Swift by Date object

I want to be able to either set a sorting condition for my SQLite Table or sort it every time a new entry is inserted. The SQlite docs say to use query.order(expression) Currently this is what I have: class SQLiteData { var fileURL : URL …
koza
  • 71
  • 1
  • 2
  • 13
1
vote
1 answer

issue while updating value in sqlite table with update query

I'm implementing sqlite in my swift project and with update query i am updating some value from table but i am getting syntax error i am not sure why i am getting error. UPDATE Code let updateStatementString = "UPDATE CreateInspDrawingDetail SET…
Vishal Parmar
  • 615
  • 4
  • 31
1
vote
1 answer

read/write database path using sqlite.swift

I'm just starting out trying sqlite.swift and databases with swift. I have prepared a database with tables and preloaded with data. I wish to select data and insert data from within the app. The problem is that I don't understand where (in my…
Andreas Norman
  • 999
  • 1
  • 9
  • 19
1
vote
1 answer

Problem with SQLite.swift after migration to Swift 5

I use SQLite.swift and after upgrading to Swift 5 an error appears in the library. Please help me rewrite the method. Error: 'withUnsafeBytes' is deprecated: use `withUnsafeBytes(_: (UnsafeRawBufferPointer) throws -> R) rethrows -> R`…
Vergiliy
  • 1,248
  • 1
  • 13
  • 22
1
vote
2 answers

Passing an object to a ViewController from AppDelegate

In my application, a Connection object is initialized in my AppDelegate.swift, applicationDidBecomeActive(). How do I pass that Connection object to my ViewController subclass?
coiax
  • 462
  • 4
  • 19
1
vote
1 answer

iOS. xcode copies a zero byte sqlite database at start in the documents directory/

EDIT: As asked by Maddy I am including the code that "opens" the file: I deleted an app and run it again via Xcode. Before there were no files in the documents directory so I checked and since there were no files I could copy my 32 bytes sqlite file…
Juanjo
  • 670
  • 7
  • 17
1
vote
0 answers

Promise return all column values sqlite ionic sqlite swift

sqlite.swift code: func get(name:String) -> Data? { var retData: Data = Data() guard let db: Connection = try? getReadableDatabase()! else {return nil} let query = TABLE_STORAGE.filter(COL_NAME == name).limit(1) guard let rData =…
Ed Die
  • 219
  • 3
  • 18
1
vote
1 answer

Is it a good practice to use database connection as static?

I am using SQLite.swift framework for my iOS application. I have DatabaseService class where I create a database connection and perform all CURD operations. I was instantiating this class and creating a connection on each controller but recently I…
Maihan Nijat
  • 9,054
  • 11
  • 62
  • 110
1
vote
1 answer

Takes about 60 - 70 seconds to insert around 10000 data. Do I need to commit transactions?

I am trying to insert about 10000 data into my database. Check below function for code. It takes about a minute to insert all data. Now I already added block in transaction but do I need to Commit it or it manages automatically. How can I write it…
Parth Adroja
  • 13,198
  • 5
  • 37
  • 71
1
vote
1 answer

Data is retrieved triple duplicately in a table view cells from SQlite in Swift ios

I am retrieving the data from SQLite to a table view cells, but the data is being retrieved duplicate triple times, means on each data there should be a single cell in which the retrieved data will be. but the current situation is that for each data…
iOS Developer
  • 311
  • 4
  • 25
1
vote
1 answer

SQL.swift select from multiple tables

I use SQL.swift but I cannot find a way to select values from multiple tables during a join. My db structure is the following: airport --* tower --* tower_frequency An airport can have several control towers and each control tower can have several…
Jan
  • 7,444
  • 9
  • 50
  • 74
1
vote
2 answers

Detect the Type of a Column with SQLite.swift

I am reading two different SQLite files and reading the 4th column. In one of the files, the type is REAL and in the other, it's INTEGER. When I try to extract the value, I am unable to ever determine the type: for row in try! db.prepare("SELECT *…
Clifton Labrum
  • 13,053
  • 9
  • 65
  • 128
1
vote
1 answer

Composite Primary Key (Sqlite.Swift)

How can I create a table with a composite primary key with this library. For example: CREATE TABLE something ( column1, column2, column3, PRIMARY KEY (column1, column2) ); The only example I see in the documentation is a primary key on…
Paul
  • 652
  • 5
  • 16