Skip to content

Commit

Permalink
Merge pull request #1575 from Jason-Abbott/development
Browse files Browse the repository at this point in the history
Show trigger comments for expanded statement tracing
  • Loading branch information
groue authored Jul 17, 2024
2 parents 9f41e56 + 14d2b93 commit 9f16865
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion GRDB/Core/Database.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2083,7 +2083,8 @@ extension Database {
/// ```
public var sql: String {
if let unexpandedSQL {
return String(cString: unexpandedSQL).trimmedSQLStatement
let sql = String(cString: unexpandedSQL)
return sql.hasPrefix("--") ? sql : sql.trimmedSQLStatement
} else {
return String(cString: sqlite3_sql(sqliteStatement)).trimmedSQLStatement
}
Expand All @@ -2101,6 +2102,10 @@ extension Database {
/// information from leaking in unexpected locations, so use this
/// property with care.
public var expandedSQL: String {
if let unexpandedSQL {
let sql = String(cString: unexpandedSQL)
if sql.hasPrefix("--") { return sql }
}
guard let cString = sqlite3_expanded_sql(sqliteStatement) else {
return ""
}
Expand Down

0 comments on commit 9f16865

Please sign in to comment.