tizen 2.4 release
[framework/web/wrt-commons.git] / tests / db / test_sql_connection.cpp
old mode 100644 (file)
new mode 100755 (executable)
index 20907fa..5840453
@@ -23,7 +23,7 @@
 #include <dpl/db/sql_connection.h>
 #include <dpl/db/naive_synchronization_object.h>
 #include <memory>
-#include <dpl/log/log.h>
+#include <boost/optional.hpp>
 #include <sstream>
 #include <string>
 #include <cstdlib>
@@ -66,7 +66,7 @@ class StressGenerator :
     {
         DPL::DB::SqlConnection connection(
             m_dbFileName,
-            DPL::DB::SqlConnection::Flag::None,
+            DPL::DB::SqlConnection::Flag::NotDefined,
             DPL::DB::SqlConnection::Flag::RW,
             m_generator->Create());
 
@@ -186,7 +186,7 @@ RUNNER_TEST(SqlConnection_Not_Connected)
 {
     Try {
         DPL::DB::SqlConnection connection("/notexisitingdirectiory/foo",
-                                          DPL::DB::SqlConnection::Flag::None,
+                                          DPL::DB::SqlConnection::Flag::NotDefined,
                                           DPL::DB::SqlConnection::Flag::RW);
         RUNNER_ASSERT_MSG(false,
                           "connection should throw on accessing "
@@ -296,14 +296,14 @@ RUNNER_TEST(SqlConnection_Int8)
     RUNNER_ASSERT(!insertCommand->Step());
     insertCommand->Reset();
 
-    insertCommand->BindInt8(1, DPL::Optional<int8_t>(-127));
+    insertCommand->BindInt8(1, boost::optional<int8_t>(-127));
     RUNNER_ASSERT(!insertCommand->Step());
     insertCommand->Reset();
 
     RUNNER_ASSERT(selectCommand->Step());
     RUNNER_ASSERT(selectCommand->GetColumnInt8(0) == 127);
     RUNNER_ASSERT(selectCommand->Step());
-    RUNNER_ASSERT(selectCommand->GetColumnOptionalInt8(0) == -127);
+    RUNNER_ASSERT(selectCommand->GetColumnOptionalInt8(0) == static_cast<int8_t>(-127));
     selectCommand->Reset();
 
     connection.ExecCommand("DROP TABLE testInt8;");
@@ -331,7 +331,7 @@ RUNNER_TEST(SqlConnection_Int16)
     RUNNER_ASSERT(!insertCommand->Step());
     insertCommand->Reset();
 
-    insertCommand->BindInt16(1, DPL::Optional<int16_t>((int16_t)0x8000));
+    insertCommand->BindInt16(1, boost::optional<int16_t>((int16_t)0x8000));
     RUNNER_ASSERT(!insertCommand->Step());
     insertCommand->Reset();
 
@@ -366,14 +366,14 @@ RUNNER_TEST(SqlConnection_Int32)
     RUNNER_ASSERT(!insertCommand->Step());
     insertCommand->Reset();
 
-    insertCommand->BindInt32(1, DPL::Optional<int32_t>(0x80000000));
+    insertCommand->BindInt32(1, boost::optional<int32_t>(0x80000000));
     RUNNER_ASSERT(!insertCommand->Step());
     insertCommand->Reset();
 
     RUNNER_ASSERT(selectCommand->Step());
     RUNNER_ASSERT(selectCommand->GetColumnInt32(0) == (int32_t)0xFFFFFFFF);
     RUNNER_ASSERT(selectCommand->Step());
-    RUNNER_ASSERT(selectCommand->GetColumnOptionalInt32(0) == 0x80000000);
+    RUNNER_ASSERT(selectCommand->GetColumnOptionalInt32(0) == static_cast<int32_t>(0x80000000));
     selectCommand->Reset();
 
     connection.ExecCommand("DROP TABLE testInt32;");
@@ -401,7 +401,7 @@ RUNNER_TEST(SqlConnection_Int64)
     RUNNER_ASSERT(!insertCommand->Step());
     insertCommand->Reset();
 
-    insertCommand->BindInt64(1, DPL::Optional<int64_t>(0x8000000000000000));
+    insertCommand->BindInt64(1, boost::optional<int64_t>(0x8000000000000000));
     RUNNER_ASSERT(!insertCommand->Step());
     insertCommand->Reset();
 
@@ -409,7 +409,7 @@ RUNNER_TEST(SqlConnection_Int64)
     RUNNER_ASSERT(selectCommand->Step());
     RUNNER_ASSERT(selectCommand->GetColumnInt64(0) == (int64_t)0xFFFFFFFFFFFFFFFF);
     RUNNER_ASSERT(selectCommand->Step());
-    RUNNER_ASSERT(selectCommand->GetColumnOptionalInt64(0) == 0x8000000000000000);
+    RUNNER_ASSERT(selectCommand->GetColumnOptionalInt64(0) == static_cast<int64_t>(0x8000000000000000));
     selectCommand->Reset();
 
     connection.ExecCommand("DROP TABLE testInt64;");
@@ -437,7 +437,7 @@ RUNNER_TEST(SqlConnection_Float)
     RUNNER_ASSERT(!insertCommand->Step());
     insertCommand->Reset();
 
-    insertCommand->BindFloat(1, DPL::Optional<float>(-90.6788f));
+    insertCommand->BindFloat(1, boost::optional<float>(-90.6788f));
     RUNNER_ASSERT(!insertCommand->Step());
     insertCommand->Reset();
 
@@ -474,7 +474,7 @@ RUNNER_TEST(SqlConnection_Double)
     RUNNER_ASSERT(!insertCommand->Step());
     insertCommand->Reset();
 
-    insertCommand->BindDouble(1, DPL::Optional<double>(-90.6788));
+    insertCommand->BindDouble(1, boost::optional<double>(-90.6788));
     RUNNER_ASSERT(!insertCommand->Step());
     insertCommand->Reset();