Difference between revisions of "Executing Commands on the Database Using Scripts"

From Observer GigaFlow Support | VIAVI Solutions Inc.
Jump to: navigation, search
Line 1: Line 1:
 +
[[Category:Databasing Notes]]
 +
[[Category:Scripting Notes]]
 +
[[Category:Technical Notes]]
 
Executing Commands
 
Executing Commands
  

Revision as of 15:25, 12 October 2018

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 addary with the data to pusg into the databse
  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"))