SBM ModScript Reference → Programming SBM ModScript → Object Types → AppDb → AppDB ReadDynaSQL() Method
(SBM On-Premise/PaaS only) Reads multiple rows of a set of columns from the database, filling the Vector "out".
Parameter | Type | Description |
---|---|---|
sqlText |
string |
The SQL to invoke. |
sqlColumns |
Vector |
A Vector storing SQL output column definitions, where each entry is a SQLColumnDef. |
out |
Vector& |
The results of the query. Each entry in the Vector will be a Vector; each entry in that Vector is specified by the type from the corresponding entry in sqlColumns. For instance, if sqlColumns has a DBConstants.INTEGER and a DBConstants.VARCHAR, each entry in the out Vector will be a Vector that contains an int and a string. |
params |
Vector |
An optional Vector storing SQL bind parameters, where each entry is a Pair, with the first value as the parameter type and the second value as the value to bind to the SQL parameter. Corresponds to DBTypeConstants. |
Type | Description |
---|---|
bool |
Returns true if successful; false otherwise. A successful read may return zero results if no items match the query. Check for results by calling the Vector.empty() method. |
SBM ModScript version: 11.4.
var out = []; // creates an empty Vector Shell.Db().ReadDynaSQL( "select TS_ID,TS_NAME,TS_LASTLOGINDATE from TS_USERS where TS_STATUS=? order by TS_NAME", [ SQLColumnDef(DBTypeConstants.INTEGER,"TS_ID"), SQLColumnDef(DBTypeConstants.VARCHAR,"TS_NAME"), SQLColumnDef(DBTypeConstants.BIGINT,"TS_LASTLOGINDATE", SQLColumnDefOutputHint.TimeT) ], out, [Pair(DBTypeConstants.INTEGER, 0)] ); for ( row : out ){ Ext.WriteStream( "${row[0]}\t${row[1]}\t${row[2].date}" ); }
None.
Copyright © 2007–2018 Serena Software, Inc., a Micro Focus company. All rights reserved.