Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to get full QueryInterfaceRequest sql string in grdb including all arguments (GRDB.StatementArguments) in the string

Tags:

swift

grdb

I need to get full sql query of query interface in order to save them in user defaults but i couldn't find this functionality

update: in order to achieve full query string:

  1. including arguments that were trimmed by sqlite for injection you can not replace those arguments with question mark manualy.

  2. you can not achieve real value of those arguments because they are private

like image 353
Hamed Nova Avatar asked Oct 29 '25 19:10

Hamed Nova


1 Answers

There is a trace function in the latest GRDB:

// Prints all SQL statements
var config = Configuration()
config.prepareDatabase { db in
    db.trace { print($0) }
}
like image 175
Aliaksandr Bialiauski Avatar answered Nov 01 '25 10:11

Aliaksandr Bialiauski



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!