Lines Matching refs:sql

217 static int sql_exec_tran_no_cb(sqlite *db, char *sql, const char *dbname,
227 const char *detect_version_sql, char * const *sql, in init_db_instance() argument
307 sql[curr_version]); in init_db_instance()
309 rc = sql_exec_tran_no_cb(db, sql[curr_version], dbname, in init_db_instance()
449 char *sql[4]; in init_dbs() local
453 sql[0] = DB_INSTALL_SQL; in init_dbs()
454 sql[1] = DB_UPGRADE_FROM_v1_SQL; in init_dbs()
455 sql[2] = NULL; in init_dbs()
457 if (init_db_instance(IDMAP_DBNAME, DB_VERSION, DB_VERSION_SQL, sql, in init_dbs()
462 sql[0] = CACHE_INSTALL_SQL; in init_dbs()
463 sql[1] = CACHE_UPGRADE_FROM_v1_SQL; in init_dbs()
464 sql[2] = CACHE_UPGRADE_FROM_v2_SQL; in init_dbs()
465 sql[3] = NULL; in init_dbs()
468 sql, REMOVE_IF_CORRUPT, &created, &upgraded) < 0) in init_dbs()
521 sql_exec_tran_no_cb(sqlite *db, char *sql, const char *dbname, in sql_exec_tran_no_cb() argument
535 rc = sqlite_exec(db, sql, NULL, NULL, &errmsg); in sql_exec_tran_no_cb()
572 sql_exec_no_cb(sqlite *db, const char *dbname, char *sql) in sql_exec_no_cb() argument
578 r = sqlite_exec(db, sql, NULL, NULL, &errmsg); in sql_exec_no_cb()
583 "(%s)", dbname, sql, CHECK_NULL(errmsg)); in sql_exec_no_cb()
691 process_list_svc_sql(sqlite *db, const char *dbname, char *sql, uint64_t limit, in process_list_svc_sql() argument
705 r = sqlite_exec(db, sql, cb, &cb_data, &errmsg); in process_list_svc_sql()
715 "%s (%s)", dbname, sql, CHECK_NULL(errmsg)); in process_list_svc_sql()
876 char *sql = NULL; in add_namerule() local
917 sql = sqlite_mprintf("INSERT into namerules " in add_namerule()
926 if (sql == NULL) { in add_namerule()
932 retcode = sql_exec_no_cb(db, IDMAP_DBNAME, sql); in add_namerule()
940 if (sql != NULL) in add_namerule()
941 sqlite_freemem(sql); in add_namerule()
964 char *sql = NULL; in rm_namerule() local
976 sql = sqlite_mprintf("DELETE FROM namerules WHERE 1 %s;", expr); in rm_namerule()
978 if (sql == NULL) { in rm_namerule()
985 retcode = sql_exec_no_cb(db, IDMAP_DBNAME, sql); in rm_namerule()
990 if (sql != NULL) in rm_namerule()
991 sqlite_freemem(sql); in rm_namerule()
1015 sql_compile_n_step_once(sqlite *db, char *sql, sqlite_vm **vm, int *ncol, in sql_compile_n_step_once() argument
1021 if ((r = sqlite_compile(db, sql, NULL, vm, &errmsg)) != SQLITE_OK) { in sql_compile_n_step_once()
1022 idmapdlog(LOG_ERR, "Database error during %s (%s)", sql, in sql_compile_n_step_once()
1047 idmapdlog(LOG_ERR, "Database error during %s (%s)", sql, in sql_compile_n_step_once()
1504 char *sql = NULL; in lookup_cache_sid2pid() local
1541 sql = sqlite_mprintf("SELECT pid, is_user, expiration, " in lookup_cache_sid2pid()
1555 sql = sqlite_mprintf("SELECT pid, is_user, expiration, " in lookup_cache_sid2pid()
1572 if (sql == NULL) { in lookup_cache_sid2pid()
1577 retcode = sql_compile_n_step_once(cache, sql, &vm, &ncol, in lookup_cache_sid2pid()
1579 sqlite_freemem(sql); in lookup_cache_sid2pid()
1745 char *sql = NULL; in lookup_cache_sid2name() local
1762 sql = sqlite_mprintf("SELECT canon_name, domain, type " in lookup_cache_sid2name()
1768 if (sql == NULL) { in lookup_cache_sid2name()
1773 retcode = sql_compile_n_step_once(cache, sql, &vm, &ncol, 3, &values); in lookup_cache_sid2name()
1774 sqlite_freemem(sql); in lookup_cache_sid2name()
3013 char *sql = NULL, *errmsg = NULL, *lower_winname = NULL; in name_based_mapping_sid2pid() local
3060 sql = sqlite_mprintf( in name_based_mapping_sid2pid()
3068 if (sql == NULL) { in name_based_mapping_sid2pid()
3074 if (sqlite_compile(state->db, sql, NULL, &vm, &errmsg) != SQLITE_OK) { in name_based_mapping_sid2pid()
3196 if (sql != NULL) in name_based_mapping_sid2pid()
3197 sqlite_freemem(sql); in name_based_mapping_sid2pid()
3580 char *sql = NULL; in update_cache_pid2sid() local
3667 sql = sqlite_mprintf("INSERT OR REPLACE into idmap_cache " in update_cache_pid2sid()
3684 if (sql == NULL) { in update_cache_pid2sid()
3690 retcode = sql_exec_no_cb(state->cache, IDMAP_CACHENAME, sql); in update_cache_pid2sid()
3695 sqlite_freemem(sql); in update_cache_pid2sid()
3696 sql = NULL; in update_cache_pid2sid()
3705 sql = sqlite_mprintf("INSERT OR REPLACE into name_cache " in update_cache_pid2sid()
3712 if (sql == NULL) { in update_cache_pid2sid()
3718 retcode = sql_exec_no_cb(state->cache, IDMAP_CACHENAME, sql); in update_cache_pid2sid()
3721 if (sql != NULL) in update_cache_pid2sid()
3722 sqlite_freemem(sql); in update_cache_pid2sid()
3730 char *sql = NULL; in update_cache_sid2pid() local
3758 sql = sqlite_mprintf("UPDATE idmap_cache " in update_cache_sid2pid()
3765 if (sql == NULL) { in update_cache_sid2pid()
3771 retcode = sql_exec_no_cb(state->cache, IDMAP_CACHENAME, sql); in update_cache_sid2pid()
3775 sqlite_freemem(sql); in update_cache_sid2pid()
3776 sql = NULL; in update_cache_sid2pid()
3816 sql = sqlite_mprintf("INSERT OR REPLACE into idmap_cache " in update_cache_sid2pid()
3834 if (sql == NULL) { in update_cache_sid2pid()
3840 retcode = sql_exec_no_cb(state->cache, IDMAP_CACHENAME, sql); in update_cache_sid2pid()
3845 sqlite_freemem(sql); in update_cache_sid2pid()
3846 sql = NULL; in update_cache_sid2pid()
3855 sql = sqlite_mprintf("INSERT OR REPLACE into name_cache " in update_cache_sid2pid()
3862 if (sql == NULL) { in update_cache_sid2pid()
3868 retcode = sql_exec_no_cb(state->cache, IDMAP_CACHENAME, sql); in update_cache_sid2pid()
3871 if (sql != NULL) in update_cache_sid2pid()
3872 sqlite_freemem(sql); in update_cache_sid2pid()
3882 char *sql = NULL; in lookup_cache_pid2sid() local
3901 sql = sqlite_mprintf("SELECT sidprefix, rid, " in lookup_cache_pid2sid()
3912 sql = sqlite_mprintf("SELECT sidprefix, rid, " in lookup_cache_pid2sid()
3927 if (sql == NULL) { in lookup_cache_pid2sid()
3933 cache, sql, &vm, &ncol, 14, &values); in lookup_cache_pid2sid()
3934 sqlite_freemem(sql); in lookup_cache_pid2sid()
4097 char *sql; in lookup_cache_name2sid() local
4120 sql = sqlite_mprintf("SELECT sidprefix, rid, type, canon_name " in lookup_cache_name2sid()
4126 if (sql == NULL) { in lookup_cache_name2sid()
4131 retcode = sql_compile_n_step_once(cache, sql, &vm, &ncol, 4, &values); in lookup_cache_name2sid()
4133 sqlite_freemem(sql); in lookup_cache_name2sid()
4413 char *sql = NULL, *errmsg = NULL; in name_based_mapping_pid2sid() local
4428 sql = sqlite_mprintf( in name_based_mapping_pid2sid()
4435 if (sql == NULL) { in name_based_mapping_pid2sid()
4441 if (sqlite_compile(state->db, sql, NULL, &vm, &errmsg) != SQLITE_OK) { in name_based_mapping_pid2sid()
4578 if (sql != NULL) in name_based_mapping_pid2sid()
4579 sqlite_freemem(sql); in name_based_mapping_pid2sid()