Initial commit
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
#include "file_reader.h"
|
||||
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
|
||||
// Read a SQL file
|
||||
bool FileReader::read(const std::string &sqlFilePath, std::string &sql) {
|
||||
// Try read the SQL file
|
||||
std::ifstream file(sqlFilePath);
|
||||
if (!file.is_open()) {
|
||||
std::cerr << "Error opening file:" << sqlFilePath << std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
std::stringstream buffer;
|
||||
buffer << file.rdbuf();
|
||||
|
||||
sql = buffer.str();
|
||||
file.close();
|
||||
|
||||
return true;
|
||||
}
|
||||
Reference in New Issue
Block a user