Skip to content

Using database object in native code, with Swift #65

Open
@jigyasu11

Description

@jigyasu11

Hi there,

We are using sqlite-plugin to handle db operations in ionic app side. We have our own plugin that needs to interact with database as well. Its has been observed that sometimes we get 'db locked' errors. On root causing the issue, the obvious suspect was indeed the culprit! In our plugin, for every execution we open the db and when plugin exits close the db.

    init() {
        self.db = self.open()
    }
    
    deinit {
        if sqlite3_close(db) != SQLITE_OK {
            print("error while closing database")
        } else{
            print("successfully closed database")
        }

    }

Since our plugin gets executed multiple time in quick succession, results in multiple db objects live on the fly.
Hence I was wondering, if we can somehow re-use the same database object that sqlite-plugin uses. This will be a robust solution as well. Is it possible?
Thanks so much,
Richeek

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions