[Top][All Lists]

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

Re: [Help-glpk] Problems with Connecting GLPK to Excel

From: glpk xypron
Subject: Re: [Help-glpk] Problems with Connecting GLPK to Excel
Date: Fri, 16 Jul 2010 06:48:06 +0200

Hello Aly,

GLPK only allows strings up to 100 characters.

In the current release, SQL statements may be split over multiple strings.
A semicolon at the end of a string marks the end of the statement. Spaces are 
automatically inserted between the strings.

table ta {(i, j) in {i1 in 1..9} cross {i2 in 1..9}} OUT
  'iODBC' 'DSN=glpk;UID=glpk;PWD=gnu'
  'DELETE FROM sudoku_solution'
  'WHERE ID = ' & id & ';'
  'INSERT INTO sudoku_solution'
  '(ID, COL, LIN, VAL)'
  'VALUES(?, ?, ?, ?);' :
  id ~ ID, i ~ COL, j ~ LIN, (sum{k in 1..9} x[i,j,k] * k) ~ VAL;

Yesterday a bug was reported in the implementation of multiple string
SQL statements. Please, apply the patch described in

The statement you provided could be formatted as:

table ti IN
  'ODBC' 'DSN=glpk;UID=glpk;PWD=gnu'
  'a.OriginFacilityID, d.TransformerTypeID, b.ProductID,'
  'b.PeriodID, b.UnitCost'
  'FROM Channels a'
  'INNER JOIN ChannelPeriodProducts b'
  'ON a.ChannelID = b.ChannelID, Channels a'
  'INNER JOIN Facilities c1'
  'ON a.OriginFacilityID = c1.FacilityID, Channel a'
  'INNER JOIN Facilities c2'
  'ON a.DestinationFacilityID = c2.FacilityID, Facilities c2'
  'INNER JOIN TransformerTypes d'
  'ON c2.FacilityID = d.FacilityID'
  'WHERE (c2.FacilityType = "Transformer")'
  'AND (c1.FacilityType => "Supplier");' :

Please, check the syntax of your inner joins.

Best regards


-------- Original-Nachricht --------
> Datum: Thu, 15 Jul 2010 20:40:48 -0400 (EDT)
> CC: address@hidden
> Betreff: Re: [Help-glpk] Problems with Connecting GLPK to Excel

> Hi Xypron,
> Thanks a lot for the excellent support. I sincerely appreciate it.
> I tried the SQL idea you told me about. The problem now is that I get the
> following error: "String Literal Too Long" for the "Where" statement!!
> My SQL is:
> 'SELECT a.OriginFacilityID, a.DestinationFacilityID, b.ProductID,
> b.PeriodID, b.UnitCost, d.TransformationTypeID'
> 'FROM Channels a, ChannelPeriodProducts b, Facilities c, TransformerTypes
> d'
> 'WHERE a.ChannelID = b.ChannelID AND a.OriginFacilityID = c.FacilityID AND
> c.FacilityType = "Supplier" AND a.DestinationFacilityID = c.FacilityID AND
> c.FacilityType = "Transformer" AND a.DestinationFacilityID =
> d.FacilityID':
> I also tried the following alternative, and got the same error, now for
> the "FROM" statement:
> 'SELECT a.OriginFacilityID, d.TransformerTypeID, b.ProductID, b.PeriodID,
> b.UnitCost '
> 'FROM Channels a INNER JOIN ChannelPeriodProducts b ON a.ChannelID =
> b.ChannelID, Channels a INNER JOIN Facilities c1 ON a.OriginFacilityID =
> c1.FacilityID , Channel a INNER JOIN Facilities c2 ON a.DestinationFacilityID 
> =
> c2.FacilityID, Facilities c2 INNER JOIN TransformerTypes d ON c2.FacilityID =
> d.FacilityID '
> 'WHERE    (c2.FacilityType = "Transformer")  AND (c1.FacilityType =
> "Supplier")':
> Is that error because GLPK can not handle long SQL statements?? And is
> there a way to solve that problem? As I really would like to still have that
> query in GLPK (I do not want to manually create the table in Access and then
> call that table in GLPK) 
> Any help will be really appreciated.
> Best,
> Aly

GMX DSL: Internet-, Telefon- und Handy-Flat ab 19,99 EUR/mtl.  
Bis zu 150 EUR Startguthaben inklusive!

reply via email to

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