MCPcopy Create free account
hub / github.com/bloomberg/comdb2 / lua_get_prepare_flags

Function lua_get_prepare_flags

lua/sp.c:2332–2369  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2330}
2331
2332static int lua_get_prepare_flags()
2333{
2334 /*
2335 ** NOTE: Why are each of these flags used here?
2336 **
2337 ** PREPARE_DENY_DDL: Completely forbid any DDL from being
2338 ** executed. This is important because
2339 ** various places in this subsystem may
2340 ** assume that the schema should not be
2341 ** changed while a stored procedure is
2342 ** running. Setting this flag ends up
2343 ** causing the custom SQLite authorizer
2344 ** callback for Comdb2 to forbid any
2345 ** operation that is considered DDL
2346 ** (e.g. CREATE TABLE, ANALYZE, etc).
2347 **
2348 ** PREPARE_IGNORE_ERR: Prevent any error encountered during
2349 ** the prepare phase (e.g. bad syntax,
2350 ** schema changed, etc) from putting the
2351 ** "clnt" into a persistent error state.
2352 ** The SQL query that caused the error
2353 ** cannot be executed; however, the
2354 ** running stored procedure can continue
2355 ** doing other work (i.e. perhaps via a
2356 ** different SQL query, etc).
2357 **
2358 ** PREPARE_NO_NORMALIZE: Skip calculating the normalized SQL
2359 ** query text for any SQL query that
2360 ** originates from within a stored
2361 ** procedure as these are now handled
2362 ** within this subsystem, via the
2363 ** lua_end_step() function, which can
2364 ** (also) correctly calculate metrics
2365 ** associated with the normalized SQL
2366 ** query text and its fingerprint hash.
2367 */
2368 return PREPARE_DENY_DDL | PREPARE_IGNORE_ERR | PREPARE_NO_NORMALIZE;
2369}
2370
2371static int lua_prepare_sql(SP sp, const char *sql, sqlite3_stmt **stmt)
2372{

Callers 3

lua_prepare_sqlFunction · 0.85
db_prepareFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected