Lines Matching refs:sql

219 static int sql_exec_tran_no_cb(sqlite *db, char *sql, const char *dbname,
229 const char *detect_version_sql, char * const *sql, in init_db_instance() argument
309 sql[curr_version]); in init_db_instance()
311 rc = sql_exec_tran_no_cb(db, sql[curr_version], dbname, in init_db_instance()
496 char *sql[4]; in init_dbs() local
500 sql[0] = DB_INSTALL_SQL; in init_dbs()
501 sql[1] = DB_UPGRADE_FROM_v1_SQL; in init_dbs()
502 sql[2] = NULL; in init_dbs()
504 if (init_db_instance(IDMAP_DBNAME, DB_VERSION, DB_VERSION_SQL, sql, in init_dbs()
509 sql[0] = CACHE_INSTALL_SQL; in init_dbs()
510 sql[1] = CACHE_UPGRADE_FROM_v1_SQL; in init_dbs()
511 sql[2] = CACHE_UPGRADE_FROM_v2_SQL; in init_dbs()
512 sql[3] = NULL; in init_dbs()
515 sql, REMOVE_IF_CORRUPT, &created, &upgraded) < 0) in init_dbs()
579 sql_exec_tran_no_cb(sqlite *db, char *sql, const char *dbname, in sql_exec_tran_no_cb() argument
593 rc = sqlite_exec(db, sql, NULL, NULL, &errmsg); in sql_exec_tran_no_cb()
630 sql_exec_no_cb(sqlite *db, const char *dbname, char *sql) in sql_exec_no_cb() argument
636 r = sqlite_exec(db, sql, NULL, NULL, &errmsg); in sql_exec_no_cb()
639 "(%s)", dbname, sql, CHECK_NULL(errmsg)); in sql_exec_no_cb()
767 process_list_svc_sql(sqlite *db, const char *dbname, char *sql, uint64_t limit, in process_list_svc_sql() argument
781 r = sqlite_exec(db, sql, cb, &cb_data, &errmsg); in process_list_svc_sql()
791 "%s (%s)", dbname, sql, CHECK_NULL(errmsg)); in process_list_svc_sql()
952 char *sql = NULL; in add_namerule() local
993 sql = sqlite_mprintf("INSERT into namerules " in add_namerule()
1002 if (sql == NULL) { in add_namerule()
1008 retcode = sql_exec_no_cb(db, IDMAP_DBNAME, sql); in add_namerule()
1016 if (sql != NULL) in add_namerule()
1017 sqlite_freemem(sql); in add_namerule()
1040 char *sql = NULL; in rm_namerule() local
1052 sql = sqlite_mprintf("DELETE FROM namerules WHERE 1 %s;", expr); in rm_namerule()
1054 if (sql == NULL) { in rm_namerule()
1061 retcode = sql_exec_no_cb(db, IDMAP_DBNAME, sql); in rm_namerule()
1066 if (sql != NULL) in rm_namerule()
1067 sqlite_freemem(sql); in rm_namerule()
1091 sql_compile_n_step_once(sqlite *db, char *sql, sqlite_vm **vm, int *ncol, in sql_compile_n_step_once() argument
1097 if ((r = sqlite_compile(db, sql, NULL, vm, &errmsg)) != SQLITE_OK) { in sql_compile_n_step_once()
1098 idmapdlog(LOG_ERR, "Database error during %s (%s)", sql, in sql_compile_n_step_once()
1123 idmapdlog(LOG_ERR, "Database error during %s (%s)", sql, in sql_compile_n_step_once()
1580 char *sql = NULL; in lookup_cache_sid2pid() local
1617 sql = sqlite_mprintf("SELECT pid, is_user, expiration, " in lookup_cache_sid2pid()
1631 sql = sqlite_mprintf("SELECT pid, is_user, expiration, " in lookup_cache_sid2pid()
1648 if (sql == NULL) { in lookup_cache_sid2pid()
1653 retcode = sql_compile_n_step_once(cache, sql, &vm, &ncol, in lookup_cache_sid2pid()
1655 sqlite_freemem(sql); in lookup_cache_sid2pid()
1821 char *sql = NULL; in lookup_cache_sid2name() local
1838 sql = sqlite_mprintf("SELECT canon_name, domain, type " in lookup_cache_sid2name()
1844 if (sql == NULL) { in lookup_cache_sid2name()
1849 retcode = sql_compile_n_step_once(cache, sql, &vm, &ncol, 3, &values); in lookup_cache_sid2name()
1850 sqlite_freemem(sql); in lookup_cache_sid2name()
3089 char *sql = NULL, *errmsg = NULL, *lower_winname = NULL; in name_based_mapping_sid2pid() local
3136 sql = sqlite_mprintf( in name_based_mapping_sid2pid()
3144 if (sql == NULL) { in name_based_mapping_sid2pid()
3150 if (sqlite_compile(state->db, sql, NULL, &vm, &errmsg) != SQLITE_OK) { in name_based_mapping_sid2pid()
3272 if (sql != NULL) in name_based_mapping_sid2pid()
3273 sqlite_freemem(sql); in name_based_mapping_sid2pid()
3662 char *sql = NULL; in update_cache_pid2sid() local
3749 sql = sqlite_mprintf("INSERT OR REPLACE into idmap_cache " in update_cache_pid2sid()
3766 if (sql == NULL) { in update_cache_pid2sid()
3772 retcode = sql_exec_no_cb(state->cache, IDMAP_CACHENAME, sql); in update_cache_pid2sid()
3777 sqlite_freemem(sql); in update_cache_pid2sid()
3778 sql = NULL; in update_cache_pid2sid()
3787 sql = sqlite_mprintf("INSERT OR REPLACE into name_cache " in update_cache_pid2sid()
3794 if (sql == NULL) { in update_cache_pid2sid()
3800 retcode = sql_exec_no_cb(state->cache, IDMAP_CACHENAME, sql); in update_cache_pid2sid()
3803 if (sql != NULL) in update_cache_pid2sid()
3804 sqlite_freemem(sql); in update_cache_pid2sid()
3812 char *sql = NULL; in update_cache_sid2pid() local
3840 sql = sqlite_mprintf("UPDATE idmap_cache " in update_cache_sid2pid()
3847 if (sql == NULL) { in update_cache_sid2pid()
3853 retcode = sql_exec_no_cb(state->cache, IDMAP_CACHENAME, sql); in update_cache_sid2pid()
3857 sqlite_freemem(sql); in update_cache_sid2pid()
3858 sql = NULL; in update_cache_sid2pid()
3898 sql = sqlite_mprintf("INSERT OR REPLACE into idmap_cache " in update_cache_sid2pid()
3916 if (sql == NULL) { in update_cache_sid2pid()
3922 retcode = sql_exec_no_cb(state->cache, IDMAP_CACHENAME, sql); in update_cache_sid2pid()
3927 sqlite_freemem(sql); in update_cache_sid2pid()
3928 sql = NULL; in update_cache_sid2pid()
3937 sql = sqlite_mprintf("INSERT OR REPLACE into name_cache " in update_cache_sid2pid()
3944 if (sql == NULL) { in update_cache_sid2pid()
3950 retcode = sql_exec_no_cb(state->cache, IDMAP_CACHENAME, sql); in update_cache_sid2pid()
3953 if (sql != NULL) in update_cache_sid2pid()
3954 sqlite_freemem(sql); in update_cache_sid2pid()
3964 char *sql = NULL; in lookup_cache_pid2sid() local
3983 sql = sqlite_mprintf("SELECT sidprefix, rid, " in lookup_cache_pid2sid()
3994 sql = sqlite_mprintf("SELECT sidprefix, rid, " in lookup_cache_pid2sid()
4009 if (sql == NULL) { in lookup_cache_pid2sid()
4015 cache, sql, &vm, &ncol, 14, &values); in lookup_cache_pid2sid()
4016 sqlite_freemem(sql); in lookup_cache_pid2sid()
4179 char *sql; in lookup_cache_name2sid() local
4202 sql = sqlite_mprintf("SELECT sidprefix, rid, type, canon_name " in lookup_cache_name2sid()
4208 if (sql == NULL) { in lookup_cache_name2sid()
4213 retcode = sql_compile_n_step_once(cache, sql, &vm, &ncol, 4, &values); in lookup_cache_name2sid()
4215 sqlite_freemem(sql); in lookup_cache_name2sid()
4496 char *sql = NULL, *errmsg = NULL; in name_based_mapping_pid2sid() local
4511 sql = sqlite_mprintf( in name_based_mapping_pid2sid()
4518 if (sql == NULL) { in name_based_mapping_pid2sid()
4524 if (sqlite_compile(state->db, sql, NULL, &vm, &errmsg) != SQLITE_OK) { in name_based_mapping_pid2sid()
4661 if (sql != NULL) in name_based_mapping_pid2sid()
4662 sqlite_freemem(sql); in name_based_mapping_pid2sid()