There are three built-in Lua modules that assist working from the GRT shell:
grtV
– for accessing any
object/variable in the Values
tab
grtS
– for viewing the structs
defined in the Structures
tab
grtM
– for accessing any object in
the Modules
tab
All items in all the tabs are accessible from the GRT shell.
The script example below uses the getGlobal
method of the grtV
object to return a list of
databases and then iterates through this list.
dbs = grtV.getGlobal("/rdbmsMgmt/rdbms") for i = 1, grtV.getn(dbs) do print(dbs[i].name) end
The getGlobal
method returns the object found
at the path parameter passed to it. In this case, the object is a
list that is traversed using a for
loop
controlled by the getn
method which returns the
number of elements in the database list.
Running this for
loop outputs the names of the
database formats supported by the MySQL Migration Toolkit:
"Oracle" "Mysql" "MaxDB" "GenericJdbc" "Mssql" "Access"
To discover all the methods available for a specific object, type
the object name preceded by a “?
”.
For example typing ?grtV shows:
GRT Value Management Library - grtV ----------------------------------- A library that contains functions to work with GRT values. clearList child diffMake diffApply duplicate fromXml getContentType getKey getListItemByObjName getListRefValueByObjName getn getGlobal insert load lookupAdd lookupId newDict newList newObj remove save setContentType setGlobal toLua toXml typeOf Type 'help grtV.<command>' to get help on a specific command.