| 244 | } |
| 245 | |
| 246 | void comdb2DropTrigger(Parse *parse, int consumer, Token *proc) |
| 247 | { |
| 248 | if (comdb2IsPrepareOnly(parse)) |
| 249 | return; |
| 250 | |
| 251 | #ifndef SQLITE_OMIT_AUTHORIZATION |
| 252 | { |
| 253 | if( sqlite3AuthCheck(parse, consumer ? SQLITE_DROP_LUA_CONSUMER : |
| 254 | SQLITE_DROP_LUA_TRIGGER, 0, 0, 0) ){ |
| 255 | sqlite3ErrorMsg(parse, COMDB2_NOT_AUTHORIZED_ERRMSG); |
| 256 | parse->rc = SQLITE_AUTH; |
| 257 | return; |
| 258 | } |
| 259 | } |
| 260 | #endif |
| 261 | |
| 262 | if (comdb2AuthenticateUserOp(parse)) |
| 263 | return; |
| 264 | |
| 265 | char spname[MAX_SPNAME]; |
| 266 | |
| 267 | if (comdb2TokenToStr(proc, spname, sizeof(spname))) { |
| 268 | sqlite3ErrorMsg(parse, "Procedure name is too long"); |
| 269 | return; |
| 270 | } |
| 271 | |
| 272 | Q4SP(qname, spname); |
| 273 | if (!getqueuebyname(qname)) { |
| 274 | sqlite3ErrorMsg(parse, "no such trigger: %s", spname); |
| 275 | return; |
| 276 | } |
| 277 | |
| 278 | // trigger drop table:qname |
| 279 | struct schema_change_type *sc = new_schemachange_type(); |
| 280 | sc->kind = SC_DEL_TRIGGER; |
| 281 | strcpy(sc->tablename, qname); |
| 282 | Vdbe *v = sqlite3GetVdbe(parse); |
| 283 | comdb2prepareNoRows(v, parse, 0, sc, &comdb2SqlSchemaChange_tran, (vdbeFuncArgFree)&free_schema_change_type); |
| 284 | } |
| 285 | |
| 286 | #define comdb2CreateFunc(p, proc, pfx, PFX, type, flags) \ |
| 287 | do { \ |
nothing calls this directly
no test coverage detected