Lines Matching refs:recovery
13 #include "sql/recovery.h"
97 // If the Recovery handle goes out of scope without being
100 scoped_ptr<sql::Recovery> recovery = sql::Recovery::Begin(&db(), db_path());
101 ASSERT_TRUE(recovery.get());
115 scoped_ptr<sql::Recovery> recovery = sql::Recovery::Begin(&db(), db_path());
116 ASSERT_TRUE(recovery.get());
117 sql::Recovery::Unrecoverable(recovery.Pass());
133 scoped_ptr<sql::Recovery> recovery = sql::Recovery::Begin(&db(), db_path());
134 ASSERT_TRUE(recovery.get());
137 ASSERT_TRUE(recovery->db()->Execute(kCreateSql));
141 ASSERT_TRUE(recovery->db()->Execute(kAltInsertSql));
144 ASSERT_TRUE(sql::Recovery::Recovered(recovery.Pass()));
156 // The recovery virtual table is only supported for Chromium's SQLite.
159 // Run recovery through its paces on a valid database.
168 scoped_ptr<sql::Recovery> recovery = sql::Recovery::Begin(&db(), db_path());
176 ASSERT_TRUE(recovery->db()->Execute(kRecoveryCreateSql));
179 ASSERT_TRUE(recovery->db()->Execute(kCreateSql));
181 // Copy the data from the recovery tables to the new database.
184 ASSERT_TRUE(recovery->db()->Execute(kRecoveryCopySql));
187 ASSERT_TRUE(sql::Recovery::Recovered(recovery.Pass()));
207 scoped_ptr<sql::Recovery> recovery = sql::Recovery::Begin(db, db_path);
208 ASSERT_TRUE(recovery.get());
223 ASSERT_TRUE(recovery->db()->Execute(kRecoveryCreateSql));
224 ASSERT_TRUE(recovery->db()->Execute(kCreateTable));
225 ASSERT_TRUE(recovery->db()->Execute(kCreateIndex));
226 ASSERT_TRUE(recovery->db()->Execute(kRecoveryCopySql));
228 ASSERT_TRUE(sql::Recovery::Recovered(recovery.Pass()));
347 // Call the recovery callback manually.
378 scoped_ptr<sql::Recovery> recovery = sql::Recovery::Begin(&db(), db_path());
379 EXPECT_TRUE(recovery->SetupMeta());
381 EXPECT_TRUE(recovery->GetMetaVersionNumber(&version));
384 sql::Recovery::Rollback(recovery.Pass());
391 scoped_ptr<sql::Recovery> recovery = sql::Recovery::Begin(&db(), db_path());
392 EXPECT_TRUE(recovery->SetupMeta());
394 EXPECT_FALSE(recovery->GetMetaVersionNumber(&version));
397 sql::Recovery::Rollback(recovery.Pass());
406 scoped_ptr<sql::Recovery> recovery = sql::Recovery::Begin(&db(), db_path());
407 EXPECT_FALSE(recovery->SetupMeta());
425 // Create a lame-duck table which will not be propagated by recovery to
426 // detect that the recovery code actually ran.
431 scoped_ptr<sql::Recovery> recovery = sql::Recovery::Begin(&db(), db_path());
432 ASSERT_TRUE(recovery->db()->Execute(kCreateSql));
437 ExecuteWithResults(recovery->db(), kTempSchemaSql, "|", "\n"));
440 EXPECT_TRUE(recovery->AutoRecoverTable("x", 0, &rows));
445 ExecuteWithResults(recovery->db(), kTempSchemaSql, "|", "\n"));
447 ASSERT_TRUE(sql::Recovery::Recovered(recovery.Pass()));
456 // Recovery fails if the target table doesn't exist.
458 scoped_ptr<sql::Recovery> recovery = sql::Recovery::Begin(&db(), db_path());
459 ASSERT_TRUE(recovery->db()->Execute(kCreateSql));
463 EXPECT_FALSE(recovery->AutoRecoverTable("y", 0, &rows));
465 sql::Recovery::Unrecoverable(recovery.Pass());
469 // Test that default values correctly replace nulls. The recovery
493 // Create a lame-duck table which will not be propagated by recovery to
494 // detect that the recovery code actually ran.
501 // defaults coming from the recovery system. The two %5 rows should
515 scoped_ptr<sql::Recovery> recovery = sql::Recovery::Begin(&db(), db_path());
517 ASSERT_TRUE(recovery->db()->Execute(final_schema.c_str()));
520 EXPECT_TRUE(recovery->AutoRecoverTable("x", 0, &rows));
523 ASSERT_TRUE(sql::Recovery::Recovered(recovery.Pass()));
545 // Create a lame-duck table which will not be propagated by recovery to
546 // detect that the recovery code actually ran.
552 scoped_ptr<sql::Recovery> recovery = sql::Recovery::Begin(&db(), db_path());
553 ASSERT_TRUE(recovery->db()->Execute(kFinalSchema));
556 EXPECT_TRUE(recovery->AutoRecoverTable("x", 0, &rows));
559 ASSERT_TRUE(sql::Recovery::Recovered(recovery.Pass()));
585 // Create a lame-duck table which will not be propagated by recovery to
586 // detect that the recovery code actually ran.
591 scoped_ptr<sql::Recovery> recovery = sql::Recovery::Begin(&db(), db_path());
592 ASSERT_TRUE(recovery->db()->Execute(kCreateSql));
595 EXPECT_TRUE(recovery->AutoRecoverTable("x", 0, &rows));
598 ASSERT_TRUE(sql::Recovery::Recovered(recovery.Pass()));
630 // Create a lame-duck table which will not be propagated by recovery to
631 // detect that the recovery code actually ran.
636 scoped_ptr<sql::Recovery> recovery = sql::Recovery::Begin(&db(), db_path());
637 ASSERT_TRUE(recovery->db()->Execute(kCreateSql));
640 EXPECT_TRUE(recovery->AutoRecoverTable("x", 0, &rows));
643 ASSERT_TRUE(sql::Recovery::Recovered(recovery.Pass()));
672 scoped_ptr<sql::Recovery> recovery = sql::Recovery::Begin(&db(), db_path());
673 ASSERT_TRUE(recovery->db()->Execute(kCreateSql));
675 EXPECT_TRUE(recovery->AutoRecoverTable("x", 1, &rows));
677 ASSERT_TRUE(sql::Recovery::Recovered(recovery.Pass()));