comparison UnitTests/SQLiteChromium.cpp @ 50:a15e90e5d6fc

rename in code
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 05 Sep 2012 15:50:12 +0200
parents 3959d33612cc
children f1d0470ff334
comparison
equal deleted inserted replaced
49:e1a3ae0dadf3 50:a15e90e5d6fc
5 #include "../Core/SQLite/Statement.h" 5 #include "../Core/SQLite/Statement.h"
6 #include "../Core/SQLite/Transaction.h" 6 #include "../Core/SQLite/Transaction.h"
7 7
8 #include <sqlite3.h> 8 #include <sqlite3.h>
9 9
10 using namespace Palantir; 10 using namespace Palanthir;
11 11
12 12
13 13
14 /******************************************************************** 14 /********************************************************************
15 ** Tests from 15 ** Tests from
190 // Insert in the foo table the primary key. It is an error to insert 190 // Insert in the foo table the primary key. It is an error to insert
191 // something other than an number. This error causes the error callback 191 // something other than an number. This error causes the error callback
192 // handler to be called with SQLITE_MISMATCH as error code. 192 // handler to be called with SQLITE_MISMATCH as error code.
193 SQLite::Statement s(db(), "INSERT INTO foo (a) VALUES (?)"); 193 SQLite::Statement s(db(), "INSERT INTO foo (a) VALUES (?)");
194 s.BindCString(0, "bad bad"); 194 s.BindCString(0, "bad bad");
195 EXPECT_THROW(s.Run(), PalantirException); 195 EXPECT_THROW(s.Run(), PalanthirException);
196 } 196 }
197 197
198 TEST_F(SQLStatementTest, Reset) { 198 TEST_F(SQLStatementTest, Reset) {
199 ASSERT_TRUE(db().Execute("CREATE TABLE foo (a, b)")); 199 ASSERT_TRUE(db().Execute("CREATE TABLE foo (a, b)"));
200 ASSERT_TRUE(db().Execute("INSERT INTO foo (a, b) VALUES (3, 12)")); 200 ASSERT_TRUE(db().Execute("INSERT INTO foo (a, b) VALUES (3, 12)"));
328 // A third inner one will fail in Begin since one has already been rolled 328 // A third inner one will fail in Begin since one has already been rolled
329 // back. 329 // back.
330 EXPECT_EQ(1, db().GetTransactionNesting()); 330 EXPECT_EQ(1, db().GetTransactionNesting());
331 { 331 {
332 SQLite::Transaction inner3(db()); 332 SQLite::Transaction inner3(db());
333 EXPECT_THROW(inner3.Begin(), PalantirException); 333 EXPECT_THROW(inner3.Begin(), PalanthirException);
334 EXPECT_EQ(1, db().GetTransactionNesting()); 334 EXPECT_EQ(1, db().GetTransactionNesting());
335 } 335 }
336 } 336 }
337 EXPECT_EQ(0, db().GetTransactionNesting()); 337 EXPECT_EQ(0, db().GetTransactionNesting());
338 EXPECT_EQ(0, CountFoo()); 338 EXPECT_EQ(0, CountFoo());