10 #include "standalone.h"
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);}
25 const char *tableName,
const char *ars_status,
int ars_success){
return(0);}
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){}
PGconn * pgConn
Database connection.
char * fo_RepMkPath(const char *Type, char *Filename)
Given a filename, construct the full path to the file.
fo_dbManager * dbManager
fo_dbManager object
void fo_scheduler_disconnect(int retcode)
Disconnect the scheduler connection.
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...
fo_dbManager_PreparedStatement * fo_dbManager_PrepareStamement_str(fo_dbManager *dbManager, const char *name, const char *query, const char *paramtypes)
Create a prepared statement.
void fo_scheduler_set_special(int option, int value)
Sets something special about the agent within the scheduler.
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 * fo_dbManager_ExecPrepared(fo_dbManager_PreparedStatement *preparedStatement,...)
Execute a prepared statement.
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.
int fo_checkPQresult(PGconn *pgConn, PGresult *result, char *sql, char *FileID, int LineNumb)
Check the result status of a postgres SELECT.
int fo_scheduler_get_special(int option)
Gets if a particular special attribute is set in the scheduler.
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.
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.
int fo_scheduler_userID()
Gets the id of the user that created the job that the agent is running.
char * fo_scheduler_current()
Get the last read string from the scheduler.
int fo_tableExists(PGconn *pgConn, const char *tableName)
Check if table exists. Note, this assumes the database name is 'fossology'.
char * fo_scheduler_next()
Get the next data to process from the scheduler.
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.
int GetUploadPerm(PGconn *pgConn, long UploadPk, int user_pk)
Get users permission to this upload.
fo_dbManager * fo_dbManager_new(PGconn *dbConnection)
Create and initialize new fo_dbManager object.
void fo_dbManager_free(fo_dbManager *dbManager)
Un-allocate the memory from a DB manager.
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.
PGconn * db_conn
The connection to Database.
char * DBConfFile
DB conf file location.