@@ -284,7 +284,10 @@ final class QueryViewModel {
284 resultsTruncated = false
284 resultsTruncated = false
287+ /// Sets the default query for the given stream, returning `true` if the
288+ /// query text was replaced (i.e. the user hadn't customized it).
287− func setDefaultQuery(stream: String, previousStream: String? = nil) {
290+ func setDefaultQuery(stream: String, previousStream: String? = nil) -> Bool {
288 // Replace the query if it's empty or still matches the auto-generated
291 // Replace the query if it's empty or still matches the auto-generated
289 // default for the previous stream. If the user edited the SQL, keep it.
292 // default for the previous stream. If the user edited the SQL, keep it.
290 let shouldReplace: Bool
293 let shouldReplace: Bool
@@ -300,6 +303,7 @@ final class QueryViewModel {
300 if shouldReplace {
303 if shouldReplace {
301 sqlQuery = "SELECT * FROM \(Self.escapeSQLIdentifier(stream)) ORDER BY p_timestamp DESC LIMIT \(queryLimit)"
304 sqlQuery = "SELECT * FROM \(Self.escapeSQLIdentifier(stream)) ORDER BY p_timestamp DESC LIMIT \(queryLimit)"
306+ return shouldReplace
305 /// Escapes a SQL identifier by doubling internal double-quotes, then wrapping in double-quotes.
309 /// Escapes a SQL identifier by doubling internal double-quotes, then wrapping in double-quotes.