Пример #1
0
static int _db_auth_hook( 
        void *data,    /* data specific */
        int type,      /* event code , see sqlite3.h line:2630*/
        const char* a, /* event specific */
        const char* b, /* event specific */
        const char* c, /* database name */
        const char* d  /* trigger or view name */
        )
{
    const char* operation = a;
    
    printf( "db auth:  %s \n", event_description(type));
    printf("a: %s b: %s\n", a,b);

    if((a != NULL) && (type == SQLITE_TRANSACTION)) {
        printf(": %s Transaction", operation);
    }

    switch(type) {
        case SQLITE_CREATE_INDEX:
        case SQLITE_CREATE_TABLE:
        case SQLITE_CREATE_TRIGGER:
        case SQLITE_CREATE_VIEW:
        case SQLITE_DROP_INDEX:
        case SQLITE_DROP_TABLE:
        case SQLITE_DROP_TRIGGER:
        case SQLITE_DROP_VIEW:
        {
            printf(": Schema modified");
        }
        break;

        case SQLITE_READ:
        case SQLITE_INSERT:
        case SQLITE_UPDATE:
        break;

        case SQLITE_DELETE:
        break;

        case SQLITE_ATTACH:
        case SQLITE_DETACH:
        break;

        default:
        break;
    }

    return SQLITE_OK;
}
Пример #2
0
void check_event_time(struct state *state, s64 live_usecs)
{
	char *error = NULL;
	const char *description = event_description(state->event);
	if (verify_time(state,
			state->event->time_type,
			state->event->time_usecs,
			state->event->time_usecs_end, live_usecs,
			description, &error)) {
		die("%s:%d: %s\n",
		    state->config->script_path,
		    state->event->line_number,
		    error);
	}
}