GlideMultipleUpdate with addQuery

Chris P_
Tera Expert

I'm trying to use GlideMultipleUpdate, but it behaves kinda weird...

Here's my code:

var grt = new GlideMultipleUpdate("u_grit_path_import");

grt.addQuery('u_groupname', 'BUILTIN\\Administrators');

//grt.addQuery('u_groupname', 'CONTAINS', 'BUILTIN');

//grt.addQuery('u_groupname', 'IN', 'BUILTIN\\Administrators');

//grt.addQuery('BUILTIN', 'IN', 'u_groupname');

grt.setValue("sys_import_state", 'ignore');

grt.execute();

I've tried with different options which are commented out in the above example, but I keep getting the error message:

*** ERROR *** com.glide.db.GlideSQLException:

See glide log for error details

With the following message in the log:

*** ERROR *** com.glide.db.GlideSQLException:

And when I don't get an error message, he just skips the where-clause and updates all records.

I'm at a loss, any ideas anyone?

1 ACCEPTED SOLUTION
22 REPLIES 22

Kalaiarasan Pus
Giga Sage

Updates all the record makes me think, are you absolutely sure that the column name 'u_groupname' is correct?


Yeah that fieldname is correct, I've also tried another tables with other field names, but I get the same non-descriptive error...


Can you try this and see if you can get some more information on the error?


try


{


code


}


catch(xx) {


  gs.log("Exception Caught: " + xx.message);


}


Chris P_
Tera Expert

Ok so I've tried again...


With a script that is working on a line-by-line update and I get these errors:


01:45:18.228ErrorDefault-thread-99ECD17FEB372B8AC80DA7148543990EF1SEVERE *** ERROR *** Exception during batch statement commit to glide:cofelydev_1:cofelydev:jdbc:mysql://db160228.ams4.service-now.com:3417/, rolling back (all or nothing): Unknown column 'u_grit_path_import.u_groupname' in 'where clause'
01:45:18.229ErrorDefault-thread-99ECD17FEB372B8AC80DA7148543990EF1*** ERROR *** com.glide.db.GlideSQLException:
01:45:18.229ErrorDefault-thread-99ECD17FEB372B8AC80DA7148543990EF1SEVERE *** ERROR ***
java.sql.SQLException: java.sql.BatchUpdateException: Unknown column 'u_grit_path_import.u_groupname' in 'where clause'
at com.glide.db.StatementBatcher.getSQLException(StatementBatcher.java:384)
at com.glide.db.StatementBatcher.commitBatch(StatementBatcher.java:356)
at com.glide.db.StatementBatcher.commitAllOrNothing(StatementBatcher.java:255)
at com.glide.db.DBCompositeAction.executeAsBatch(DBCompositeAction.java:146)
at com.glide.db.DBCompositeAction.executeAsResultSet0(DBCompositeAction.java:84)
at com.glide.db.DBAction.executeAndReturnTable(DBAction.java:208)
at com.glide.db.DBAction.executeNormal(DBAction.java:197)
at com.glide.db.DBAction.executeAndReturnException(DBAction.java:166)
at com.glide.db.DBAction.execute(DBAction.java:119)
at com.glide.db.MultipleUpdate.executeAndReturnException(MultipleUpdate.java:38)
at com.glide.db.MultipleAction.execute(MultipleAction.java:48)
at sun.reflect.GeneratedMethodAccessor2944.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.mozilla.javascript.NativeJavaMethod.call(NativeJavaMethod.java:255)
at org.mozilla.javascript.ScriptRuntime.call(ScriptRuntime.java:1227)
at org.mozilla.javascript.gen.c31079.call(<refname>:7)
at org.mozilla.javascript.gen.c31079.exec(<refname>)
at com.glide.script.ScriptEvaluator.execute(ScriptEvaluator.java:233)
at com.glide.script.ScriptEvaluator.evaluateString(ScriptEvaluator.java:105)
at com.glide.script.ScriptEvaluator.evaluateString(ScriptEvaluator.java:72)
at com.glide.script.ScriptEvaluator.evaluateString(ScriptEvaluator.java:63)
at com.glide.script.Evaluator.evaluateString(Evaluator.java:91)
at com.glide.update.UpdateManager2.testFixScript(UpdateManager2.java:593)
at com.snc.apps.ScriptFixXMLHttpProcessor$ScriptFixWorker.evaluateScript(ScriptFixXMLHttpProcessor.java:122)
at com.snc.apps.ScriptFixXMLHttpProcessor$ScriptFixWorker.startWork(ScriptFixXMLHttpProcessor.java:100)
at com.glide.worker.AbstractProgressWorker.startAndWait(AbstractProgressWorker.java:86)
at com.glide.worker.ProgressWorker.startAndWait(ProgressWorker.java:52)
at com.glide.worker.AbstractProgressWorker.start(AbstractProgressWorker.java:67)
at com.snc.apps.ScriptFixXMLHttpProcessor.process(ScriptFixXMLHttpProcessor.java:77)
at com.glide.processors.XMLHttpProcessor.processJavaAJAX(XMLHttpProcessor.java:143)
at com.glide.processors.XMLHttpProcessor.process(XMLHttpProcessor.java:100)
at com.glide.processors.Processor.runProcessor(Processor.java:402)
at com.glide.processors.Processor.processTransaction(Processor.java:192)
at com.glide.processors.ProcessorRegistry.process(ProcessorRegistry.java:146)
at com.glide.ui.GlideServletTransaction.process(GlideServletTransaction.java:36)
at com.glide.ui.GlideServlet$1.run(GlideServlet.java:414)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
at java.lang.Thread.run(Thread.java:682)
Caused by: java.sql.BatchUpdateException: Unknown column 'u_grit_path_import.u_groupname' in 'where clause'
at com.mysql.jdbc.StatementImpl.executeBatch(StatementImpl.java:1184)
at sun.reflect.GeneratedMethodAccessor156.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.glide.db.StatementWrapper.invoke(StatementWrapper.java:36)
at com.sun.proxy.$Proxy5.executeBatch(Unknown Source)
at com.glide.db.BatchStatement.executeBatch(BatchStatement.java:66)
at com.glide.db.StatementBatcher.commitBatch(StatementBatcher.java:335)
... 38 more

find_real_file.png



Current script (which works on line-by-line!):



var grt = new GlideMultipleUpdate("u_grit_path_import");


  var qc = grt.addQuery("u_groupname",'IN', "'BUILTIN\\Administrators','\\CREATOR OWNER','BUILTIN\\Users','NT AUTHORITY\\SYSTEM','BUILTIN\\Guests','\\','\\Everyone'");


  qc.addOrCondition('filepath', 'CONTAINS', '$RECYCLE.BIN');


  qc.addOrCondition('u_folderright', 'IN', "'Full Control', 'List Folder Contents'");


  qc.addOrCondition('u_folderright', 'CONTAINS', "Special");


  grt.setValue("sys_import_state", 'ignore'); // make sure inactive incidents are closed


  grt.execute();


It clearly seems to say 'Unknown column 'u_grit_path_import.u_groupname' in 'where clause' meaning the column name to be incorrect.