[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-glpk] Testing glpk-4.26-tab
From: |
glpk xypron |
Subject: |
Re: [Help-glpk] Testing glpk-4.26-tab |
Date: |
Fri, 29 Feb 2008 19:34:44 +0100 |
Hello Andrew,
(The following information concerns a tentative implementation of SQL data base
connectivity for GLPK 4.26 which can be downloaded from
ftp://glpk.dyndns.org/glpk/glpk-4.26-tab_r119.tar.gz
)
> Writing result...
> DELETE FROM transp_result
> INSERT INTO transp_result ( LOC1, LOC2, QUANTITY ) VALUES ( ?, ?, ? )
> Model has been successfully processed
>
> Does this mean that the output table should be created once before
> it can be used as an output table in mathprog?
>
I am using the string list of the table in IN and OUT statements as follows:
The 1st string specifies the Driver 'ODBC' or 'MySQL'.
MySQL is not supported for Windows.
ODBC is support for Linux requires package iODBC.
The 2nd string describes the DSN (data source name).
The following strings but the last are SQL commands that will be executed
directly.
For table IN the last string can be a SELECT command starting with the
capitalized letters 'SELECT '. If the string does not start with 'SELECT ' it
is considered to be a table name and a SELECT statement is automatically
generated.
For table OUT the last string can contain one or multiple question marks. If it
contains a question mark it is considered as template for the write routine.
Otherwise the string is considered a table name and an INSERT template is
automatically generated.
The write routine uses the template with the question marks and replaces the
first question mark by the first output parameter, the second question mark by
the second output parameter and so forth. Then the SQL command is issued.
This means a table can preexist or the CREATE command can be issued as one of
the strings in the string list.
An example table OUT statement could be:
table OUT ta { l in LOCATIONS }
'ODBC'
'DSN=glpkdb;UID=glpkuser;PWD=glpkpassword'
'DROP TABLE result'
'CREATE TABLE result ( ID INT, LOC VARCHAR(255), QUAN DOUBLE )'
'INSERT INTO result VALUES ( 4, ?, ? )' :
l ~ LOC, quantity[l] ~ QUAN;
Alternatively You could write:
table OUT ta { l in LOCATIONS }
'ODBC'
'DSN=glpkdb;UID=glpkuser;PWD=glpkpassword'
'DROP TABLE result'
'CREATE TABLE result ( ID INT, LOC VARCHAR(255), QUAN DOUBLE )'
'result' :
l ~ LOC, quantity[l] ~ QUAN, 1 ~ ID;
Using templates with ? does not only support INSERT but also UPDATE, DELETE,
etc.
Example:
table OUT ta { l in LOCATIONS }
'ODBC'
'DSN=glpkdb;UID=glpkuser;PWD=glpkpassword'
'UPDATE result SET DATE = ' & date & ' WHERE ID = 1'
'UPDATE result SET QUAN = ? WHERE LOC = ?' AND ID = 1' :
quantity[l] ~ DUMMY_QUAN, l ~ DUMMY_LOC ;
Best regards
Xypron
--
GMX startet ShortView.de. Hier findest Du Leute mit Deinen Interessen!
Jetzt dabei sein: http://www.shortview.de/address@hidden