| Libgretl Reference Manual | ||||
|---|---|---|---|---|
| Top | Description | ||||
#define DB_DESCRIP_LEN enum db_error_codes; enum CompactMethod; typedef dbnumber; typedef dbwrapper; typedef SERIESINFO; typedef ODBC_info; #define ODBC_MAXCOLS int get_native_db_data (const char *dbbase, SERIESINFO *sinfo, double **Z); int get_remote_db_data (const char *dbbase, SERIESINFO *sinfo, double **Z); int get_pcgive_db_data (const char *dbbase, SERIESINFO *sinfo, double **Z); int get_rats_db_data (const char *fname, SERIESINFO *sinfo, double **Z); dbwrapper * read_rats_db (FILE *fp); dbwrapper * read_pcgive_db (FILE *fp); dbwrapper * dbwrapper_new (int n); void dbwrapper_destroy (dbwrapper *dw); double * compact_db_series (const double *src, SERIESINFO *sinfo, int target_pd, CompactMethod method); double * expand_db_series (const double *src, SERIESINFO *sinfo, int target_pd); int set_db_name (const char *fname, int filetype, PRN *prn); const char * get_db_name (void); int set_odbc_dsn (const char *line, PRN *prn); int db_set_sample (const char *s, DATAINFO *pdinfo); int db_get_series (char *line, double ***pZ, DATAINFO *datainfo, gretlopt opt, PRN *prn); int db_delete_series_by_name (char *line, PRN *prn); int db_delete_series_by_number (const int *list, const char *fname); void get_db_padding (SERIESINFO *sinfo, DATAINFO *pdinfo, int *pad1, int *pad2); int db_range_check (SERIESINFO *sinfo, DATAINFO *pdinfo); int check_db_import (SERIESINFO *sinfo, DATAINFO *pdinfo); int compact_data_set (double ***pZ, DATAINFO *pdinfo, int newpd, CompactMethod default_method, int monstart, int repday); int expand_data_set (double ***pZ, DATAINFO *pdinfo, int newpd);
typedef enum {
DB_MISSING_DATA = E_MAX + 1,
DB_NO_SUCH_SERIES,
DB_PARSE_ERROR
} db_error_codes;
typedef enum {
COMPACT_NONE,
COMPACT_SUM,
COMPACT_AVG,
COMPACT_SOP,
COMPACT_EOP,
COMPACT_WDAY,
COMPACT_MAX
} CompactMethod;
int get_native_db_data (const char *dbbase,
SERIESINFO *sinfo,
double **Z);
dbbase : |
|
sinfo : |
|
Z : |
|
| Returns : |
int get_remote_db_data (const char *dbbase,
SERIESINFO *sinfo,
double **Z);
dbbase : |
|
sinfo : |
|
Z : |
|
| Returns : |
int get_pcgive_db_data (const char *dbbase,
SERIESINFO *sinfo,
double **Z);
dbbase : |
|
sinfo : |
|
Z : |
|
| Returns : |
int get_rats_db_data (const char *fname,
SERIESINFO *sinfo,
double **Z);
Read the actual data values for a series from a RATS database.
fname : |
name of RATS 4.0 database to read from |
sinfo : |
holds info on the given series (input) |
Z : |
data matrix |
| Returns : | 0 on successful completion, E_FOPEN if the data could not be read, and DB_MISSING_DATA if the data were found but there were some missing values. |
dbwrapper * read_rats_db (FILE *fp);
Read the series info from a RATS 4.0 database: read the base block at offset 0 in the data file, and recurse through the directory entries.
fp : |
pre-opened stream (caller to close it) |
| Returns : | pointer to a dbwrapper containing the series info, or NULL in case of failure. |
dbwrapper * read_pcgive_db (FILE *fp);
Read the series info from a PcGive database, .in7 file
fp : |
pre-opened stream (caller to close it) |
| Returns : | pointer to a dbwrapper containing the series info, or NULL in case of failure. |
double * compact_db_series (const double *src,
SERIESINFO *sinfo,
int target_pd,
CompactMethod method);
src : |
|
sinfo : |
|
target_pd : |
|
method : |
|
| Returns : |
double * expand_db_series (const double *src,
SERIESINFO *sinfo,
int target_pd);
src : |
|
sinfo : |
|
target_pd : |
|
| Returns : |
int set_db_name (const char *fname,
int filetype,
PRN *prn);
fname : |
|
filetype : |
|
prn : |
|
| Returns : |
int db_get_series (char *line,
double ***pZ,
DATAINFO *datainfo,
gretlopt opt,
PRN *prn);
line : |
|
pZ : |
|
datainfo : |
|
opt : |
|
prn : |
|
| Returns : |
int db_delete_series_by_name (char *line,
PRN *prn);
line : |
|
prn : |
|
| Returns : |
int db_delete_series_by_number (const int *list,
const char *fname);
list : |
|
fname : |
|
| Returns : |
void get_db_padding (SERIESINFO *sinfo, DATAINFO *pdinfo, int *pad1, int *pad2);
sinfo : |
|
pdinfo : |
|
pad1 : |
|
pad2 : |
int db_range_check (SERIESINFO *sinfo, DATAINFO *pdinfo);
sinfo : |
|
pdinfo : |
|
| Returns : |
int check_db_import (SERIESINFO *sinfo, DATAINFO *pdinfo);
sinfo : |
|
pdinfo : |
|
| Returns : |
int compact_data_set (double ***pZ,
DATAINFO *pdinfo,
int newpd,
CompactMethod default_method,
int monstart,
int repday);
Compact the data set from higher to lower frequency.
pZ : |
pointer to data array. |
pdinfo : |
data information struct. |
newpd : |
target data frequency. |
default_method : |
code for the default compaction method. |
monstart : |
FIXME add explanation. |
repday : |
"representative day" for conversion from daily
to weekly data (with method COMPACT_WDAY only).
|
| Returns : | 0 on success, non-zero error code on failure. |
int expand_data_set (double ***pZ,
DATAINFO *pdinfo,
int newpd);
Expand the data set from lower to higher frequency: an "expert" option. This is supported at present only for expansion from annual to quarterly or monthly, or from quarterly to monthly.
pZ : |
pointer to data array. |
pdinfo : |
data information struct. |
newpd : |
target data frequency |
| Returns : | 0 on success, non-zero error code on failure. |