help-glpk
[Top][All Lists]
Advanced

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

Re: [Help-glpk] changes in sql table driver


From: Xypron
Subject: Re: [Help-glpk] changes in sql table driver
Date: Sat, 07 Nov 2009 13:39:26 +0100
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.4) Gecko/20091017 SeaMonkey/2.0

GLPK does not support strings exceeding 100 characters. This is too short
for many SQL statements.

I have made the necessary changes to support table instructions with SQL
statements spread over multiple strings.

The following syntax is used:

"The second argument and all following are considered to be SQL
statements

SQL statements may be spread over multiple arguments.  If the last
character of an argument is a semicolon this indicates the end of
a SQL statement.

The arguments of a SQL statement are concatenated separated by space.
The eventual trailing semicolon will be removed.

All but the last SQL statement will be executed directly.

For IN-table the last SQL statement 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 OUT-table the last SQL statement can contain one or multiple question
marks. If it contains a question mark it is considered a template for
the write routine. Otherwise the string is considered a table name and
an INSERT template is automatically generated."


I have chosen semicolon as separator because semicolon is a standard
way to end an SQL statement (and to separate different SQL statements)
in systems that allow more than one SQL statement to be executed in the
same call to a database server.

Semicolon is only considered a separator if it is the last character of an
argument to avoid parsing strings passed in SQL statements.

This patch will require changes to existing models using table instructions
with multiple SQL statements.

The changed files are appended.

The coding change can be viewed at
http://glpk.dyndns.org/viewvc/svn/glpk/glpk/branches/glpk-4.40-sql/src/glpsql.c?view=diff&r1=506&r2=504&diff_format=h

Best regards

Xypron

Andrew Makhorin wrote:
Hi Xypron,

Is it possible to make changes in the sql table driver in order to
concatenate some arguments (marked in some way) to construct the
resulting sql statement? This would allow processing sql statements
which are longer than 100 chars without changes in the language and
in the translator. Thanks.


Andrew Makhorin

  

Attachment: glpk-4.40-sql.tar.gz
Description: GNU Zip compressed data


reply via email to

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