12.07.2015 Views

ILOG OPL Development Studio Language Reference Manual

ILOG OPL Development Studio Language Reference Manual

ILOG OPL Development Studio Language Reference Manual

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

of these queries are outside the scope of this book and users should consult theappropriate database manual for more information.It is also possible to implement parameterized queries in <strong>OPL</strong>, for example:Oils from DBRead(db,"SELECT name FROM OilData WHERE quality>?")(oilQuality);where oilQuality is any scalar <strong>OPL</strong> data element already initialized and whose type isexpected in the SQL query. In this case, oilQuality should be a numeric type, for examplean integer.Note: Despite standardization, Oracle does not support the question mark as a variableidentifier. Use ':' instead. Examples are ':1', ':arg', etc.SQL encryptionIn <strong>OPL</strong> 3Because all database instructions were in the model file, the SQL statements were encryptedas well when the model was compiled.In <strong>OPL</strong>4 and laterTo do the same in <strong>OPL</strong> 4.x (where you write database instructions in data files), you candefine literal strings inside the model file (which will be compiled) and use them in the datafile, like this:In the .mod file:string connectionString = "scott/tiger@TEST";string myQuery = "select id from table";{int} setOfInt = ...;dvar int X in 1..5;minimize X;subject to {forall (i in setOfInt)X >= i;};In the .dat file:60I L O G O P L D E V E L O P M E N T S T U D I O L A N G U A G ER E F E R E N C E M A N U A L

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!