select project_id, name, description, active_p, project_lead from logger_projects where project_id = :project_id insert into logger_project_var_map (project_id, variable_id, primary_p) values (:project_id, :variable_id, :primary_p) select count(*) from logger_project_var_map where project_id = :project_id and primary_p = 't' select variable_id from logger_project_var_map where project_id = :project_id