2021-05-27 23:30:16 +02:00
|
|
|
|
// swad_degree_database.h: degrees operations with database
|
|
|
|
|
|
|
|
|
|
#ifndef _SWAD_DEG_DB
|
|
|
|
|
#define _SWAD_DEG_DB
|
|
|
|
|
/*
|
|
|
|
|
SWAD (Shared Workspace At a Distance in Spanish),
|
|
|
|
|
is a web platform developed at the University of Granada (Spain),
|
|
|
|
|
and used to support university teaching.
|
|
|
|
|
|
|
|
|
|
This file is part of SWAD core.
|
2024-02-07 00:40:28 +01:00
|
|
|
|
Copyright (C) 1999-2024 Antonio Ca<EFBFBD>as Vargas
|
2021-05-27 23:30:16 +02:00
|
|
|
|
|
|
|
|
|
This program is free software: you can redistribute it and/or modify
|
|
|
|
|
it under the terms of the GNU Affero General Public License as
|
|
|
|
|
published by the Free Software Foundation, either version 3 of the
|
|
|
|
|
License, or (at your option) any later version.
|
|
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
GNU Affero General Public License for more details.
|
|
|
|
|
|
|
|
|
|
You should have received a copy of the GNU Affero General Public License
|
|
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
*/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/********************************* Headers ***********************************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
#include <mysql/mysql.h> // To access MySQL databases
|
|
|
|
|
|
2021-05-28 19:59:55 +02:00
|
|
|
|
#include "swad_degree.h"
|
2021-05-27 23:30:16 +02:00
|
|
|
|
#include "swad_degree_type.h"
|
2021-10-15 01:39:56 +02:00
|
|
|
|
#include "swad_search.h"
|
2021-05-27 23:30:16 +02:00
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/***************************** Public prototypes *****************************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
void Deg_DB_CreateDegreeType (const char DegTypName[DegTyp_MAX_BYTES_DEGREE_TYPE_NAME + 1]);
|
2023-09-18 15:15:29 +02:00
|
|
|
|
void Deg_DB_CreateDegree (struct Hie_Node *Deg,Hie_Status_t Status);
|
2021-05-27 23:30:16 +02:00
|
|
|
|
|
2023-09-22 14:47:56 +02:00
|
|
|
|
unsigned Deg_DB_GetNumDegreeTypes (Hie_Level_t Level);
|
2021-05-27 23:30:16 +02:00
|
|
|
|
unsigned Deg_DB_GetDegreeTypes (MYSQL_RES **mysql_res,
|
2023-09-22 14:47:56 +02:00
|
|
|
|
Hie_Level_t Level,DegTyp_Order_t Order);
|
2024-04-23 23:54:23 +02:00
|
|
|
|
void Deg_DB_GetDegTypeNameByCod (struct DegTyp_DegType *DegTyp);
|
2024-02-09 00:22:59 +01:00
|
|
|
|
unsigned Deg_DB_GetDegreeDataByCod (MYSQL_RES **mysql_res,long HieCod);
|
|
|
|
|
long Deg_DB_GetInsCodOfDegreeByCod (long HieCod);
|
|
|
|
|
long Deg_DB_GetCtrCodOfDegreeByCod (long HieCod);
|
|
|
|
|
void Deg_DB_GetDegShrtName (long HieCod,char ShrtName[Nam_MAX_BYTES_SHRT_NAME + 1]);
|
2021-05-27 23:30:16 +02:00
|
|
|
|
bool Deg_DB_CheckIfDegreeTypeNameExists (const char *DegTypName,long DegTypCod);
|
|
|
|
|
unsigned Deg_DB_GetNumDegsOfType (long DegTypCod);
|
|
|
|
|
unsigned Deg_DB_GetDegsOfType (MYSQL_RES **mysql_res,long DegTypCod);
|
2021-05-28 19:59:55 +02:00
|
|
|
|
unsigned Deg_DB_GetDegsOfCurrentCtrBasic (MYSQL_RES **mysql_res);
|
|
|
|
|
unsigned Deg_DB_GetDegsOfCurrentCtrFull (MYSQL_RES **mysql_res);
|
2021-05-27 23:30:16 +02:00
|
|
|
|
unsigned Deg_DB_GetDegsWithPendingCrss (MYSQL_RES **mysql_res);
|
2021-05-28 19:59:55 +02:00
|
|
|
|
unsigned Deg_DB_GetDegsWithStds (MYSQL_RES **mysql_res);
|
2023-03-10 00:13:55 +01:00
|
|
|
|
bool Deg_DB_CheckIfDegNameExistsInCtr (const char *FldName,const char *Name,
|
2023-10-10 14:42:33 +02:00
|
|
|
|
long Cod,long PrtCod,
|
|
|
|
|
__attribute__((unused)) unsigned Year);
|
2021-05-27 23:30:16 +02:00
|
|
|
|
|
2021-10-15 01:39:56 +02:00
|
|
|
|
unsigned Deg_DB_SearchDegs (MYSQL_RES **mysql_res,
|
|
|
|
|
const char SearchQuery[Sch_MAX_BYTES_SEARCH_QUERY + 1],
|
|
|
|
|
const char *RangeQuery);
|
|
|
|
|
|
2023-09-22 14:47:56 +02:00
|
|
|
|
unsigned Deg_DB_GetNumDegsWithCrss (Hie_Level_t Level,long Cod);
|
2021-09-10 10:19:46 +02:00
|
|
|
|
unsigned Deg_DB_GetNumDegsWithUsrs (Rol_Role_t Role,
|
2023-09-22 14:47:56 +02:00
|
|
|
|
Hie_Level_t Level,long Cod);
|
2021-11-03 11:35:21 +01:00
|
|
|
|
|
2023-09-22 14:47:56 +02:00
|
|
|
|
unsigned Deg_DB_GetNumDegsInSys (__attribute__((unused)) long SysCod);
|
2024-02-09 00:22:59 +01:00
|
|
|
|
unsigned Deg_DB_GetNumDegsInCty (long HieCod);
|
|
|
|
|
unsigned Deg_DB_GetNumDegsInIns (long HieCod);
|
|
|
|
|
unsigned Deg_DB_GetNumDegsInCtr (long HieCod);
|
2021-05-28 19:59:55 +02:00
|
|
|
|
|
|
|
|
|
void Deg_DB_UpdateDegTypName (long DegTypCod,
|
|
|
|
|
const char NewNameDegTyp[DegTyp_MAX_BYTES_DEGREE_TYPE_NAME + 1]);
|
2024-02-09 00:22:59 +01:00
|
|
|
|
void Deg_DB_UpdateDegNameDB (long HieCod,
|
2023-10-11 09:55:06 +02:00
|
|
|
|
const char *FldName,const char *NewDegName);
|
2024-02-09 00:22:59 +01:00
|
|
|
|
void Deg_DB_UpdateDegCtr (long HieCod,long NewCtrCod);
|
|
|
|
|
void Deg_DB_UpdateDegTyp (long HieCod,long NewDegTypCod);
|
2024-04-23 23:54:23 +02:00
|
|
|
|
void Deg_DB_UpdateDegWWW (long HieCod,const char NewWWW[WWW_MAX_BYTES_WWW + 1]);
|
2021-11-10 10:53:08 +01:00
|
|
|
|
void Deg_DB_UpdateDegStatus (long DegCod,Hie_Status_t NewStatus);
|
2021-05-27 23:30:16 +02:00
|
|
|
|
|
2023-10-03 15:35:36 +02:00
|
|
|
|
unsigned Deg_DB_GetMyDegs (MYSQL_RES **mysql_res,long HieCod);
|
2021-11-03 21:31:16 +01:00
|
|
|
|
unsigned Deg_DB_GetUsrMainDeg (MYSQL_RES **mysql_res,long UsrCod);
|
2024-04-19 12:49:42 +02:00
|
|
|
|
Usr_Belong_t Deg_DB_CheckIfUsrBelongsToDeg (long UsrCod,long HieCod,
|
|
|
|
|
bool CountOnlyAcceptedCourses);
|
2021-11-03 21:31:16 +01:00
|
|
|
|
|
2021-05-27 23:30:16 +02:00
|
|
|
|
void Deg_DB_RemoveDegTyp (long DegTypCod);
|
2021-05-28 19:59:55 +02:00
|
|
|
|
void Deg_DB_RemoveDeg (long DegCod);
|
2021-05-27 23:30:16 +02:00
|
|
|
|
|
|
|
|
|
#endif
|