5 #include "standalone.h" 17 char*
fo_sysconfig(
const char* sectionname,
const char* variablename){
return(0);}
18 int fo_GetAgentKey (PGconn *
pgConn,
const char *agent_name,
long unused,
const char *cpunused,
const char *agent_desc){
return(0);}
20 const char *tableName,
const char *ars_status,
int ars_success){
return(0);}
37 int PQresultStatus(
const PGresult *res){
return(PGRES_COMMAND_OK);}
38 char *PQresultErrorMessage(
const PGresult *res){
return(0);}
39 char *PQresultErrorField(
const PGresult *res,
int fieldcode){
return(0);}
40 int PQntuples(
const PGresult *res){
return(1);}
41 PGresult *PQexec(PGconn *conn,
const char *query){
return(0);}
42 void PQclear(PGresult *res){}
43 char *PQgetvalue(
const PGresult *res,
int tup_num,
int field_num){
return(
"1");}
44 size_t PQescapeStringConn(PGconn *conn,
45 char *to,
const char *from,
size_t length,
int *error){*error=0;
return(0);}
46 void PQfinish(PGconn *conn){}
char * DBConfFile
DB conf file location.
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.
fo_dbManager_PreparedStatement * fo_dbManager_PrepareStamement_str(fo_dbManager *dbManager, const char *name, const char *query, const char *paramtypes)
Create a prepared statement.
PGconn * pgConn
Database connection.
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.
char * fo_scheduler_next()
Get the next data to process from the scheduler.
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...
PGresult * fo_dbManager_ExecPrepared(fo_dbManager_PreparedStatement *preparedStatement,...)
Execute a prepared statement.
int fo_tableExists(PGconn *pgConn, const char *tableName)
Check if table exists. Note, this assumes the database name is 'fossology'.
void fo_scheduler_set_special(int option, int value)
Sets something special about the agent within the scheduler.
int GetUploadPerm(PGconn *pgConn, long UploadPk, int user_pk)
Get users permission to this upload.
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.
char * fo_scheduler_current()
Get the last read string from the scheduler.
int fo_scheduler_get_special(int option)
Gets if a particular special attribute is set in the scheduler.
int fo_scheduler_userID()
Gets the id of the user that created the job that the agent is running.
fo_dbManager * fo_dbManager_new(PGconn *dbConnection)
Create and initialize new fo_dbManager object.
char * fo_sysconfig(const char *sectionname, const char *variablename)
gets a system configuration variable from the configuration data.
PGconn * fo_dbconnect(char *DBConfFile, char **ErrorBuf)
Connect to a database. The default is Db.conf.
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...
char * fo_RepMkPath(const char *Type, char *Filename)
Given a filename, construct the full path to the file.
fo_dbManager * dbManager
fo_dbManager object
PGconn * db_conn
The connection to Database.
int fo_checkPQresult(PGconn *pgConn, PGresult *result, char *sql, char *FileID, int LineNumb)
Check the result status of a postgres SELECT.
void fo_scheduler_disconnect(int retcode)
Disconnect the scheduler connection.
void fo_dbManager_free(fo_dbManager *dbManager)
Un-allocate the memory from a DB manager.
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...
void fo_scheduler_connect(int *argc, char **argv, PGconn **db_conn)
Establish a connection between an agent and the scheduler.