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.
|
2023-03-10 17:21:04 +01:00
|
|
|
|
Copyright (C) 1999-2023 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-07-11 19:12:24 +02:00
|
|
|
|
unsigned Deg_DB_GetNumDegreeTypes (HieLvl_Level_t Level);
|
2021-05-27 23:30:16 +02:00
|
|
|
|
unsigned Deg_DB_GetDegreeTypes (MYSQL_RES **mysql_res,
|
2023-07-11 19:12:24 +02:00
|
|
|
|
HieLvl_Level_t Level,DegTyp_Order_t Order);
|
2022-10-28 20:07:14 +02:00
|
|
|
|
void Deg_DB_GetDegTypeNameByCod (struct DegTyp_DegreeType *DegTyp);
|
2023-03-23 09:35:20 +01:00
|
|
|
|
unsigned Deg_DB_GetDegreeDataByCod (MYSQL_RES **mysql_res,long DegCod);
|
2021-05-28 19:59:55 +02:00
|
|
|
|
long Deg_DB_GetInsCodOfDegreeByCod (long DegCod);
|
2021-05-27 23:30:16 +02:00
|
|
|
|
long Deg_DB_GetCtrCodOfDegreeByCod (long DegCod);
|
2021-06-02 13:09:30 +02:00
|
|
|
|
void Deg_DB_GetShortNameOfDegreeByCod (long DegCod,char ShrtName[Cns_HIERARCHY_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,
|
2021-05-28 19:59:55 +02:00
|
|
|
|
long DegCod,long CtrCod);
|
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-07-11 19:12:24 +02:00
|
|
|
|
unsigned Deg_DB_GetNumDegsWithCrss (HieLvl_Level_t Level,long Cod);
|
2021-09-10 10:19:46 +02:00
|
|
|
|
unsigned Deg_DB_GetNumDegsWithUsrs (Rol_Role_t Role,
|
2023-07-11 19:12:24 +02:00
|
|
|
|
HieLvl_Level_t Level,long Cod);
|
2021-11-03 11:35:21 +01:00
|
|
|
|
|
2021-05-28 19:59:55 +02:00
|
|
|
|
unsigned Deg_DB_GetNumDegsInCty (long CtyCod);
|
|
|
|
|
unsigned Deg_DB_GetNumDegsInIns (long InsCod);
|
|
|
|
|
unsigned Deg_DB_GetNumDegsInCtr (long CtrCod);
|
|
|
|
|
|
|
|
|
|
void Deg_DB_UpdateDegTypName (long DegTypCod,
|
|
|
|
|
const char NewNameDegTyp[DegTyp_MAX_BYTES_DEGREE_TYPE_NAME + 1]);
|
2023-03-10 00:13:55 +01:00
|
|
|
|
void Deg_DB_UpdateDegNameDB (long DegCod,const char *FldName,
|
2021-05-28 19:59:55 +02:00
|
|
|
|
const char NewDegName[Cns_HIERARCHY_MAX_BYTES_FULL_NAME + 1]);
|
|
|
|
|
void Deg_DB_UpdateDegCtr (long DegCod,long NewCtrCod);
|
|
|
|
|
void Deg_DB_UpdateDegTyp (long DegCod,long NewDegTypCod);
|
|
|
|
|
void Deg_DB_UpdateDegWWW (long DegCod,const char NewWWW[Cns_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
|
|
|
|
|
2021-11-03 21:31:16 +01:00
|
|
|
|
unsigned Deg_DB_GetDegsFromUsr (MYSQL_RES **mysql_res,long UsrCod,long CtrCod);
|
|
|
|
|
unsigned Deg_DB_GetUsrMainDeg (MYSQL_RES **mysql_res,long UsrCod);
|
|
|
|
|
bool Deg_DB_CheckIfUsrBelongsToDeg (long UsrCod,long DegCod);
|
|
|
|
|
|
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
|