![]() |
FOSSology
3.2.0rc1
Open Source License Compliance by Open Source Software
|
Common libpq database functions. More...
#include "libfossdb.h"#include <string.h>
Go to the source code of this file.
Macros | |
| #define | ERRBUFSIZE 11264 |
Functions | |
| PGconn * | fo_dbconnect (char *DBConfFile, char **ErrorBuf) |
| Connect to a database. The default is Db.conf. More... | |
| int | fo_checkPQresult (PGconn *pgConn, PGresult *result, char *sql, char *FileID, int LineNumb) |
| Check the result status of a postgres SELECT. More... | |
| 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 stdout. More... | |
| int | fo_tableExists (PGconn *pgConn, const char *tableName) |
| Check if table exists. Note, this assumes the database name is 'fossology'. More... | |
Common libpq database functions.
Definition in file libfossdb.c.
| 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 stdout.
| pgConn | Database connection object |
| result | Postgres result object |
| sql | the sql query |
| FileID | is a file identifier string to write into the error message. Typically the caller will use FILE, but any identifier string is ok. |
| LineNumb | the line number of the caller (LINE) |
Definition at line 215 of file libfossdb.c.
| int fo_checkPQresult | ( | PGconn * | pgConn, |
| PGresult * | result, | ||
| char * | sql, | ||
| char * | FileID, | ||
| int | LineNumb | ||
| ) |
Check the result status of a postgres SELECT.
If an error occured, write the error to stdout
| pgConn | Database connection object |
| result | Postgres result object |
| sql | the sql query |
| FileID | is a file identifier string to write into the error message. Typically the caller will use FILE, but any identifier string is ok. |
| LineNumb | the line number of the caller (LINE) |
Definition at line 181 of file libfossdb.c.
| PGconn* fo_dbconnect | ( | char * | DBConfFile, |
| char ** | ErrorBuf | ||
| ) |
Connect to a database. The default is Db.conf.
| DBConfFile | File path of the Db.conf file to use. If NULL, use the default Db.conf |
| ErrorBuf | Address of pointer to error buffer. fo_dbconnect will allocate this if needed. The caller should free it. |
Definition at line 40 of file libfossdb.c.
| int fo_tableExists | ( | PGconn * | pgConn, |
| const char * | tableName | ||
| ) |
Check if table exists. Note, this assumes the database name is 'fossology'.
| pgConn | database connection |
| tableName | The table in question |
Definition at line 243 of file libfossdb.c.