Lines Matching refs:db_
219 if (db_.get()) {
221 db_->CommitTransaction();
222 db_.reset();
293 if (!db_->GetRowForVisit(visit_id, &row))
315 if (!db_.get())
328 std::string segment_name = db_->ComputeSegmentName(url);
329 URLID url_id = db_->GetRowForURL(url, NULL);
333 if (!(segment_id = db_->GetSegmentNamed(segment_name))) {
334 if (!(segment_id = db_->CreateSegment(url_id, segment_name))) {
342 db_->UpdateSegmentRepresentationURL(segment_id, url_id);
354 if (!db_->SetSegmentID(visit_id, segment_id)) {
360 if (!db_->IncreaseSegmentVisitCount(segment_id, ts, 1)) {
368 if (!db_.get())
455 db_->GetRowForVisit(last_ids.second, &visit_row) &&
458 db_->UpdateVisitRow(visit_row);
515 DCHECK(!db_.get()) << "Initializing HistoryBackend twice";
518 // we only set db_ to the created database if creation is successful. That
519 // way other methods won't do anything as db_ is still NULL.
532 db_.reset(new HistoryDatabase());
533 sql::InitStatus status = db_->Init(history_name, tmp_bookmarks_file);
538 // A NULL db_ will cause all calls on this object to notice this error
541 db_.reset();
550 if (mem_backend->Init(history_name, history_dir_, db_.get(), languages))
554 db_->BeginExclusiveMode(); // Must be after the mem backend read the data.
568 db_.get(), db_.get()));
573 if (db_->needs_version_17_migration()) {
583 if (!db_->GetNeedsThumbnailMigration()) {
589 db_.get()) != sql::INIT_OK) {
599 if (db_->GetNeedsThumbnailMigration()) {
605 if (db_->needs_version_17_migration()) {
618 // happen before db_->Init() is called since the callback ForceArchiveHistory
624 expirer_.SetDatabases(db_.get(), archived_db_.get(),
628 db_->BeginTransaction();
637 db_->GetStartDate(&first_recorded_time_);
669 URLID url_id = db_->GetRowForURL(url, &url_info);
682 db_->UpdateURLRow(url_id, url_info);
690 url_id = db_->AddURL(url_info);
708 VisitID visit_id = db_->AddVisit(&visit_info, visit_source);
732 if (!db_.get())
750 url_database = db_.get();
751 visit_database = db_.get();
815 if (!db_.get())
841 URLID row_id = db_->GetRowForURL(redirects->at(i), &row);
844 db_->UpdateURLRow(row_id, row);
877 if (!db_.get())
881 URLID url_id = db_->GetRowForURL(url, &url_info);
890 db_->AddURL(url_info);
894 if (db_.get()) {
896 if (db_->InitURLEnumeratorForEverything(&e)) {
909 if (db_.get())
910 return db_->GetAllTypedUrls(urls);
915 if (db_.get())
916 return db_->GetVisitsForURL(id, visits);
921 if (db_.get())
922 return db_->UpdateURLRow(id, url);
929 if (db_.get()) {
943 if (db_.get()) {
947 db_->DeleteVisit(*visit);
959 if (!db_->GetURLRow(count->first, &url_row)) {
964 if (!db_->UpdateURLRow(url_row.id(), url_row)) {
975 if (db_.get())
976 return db_->GetRowForURL(url, url_row) != 0;
989 if (db_.get()) {
990 if (db_->GetRowForURL(url, row)) {
996 db_->GetVisitsForURL(row->id(), visits);
1006 if (db_.get())
1007 db_->DeleteSegmentData(Time::Now() -
1013 if (db_.get())
1014 db_->SetSegmentPresentationIndex(segment_id, index);
1024 if (db_.get()) {
1025 db_->QuerySegmentUsage(from_time, max_result_count, &request->value.get());
1046 if (!db_.get())
1051 if (!db_->GetRowForURL(url, &url_row)) {
1057 db_->SetKeywordSearchTermsForURL(url_row.id(), keyword_id, term);
1071 if (!db_.get())
1074 db_->DeleteAllSearchTermsForKeyword(keyword_id);
1087 if (db_.get()) {
1088 db_->GetMostRecentKeywordSearchTerms(keyword_id, prefix, max_count,
1103 if (db_.get())
1104 db_->QueryDownloads(&request->value);
1110 if (db_.get()) {
1113 db_->CleanUpInProgressEntries();
1121 if (db_.get())
1122 db_->UpdateDownload(received_bytes, state, db_handle);
1128 if (db_.get())
1129 db_->UpdateDownloadPath(path, db_handle);
1138 if (db_.get())
1139 db_handle = db_->CreateDownload(create_info);
1146 if (db_.get())
1147 db_->RemoveDownload(db_handle);
1152 if (db_.get())
1153 db_->RemoveDownloadsBetween(remove_begin, remove_end);
1164 if (db_.get()) {
1167 QueryHistoryBasic(db_.get(), db_.get(), options, &request->value);
1223 if (url_db == db_.get()) {
1227 db_->GetRowForURL(url_result.url(), &url_result);
1253 URLQuerier querier(db_.get(), archived_db_.get(), true);
1322 const bool success = (db_.get() && db_->GetVisitCountToHost(url, &count,
1334 if (!db_.get()) {
1344 db_->QuerySegmentUsage(base::Time::Now() - base::TimeDelta::FromDays(90),
1366 if (!db_.get()) {
1382 if (!db_.get())
1386 db_->QuerySegmentUsage(base::Time::Now() -
1407 while (db_->GetRedirectFromVisit(cur_visit, &cur_visit, &cur_url)) {
1423 if (!db_.get())
1429 while (db_->GetRedirectToVisit(cur_visit, &cur_visit, &cur_url)) {
1443 if (!db_.get())
1446 URLID from_url_id = db_->GetRowForURL(from_url, NULL);
1447 VisitID cur_visit = db_->GetMostRecentVisitForURL(from_url_id, NULL);
1459 if (!db_.get())
1462 URLID to_url_id = db_->GetRowForURL(to_url, NULL);
1463 VisitID cur_visit = db_->GetMostRecentVisitForURL(to_url_id, NULL);
1474 provider->ExecuteWithDB(this, db_.get(), params);
1489 if (!db_.get() || !thumbnail_db_.get())
1493 URLID url_id = db_->GetRowForURL(url, &url_row);
1532 if ((url_id = db_->GetRowForURL(redirects.back(), NULL)))
1538 if ((url_id = db_->GetRowForURL(page_url, NULL)))
1559 if (db_.get()) {
1565 db_->ThumbnailMigrationDone();
1574 URLID page_url_id = db_->GetRowForURL(page_url, NULL);
1576 db_->GetMostRecentVisitsForURL(
1591 if ((url_id = db_->GetRowForURL(redirects.back(), NULL)))
1631 if (!db_.get() || !thumbnail_db_.get())
1657 if (!db_->GetRowForURL(*url, &url_row)) {
1669 db_->AddURL(url_info);
1740 if (db_.get() && thumbnail_db_.get()) {
1772 if (!thumbnail_db_.get() || !db_.get())
1875 if (!db_.get())
1886 db_->CommitTransaction();
1887 DCHECK(db_->transaction_nesting() == 0) << "Somebody left a transaction open";
1888 db_->BeginTransaction();
1926 if (!db_.get()) {
1943 if (request->value->RunOnDBThread(this, db_.get())) {
1977 db_->GetStartDate(&first_recorded_time_);
1986 db_->GetStartDate(&first_recorded_time_);
2000 if (db_.get()) {
2016 db_->GetStartDate(&first_recorded_time_);
2025 if (!db_.get())
2030 if (!db_->GetRowForURL(*i, &url_row))
2034 db_->GetVisitsForURL(url_row.id(), &visits);
2089 if (!db_->GetRowForURL(starred_urls[i], &row))
2139 db_->GetStartDate(&first_recorded_time_);
2217 if (!db_->CreateTemporaryURLTable())
2227 URLID new_id = db_->AddTemporaryURL(*i);
2232 if (!db_->CommitTemporaryURLTable())
2236 db_->RecreateAllTablesButURL();
2241 db_->CommitTransaction();
2242 db_->Vacuum();
2243 db_->BeginTransaction();
2244 db_->GetStartDate(&first_recorded_time_);