| 362 | virtual void TearDown() { pool_.Clear(); } |
| 363 | |
| 364 | string GetValue(const string& expr, const ColumnType& expr_type, |
| 365 | bool expect_error = false) { |
| 366 | string stmt = "select " + expr; |
| 367 | vector<FieldSchema> result_types; |
| 368 | Status status = executor_->Exec(stmt, &result_types); |
| 369 | if (!status.ok()) { |
| 370 | EXPECT_TRUE(expect_error) << "stmt: " << stmt << "\nerror: " << status.GetDetail(); |
| 371 | return ""; |
| 372 | } |
| 373 | string result_row; |
| 374 | status = executor_->FetchResult(&result_row); |
| 375 | if (expect_error) { |
| 376 | EXPECT_FALSE(status.ok()) << "Expected error\nstmt: " << stmt; |
| 377 | return ""; |
| 378 | } |
| 379 | EXPECT_TRUE(status.ok()) << "stmt: " << stmt << "\nerror: " << status.GetDetail(); |
| 380 | string odbcType = TypeToOdbcString(expr_type.ToThrift()); |
| 381 | // ColumnType cannot be BINARY, so STRING is used instead. |
| 382 | string expectedType = |
| 383 | result_types[0].type == "binary" ? "string" : result_types[0].type; |
| 384 | EXPECT_EQ(odbcType, expectedType) << expr; |
| 385 | return result_row; |
| 386 | } |
| 387 | |
| 388 | template <typename T> |
| 389 | T ConvertValue(const string& value); |
no test coverage detected