src/SqlInputScanner.h
author František Kučera <franta-hg@frantovo.cz>
Thu, 04 Jun 2020 00:46:00 +0200
branchv_0
changeset 47 428c278af4be
parent 33 86ceb97db7de
permissions -rw-r--r--
rename option --data-source-url to --data-source-string In some implementations like JDBC, the connection string is URL, but in ODBC the string is not formally URL, so it is better to use more general term „data source string“ instead of URL. - data source name (DSN) = name of a pre-configured database connection that should be looked-up in configuration and used - data source string (connection string) = arbitrary string containing (in certain encoding which might and might not be URL) all needed parameters (e.g. server name + port + user name + password) Name and string might sometimes be also combined: in ODBC we can e.g. connect to a string: DSN=relpipe;someParameter=foo;someOther=bar which will lookup configuration for the „relpipe“ data source and will combine it with given parameters.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
33
86ceb97db7de SqlInputScanner for parsing SQL script and separating particular statements; does not depend on sqlite3_complete()
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     1
/**
86ceb97db7de SqlInputScanner for parsing SQL script and separating particular statements; does not depend on sqlite3_complete()
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     2
 * Relational pipes
86ceb97db7de SqlInputScanner for parsing SQL script and separating particular statements; does not depend on sqlite3_complete()
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     3
 * Copyright © 2020 František Kučera (Frantovo.cz, GlobalCode.info)
86ceb97db7de SqlInputScanner for parsing SQL script and separating particular statements; does not depend on sqlite3_complete()
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     4
 *
86ceb97db7de SqlInputScanner for parsing SQL script and separating particular statements; does not depend on sqlite3_complete()
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     5
 * This program is free software: you can redistribute it and/or modify
86ceb97db7de SqlInputScanner for parsing SQL script and separating particular statements; does not depend on sqlite3_complete()
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     6
 * it under the terms of the GNU General Public License as published by
86ceb97db7de SqlInputScanner for parsing SQL script and separating particular statements; does not depend on sqlite3_complete()
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     7
 * the Free Software Foundation, version 3.
86ceb97db7de SqlInputScanner for parsing SQL script and separating particular statements; does not depend on sqlite3_complete()
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     8
 *
86ceb97db7de SqlInputScanner for parsing SQL script and separating particular statements; does not depend on sqlite3_complete()
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     9
 * This program is distributed in the hope that it will be useful,
86ceb97db7de SqlInputScanner for parsing SQL script and separating particular statements; does not depend on sqlite3_complete()
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
86ceb97db7de SqlInputScanner for parsing SQL script and separating particular statements; does not depend on sqlite3_complete()
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
86ceb97db7de SqlInputScanner for parsing SQL script and separating particular statements; does not depend on sqlite3_complete()
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    12
 * GNU General Public License for more details.
86ceb97db7de SqlInputScanner for parsing SQL script and separating particular statements; does not depend on sqlite3_complete()
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    13
 *
86ceb97db7de SqlInputScanner for parsing SQL script and separating particular statements; does not depend on sqlite3_complete()
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    14
 * You should have received a copy of the GNU General Public License
86ceb97db7de SqlInputScanner for parsing SQL script and separating particular statements; does not depend on sqlite3_complete()
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    15
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
86ceb97db7de SqlInputScanner for parsing SQL script and separating particular statements; does not depend on sqlite3_complete()
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    16
 */
86ceb97db7de SqlInputScanner for parsing SQL script and separating particular statements; does not depend on sqlite3_complete()
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    17
#pragma once
86ceb97db7de SqlInputScanner for parsing SQL script and separating particular statements; does not depend on sqlite3_complete()
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    18
86ceb97db7de SqlInputScanner for parsing SQL script and separating particular statements; does not depend on sqlite3_complete()
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    19
#include <sstream>
86ceb97db7de SqlInputScanner for parsing SQL script and separating particular statements; does not depend on sqlite3_complete()
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    20
#include <stdexcept>
86ceb97db7de SqlInputScanner for parsing SQL script and separating particular statements; does not depend on sqlite3_complete()
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    21
#include <string>
86ceb97db7de SqlInputScanner for parsing SQL script and separating particular statements; does not depend on sqlite3_complete()
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    22
86ceb97db7de SqlInputScanner for parsing SQL script and separating particular statements; does not depend on sqlite3_complete()
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    23
namespace relpipe {
86ceb97db7de SqlInputScanner for parsing SQL script and separating particular statements; does not depend on sqlite3_complete()
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    24
namespace tr {
86ceb97db7de SqlInputScanner for parsing SQL script and separating particular statements; does not depend on sqlite3_complete()
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    25
namespace sql {
86ceb97db7de SqlInputScanner for parsing SQL script and separating particular statements; does not depend on sqlite3_complete()
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    26
86ceb97db7de SqlInputScanner for parsing SQL script and separating particular statements; does not depend on sqlite3_complete()
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    27
/**
86ceb97db7de SqlInputScanner for parsing SQL script and separating particular statements; does not depend on sqlite3_complete()
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    28
 * An SQL script may consist of several SQL statements separated by „;“ character.
86ceb97db7de SqlInputScanner for parsing SQL script and separating particular statements; does not depend on sqlite3_complete()
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    29
 * But this character may also occur in literal values or quoted identifiers where it does not separate SQL statements.
86ceb97db7de SqlInputScanner for parsing SQL script and separating particular statements; does not depend on sqlite3_complete()
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    30
 * This scanner reads SQL script character by character and separates particular SQL statements.
86ceb97db7de SqlInputScanner for parsing SQL script and separating particular statements; does not depend on sqlite3_complete()
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    31
 * It recognizes comments, literals, quoted values and other parts (see enum State),
86ceb97db7de SqlInputScanner for parsing SQL script and separating particular statements; does not depend on sqlite3_complete()
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    32
 * so it is able to distinguish which „;“ separates SQL statements from other „;“ that should be ignored.
86ceb97db7de SqlInputScanner for parsing SQL script and separating particular statements; does not depend on sqlite3_complete()
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    33
 * 
86ceb97db7de SqlInputScanner for parsing SQL script and separating particular statements; does not depend on sqlite3_complete()
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    34
 * Usage:
86ceb97db7de SqlInputScanner for parsing SQL script and separating particular statements; does not depend on sqlite3_complete()
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    35
 * Append characters using append() and when it returns true,
86ceb97db7de SqlInputScanner for parsing SQL script and separating particular statements; does not depend on sqlite3_complete()
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    36
 * call getAndReset() and use the returned statement.
86ceb97db7de SqlInputScanner for parsing SQL script and separating particular statements; does not depend on sqlite3_complete()
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    37
 * If there are any remaining characters on the input, start again with appending…
86ceb97db7de SqlInputScanner for parsing SQL script and separating particular statements; does not depend on sqlite3_complete()
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    38
 */
86ceb97db7de SqlInputScanner for parsing SQL script and separating particular statements; does not depend on sqlite3_complete()
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    39
class SqlInputScanner {
86ceb97db7de SqlInputScanner for parsing SQL script and separating particular statements; does not depend on sqlite3_complete()
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    40
private:
86ceb97db7de SqlInputScanner for parsing SQL script and separating particular statements; does not depend on sqlite3_complete()
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    41
86ceb97db7de SqlInputScanner for parsing SQL script and separating particular statements; does not depend on sqlite3_complete()
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    42
	enum class State {
86ceb97db7de SqlInputScanner for parsing SQL script and separating particular statements; does not depend on sqlite3_complete()
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    43
		/** SQL code like keywords, functions, operators or identifiers (not quoted ones) */
86ceb97db7de SqlInputScanner for parsing SQL script and separating particular statements; does not depend on sqlite3_complete()
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    44
		SQL,
86ceb97db7de SqlInputScanner for parsing SQL script and separating particular statements; does not depend on sqlite3_complete()
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    45
		/** classic SQL comment: -- terminated by the line end */
86ceb97db7de SqlInputScanner for parsing SQL script and separating particular statements; does not depend on sqlite3_complete()
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    46
		COMMENT_SINGLE,
86ceb97db7de SqlInputScanner for parsing SQL script and separating particular statements; does not depend on sqlite3_complete()
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    47
		/** comment like this one */
86ceb97db7de SqlInputScanner for parsing SQL script and separating particular statements; does not depend on sqlite3_complete()
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    48
		COMMENT_MULTI,
86ceb97db7de SqlInputScanner for parsing SQL script and separating particular statements; does not depend on sqlite3_complete()
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    49
		/** quoted identifier like "column_name" */
86ceb97db7de SqlInputScanner for parsing SQL script and separating particular statements; does not depend on sqlite3_complete()
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    50
		IDENTIFIER,
86ceb97db7de SqlInputScanner for parsing SQL script and separating particular statements; does not depend on sqlite3_complete()
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    51
		/** string literal like 'some value' */
86ceb97db7de SqlInputScanner for parsing SQL script and separating particular statements; does not depend on sqlite3_complete()
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    52
		STRING_VALUE
86ceb97db7de SqlInputScanner for parsing SQL script and separating particular statements; does not depend on sqlite3_complete()
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    53
	};
86ceb97db7de SqlInputScanner for parsing SQL script and separating particular statements; does not depend on sqlite3_complete()
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    54
86ceb97db7de SqlInputScanner for parsing SQL script and separating particular statements; does not depend on sqlite3_complete()
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    55
	State state = State::SQL;
86ceb97db7de SqlInputScanner for parsing SQL script and separating particular statements; does not depend on sqlite3_complete()
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    56
	bool includeSeparators = true;
86ceb97db7de SqlInputScanner for parsing SQL script and separating particular statements; does not depend on sqlite3_complete()
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    57
	std::wstringstream current;
86ceb97db7de SqlInputScanner for parsing SQL script and separating particular statements; does not depend on sqlite3_complete()
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    58
	wchar_t last = L'\0';
86ceb97db7de SqlInputScanner for parsing SQL script and separating particular statements; does not depend on sqlite3_complete()
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    59
86ceb97db7de SqlInputScanner for parsing SQL script and separating particular statements; does not depend on sqlite3_complete()
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    60
public:
86ceb97db7de SqlInputScanner for parsing SQL script and separating particular statements; does not depend on sqlite3_complete()
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    61
	/**
86ceb97db7de SqlInputScanner for parsing SQL script and separating particular statements; does not depend on sqlite3_complete()
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    62
	 * @param ch next character from the input stream
86ceb97db7de SqlInputScanner for parsing SQL script and separating particular statements; does not depend on sqlite3_complete()
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    63
	 * @return whether the accumulated SQL statement is complete – then call getAndReset(), otherwise continue appending
86ceb97db7de SqlInputScanner for parsing SQL script and separating particular statements; does not depend on sqlite3_complete()
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    64
	 */
86ceb97db7de SqlInputScanner for parsing SQL script and separating particular statements; does not depend on sqlite3_complete()
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    65
	bool append(wchar_t ch);
86ceb97db7de SqlInputScanner for parsing SQL script and separating particular statements; does not depend on sqlite3_complete()
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    66
86ceb97db7de SqlInputScanner for parsing SQL script and separating particular statements; does not depend on sqlite3_complete()
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    67
	/**
86ceb97db7de SqlInputScanner for parsing SQL script and separating particular statements; does not depend on sqlite3_complete()
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    68
	 * Returns current buffer and empties it, so append() can be called again (building new SQL statement)
86ceb97db7de SqlInputScanner for parsing SQL script and separating particular statements; does not depend on sqlite3_complete()
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    69
	 * @return accumulated SQL statement
86ceb97db7de SqlInputScanner for parsing SQL script and separating particular statements; does not depend on sqlite3_complete()
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    70
	 */
86ceb97db7de SqlInputScanner for parsing SQL script and separating particular statements; does not depend on sqlite3_complete()
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    71
	std::wstring getAndReset();
86ceb97db7de SqlInputScanner for parsing SQL script and separating particular statements; does not depend on sqlite3_complete()
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    72
86ceb97db7de SqlInputScanner for parsing SQL script and separating particular statements; does not depend on sqlite3_complete()
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    73
	/**
86ceb97db7de SqlInputScanner for parsing SQL script and separating particular statements; does not depend on sqlite3_complete()
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    74
	 * @param includeSeparators whether „;“ separators should be appended to the buffer
86ceb97db7de SqlInputScanner for parsing SQL script and separating particular statements; does not depend on sqlite3_complete()
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    75
	 * and then returned from getAndReset() as part of the SQL statement
86ceb97db7de SqlInputScanner for parsing SQL script and separating particular statements; does not depend on sqlite3_complete()
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    76
	 */
86ceb97db7de SqlInputScanner for parsing SQL script and separating particular statements; does not depend on sqlite3_complete()
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    77
	void setIncludeSeparators(bool includeSeparators) {
86ceb97db7de SqlInputScanner for parsing SQL script and separating particular statements; does not depend on sqlite3_complete()
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    78
		this->includeSeparators = includeSeparators;
86ceb97db7de SqlInputScanner for parsing SQL script and separating particular statements; does not depend on sqlite3_complete()
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    79
	}
86ceb97db7de SqlInputScanner for parsing SQL script and separating particular statements; does not depend on sqlite3_complete()
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    80
};
86ceb97db7de SqlInputScanner for parsing SQL script and separating particular statements; does not depend on sqlite3_complete()
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    81
86ceb97db7de SqlInputScanner for parsing SQL script and separating particular statements; does not depend on sqlite3_complete()
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    82
bool SqlInputScanner::append(wchar_t ch) {
86ceb97db7de SqlInputScanner for parsing SQL script and separating particular statements; does not depend on sqlite3_complete()
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    83
	if (state != State::SQL || (ch != L';') || (includeSeparators && ch == L';')) current << ch;
86ceb97db7de SqlInputScanner for parsing SQL script and separating particular statements; does not depend on sqlite3_complete()
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    84
86ceb97db7de SqlInputScanner for parsing SQL script and separating particular statements; does not depend on sqlite3_complete()
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    85
	if (state == State::SQL) {
86ceb97db7de SqlInputScanner for parsing SQL script and separating particular statements; does not depend on sqlite3_complete()
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    86
		if (ch == L'"') state = State::IDENTIFIER;
86ceb97db7de SqlInputScanner for parsing SQL script and separating particular statements; does not depend on sqlite3_complete()
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    87
		else if (ch == L'\'') state = State::STRING_VALUE;
86ceb97db7de SqlInputScanner for parsing SQL script and separating particular statements; does not depend on sqlite3_complete()
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    88
		else if (ch == L'-' && last == L'-') state = State::COMMENT_SINGLE;
86ceb97db7de SqlInputScanner for parsing SQL script and separating particular statements; does not depend on sqlite3_complete()
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    89
		else if (ch == L'*' && last == L'/') state = State::COMMENT_MULTI;
86ceb97db7de SqlInputScanner for parsing SQL script and separating particular statements; does not depend on sqlite3_complete()
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    90
	} else if (state == State::COMMENT_SINGLE) {
86ceb97db7de SqlInputScanner for parsing SQL script and separating particular statements; does not depend on sqlite3_complete()
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    91
		if (ch == L'\n') state = State::SQL;
86ceb97db7de SqlInputScanner for parsing SQL script and separating particular statements; does not depend on sqlite3_complete()
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    92
	} else if (state == State::COMMENT_MULTI) {
86ceb97db7de SqlInputScanner for parsing SQL script and separating particular statements; does not depend on sqlite3_complete()
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    93
		if (ch == L'/' && last == L'*') state = State::SQL;
86ceb97db7de SqlInputScanner for parsing SQL script and separating particular statements; does not depend on sqlite3_complete()
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    94
	} else if (state == State::IDENTIFIER) {
86ceb97db7de SqlInputScanner for parsing SQL script and separating particular statements; does not depend on sqlite3_complete()
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    95
		if (ch == L'"') state = State::SQL;
86ceb97db7de SqlInputScanner for parsing SQL script and separating particular statements; does not depend on sqlite3_complete()
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    96
	} else if (state == State::STRING_VALUE) {
86ceb97db7de SqlInputScanner for parsing SQL script and separating particular statements; does not depend on sqlite3_complete()
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    97
		if (ch == L'\'') state = State::SQL;
86ceb97db7de SqlInputScanner for parsing SQL script and separating particular statements; does not depend on sqlite3_complete()
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    98
	} else {
86ceb97db7de SqlInputScanner for parsing SQL script and separating particular statements; does not depend on sqlite3_complete()
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    99
		throw std::domain_error("Unsupported SqlInputScanner state (bug in code)");
86ceb97db7de SqlInputScanner for parsing SQL script and separating particular statements; does not depend on sqlite3_complete()
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   100
	}
86ceb97db7de SqlInputScanner for parsing SQL script and separating particular statements; does not depend on sqlite3_complete()
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   101
86ceb97db7de SqlInputScanner for parsing SQL script and separating particular statements; does not depend on sqlite3_complete()
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   102
	last = ch;
86ceb97db7de SqlInputScanner for parsing SQL script and separating particular statements; does not depend on sqlite3_complete()
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   103
	return state == State::SQL && ch == L';';
86ceb97db7de SqlInputScanner for parsing SQL script and separating particular statements; does not depend on sqlite3_complete()
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   104
};
86ceb97db7de SqlInputScanner for parsing SQL script and separating particular statements; does not depend on sqlite3_complete()
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   105
86ceb97db7de SqlInputScanner for parsing SQL script and separating particular statements; does not depend on sqlite3_complete()
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   106
std::wstring SqlInputScanner::getAndReset() {
86ceb97db7de SqlInputScanner for parsing SQL script and separating particular statements; does not depend on sqlite3_complete()
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   107
	std::wstring str = current.str();
86ceb97db7de SqlInputScanner for parsing SQL script and separating particular statements; does not depend on sqlite3_complete()
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   108
	current.str(L"");
86ceb97db7de SqlInputScanner for parsing SQL script and separating particular statements; does not depend on sqlite3_complete()
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   109
	current.clear();
86ceb97db7de SqlInputScanner for parsing SQL script and separating particular statements; does not depend on sqlite3_complete()
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   110
	return str;
86ceb97db7de SqlInputScanner for parsing SQL script and separating particular statements; does not depend on sqlite3_complete()
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   111
}
86ceb97db7de SqlInputScanner for parsing SQL script and separating particular statements; does not depend on sqlite3_complete()
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   112
86ceb97db7de SqlInputScanner for parsing SQL script and separating particular statements; does not depend on sqlite3_complete()
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   113
}
86ceb97db7de SqlInputScanner for parsing SQL script and separating particular statements; does not depend on sqlite3_complete()
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   114
}
86ceb97db7de SqlInputScanner for parsing SQL script and separating particular statements; does not depend on sqlite3_complete()
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   115
}