| 305 | } |
| 306 | |
| 307 | std::string readSqlFromFile(const std::string& path) { |
| 308 | std::ifstream inputFile(path, std::ifstream::binary); |
| 309 | |
| 310 | // Find out file size. |
| 311 | auto begin = inputFile.tellg(); |
| 312 | inputFile.seekg(0, std::ios::end); |
| 313 | auto end = inputFile.tellg(); |
| 314 | |
| 315 | auto fileSize = end - begin; |
| 316 | if (fileSize == 0) { |
| 317 | return ""; |
| 318 | } |
| 319 | |
| 320 | // Read the file. |
| 321 | std::string sql; |
| 322 | sql.resize(fileSize); |
| 323 | |
| 324 | inputFile.seekg(begin); |
| 325 | inputFile.read(sql.data(), fileSize); |
| 326 | inputFile.close(); |
| 327 | return sql; |
| 328 | } |
| 329 | |
| 330 | std::exception_ptr assertError( |
| 331 | const std::string& expression, |