FOSSology  4.4.0
Open Source License Compliance by Open Source Software
standalone.c
Go to the documentation of this file.
1 /*
2  SPDX-FileCopyrightText: © Fossology contributors
3 
4  SPDX-License-Identifier: GPL-2.0-only
5 */
10 #include "standalone.h"
11 
12 int result = 0;
13 
14 void fo_scheduler_heart(int i){}
15 void fo_scheduler_connect(int* argc, char** argv, PGconn** db_conn){}
16 void fo_scheduler_disconnect(int retcode){}
17 char* fo_scheduler_next(){return(0);}
18 char* fo_scheduler_current(){return(0);}
19 int fo_scheduler_userID(){return(0);}
20 void fo_scheduler_set_special(int option, int value){}
21 int fo_scheduler_get_special(int option){return(0);}
22 char* fo_sysconfig(const char* sectionname, const char* variablename){return(0);}
23 int fo_GetAgentKey (PGconn *pgConn, const char *agent_name, long unused, const char *cpunused, const char *agent_desc){return(0);}
24 int fo_WriteARS(PGconn *pgConn, int ars_pk, int upload_pk, int agent_pk,
25  const char *tableName, const char *ars_status, int ars_success){return(0);}
26 PGconn *fo_dbconnect(char *DBConfFile, char **ErrorBuf){return(0);}
27 int fo_checkPQcommand(PGconn *pgConn, PGresult *result, char *sql, char *FileID, int LineNumb){return(0);}
28 int fo_checkPQresult(PGconn *pgConn, PGresult *result, char *sql, char *FileID, int LineNumb){return(0);}
29 int fo_tableExists(PGconn *pgConn, const char *tableName){return(0);}
30 char * fo_RepMkPath (char *Type, char *Filename){return(0);}
31 int GetUploadPerm(PGconn *pgConn, long UploadPk, int user_pk){return(10);}
32 
33 fo_dbManager* fo_dbManager_new(PGconn* dbConnection) {return NULL;}
35 fo_dbManager_PreparedStatement* fo_dbManager_PrepareStamement_str(fo_dbManager* dbManager, const char* name, const char* query, const char* paramtypes) {return NULL;}
36 PGresult* fo_dbManager_ExecPrepared(fo_dbManager_PreparedStatement* preparedStatement, ...) {return NULL;}
37 
38 PGresult* getSelectedPFiles(PGconn* pgConn, int uploadPk, int agentPk, bool ignoreFilesWithMimeType) {return NULL;}
39 PGresult* checkDuplicateReq(PGconn* pgConn, int uploadPk, int agentPk) {return NULL;}
40 
41 //ExecStatusType PQresultStatus(const PGresult *res);
42 int PQresultStatus(const PGresult *res){ return(PGRES_COMMAND_OK);}
43 char *PQresultErrorMessage(const PGresult *res){return(0);}
44 char *PQresultErrorField(const PGresult *res, int fieldcode){return(0);}
45 int PQntuples(const PGresult *res){return(1);}
46 PGresult *PQexec(PGconn *conn, const char *query){return(0);}
47 void PQclear(PGresult *res){}
48 char *PQgetvalue(const PGresult *res, int tup_num, int field_num){return("1");}
49 size_t PQescapeStringConn(PGconn *conn,
50  char *to, const char *from, size_t length, int *error){*error=0;return(0);}
51 void PQfinish(PGconn *conn){}
52 
PGconn * pgConn
Database connection.
Definition: adj2nest.c:86
int agent_pk
Definition: agent.h:74
char * fo_RepMkPath(const char *Type, char *Filename)
Given a filename, construct the full path to the file.
Definition: libfossrepo.c:352
fo_dbManager * dbManager
fo_dbManager object
Definition: process.c:16
void fo_scheduler_disconnect(int retcode)
Disconnect the scheduler connection.
Definition: standalone.c:16
void fo_scheduler_heart(int i)
This function must be called by agents to let the scheduler know they are alive and how many items th...
Definition: standalone.c:14
fo_dbManager_PreparedStatement * fo_dbManager_PrepareStamement_str(fo_dbManager *dbManager, const char *name, const char *query, const char *paramtypes)
Create a prepared statement.
Definition: standalone.c:35
void fo_scheduler_set_special(int option, int value)
Sets something special about the agent within the scheduler.
Definition: standalone.c:20
char * fo_sysconfig(const char *sectionname, const char *variablename)
gets a system configuration variable from the configuration data.
Definition: standalone.c:22
PGconn * fo_dbconnect(char *DBConfFile, char **ErrorBuf)
Connect to a database. The default is Db.conf.
Definition: standalone.c:26
PGresult * fo_dbManager_ExecPrepared(fo_dbManager_PreparedStatement *preparedStatement,...)
Execute a prepared statement.
Definition: standalone.c:36
int fo_WriteARS(PGconn *pgConn, int ars_pk, int upload_pk, int agent_pk, const char *tableName, const char *ars_status, int ars_success)
Write ars record.
Definition: standalone.c:24
int fo_checkPQresult(PGconn *pgConn, PGresult *result, char *sql, char *FileID, int LineNumb)
Check the result status of a postgres SELECT.
Definition: standalone.c:28
int fo_scheduler_get_special(int option)
Gets if a particular special attribute is set in the scheduler.
Definition: standalone.c:21
PGresult * checkDuplicateReq(PGconn *pgConn, int uploadPk, int agentPk)
Get the upload_pk and agent_pk to find out the agent has already scanned the package.
Definition: standalone.c:39
int fo_GetAgentKey(PGconn *pgConn, const char *agent_name, long unused, const char *cpunused, const char *agent_desc)
Get the latest enabled agent key (agent_pk) from the database.
Definition: standalone.c:23
int fo_scheduler_userID()
Gets the id of the user that created the job that the agent is running.
Definition: standalone.c:19
char * fo_scheduler_current()
Get the last read string from the scheduler.
Definition: standalone.c:18
int fo_tableExists(PGconn *pgConn, const char *tableName)
Check if table exists. Note, this assumes the database name is 'fossology'.
Definition: standalone.c:29
char * fo_scheduler_next()
Get the next data to process from the scheduler.
Definition: standalone.c:17
int fo_checkPQcommand(PGconn *pgConn, PGresult *result, char *sql, char *FileID, int LineNumb)
Check the result status of a postgres commands (not select) If an error occured, write the error to s...
Definition: standalone.c:27
void fo_scheduler_connect(int *argc, char **argv, PGconn **db_conn)
Establish a connection between an agent and the scheduler.
Definition: standalone.c:15
int GetUploadPerm(PGconn *pgConn, long UploadPk, int user_pk)
Get users permission to this upload.
Definition: standalone.c:31
fo_dbManager * fo_dbManager_new(PGconn *dbConnection)
Create and initialize new fo_dbManager object.
Definition: standalone.c:33
void fo_dbManager_free(fo_dbManager *dbManager)
Un-allocate the memory from a DB manager.
Definition: standalone.c:34
PGresult * getSelectedPFiles(PGconn *pgConn, int uploadPk, int agentPk, bool ignoreFilesWithMimeType)
Get the upload_pk, agent_pk and ignoreFilesWithMimeType to get all the file Ids for nomos.
Definition: standalone.c:38
PGconn * db_conn
The connection to Database.
Definition: pkgagent.c:22
const char * upload_pk
Definition: sqlstatements.h:82
char * DBConfFile
DB conf file location.
Definition: testRun.c:21
char * Filename
Filename.
Definition: run_tests.c:17