gdxsqlite1.gms : Test basic functionality of GDX2SQLITE tool

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=bdmlp 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;"