Lines Matching refs:sql

216 static int sql_exec_tran_no_cb(sqlite *db, char *sql, const char *dbname,
226 const char *detect_version_sql, char * const *sql, in init_db_instance() argument
306 sql[curr_version]); in init_db_instance()
308 rc = sql_exec_tran_no_cb(db, sql[curr_version], dbname, in init_db_instance()
448 char *sql[4]; in init_dbs() local
452 sql[0] = DB_INSTALL_SQL; in init_dbs()
453 sql[1] = DB_UPGRADE_FROM_v1_SQL; in init_dbs()
454 sql[2] = NULL; in init_dbs()
456 if (init_db_instance(IDMAP_DBNAME, DB_VERSION, DB_VERSION_SQL, sql, in init_dbs()
461 sql[0] = CACHE_INSTALL_SQL; in init_dbs()
462 sql[1] = CACHE_UPGRADE_FROM_v1_SQL; in init_dbs()
463 sql[2] = CACHE_UPGRADE_FROM_v2_SQL; in init_dbs()
464 sql[3] = NULL; in init_dbs()
467 sql, REMOVE_IF_CORRUPT, &created, &upgraded) < 0) in init_dbs()
520 sql_exec_tran_no_cb(sqlite *db, char *sql, const char *dbname, in sql_exec_tran_no_cb() argument
534 rc = sqlite_exec(db, sql, NULL, NULL, &errmsg); in sql_exec_tran_no_cb()
571 sql_exec_no_cb(sqlite *db, const char *dbname, char *sql) in sql_exec_no_cb() argument
577 r = sqlite_exec(db, sql, NULL, NULL, &errmsg); in sql_exec_no_cb()
582 "(%s)", dbname, sql, CHECK_NULL(errmsg)); in sql_exec_no_cb()
690 process_list_svc_sql(sqlite *db, const char *dbname, char *sql, uint64_t limit, in process_list_svc_sql() argument
704 r = sqlite_exec(db, sql, cb, &cb_data, &errmsg); in process_list_svc_sql()
714 "%s (%s)", dbname, sql, CHECK_NULL(errmsg)); in process_list_svc_sql()
875 char *sql = NULL; in add_namerule() local
916 sql = sqlite_mprintf("INSERT into namerules " in add_namerule()
925 if (sql == NULL) { in add_namerule()
931 retcode = sql_exec_no_cb(db, IDMAP_DBNAME, sql); in add_namerule()
939 if (sql != NULL) in add_namerule()
940 sqlite_freemem(sql); in add_namerule()
963 char *sql = NULL; in rm_namerule() local
975 sql = sqlite_mprintf("DELETE FROM namerules WHERE 1 %s;", expr); in rm_namerule()
977 if (sql == NULL) { in rm_namerule()
984 retcode = sql_exec_no_cb(db, IDMAP_DBNAME, sql); in rm_namerule()
989 if (sql != NULL) in rm_namerule()
990 sqlite_freemem(sql); in rm_namerule()
1014 sql_compile_n_step_once(sqlite *db, char *sql, sqlite_vm **vm, int *ncol, in sql_compile_n_step_once() argument
1020 if ((r = sqlite_compile(db, sql, NULL, vm, &errmsg)) != SQLITE_OK) { in sql_compile_n_step_once()
1021 idmapdlog(LOG_ERR, "Database error during %s (%s)", sql, in sql_compile_n_step_once()
1046 idmapdlog(LOG_ERR, "Database error during %s (%s)", sql, in sql_compile_n_step_once()
1498 char *sql = NULL; in lookup_cache_sid2pid() local
1535 sql = sqlite_mprintf("SELECT pid, is_user, expiration, " in lookup_cache_sid2pid()
1549 sql = sqlite_mprintf("SELECT pid, is_user, expiration, " in lookup_cache_sid2pid()
1566 if (sql == NULL) { in lookup_cache_sid2pid()
1571 retcode = sql_compile_n_step_once(cache, sql, &vm, &ncol, in lookup_cache_sid2pid()
1573 sqlite_freemem(sql); in lookup_cache_sid2pid()
1739 char *sql = NULL; in lookup_cache_sid2name() local
1756 sql = sqlite_mprintf("SELECT canon_name, domain, type " in lookup_cache_sid2name()
1762 if (sql == NULL) { in lookup_cache_sid2name()
1767 retcode = sql_compile_n_step_once(cache, sql, &vm, &ncol, 3, &values); in lookup_cache_sid2name()
1768 sqlite_freemem(sql); in lookup_cache_sid2name()
3007 char *sql = NULL, *errmsg = NULL, *lower_winname = NULL; in name_based_mapping_sid2pid() local
3054 sql = sqlite_mprintf( in name_based_mapping_sid2pid()
3062 if (sql == NULL) { in name_based_mapping_sid2pid()
3068 if (sqlite_compile(state->db, sql, NULL, &vm, &errmsg) != SQLITE_OK) { in name_based_mapping_sid2pid()
3190 if (sql != NULL) in name_based_mapping_sid2pid()
3191 sqlite_freemem(sql); in name_based_mapping_sid2pid()
3574 char *sql = NULL; in update_cache_pid2sid() local
3661 sql = sqlite_mprintf("INSERT OR REPLACE into idmap_cache " in update_cache_pid2sid()
3677 if (sql == NULL) { in update_cache_pid2sid()
3683 retcode = sql_exec_no_cb(state->cache, IDMAP_CACHENAME, sql); in update_cache_pid2sid()
3688 sqlite_freemem(sql); in update_cache_pid2sid()
3689 sql = NULL; in update_cache_pid2sid()
3698 sql = sqlite_mprintf("INSERT OR REPLACE into name_cache " in update_cache_pid2sid()
3705 if (sql == NULL) { in update_cache_pid2sid()
3711 retcode = sql_exec_no_cb(state->cache, IDMAP_CACHENAME, sql); in update_cache_pid2sid()
3714 if (sql != NULL) in update_cache_pid2sid()
3715 sqlite_freemem(sql); in update_cache_pid2sid()
3723 char *sql = NULL; in update_cache_sid2pid() local
3751 sql = sqlite_mprintf("UPDATE idmap_cache " in update_cache_sid2pid()
3758 if (sql == NULL) { in update_cache_sid2pid()
3764 retcode = sql_exec_no_cb(state->cache, IDMAP_CACHENAME, sql); in update_cache_sid2pid()
3768 sqlite_freemem(sql); in update_cache_sid2pid()
3769 sql = NULL; in update_cache_sid2pid()
3809 sql = sqlite_mprintf("INSERT OR REPLACE into idmap_cache " in update_cache_sid2pid()
3826 if (sql == NULL) { in update_cache_sid2pid()
3832 retcode = sql_exec_no_cb(state->cache, IDMAP_CACHENAME, sql); in update_cache_sid2pid()
3837 sqlite_freemem(sql); in update_cache_sid2pid()
3838 sql = NULL; in update_cache_sid2pid()
3847 sql = sqlite_mprintf("INSERT OR REPLACE into name_cache " in update_cache_sid2pid()
3854 if (sql == NULL) { in update_cache_sid2pid()
3860 retcode = sql_exec_no_cb(state->cache, IDMAP_CACHENAME, sql); in update_cache_sid2pid()
3863 if (sql != NULL) in update_cache_sid2pid()
3864 sqlite_freemem(sql); in update_cache_sid2pid()
3874 char *sql = NULL; in lookup_cache_pid2sid() local
3893 sql = sqlite_mprintf("SELECT sidprefix, rid, " in lookup_cache_pid2sid()
3904 sql = sqlite_mprintf("SELECT sidprefix, rid, " in lookup_cache_pid2sid()
3919 if (sql == NULL) { in lookup_cache_pid2sid()
3925 cache, sql, &vm, &ncol, 14, &values); in lookup_cache_pid2sid()
3926 sqlite_freemem(sql); in lookup_cache_pid2sid()
4089 char *sql; in lookup_cache_name2sid() local
4112 sql = sqlite_mprintf("SELECT sidprefix, rid, type, canon_name " in lookup_cache_name2sid()
4118 if (sql == NULL) { in lookup_cache_name2sid()
4123 retcode = sql_compile_n_step_once(cache, sql, &vm, &ncol, 4, &values); in lookup_cache_name2sid()
4125 sqlite_freemem(sql); in lookup_cache_name2sid()
4405 char *sql = NULL, *errmsg = NULL; in name_based_mapping_pid2sid() local
4420 sql = sqlite_mprintf( in name_based_mapping_pid2sid()
4427 if (sql == NULL) { in name_based_mapping_pid2sid()
4433 if (sqlite_compile(state->db, sql, NULL, &vm, &errmsg) != SQLITE_OK) { in name_based_mapping_pid2sid()
4570 if (sql != NULL) in name_based_mapping_pid2sid()
4571 sqlite_freemem(sql); in name_based_mapping_pid2sid()