[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-glpk] Database connectivity in MathProg

From: Andrew Makhorin
Subject: Re: [Help-glpk] Database connectivity in MathProg
Date: Sun, 17 Feb 2008 03:23:28 +0300

Hi Xypron,

Just a few words about implementation of the table drivers.

Currently the mathprog interpreter interacts with the driver through
the following four routines:

void mpl_tab_drv_open(MPL *mpl, int mode) opens a table for reading
(mode = 'R') or writing (mode = 'W');

int mpl_tab_drv_read(MPL *mpl) reads a next record from the table
and returns zero, or returns non-zero if there is no more records.

void mpl_tab_drv_write(MPL *mpl) writes a next record to the table.

void mpl_tab_drv_close(MPL *mpl) closes the table.

To access to the mathprog database there are the following interface
routines intended for using within the driver routine:

int mpl_tab_num_args(TABDCA *dca) returns the number of arguments
specified in the table statement being executed;

const char *mpl_tab_get_arg(TABDCA *dca, int k) returns pointer to
k-th argument;

int mpl_tab_num_flds(TABDCA *dca) returns the number of fields;

const char *mpl_tab_get_name(TABDCA *dca, int k) returns pointer to
name of k-th field;

int mpl_tab_get_type(TABDCA *dca, int k) returns type of k-th field
('?' - value not set, 'N' - floating-point number, 'S' - char string);

double mpl_tab_get_num(TABDCA *dca, int k) returns numeric value of
k-th field;

const char *mpl_tab_get_str(TABDCA *dca, int k) returns pointer to
string value of k-th field;

void mpl_tab_set_num(TABDCA *dca, int k, double num) assigns numeric
value to k-th field;

void mpl_tab_set_str(TABDCA *dca, int k, const char *str) assigns
string value to k-th field.

For implementation details you can look at the CSV table driver (see
file src/glpmpl05.c).

Best regards,

Andrew Makhorin

reply via email to

[Prev in Thread] Current Thread [Next in Thread]