Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(22)

Unified Diff: sql/statement_unittest.cc

Issue 10171014: Changed to Reset(bool clear_bound_vars) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« sql/statement.h ('K') | « sql/statement.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sql/statement_unittest.cc
diff --git a/sql/statement_unittest.cc b/sql/statement_unittest.cc
index b6b6aa8b5f9b4c184271151d1f1e0ec2397bbd9a..e8e7b0182ced3e41592276b5545188e6a538b6fd 100644
--- a/sql/statement_unittest.cc
+++ b/sql/statement_unittest.cc
@@ -120,3 +120,24 @@ TEST_F(SQLStatementTest, BasicErrorCallback) {
EXPECT_EQ(SQLITE_MISMATCH, sqlite_error());
reset_error();
}
+
+TEST_F(SQLStatementTest, ResetWithoutClearingBoundVariables) {
+ ASSERT_TRUE(db().Execute("CREATE TABLE foo (a, b)"));
+ ASSERT_TRUE(db().Execute("INSERT INTO foo (a, b) VALUES (3, 12)"));
+ ASSERT_TRUE(db().Execute("INSERT INTO foo (a, b) VALUES (4, 13)"));
+
+ sql::Statement s(db().GetUniqueStatement("SELECT b FROM foo ORDER BY a ASC"));
+ ASSERT_TRUE(s.Step());
+ EXPECT_EQ(12, s.ColumnInt(0));
+ ASSERT_TRUE(s.Step());
+ EXPECT_EQ(13, s.ColumnInt(0));
+ EXPECT_FALSE(s.Step());
+
+ s.ResetWithoutClearingBoundVariables();
+ // Verify that we can get all rows again.
+ ASSERT_TRUE(s.Step());
+ EXPECT_EQ(12, s.ColumnInt(0));
+ ASSERT_TRUE(s.Step());
+ EXPECT_EQ(13, s.ColumnInt(0));
+ EXPECT_FALSE(s.Step());
+}
« sql/statement.h ('K') | « sql/statement.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698