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

From Observer GigaFlow Support | VIAVI Solutions Inc.
Jump to: navigation, search
Line 8: Line 8:
 
  //Populate table with data
 
  //Populate table with data
 
  for (var i=0;i<10;i++){
 
  for (var i=0;i<10;i++){
   /Create the addary with the data to pusg into the databse
+
   /Create the array with the data to push into the database
 
   var datatogo = [i,i+"text"];
 
   var datatogo = [i,i+"text"];
 
   //Create and execute the prepared statement
 
   //Create and execute the prepared statement

Revision as of 10:25, 21 November 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 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"))