| 97 | } |
| 98 | |
| 99 | void TestBindColumnBigInt(const std::shared_ptr<Connection>& connection) { |
| 100 | const std::shared_ptr<Statement>& statement = connection->CreateStatement(); |
| 101 | statement->Execute( |
| 102 | "SELECT IncidntNum, CAST(\"IncidntNum\" AS DOUBLE) / 100 AS " |
| 103 | "double_field, Category\n" |
| 104 | "FROM (\n" |
| 105 | " SELECT CONVERT_TO_INTEGER(IncidntNum, 1, 1, 0) AS IncidntNum, " |
| 106 | "Category\n" |
| 107 | " FROM (\n" |
| 108 | " SELECT IncidntNum, Category FROM \"@apache\".Test LIMIT 10\n" |
| 109 | " ) nested_0\n" |
| 110 | ") nested_0"); |
| 111 | |
| 112 | const std::shared_ptr<ResultSet>& result_set = statement->GetResultSet(); |
| 113 | |
| 114 | const int batch_size = 100; |
| 115 | const int max_strlen = 1000; |
| 116 | |
| 117 | char incidnt_num[batch_size][max_strlen]; |
| 118 | ssize_t incidnt_num_length[batch_size]; |
| 119 | |
| 120 | double double_field[batch_size]; |
| 121 | ssize_t double_field_length[batch_size]; |
| 122 | |
| 123 | char category[batch_size][max_strlen]; |
| 124 | ssize_t category_length[batch_size]; |
| 125 | |
| 126 | result_set->BindColumn(1, arrow::flight::sql::odbc::CDataType_CHAR, 0, 0, incidnt_num, |
| 127 | max_strlen, incidnt_num_length); |
| 128 | result_set->BindColumn(2, arrow::flight::sql::odbc::CDataType_DOUBLE, 0, 0, |
| 129 | double_field, max_strlen, double_field_length); |
| 130 | result_set->BindColumn(3, arrow::flight::sql::odbc::CDataType_CHAR, 0, 0, category, |
| 131 | max_strlen, category_length); |
| 132 | |
| 133 | size_t total = 0; |
| 134 | while (true) { |
| 135 | size_t fetched_rows = result_set->Move(batch_size, 0, 0, nullptr); |
| 136 | ARROW_LOG(DEBUG) << "Fetched " << fetched_rows << " rows."; |
| 137 | |
| 138 | total += fetched_rows; |
| 139 | ARROW_LOG(DEBUG) << "Total:" << total; |
| 140 | |
| 141 | for (size_t i = 0; i < fetched_rows; ++i) { |
| 142 | ARROW_LOG(DEBUG) << "Row[" << i << "] incidnt_num: '" << incidnt_num[i] << "', " |
| 143 | << "double_field: '" << double_field[i] << "', " |
| 144 | << "category: '" << category[i] << "'"; |
| 145 | } |
| 146 | |
| 147 | if (fetched_rows < batch_size) break; |
| 148 | } |
| 149 | } |
| 150 | |
| 151 | void TestGetTablesV2(const std::shared_ptr<Connection>& connection) { |
| 152 | const std::shared_ptr<Statement>& statement = connection->CreateStatement(); |
nothing calls this directly
no test coverage detected