equal
deleted
inserted
replaced
34 |
34 |
35 #include <relpipe/writer/Factory.h> |
35 #include <relpipe/writer/Factory.h> |
36 |
36 |
37 #include "Configuration.h" |
37 #include "Configuration.h" |
38 #include "SqlException.h" |
38 #include "SqlException.h" |
|
39 #include "SqlInputScanner.h" |
39 #include "PreparedStatement.h" |
40 #include "PreparedStatement.h" |
40 #include "Connection.h" |
41 #include "Connection.h" |
41 |
42 |
42 namespace relpipe { |
43 namespace relpipe { |
43 namespace tr { |
44 namespace tr { |
61 |
62 |
62 bool readNextSqlStatement(std::wistream* input, std::wstringstream* sql) { |
63 bool readNextSqlStatement(std::wistream* input, std::wstringstream* sql) { |
63 sql->str(L""); |
64 sql->str(L""); |
64 sql->clear(); |
65 sql->clear(); |
65 |
66 |
|
67 SqlInputScanner scanner; |
|
68 |
66 for (wchar_t ch; *input >> ch;) { |
69 for (wchar_t ch; *input >> ch;) { |
67 *sql << ch; |
70 if (scanner.append(ch)) { |
68 if (ch == L';' && PreparedStatement::isComplete(convertor.to_bytes(sql->str()).c_str())) return true; |
71 *sql << scanner.getAndReset().c_str(); |
69 } |
72 return true; |
70 |
73 } |
71 string_t remainingSql = sql->str(); |
74 } |
|
75 |
|
76 string_t remainingSql = scanner.getAndReset(); |
72 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"“"); |
77 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"“"); |
73 |
78 |
74 return false; |
79 return false; |
75 } |
80 } |
76 |
81 |