--- a/src/SqlHandler.h Fri May 08 12:51:01 2020 +0200
+++ b/src/SqlHandler.h Sat May 23 23:58:50 2020 +0200
@@ -36,6 +36,7 @@
#include "Configuration.h"
#include "SqlException.h"
+#include "SqlInputScanner.h"
#include "PreparedStatement.h"
#include "Connection.h"
@@ -63,12 +64,16 @@
sql->str(L"");
sql->clear();
+ SqlInputScanner scanner;
+
for (wchar_t ch; *input >> ch;) {
- *sql << ch;
- if (ch == L';' && PreparedStatement::isComplete(convertor.to_bytes(sql->str()).c_str())) return true;
+ if (scanner.append(ch)) {
+ *sql << scanner.getAndReset().c_str();
+ return true;
+ }
}
- string_t remainingSql = sql->str();
+ string_t remainingSql = scanner.getAndReset();
for (wchar_t ch : remainingSql) if (ch != L' ' && ch != L'\n' && ch != L'\r' && ch != L'\t') throw SqlException(L"Unexpected EOF, missing „;“ after: „" + remainingSql + L"“");
return false;