MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / PREPARSE_execute

Function PREPARSE_execute

src/yvalve/preparse.cpp:158–337  ·  view source on GitHub ↗

PREPARSE_execute @brief @param status @param ptrAtt @param stmt_length @param stmt @param stmt_eaten @param dialect **/

Source from the content-addressed store, hash-verified

156
157 **/
158bool PREPARSE_execute(CheckStatusWrapper* status, Why::YAttachment** ptrAtt,
159 string& stmt, bool* stmt_eaten, USHORT dialect)
160{
161 // no use creating separate pool for a couple of strings
162 ContextPoolHolder context(getDefaultMemoryPool());
163
164 try
165 {
166 if (stmt.isEmpty())
167 {
168 return false; // let others care
169 }
170
171 bool hasUser = true;
172 status->init();
173 for (int qStrip = 0; qStrip < 2; ++qStrip)
174 {
175 hasUser = false;
176
177 Tokens tks;
178 tks.quotes(quotes);
179 tks.parse(stmt.length(), stmt.c_str());
180
181 for (int tokenPos = tks.getCount() - 1; tokenPos >= 0; --tokenPos)
182 {
183 const Tokens::Tok& token = tks[tokenPos];
184
185 if (token.length > 0 && token.text[0] == '"')
186 {
187 string newToken = "'";
188
189 for (unsigned i = 1; i < token.length - 1; ++i)
190 {
191 switch (token.text[i])
192 {
193 case '\'':
194 newToken += "''";
195 break;
196
197 case '"':
198 ++i;
199 newToken += '"';
200 break;
201
202 default:
203 newToken += token.text[i];
204 }
205 }
206
207 newToken += "'";
208 stmt.replace(token.origin, token.length, newToken);
209 }
210 }
211
212 unsigned pos = 0;
213
214 if (getToken(pos, tks) != pp_symbols[PP_CREATE].symbol)
215 {

Callers 1

executeCreateDatabaseMethod · 0.85

Calls 15

getDefaultMemoryPoolFunction · 0.85
quotesMethod · 0.80
ToPathNameMethod · 0.80
insertByteMethod · 0.80
getTokenFunction · 0.70
generate_errorFunction · 0.70
isEmptyMethod · 0.45
initMethod · 0.45
parseMethod · 0.45
lengthMethod · 0.45
c_strMethod · 0.45
getCountMethod · 0.45

Tested by

no test coverage detected