|
@@ -1,8 +1,38 @@
|
|
|
// Copyright: All Rights Reserved
|
|
// Copyright: All Rights Reserved
|
|
|
// Author: egametang@gmail.com (tanghai)
|
|
// Author: egametang@gmail.com (tanghai)
|
|
|
|
|
|
|
|
|
|
+#include <gtest/gtest.h>
|
|
|
|
|
+#include <gflags/gflags.h>
|
|
|
|
|
+#include <glog/logging.h>
|
|
|
|
|
+#include "Orm/DbHelper.h"
|
|
|
#include "Orm/DbResult.h"
|
|
#include "Orm/DbResult.h"
|
|
|
|
|
+#include "Orm/Select.h"
|
|
|
|
|
+#include "Orm/Person.pb.h"
|
|
|
|
|
|
|
|
namespace Egametang {
|
|
namespace Egametang {
|
|
|
|
|
|
|
|
|
|
+class DbResultTest: public testing::Test
|
|
|
|
|
+{
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
|
|
+TEST_F(DbResultTest, One)
|
|
|
|
|
+{
|
|
|
|
|
+ DbHelper dbHelper("192.168.1.4", "root", "111111");
|
|
|
|
|
+
|
|
|
|
|
+ DbResultPtr result = dbHelper.Execute(
|
|
|
|
|
+ Select<Person>(Column("*"))
|
|
|
|
|
+ .Where(Column("age") > 10));
|
|
|
|
|
+
|
|
|
|
|
+ boost::shared_ptr<Person> person;
|
|
|
|
|
+ result->One(person);
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
} // namespace Egametang
|
|
} // namespace Egametang
|
|
|
|
|
+
|
|
|
|
|
+int main(int argc, char* argv[])
|
|
|
|
|
+{
|
|
|
|
|
+ testing::InitGoogleTest(&argc, argv);
|
|
|
|
|
+ google::InitGoogleLogging(argv[0]);
|
|
|
|
|
+ google::ParseCommandLineFlags(&argc, &argv, true);
|
|
|
|
|
+ return RUN_ALL_TESTS();
|
|
|
|
|
+}
|