| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "sql/connection.h" | 5 #include "sql/connection.h" |
| 6 | 6 |
| 7 #include <string.h> | 7 #include <string.h> |
| 8 | 8 |
| 9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
| 10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
| (...skipping 1309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1320 | 1320 |
| 1321 bool ret = false; | 1321 bool ret = false; |
| 1322 { | 1322 { |
| 1323 sql::Statement stmt(GetUniqueStatement(pragma_sql)); | 1323 sql::Statement stmt(GetUniqueStatement(pragma_sql)); |
| 1324 | 1324 |
| 1325 // The pragma appears to return all results (up to 100 by default) | 1325 // The pragma appears to return all results (up to 100 by default) |
| 1326 // as a single string. This doesn't appear to be an API contract, | 1326 // as a single string. This doesn't appear to be an API contract, |
| 1327 // it could return separate lines, so loop _and_ split. | 1327 // it could return separate lines, so loop _and_ split. |
| 1328 while (stmt.Step()) { | 1328 while (stmt.Step()) { |
| 1329 std::string result(stmt.ColumnString(0)); | 1329 std::string result(stmt.ColumnString(0)); |
| 1330 base::SplitString(result, '\n', messages); | 1330 *messages = base::SplitString(result, "\n", base::TRIM_WHITESPACE, |
| 1331 base::SPLIT_WANT_ALL); |
| 1331 } | 1332 } |
| 1332 ret = stmt.Succeeded(); | 1333 ret = stmt.Succeeded(); |
| 1333 } | 1334 } |
| 1334 | 1335 |
| 1335 // Best effort to put things back as they were before. | 1336 // Best effort to put things back as they were before. |
| 1336 const char kNoWritableSchema[] = "PRAGMA writable_schema = OFF"; | 1337 const char kNoWritableSchema[] = "PRAGMA writable_schema = OFF"; |
| 1337 ignore_result(Execute(kNoWritableSchema)); | 1338 ignore_result(Execute(kNoWritableSchema)); |
| 1338 | 1339 |
| 1339 return ret; | 1340 return ret; |
| 1340 } | 1341 } |
| 1341 | 1342 |
| 1342 base::TimeTicks TimeSource::Now() { | 1343 base::TimeTicks TimeSource::Now() { |
| 1343 return base::TimeTicks::Now(); | 1344 return base::TimeTicks::Now(); |
| 1344 } | 1345 } |
| 1345 | 1346 |
| 1346 } // namespace sql | 1347 } // namespace sql |
| OLD | NEW |