Executing Commands on the Database Using Scripts

From Observer GigaFlow Support | VIAVI Solutions Inc.
Revision as of 11:51, 23 November 2018 by Niall (Talk | contribs)

Jump to: navigation, search

Executing Commands

//Create a table
actions.getDatabaseManager().executePrepared("create table test1(id integer,name text) ",[])
//Populate table with data
for (var i=0;i<10;i++){
  /Create the array with the data to push into the database
  var datatogo = [i,i+"text"];
  //Create and execute the prepared statement
  actions.getDatabaseManager().executePrepared("insert into test1 (id,name) values (?,?)",[datatogo])
//Count the number of entries in the table
log.warn(actions.getDatabaseManager().getLongFromDB("select count(*) from test1",0))

//log.warn(actionsgetDeviceManager()) //log.warn(actions.ros.subscriptedBlacklists) //log.warn(actions.ros.subscriptedBlacklists.get("https://lists.blocklist.de/lists/strongips.txt"))