Description
This program tests the basic gdx2sqlite functionality by producing a sqlite database via the gdx2sqlite utility and interrogate this database with the sqlite shell utility sqlite3 also shipped with the GAMS System. Contributor: Michael Bussieck, July 2014
Small Model of Type : GAMS
Category : GAMS Test library
Main file : gdxsqlite1.gms
$title 'Test basic functionality of GDX2SQLITE tool' (gdx2sqlite01,SEQ=662)
$onText
This program tests the basic gdx2sqlite functionality by producing
a sqlite database via the gdx2sqlite utility and interrogate this
database with the sqlite shell utility sqlite3 also shipped with
the GAMS System.
Contributor: Michael Bussieck, July 2014
$offText
$call gamslib -q trnsport
$if errorlevel 1 $abort Problems retrieving trnsport from GAMS Model Library
$call gams trnsport.gms gdx=sqlite_test lp=soplex lo=%gams.lo%
$if errorlevel 1 $abort Problems running GAMS model trnsport
$call gdx2sqlite -i sqlite_test.gdx -o sqlite_test.db > %system.nullfile%
$if errorlevel 1 $abort Problems creating database using gdx2sqlite
* Batch script to produce output
$onEchoV > run_sqlite.gms
$call sqlite3 sqlite_test.db "%1" > sqlite_out.txt
$if errorlevel 1 $abort Problems executing sqlite3
$call diff sqlite_out.txt expected.txt
$if errorlevel 1 $abort Output not as expected for '%1'
$offEcho
$onEcho > expected.txt
seattle
san-diego
$offEcho
$batInclude run_sqlite "select * from i;"
$onEcho > expected.txt
new-york
chicago
topeka
$offEcho
$batInclude run_sqlite "select * from j;"
$onEcho > expected.txt
seattle|new-york|0.225
seattle|chicago|0.153
seattle|topeka|0.162
san-diego|new-york|0.225
san-diego|chicago|0.162
san-diego|topeka|0.126
$offEcho
$batInclude run_sqlite "select * from c;"
$onEcho > expected.txt
new-york|2.5
chicago|1.7
topeka|1.8
$offEcho
$batInclude run_sqlite "select j,value from d where i=='seattle';"
$onEcho > expected.txt
-1.0e+100
-1.0e+100
$offEcho
$batInclude run_sqlite "select lo from supply;"
$onEcho > expected.txt
f|90.0
$offEcho
$batInclude run_sqlite "select * from scalars;"
$onEcho > expected.txt
z|153.675|-1.0e+100|1.0e+100|0.0
$offEcho
$batInclude run_sqlite "select * from scalarvariables;"
$onEcho > expected.txt
cost|0.0|0.0|0.0|1.0
$offEcho
$batInclude run_sqlite "select * from scalarequations;"