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

Side by Side Diff: sql/statement_unittest.cc

Issue 7353026: Move app/sql/* files to sql/ directory. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased Created 9 years, 5 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « sql/statement.cc ('k') | sql/transaction.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 <string> 5 #include <string>
6 6
7 #include "app/sql/connection.h"
8 #include "app/sql/statement.h"
9 #include "base/file_util.h" 7 #include "base/file_util.h"
10 #include "base/scoped_temp_dir.h" 8 #include "base/scoped_temp_dir.h"
9 #include "sql/connection.h"
10 #include "sql/statement.h"
11 #include "testing/gtest/include/gtest/gtest.h" 11 #include "testing/gtest/include/gtest/gtest.h"
12 #include "third_party/sqlite/sqlite3.h" 12 #include "third_party/sqlite/sqlite3.h"
13 13
14 class StatementErrorHandler : public sql::ErrorDelegate { 14 class StatementErrorHandler : public sql::ErrorDelegate {
15 public: 15 public:
16 StatementErrorHandler() : error_(SQLITE_OK) {} 16 StatementErrorHandler() : error_(SQLITE_OK) {}
17 17
18 virtual int OnError(int error, sql::Connection* connection, 18 virtual int OnError(int error, sql::Connection* connection,
19 sql::Statement* stmt) { 19 sql::Statement* stmt) {
20 error_ = error; 20 error_ = error;
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 // Insert in the foo table the primary key. It is an error to insert 117 // Insert in the foo table the primary key. It is an error to insert
118 // something other than an number. This error causes the error callback 118 // something other than an number. This error causes the error callback
119 // handler to be called with SQLITE_MISMATCH as error code. 119 // handler to be called with SQLITE_MISMATCH as error code.
120 sql::Statement s(db().GetUniqueStatement("INSERT INTO foo (a) VALUES (?)")); 120 sql::Statement s(db().GetUniqueStatement("INSERT INTO foo (a) VALUES (?)"));
121 EXPECT_TRUE(s.is_valid()); 121 EXPECT_TRUE(s.is_valid());
122 s.BindCString(0, "bad bad"); 122 s.BindCString(0, "bad bad");
123 EXPECT_FALSE(s.Run()); 123 EXPECT_FALSE(s.Run());
124 EXPECT_EQ(SQLITE_MISMATCH, sqlite_error()); 124 EXPECT_EQ(SQLITE_MISMATCH, sqlite_error());
125 reset_error(); 125 reset_error();
126 } 126 }
OLDNEW
« no previous file with comments | « sql/statement.cc ('k') | sql/transaction.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698