[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-glpk] MySQL Support for GLPK 4.23
From: |
glpk xypron |
Subject: |
Re: [Help-glpk] MySQL Support for GLPK 4.23 |
Date: |
Sat, 03 Nov 2007 20:00:12 +0100 |
Hi Andrew,
as the rest of GNU Math is oriented vs. the AMPL syntax adapting the table
syntax makes sense.
The table statements seem rather powerful.
A detailed description of AMPL tables can be found at
http://www.netlib.org/ampl/tables/TABLES.RME
An example is:
table TransOutTable OUT "ODBC"
"D:\Personal\15057\TransportationData.mdb"
"TransOut":
{origin in ORIG, destination in DEST:
Trans[origin, destination] > 0} -> [origin, destination],
Trans[origin,destination]~Trans;
write table TransOutTable;
To answer Your question, how difficult it is to implement the TABLE statement
which should go through the following steps:
1. consider whether the AMPL table syntax is sufficient for addressing SQL
connectivity
2. clarify the functionality that shall be implemented in GLPK.
Starting with step 1, I have made the following observations:
To my understanding a deficiency of the AMPL table statements is that they do
not define how to execute SQL commands like DROP table, CREATE table, DELETE
FROM table to cleanup result tables before writing.
http://www.ampl.com/NEW/tables.html is very vague concerning what WRITE TABLE
is meant to do:
In certain circumstances, the write table command may create a new external
file or table, overwrite an existing table, overwrite certain columns within an
existing table, or append columns to an existing table. Details may vary
somewhat depending on the database handler and the file type, ...
It is unclear to me what AMPL does when executing WRITE TABLE on an existing
SQL data base table. Three possibilities exist:
* The table is cleared before writing. This would make merging data
from multiple calculation runs into one data base table impossible
* Existing data rows with equal keys are modified. Rows with new keys
are inserted. This would make it impossible to decide afterwards
which rows are new and which are old.
* All rows are inserted. Duplicate keys cause a SQL error.
My requirements are the following:
- GLPK should be able to delete specified existing records from a
SQL table (e.g. in SQL syntax "DELETE FROM table WHERE value = 3")
- GLPK should be able to append records to an existing SQL table.
- It should be possible to add multiple result sets to the same SQL table.
One possibility within the AMPL syntax would be to use the "strings" parameter
in the syntax
table table_name [indexing] [inout] strings : ...
Using strings like:
'BEFORE_READ="LOCK TABLES cap;"
'READ="SELECT c1, c2 FROM cap WHERE iter=1"'
'AFTER_READ="UNLOCK TABLES;"'
'BEFORE_WRITE="LOCK TABLES res;"
'BEFORE_WRITE="DELETE FROM res WHERE iter=1;" '
'WRITE="INSERT INTO res (iter, c1, c2) VALUES(1,?,?);"'
'AFTER_WRITE="UNLOCK TABLES;"'
could uniquely define what should be done, but would not add much to the
clarity of the syntax.
What are Your ideas concerning what WRITE TABLE should do?
How would You treat existing records in tables?
Best regards
Xypron
-------- Original-Nachricht --------
> Datum: Sat, 3 Nov 2007 14:48:54 +0300
> Von: Andrew Makhorin <address@hidden>
> An: address@hidden
> CC: address@hidden
> Betreff: Re: [Help-glpk] MySQL Support for GLPK 4.23
>
> How difficult to provide compatibility with a similar feature existing
> in AMPL? Please see http://www.ampl.com/NEW/tables.html .
>
>
>
--
GMX FreeMail: 1 GB Postfach, 5 E-Mail-Adressen, 10 Free SMS.
Alle Infos und kostenlose Anmeldung: http://www.gmx.net/de/go/freemail