Merge pull request #82 from zhjunjun/master

Add some query tests in db_test.cc for orm_lib
This commit is contained in:
An Tao 2019-03-20 23:09:42 +08:00 committed by GitHub
commit 11d3f46edb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 30 additions and 55 deletions

View File

@ -1,36 +0,0 @@
---
name: Bug report
about: Create a report to help us improve
labels:
---
**Describe the bug**
A clear and concise description of what the bug is.
**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
**Expected behavior**
A clear and concise description of what you expected to happen.
**Screenshots**
If applicable, add screenshots to help explain your problem.
**Desktop (please complete the following information):**
- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]
**Smartphone (please complete the following information):**
- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]
**Additional context**
Add any other context about the problem here.

View File

@ -1,18 +0,0 @@
---
name: Feature request
about: Suggest an idea for this project
labels:
---
**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
**Describe the solution you'd like**
A clear and concise description of what you want to happen.
**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.
**Additional context**
Add any other context or screenshots about the feature request here.

View File

@ -113,7 +113,36 @@ int main()
std::cerr << e.base().what() << std::endl;
testOutput(false, "DbClient streaming-type interface(1)");
};
/// Add more testing here
///1.3 query,no-blocking
*clientPtr << "select * from users where 1 = 1"
<< Mode::NonBlocking >>
[](const Result &r) {
for (Result::size_type i = 0; i < r.size(); ++i)
{
std::cout << r[i]["id"].as<int64_t>() << " " << r[i]["user_id"].as<std::string>() << " "
<< r[i]["user_name"].as<std::string>() << std::endl;
}
testOutput(true, "DbClient streaming-type interface(0)");
} >>
[](const DrogonDbException &e) {
std::cerr << e.base().what() << std::endl;
testOutput(false, "DbClient streaming-type interface(0)");
};
///1.4 query,blocking
*clientPtr << "select * from users where 1 = 1"
<< Mode::Blocking >>
[](const Result &r) {
for (const auto &item : r)
{
std::cout << item["id"].as<int64_t>() << " " << item["user_id"].as<std::string>() << " "
<< item["user_name"].as<std::string>() << std::endl;
}
testOutput(true, "DbClient streaming-type interface(1)");
} >>
[](const DrogonDbException &e) {
std::cerr << e.base().what() << std::endl;
testOutput(false, "DbClient streaming-type interface(1)");
};
/// 2 DbClient execSqlAsync()...
///