SQLite.swift icon indicating copy to clipboard operation
SQLite.swift copied to clipboard

EXC_BREAKPOINT String.wrap<T>

Open milan-galitein opened this issue 1 year ago • 0 comments

Image

I got one sentry related to this. this is not reproducible but one of my client has faced this.

at the time of creating table using try! db.run(table.create(ifNotExists: true) { t in inside create method, in below code block

let clauses: [Expressible?] = [ create(Table.identifier, tableName(), temporary ? .temporary : nil, ifNotExists), "".wrap(builder.definitions) as Expression<Void>, withoutRowid ? Expression<Void>(literal: "WITHOUT ROWID") : nil ]

"".wrap(builder.definitions) as Expression<Void> => May be due to below reason crash happen

builder.definitions is empty then crash happen


And also second crash in Screenshot you can see. below is code for it.

`extension Expressible {

// naïve compiler for statements that can’t be bound, e.g., CREATE TABLE
// FIXME: make internal (0.13.0)
public func asSQL() -> String {
    let expressed = expression
    var idx = 0
    return expressed.template.reduce("") { template, character in
        let transcoded: String

        if character == "?" {
            transcoded = transcode(expressed.bindings[idx])
            idx += 1
        } else {
            transcoded = String(character)
        }
        return template + transcoded
    }
}

}`

milan-galitein avatar Feb 20 '25 06:02 milan-galitein