Chromium Code Reviews| Index: sql/connection.cc |
| diff --git a/sql/connection.cc b/sql/connection.cc |
| index 073b032cde62157b69a91512a357ce450eb1e4d5..66b2bc1b53881fca6251c36d8e0d9ce9591cc485 100644 |
| --- a/sql/connection.cc |
| +++ b/sql/connection.cc |
| @@ -994,6 +994,22 @@ void Connection::TrimMemory(bool aggressively) { |
| DLOG(WARNING) << "Could not restore cache size: " << GetErrorMessage(); |
| } |
| +bool Connection::UpdateCacheSize(int new_cache_size) { |
| + if (!db_) |
| + return false; |
| + if (cache_size_ == new_cache_size) |
| + return true; |
|
Scott Hess - ex-Googler
2016/09/01 18:29:09
I think this is fine, but might not even be worth
|
| + |
| + const std::string sql = |
| + base::StringPrintf("PRAGMA cache_size=%d", new_cache_size); |
| + if (!Execute(sql.c_str())) { |
| + DLOG(WARNING) << "Could not update cache size: " << GetErrorMessage(); |
|
Scott Hess - ex-Googler
2016/09/01 18:29:09
Execute() will already emit messages in case of er
|
| + return false; |
| + } |
| + cache_size_ = new_cache_size; |
| + return true; |
| +} |
| + |
| // Create an in-memory database with the existing database's page |
| // size, then backup that database over the existing database. |
| bool Connection::Raze() { |