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

Side by Side Diff: app/sql/statement_unittest.cc

Issue 3108030: Move bundled copy of sqlite one level deeper to better separate it... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 10 years, 4 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 | « app/sql/statement.cc ('k') | app/sql/transaction_unittest.cc » ('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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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" 7 #include "app/sql/connection.h"
8 #include "app/sql/statement.h" 8 #include "app/sql/statement.h"
9 #include "base/file_path.h" 9 #include "base/file_path.h"
10 #include "base/file_util.h" 10 #include "base/file_util.h"
11 #include "base/path_service.h" 11 #include "base/path_service.h"
12 #include "testing/gtest/include/gtest/gtest.h" 12 #include "testing/gtest/include/gtest/gtest.h"
13 #include "third_party/sqlite/preprocessed/sqlite3.h" 13 #include "third_party/sqlite/sqlite3.h"
14 14
15 class StatementErrorHandler : public sql::ErrorDelegate { 15 class StatementErrorHandler : public sql::ErrorDelegate {
16 public: 16 public:
17 StatementErrorHandler() : error_(SQLITE_OK) {} 17 StatementErrorHandler() : error_(SQLITE_OK) {}
18 18
19 virtual int OnError(int error, sql::Connection* connection, 19 virtual int OnError(int error, sql::Connection* connection,
20 sql::Statement* stmt) { 20 sql::Statement* stmt) {
21 error_ = error; 21 error_ = error;
22 const char* sql_txt = stmt ? stmt->GetSQLStatement() : NULL; 22 const char* sql_txt = stmt ? stmt->GetSQLStatement() : NULL;
23 sql_text_ = sql_txt ? sql_txt : "no statement available"; 23 sql_text_ = sql_txt ? sql_txt : "no statement available";
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 // Insert in the foo table the primary key. It is an error to insert 122 // Insert in the foo table the primary key. It is an error to insert
123 // something other than an number. This error causes the error callback 123 // something other than an number. This error causes the error callback
124 // handler to be called with SQLITE_MISMATCH as error code. 124 // handler to be called with SQLITE_MISMATCH as error code.
125 sql::Statement s(db().GetUniqueStatement("INSERT INTO foo (a) VALUES (?)")); 125 sql::Statement s(db().GetUniqueStatement("INSERT INTO foo (a) VALUES (?)"));
126 EXPECT_TRUE(s.is_valid()); 126 EXPECT_TRUE(s.is_valid());
127 s.BindCString(0, "bad bad"); 127 s.BindCString(0, "bad bad");
128 EXPECT_FALSE(s.Run()); 128 EXPECT_FALSE(s.Run());
129 EXPECT_EQ(SQLITE_MISMATCH, sqlite_error()); 129 EXPECT_EQ(SQLITE_MISMATCH, sqlite_error());
130 reset_error(); 130 reset_error();
131 } 131 }
OLDNEW
« no previous file with comments | « app/sql/statement.cc ('k') | app/sql/transaction_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698